Issue metadata
Sign in to add a comment
|
window.print dont fire window.onafterprint
Reported by
hbd...@gmail.com,
Dec 7
|
||||||||||||||||||||||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36
Steps to reproduce the problem:
1. window.onafterprint = function(){console.log('after')};
2. window.print();
3.
What is the expected behavior?
console write 'after'
What went wrong?
console dont write, onafterprint is not fired
Did this work before? Yes 70.0.3538.110
Chrome version: 71.0.3578.80 Channel: stable
OS Version: 10.0
Flash Version:
,
Dec 7
onbeforeprint seems similarly broken. This bisects to https://chromium.googlesource.com/chromium/src/+log/2555486f..623c4e77 so it is very likely due to r597054.
,
Dec 8
Based on comment#2 this is a M71 regression hence tagging the bug as Stable blocker.
,
Dec 8
,
Dec 8
In general, onbeforeprint and onafterprint events are used for making web pages into a print-friendly layout (e.g. removing unnecessary banners, ads, etc.), and I'm afraid that these events would have major impacts on businesses (form print, receipt print, etc.). I think that it's better to merge a fix into M71. I've prepared a fix at: https://chromium-review.googlesource.com/c/chromium/src/+/1368848 The fix is simple and pretty safe to merge. I confirmed the fix with local build.
,
Dec 8
this is exactly my case, I have a business line application this bug caused a big problem in the impressions. I would be very happy to release an update soon.
,
Dec 8
Can i get some more context regarding the issue, why it's an emergency, and why it's a stable blocker? And why it was discovered so late in testing? Timing is pretty bad for release plans
,
Dec 8
Re #5, Thank you yukishiino@. Could you pls merge the change to current canary branch 3633 once it lands so I can trigger new canary from same branch to make sure we get canary coverage? Is this bug applicable to Android as well?
,
Dec 8
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/fa8fd965900a1ae66630aa9b36f1e837178f32e7 commit fa8fd965900a1ae66630aa9b36f1e837178f32e7 Author: Yuki Shiino <yukishiino@chromium.org> Date: Sat Dec 08 16:24:39 2018 v8binding: Invoke on{before,after}print event listeners even when paused This patch fixes a regression at https://crrev.com/c/1215512 , which doesn't run '{before,after}print' event listeners when one of the related execution contexts is paused. This is almost the same fix as https://crrev.com/c/1333548 . Another idea for fix is that Blink should pause an execution context in a narrower range; after dispatching onbeforeprint event and before dispatching onafterprint event. However, the content/ layer has the control of printing and event dispatching, and it's not easy to change such an overall design in a short term. See also WebLocalFrame::Dispatch{Before,After}PrintEvent and its implementations and call sites: https://cs.chromium.org/chromium/src/third_party/blink/public/web/web_local_frame.h?rcl=92c06acc4c92805f4020ad1b12c537fa4ac122c3&l=670 With such a background, this patch allows exceptional invocations not only for beforeunload event but also {before,after}print event. TBR=haraken@chromium.org Bug: 912966 Change-Id: Id38be3ea61668a8e88274b95a4192837e469bd48 Reviewed-on: https://chromium-review.googlesource.com/c/1368848 Reviewed-by: Yuki Shiino <yukishiino@chromium.org> Commit-Queue: Yuki Shiino <yukishiino@chromium.org> Cr-Commit-Position: refs/heads/master@{#614972} [modify] https://crrev.com/fa8fd965900a1ae66630aa9b36f1e837178f32e7/third_party/blink/renderer/bindings/core/v8/js_event_handler.cc [modify] https://crrev.com/fa8fd965900a1ae66630aa9b36f1e837178f32e7/third_party/blink/renderer/bindings/core/v8/js_event_listener.cc
,
Dec 8
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/dad0533b9a6bfda7b09b0bac2850b99ffea62fec commit dad0533b9a6bfda7b09b0bac2850b99ffea62fec Author: Yuki Shiino <yukishiino@chromium.org> Date: Sat Dec 08 16:36:27 2018 v8binding: Invoke on{before,after}print event listeners even when paused This patch fixes a regression at https://crrev.com/c/1215512 , which doesn't run '{before,after}print' event listeners when one of the related execution contexts is paused. This is almost the same fix as https://crrev.com/c/1333548 . Another idea for fix is that Blink should pause an execution context in a narrower range; after dispatching onbeforeprint event and before dispatching onafterprint event. However, the content/ layer has the control of printing and event dispatching, and it's not easy to change such an overall design in a short term. See also WebLocalFrame::Dispatch{Before,After}PrintEvent and its implementations and call sites: https://cs.chromium.org/chromium/src/third_party/blink/public/web/web_local_frame.h?rcl=92c06acc4c92805f4020ad1b12c537fa4ac122c3&l=670 With such a background, this patch allows exceptional invocations not only for beforeunload event but also {before,after}print event. TBR=haraken@chromium.org Bug: 912966 Change-Id: Id38be3ea61668a8e88274b95a4192837e469bd48 Reviewed-on: https://chromium-review.googlesource.com/c/1368848 Reviewed-by: Yuki Shiino <yukishiino@chromium.org> Commit-Queue: Yuki Shiino <yukishiino@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#614972}(cherry picked from commit fa8fd965900a1ae66630aa9b36f1e837178f32e7) Reviewed-on: https://chromium-review.googlesource.com/c/1369209 Reviewed-by: Krishna Govind <govind@chromium.org> Cr-Commit-Position: refs/branch-heads/3634@{#3} Cr-Branched-From: 87ffab8656b43fd2a6b49c0bc62dc97bc26ebde5-refs/heads/master@{#614909} [modify] https://crrev.com/dad0533b9a6bfda7b09b0bac2850b99ffea62fec/third_party/blink/renderer/bindings/core/v8/js_event_handler.cc [modify] https://crrev.com/dad0533b9a6bfda7b09b0bac2850b99ffea62fec/third_party/blink/renderer/bindings/core/v8/js_event_listener.cc
,
Dec 8
I've merged the change listed at #9 to current canary branch 3634 and triggering new canary from same branch - https://chromium.googlesource.com/chromium/src.git/+/dad0533b9a6bfda7b09b0bac2850b99ffea62fec.
,
Dec 8
Re #c7: The issue is that 'onbeforeprint' and 'onafterprint' event dispatching doesn't work at all. These events are usually used to make web pages into print-friendly layout so that printed papers do not include side menu, banners, redundant headers/footers, ads, etc. I'm afraid that those who are doing "print web pages from Chrome" will be affected by the issue. For example, application forms, receipts, etc. will be printed in unpleasant format/layout. Those who're printing from Chrome in their daily business will be affected. I personally think that it's worth stable blocking. Re #c8: All platforms other than iOS are affected, including Android and Chrome OS, not limited to desktop. I guess that it's not so rare nowadays to print web pages from Chrome on Android and Chrome OS. I imagine that some merchants use Android tablets for their business and print web pages. Re #c10: And thanks for the merge to Canary.
,
Dec 8
Adding OS=Android per comment #12 (+benmason@ Chrome on Android TPM).
,
Dec 8
Canary 73.0.3634.2 is currently building with this merge for Android, Desktop and CrOS.
,
Dec 8
Canary #73.0.3634.2 went live which includes this merge. Pls update bug with canary result on Monday morning PT.
,
Dec 9
Thanks for the quick merge! I believe that the fix is trivial and is a very low risk. i.e., it would be safe to merge to stable.
,
Dec 9
Thank you haraken@. Approving merge to M71 branch 3578 based on comments #5, #12 and #16. Pls merge to M71 only after verifying on canary if change looks good. Thank you.
,
Dec 9
This will also need a merge to M72, so approving merge to M72 branch 3626.
,
Dec 9
Confirmed the fix on Canary on Mac: Version 73.0.3635.0 (Official Build) canary (64-bit) (beforeprint, afterprint) x (event handler, event listener), all combinations work as expected. I'll merge the fix to M71 and M72 tomorrow (Monday in JST).
,
Dec 9
Re #19: Sounds good, Thank you.
,
Dec 9
Any chance this can get merged to M71 asap so I'll have a version of chrome with the fix on Monday for Chrome OS? Thanks
,
Dec 9
I'm trying to merge to M71 to unblock Stable RC cut for Chrome OS.
,
Dec 9
Sorry, I try to merge to M71 branch 3578 but unable to merge due to merge conflict. Getting below error: An error occurred Could not perform action: Cherry pick failed: merge conflict. yukishiino@, pls resolve merge conflict and then merge to M71. Thank you.
,
Dec 10
Pls merge you change to M72 branch 3626 ASAP so we can pick it up for next Dev/Beta release, RC cut on Monday, 12/10 @ 1:00 PM PT. Thank you.
,
Dec 10
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/d6e7d74e2f4b33b0797dfc2183f6d345538971d9 commit d6e7d74e2f4b33b0797dfc2183f6d345538971d9 Author: Yuki Shiino <yukishiino@chromium.org> Date: Mon Dec 10 06:38:10 2018 v8binding: Invoke on{before,after}print event listeners even when paused This patch fixes a regression at https://crrev.com/c/1215512 , which doesn't run '{before,after}print' event listeners when one of the related execution contexts is paused. This is almost the same fix as https://crrev.com/c/1333548 . Another idea for fix is that Blink should pause an execution context in a narrower range; after dispatching onbeforeprint event and before dispatching onafterprint event. However, the content/ layer has the control of printing and event dispatching, and it's not easy to change such an overall design in a short term. See also WebLocalFrame::Dispatch{Before,After}PrintEvent and its implementations and call sites: https://cs.chromium.org/chromium/src/third_party/blink/public/web/web_local_frame.h?rcl=92c06acc4c92805f4020ad1b12c537fa4ac122c3&l=670 With such a background, this patch allows exceptional invocations not only for beforeunload event but also {before,after}print event. TBR=haraken@chromium.org Bug: 912966 Change-Id: Id38be3ea61668a8e88274b95a4192837e469bd48 Reviewed-on: https://chromium-review.googlesource.com/c/1368848 Reviewed-by: Yuki Shiino <yukishiino@chromium.org> Commit-Queue: Yuki Shiino <yukishiino@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#614972}(cherry picked from commit fa8fd965900a1ae66630aa9b36f1e837178f32e7) Reviewed-on: https://chromium-review.googlesource.com/c/1369555 Cr-Commit-Position: refs/branch-heads/3626@{#172} Cr-Branched-From: d897fb137fbaaa9355c0c93124cc048824eb1e65-refs/heads/master@{#612437} [modify] https://crrev.com/d6e7d74e2f4b33b0797dfc2183f6d345538971d9/third_party/blink/renderer/bindings/core/v8/js_event_handler.cc [modify] https://crrev.com/d6e7d74e2f4b33b0797dfc2183f6d345538971d9/third_party/blink/renderer/bindings/core/v8/js_event_listener.cc
,
Dec 10
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/4cf3d0904c332b3676790c7dc532bbaee5aea8e9 Commit: 4cf3d0904c332b3676790c7dc532bbaee5aea8e9 Author: yukishiino@chromium.org Commiter: yukishiino@chromium.org Date: 2018-12-10 07:59:37 +0000 UTC v8binding: Invoke on{before,after}print event listeners even when paused This patch fixes a regression at https://crrev.com/c/1215512 , which doesn't run '{before,after}print' event listeners when one of the related execution contexts is paused. This is almost the same fix as https://crrev.com/c/1333548 . Another idea for fix is that Blink should pause an execution context in a narrower range; after dispatching onbeforeprint event and before dispatching onafterprint event. However, the content/ layer has the control of printing and event dispatching, and it's not easy to change such an overall design in a short term. See also WebLocalFrame::Dispatch{Before,After}PrintEvent and its implementations and call sites: https://cs.chromium.org/chromium/src/third_party/blink/public/web/web_local_frame.h?rcl=92c06acc4c92805f4020ad1b12c537fa4ac122c3&l=670 With such a background, this patch allows exceptional invocations not only for beforeunload event but also {before,after}print event. TBR=haraken@chromium.org (cherry picked from commit fa8fd965900a1ae66630aa9b36f1e837178f32e7) Bug: 912966 Change-Id: Id38be3ea61668a8e88274b95a4192837e469bd48 Reviewed-on: https://chromium-review.googlesource.com/c/1368848 Reviewed-by: Yuki Shiino <yukishiino@chromium.org> Commit-Queue: Yuki Shiino <yukishiino@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#614972} Reviewed-on: https://chromium-review.googlesource.com/c/1369561 Cr-Commit-Position: refs/branch-heads/3578@{#886} Cr-Branched-From: 4226ddf99103e493d7afb23a4c7902ee496108b6-refs/heads/master@{#599034}
,
Dec 10
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/4cf3d0904c332b3676790c7dc532bbaee5aea8e9 commit 4cf3d0904c332b3676790c7dc532bbaee5aea8e9 Author: Yuki Shiino <yukishiino@chromium.org> Date: Mon Dec 10 07:59:37 2018 v8binding: Invoke on{before,after}print event listeners even when paused This patch fixes a regression at https://crrev.com/c/1215512 , which doesn't run '{before,after}print' event listeners when one of the related execution contexts is paused. This is almost the same fix as https://crrev.com/c/1333548 . Another idea for fix is that Blink should pause an execution context in a narrower range; after dispatching onbeforeprint event and before dispatching onafterprint event. However, the content/ layer has the control of printing and event dispatching, and it's not easy to change such an overall design in a short term. See also WebLocalFrame::Dispatch{Before,After}PrintEvent and its implementations and call sites: https://cs.chromium.org/chromium/src/third_party/blink/public/web/web_local_frame.h?rcl=92c06acc4c92805f4020ad1b12c537fa4ac122c3&l=670 With such a background, this patch allows exceptional invocations not only for beforeunload event but also {before,after}print event. TBR=haraken@chromium.org (cherry picked from commit fa8fd965900a1ae66630aa9b36f1e837178f32e7) Bug: 912966 Change-Id: Id38be3ea61668a8e88274b95a4192837e469bd48 Reviewed-on: https://chromium-review.googlesource.com/c/1368848 Reviewed-by: Yuki Shiino <yukishiino@chromium.org> Commit-Queue: Yuki Shiino <yukishiino@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#614972} Reviewed-on: https://chromium-review.googlesource.com/c/1369561 Cr-Commit-Position: refs/branch-heads/3578@{#886} Cr-Branched-From: 4226ddf99103e493d7afb23a4c7902ee496108b6-refs/heads/master@{#599034} [modify] https://crrev.com/4cf3d0904c332b3676790c7dc532bbaee5aea8e9/third_party/blink/renderer/bindings/core/v8/js_event_handler.cc [modify] https://crrev.com/4cf3d0904c332b3676790c7dc532bbaee5aea8e9/third_party/blink/renderer/bindings/core/v8/js_event_listener.cc
,
Dec 10
Thank you yukishiino@. Triggered new M71 build with this merge in for Android, Desktop and Chrome OS - version 71.0.3578.93 (currently building).
,
Dec 10
Able to reproduce this issue on Windows 10, Mac OS 10.13.6 and Ubuntu 17.10 on the reported version 71.0.3578.80 and the issue is fixed on the latest M-73 build 73.0.3636.0.
1. Launched Chrome and entered window.onafterprint = function(){console.log('after')}; and window.print(); in Devtools -> Console.
2. Could observe that 'after' is printed in the console.
Attached is the screen shot for reference.
Hence adding TE verified labels as the fix is working as intended.
Thanks..
,
Dec 10
The NextAction date has arrived: 2018-12-10
,
Dec 10
,
Dec 10
re #c28: M71 desktop builds finished. The build results of 71.0.3578.93 are the same as ones of 71.0.3578.92 (previous one). Some of content_browsertests and browser_tests are failing in the same way. So, no difference between 93 and 92. Chrome for Android is still in the middle of building.
,
Dec 10
re #c28: M71 Android builds finished successfully with all green.
,
Dec 10
I'll try to write a test for this, to make it harder to regress.
,
Dec 11
Able to reproduce this issue on Windows 10, Mac OS 10.13.6 and Ubuntu 17.10 on the reported version 71.0.3578.80 and the issue is fixed on the latest M-72 build 72.0.3626.14.
1. Launched Chrome and entered window.onafterprint = function(){console.log('after')}; and window.print(); in Devtools -> Console.
2. Could observe that 'after' is printed in the console.
Attached is the screen shot for reference.
Hence adding TE verified labels as the fix is working as intended.
Thanks..
,
Dec 11
//attaching screen shot for comment #35
,
Dec 11
Tested the issue on Windows 10, Mac OS 10.13.6, Ubuntu 17.10 and the issue is fixed on the latest M-71 build 71.0.3578.95. Hence adding TE verified labels. Thanks..
,
Dec 11
Issue 914019 has been merged into this issue.
,
Dec 11
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/39e5d59018f0fb802cff93a5d9793c0905b9b497 commit 39e5d59018f0fb802cff93a5d9793c0905b9b497 Author: Lei Zhang <thestig@chromium.org> Date: Tue Dec 11 19:31:22 2018 Add more PrintRenderFrameHelperTests. - PrintRenderFrameHelperTest.WindowPrintBeforePrintAfterPrint covers the regression in bug 912966 without Print Preview. - PrintRenderFrameHelperPreviewTest.WindowPrintBeforePrintAfterPrint covers the regression in bug 912966 with Print Preview. - PrintRenderFrameHelperPreviewTest.BasicBeforePrintAfterPrint is the equivalent to PrintRenderFrameHelperTest.BasicBeforePrintAfterPrint, but for Print Preview. - Merge common code to avoid repeats. BUG= 912966 Change-Id: I80b0ef718e4f06e2e1bd858bd1c2a39028d4a6ec Reviewed-on: https://chromium-review.googlesource.com/c/1371211 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/master@{#615624} [modify] https://crrev.com/39e5d59018f0fb802cff93a5d9793c0905b9b497/components/printing/test/print_render_frame_helper_browsertest.cc
,
Dec 12
,
Dec 12
Good news: 71.0.3578.98 is now available with the fix on Chrome Stable. You can force an update by visiting chrome://chrome. Thank you.
,
Dec 19
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/d6e7d74e2f4b33b0797dfc2183f6d345538971d9 Commit: d6e7d74e2f4b33b0797dfc2183f6d345538971d9 Author: yukishiino@chromium.org Commiter: yukishiino@chromium.org Date: 2018-12-10 06:38:10 +0000 UTC v8binding: Invoke on{before,after}print event listeners even when paused This patch fixes a regression at https://crrev.com/c/1215512 , which doesn't run '{before,after}print' event listeners when one of the related execution contexts is paused. This is almost the same fix as https://crrev.com/c/1333548 . Another idea for fix is that Blink should pause an execution context in a narrower range; after dispatching onbeforeprint event and before dispatching onafterprint event. However, the content/ layer has the control of printing and event dispatching, and it's not easy to change such an overall design in a short term. See also WebLocalFrame::Dispatch{Before,After}PrintEvent and its implementations and call sites: https://cs.chromium.org/chromium/src/third_party/blink/public/web/web_local_frame.h?rcl=92c06acc4c92805f4020ad1b12c537fa4ac122c3&l=670 With such a background, this patch allows exceptional invocations not only for beforeunload event but also {before,after}print event. TBR=haraken@chromium.org Bug: 912966 Change-Id: Id38be3ea61668a8e88274b95a4192837e469bd48 Reviewed-on: https://chromium-review.googlesource.com/c/1368848 Reviewed-by: Yuki Shiino <yukishiino@chromium.org> Commit-Queue: Yuki Shiino <yukishiino@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#614972}(cherry picked from commit fa8fd965900a1ae66630aa9b36f1e837178f32e7) Reviewed-on: https://chromium-review.googlesource.com/c/1369555 Cr-Commit-Position: refs/branch-heads/3626@{#172} Cr-Branched-From: d897fb137fbaaa9355c0c93124cc048824eb1e65-refs/heads/master@{#612437}
,
Jan 7
|
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by pbomm...@chromium.org
, Dec 7