Closed Bug 1728779 Opened 3 years ago Closed 3 years ago

afterprint fired too early

Categories

(Core :: Widget: Gtk, defect)

Firefox 88
defect

Tracking

()

RESOLVED DUPLICATE of bug 1663290

People

(Reporter: eb, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36

Steps to reproduce:

window.addEventListener("afterprint", () => { console.log("afterprint")})
window.print()

Actual results:

"afterprint" event is fired immediately after the dialog opens.
This bug seems to have appeared around Firefox v83, it's reproduced on v88 and v89.
I personnaly use Ubuntu 20.04 with Firefox 88.

Related Stack overflow question: https://stackoverflow.com/questions/68154482/afterprint-event-on-firefox-89

Expected results:

From the documentation (https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onafterprint), it should be fired when the dialog is closed or the printing physically starts. This is needed to alter the style temporarily before print.

The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: General → Widget: Gtk

Can you please try to use mozregression tool to find where it broke?
https://fedoraproject.org/wiki/How_to_debug_Firefox_problems?rd=Bug_info_Firefox#Use_Mozregression_tool
Thanks.

Flags: needinfo?(eb)

Dupe of bug 1663290. But we can fire afterprint earlier because printing clones the document. So all the temporary modifications that you make in beforeprint will make an effect and you can safely undo them in afterprint.

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Flags: needinfo?(eb)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.