Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling printToPDF with cross origin iframe blocks all calls to printToPDF #27605

Closed
3 tasks done
t57ser opened this issue Feb 3, 2021 · 2 comments · Fixed by #33654
Closed
3 tasks done

Calling printToPDF with cross origin iframe blocks all calls to printToPDF #27605

t57ser opened this issue Feb 3, 2021 · 2 comments · Fixed by #33654
Assignees
Labels
11-x-y bug 🪲 component/printing has-repro-gist Issue can be reproduced with code at https://gist.github.com/
Projects

Comments

@t57ser
Copy link
Contributor

t57ser commented Feb 3, 2021

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>
@ckerr
Copy link
Member

ckerr commented Feb 3, 2021

gist form of above snippets: https://gist.github.com/ckerr/ee185d9555ecebdde611eb347eb7d212

@ckerr ckerr added the has-repro-gist Issue can be reproduced with code at https://gist.github.com/ label Feb 3, 2021
@codebytere codebytere self-assigned this Feb 9, 2021
@deepak1556 deepak1556 added this to Unsorted Issues in 12-x-y Feb 10, 2021
@mikkorantalainen
Copy link

Is anybody working on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
11-x-y bug 🪲 component/printing has-repro-gist Issue can be reproduced with code at https://gist.github.com/
Projects
No open projects
12-x-y
Does Not Block Stable
Development

Successfully merging a pull request may close this issue.

4 participants