afterprint event is triggered when the print dialog is opened
Categories
(Toolkit :: Printing, defect, P2)
Tracking
()
People
(Reporter: Radoslav.Yankov, Unassigned)
References
(Regression)
Details
(Keywords: regression)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0
Steps to reproduce:
window.onbeforeprint = function () {
console.log('before') // this should appear when the dialog appears
};
window.onafterprint = function () {
console.log('after') // this should appear when the dialog disappears, but actually appears immediately
};
window.print(); or Ctrl + P
Actual results:
afterprint event is triggered when the print dialog is opened.
Expected results:
afterprint event should be triggered afer closing the print dialog.
For comparison, Chrome fires afterprint after the dialog is closed in either case (printing dispatched or dialog cancelled).
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Toolkit::Printing' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Updated•3 years ago
|
Updated•3 years ago
|
Comment 2•3 years ago
|
||
Hello,
QA would want to help pull a regression range for this issue.
Is anything that we can do here? If yes, could you please give us a more in-depth STR?
Comment 3•3 years ago
|
||
STR:
- Navigate to
data:text/html,<script>window.onbeforeprint = ()=>console.log('before');window.onafterprint = ()=>console.log('after');</script> - Open the console (Ctrl+Shift+K)
- Print (Ctrl+P)
Expected results:
- Console shows:
before
Actual results:
- Console shows:
beforeafter
Comment 4•3 years ago
|
||
Thank you, Mark!
Attaching the regression range made on Windows 10x64:
Last good revision: 52ae1bffec15aeea1deb8213af9948e57ad5d0cc (2020-07-10)
First bad revision: 517957ca7a3c2892a4ae3c7491fb538a5d84aa12 (2020-07-11)
Pushlog:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=52ae1bffec15aeea1deb8213af9948e57ad5d0cc&tochange=517957ca7a3c2892a4ae3c7491fb538a5d84aa12
I have also searched for a recent regression including the new print modal but I didn't find one.
Unfortunately, mozregression cannot bisect further because the builds are old and I don't know which one is the culprit here. At first glance bug 1557983 and bug 1651532 looks printing related. Hope it helps. If more information is needed please let us know.
Comment 5•3 years ago
|
||
Seems quite likely bug 1557983 regressed this then, Jonathan do you mind taking a look?
Comment 6•3 years ago
|
||
Set release status flags based on info from the regressing bug 1557983
Comment 7•3 years ago
|
||
Set release status flags based on info from the regressing bug 1557983
Updated•3 years ago
|
Updated•3 years ago
|
Comment 8•3 years ago
|
||
This behavior is intentional.
The beforeprint/afterprint events are intended to allow script to make changes to a document to make it more suitable for printing, then to revert those changes once they are no longer needed so that the on-screen document doesn't continue to show the for-print changes.
Shortly after the beforeprint event fires, Mozilla's printing implementation clones the document that is to be printed, which allows the afterprint event to be fired immediately after the clone is complete. That means that there is no need to wait until the print dialog closes to fire afterprint.
Updated•3 years ago
|
Description
•