window.onafterprint is called before print dialog closes
Categories
(Toolkit :: Printing, defect)
Tracking
()
People
(Reporter: u721905, Unassigned)
References
Details
Attachments
(1 file)
92 bytes,
text/html
|
Details |
Steps to reproduce:
Open the attached HTML and press Ctrl+P
Actual results:
"onafterprint" was logged to the console before the print dialog closed
Expected results:
"onafterprint" is logged to the console after the print dialog closes.
This is similar and perhaps related to https://bugzilla.mozilla.org/show_bug.cgi?id=1214805, but in this case the behavior does not depend on clicking Cancel vs Print in the print dialog.
Comment 2•1 year ago
|
||
The Bugbug bot thinks this bug should belong to the 'DevTools::Console' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 3•1 year ago
|
||
Not related to console, you can see the issue with data:text/html,<meta charset=utf8><script>window.onafterprint = () => document.body.style.background = "tomato"</script>Hello
The page will turn red before the page is printed
Comment 4•1 year ago
|
||
I am having the same issue using FF 109.0.1 (64bit) on macOS. Both the beforeprint and afterprint events fire when the print dialog opens. I would not expect the afterprint event to fire until the print dialog is dismissed (regardless of how it is dismissed).
Updated•1 year ago
|
Comment 6•1 year ago
|
||
For completeness bug 1663290 is where this could potentially change. Bug 1793627 states that this was a conscious decision and the afterprint event should fire when we've prepared the printing document, not to expose the user's interaction with the print dialog.
Description
•