Closed Bug 1815734 Opened 1 year ago Closed 1 year ago

window.onafterprint is called before print dialog closes

Categories

(Toolkit :: Printing, defect)

Firefox 109
defect

Tracking

()

RESOLVED DUPLICATE of bug 1663290

People

(Reporter: u721905, Unassigned)

References

Details

Attachments

(1 file)

Attached file windowPrintEvents.html

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.

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.

Component: Untriaged → Console
Product: Firefox → DevTools

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

Component: Console → Printing
Product: DevTools → Toolkit

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).

Status: UNCONFIRMED → RESOLVED
Closed: 1 year ago
Duplicate of bug: 1663290
Resolution: --- → DUPLICATE
See Also: → 1793627

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.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: