Issue 1:
Preflight Checklist

I have read the Contributing Guidelines for this project.

I agree to follow the Code of Conduct that this project adheres to.

I have searched the issue tracker for a feature request that matches the one I want to file, without success.

Electron Version

11.2.0 12.0.0

What operating system are you using?

macOS

Operating System Version

macos 11.2.3

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

clone the electron-quick-start example.

Fill index.html with following content:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
We are using Node.js <span id="node-version"></span>,
Chromium <span id="chrome-version"></span>,
and Electron <span id="electron-version"></span>.

<form id="searchForm" action="http://www.africau.edu/images/default/sample.pdf" method="get">
<div class="btn-group form-inline">
<button name='submit'>open pdf window</button>
</div>
</form>

<!-- You can also require other files to run in this process -->
<script src="./renderer.js"></script>
</body>
</html>

open pdf window

Then just execute window.print() within pdf_window. Print dialog model opened, click ok, content should be printed && the pdf_window can scroll normally.

Actual Behavior

The pdf_window will been stalled with no response to any interaction.

Testcase Gist URL

No response

Additional Information

No response

Issue 2:
Preflight Checklist

I have read the Contributing Guidelines for this project.

I agree to follow the Code of Conduct that this project adheres to.

I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

Electron Version:

11.2.2

Operating System:

Windows 10

Last Known Working Electron version:

Unknown

Expected Behavior

printToPDF should finish

Actual Behavior

Calling printToPDF in a window that contains a cross origin iframe will never resolve.

Additionally all other calls to printToPDF never resolve as well, even for other windows and other partitions

To Reproduce

const electron = require("electron");
function init() {
let browserWindow3 = new electron.BrowserWindow({
show: true,
x: 500,
y: 100,
width: 900,
height: 900,
webPreferences: {
partition: "persist:test1"
}
});
let browserWindow2 = new electron.BrowserWindow({
show: true,
x: 500,
y: 100,
width: 900,
height: 900,
webPreferences: {
partition: "persist:test2"
}
});
browserWindow2.webContents.loadURL("http://www.google.com")
browserWindow3.webContents.loadURL("http://localhost:9000/index.html").then(() => {
setTimeout(() => {
console.log("calling print to pdf");

// Comment out this one to make the other one work
browserWindow3.webContents.printToPDF({
}).then(() => {
console.log("done 1");
})

setTimeout(() => {
browserWindow2.webContents.printToPDF({
}).then(() => {
console.log("done 2");
})
}, 2000);
}, 2000);
});
}
electron.app.on("ready", () => {
init();
});

index.html

<!DOCTYPE html>
<html>
<body>
<iframe src="http://www.orf.at"/>
</body>
<script>
</script>
</html>