Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Issue 427723004: Fix for race condition where print preview hangs when attempting to print a PDF that hasn't loaded. (Closed)

Created:
6 years, 4 months ago by ivandavid
Modified:
6 years, 4 months ago
CC:
chromium-reviews, Dan Beam
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Fix for race condition where print preview hangs when attempting to print a PDF that hasn't loaded. If |type| in RequestPrintPreview() equals PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME and |is_loading_| is true, RequestPrintPreview() returns, then is called again, right after |is_loading_| is set to false in DidStopLoading(). BUG=376969 TEST=See bug for steps to reproduce. Additional way to reproduce: Build blink_tests and browser_tests in out/Release. Then in src/webkit/tools/layout_tests run this command: ./run_webkit_tests.py --platform browser_test.linux source_pdf/ you can replace linux with win or mac depending on your platform. The program will attempt to save a PDF as a PDF through print preview. It will eventually fail because Print Preview will hang due to this bug. If you want visual confirmation that this will happen open: src/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/browser_test_driver.py. Then add this line of code to the function cmd_line. cmd.append('--enable-pixel-output-in-tests') Then run the script again. Enabling pixel output will also make it significantly more likely for the bug to occur. Its also more likely to happen on windows for some reason. This is how I came across the bug. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=287982

Patch Set 1 #

Patch Set 2 : Fixed typo in comment and space issue. #

Patch Set 3 : Moved |request_print_preview_closure_| into the switch statement. #

Total comments: 5

Patch Set 4 : Renamed closure. |on_stop_loading_closure_| now also calls ShowScriptedPrintPreview. #

Total comments: 9

Patch Set 5 : Removed NOTREACHED() in DidStopLoading(), moved the first bind statement and added another. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+32 lines, -1 line) Patch
M chrome/renderer/printing/print_web_view_helper.h View 1 2 3 2 chunks +7 lines, -0 lines 0 comments Download
M chrome/renderer/printing/print_web_view_helper.cc View 1 2 3 4 4 chunks +25 lines, -1 line 0 comments Download

Messages

Total messages: 17 (0 generated)
ivandavid
I fixed the race condition where print preview would hang when a PDF was to ...
6 years, 4 months ago (2014-07-29 00:23:37 UTC) #1
Lei Zhang
On 2014/07/29 00:23:37, ivandavid wrote: > I fixed the race condition where print preview would ...
6 years, 4 months ago (2014-07-29 19:22:39 UTC) #2
ivandavid
I am submitting the code, because its a fix for a problem that I encountered ...
6 years, 4 months ago (2014-07-29 20:02:51 UTC) #3
Lei Zhang
-karen :)
6 years, 4 months ago (2014-07-29 20:33:25 UTC) #4
Nate Chapin
This seems plausible to me, but I'm not really qualified to review it. Adding vitalybuka.
6 years, 4 months ago (2014-08-04 17:26:35 UTC) #5
Vitaly Buka (NO REVIEWS)
https://codereview.chromium.org/427723004/diff/40001/chrome/renderer/printing/print_web_view_helper.cc File chrome/renderer/printing/print_web_view_helper.cc (left): https://codereview.chromium.org/427723004/diff/40001/chrome/renderer/printing/print_web_view_helper.cc#oldcode1727 chrome/renderer/printing/print_web_view_helper.cc:1727: case PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME: { My understanding is that it's by ...
6 years, 4 months ago (2014-08-05 05:49:58 UTC) #6
Vitaly Buka (NO REVIEWS)
https://codereview.chromium.org/427723004/diff/40001/chrome/renderer/printing/print_web_view_helper.cc File chrome/renderer/printing/print_web_view_helper.cc (right): https://codereview.chromium.org/427723004/diff/40001/chrome/renderer/printing/print_web_view_helper.cc#newcode824 chrome/renderer/printing/print_web_view_helper.cc:824: ShowScriptedPrintPreview(); please remove ShowScriptedPrintPreview() from here use request_print_preview_closure_ to ...
6 years, 4 months ago (2014-08-05 06:05:07 UTC) #7
ivandavid
6 years, 4 months ago (2014-08-05 19:29:10 UTC) #8
ivandavid
https://codereview.chromium.org/427723004/diff/40001/chrome/renderer/printing/print_web_view_helper.cc File chrome/renderer/printing/print_web_view_helper.cc (left): https://codereview.chromium.org/427723004/diff/40001/chrome/renderer/printing/print_web_view_helper.cc#oldcode1727 chrome/renderer/printing/print_web_view_helper.cc:1727: case PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME: { On 2014/08/05 05:49:57, Vitaly Buka wrote: ...
6 years, 4 months ago (2014-08-05 19:30:17 UTC) #9
Vitaly Buka (NO REVIEWS)
https://codereview.chromium.org/427723004/diff/60001/chrome/renderer/printing/print_web_view_helper.cc File chrome/renderer/printing/print_web_view_helper.cc (right): https://codereview.chromium.org/427723004/diff/60001/chrome/renderer/printing/print_web_view_helper.cc#newcode826 chrome/renderer/printing/print_web_view_helper.cc:826: NOTREACHED(); NOTREACHED is incorrect here. DidStopLoading is going to ...
6 years, 4 months ago (2014-08-06 08:53:57 UTC) #10
ivandavid
https://codereview.chromium.org/427723004/diff/60001/chrome/renderer/printing/print_web_view_helper.cc File chrome/renderer/printing/print_web_view_helper.cc (right): https://codereview.chromium.org/427723004/diff/60001/chrome/renderer/printing/print_web_view_helper.cc#newcode826 chrome/renderer/printing/print_web_view_helper.cc:826: NOTREACHED(); On 2014/08/06 08:53:57, Vitaly Buka wrote: > NOTREACHED ...
6 years, 4 months ago (2014-08-06 19:00:17 UTC) #11
Vitaly Buka (NO REVIEWS)
lgtm
6 years, 4 months ago (2014-08-06 20:57:22 UTC) #12
Vitaly Buka (NO REVIEWS)
https://codereview.chromium.org/427723004/diff/60001/chrome/renderer/printing/print_web_view_helper.cc File chrome/renderer/printing/print_web_view_helper.cc (right): https://codereview.chromium.org/427723004/diff/60001/chrome/renderer/printing/print_web_view_helper.cc#newcode1738 chrome/renderer/printing/print_web_view_helper.cc:1738: if (is_loading_ && GetPlugin(print_preview_context_.source_frame())) { Yes, it should be ...
6 years, 4 months ago (2014-08-06 21:00:37 UTC) #13
ivandavid
The CQ bit was checked by ivandavid@chromium.org
6 years, 4 months ago (2014-08-06 21:39:25 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ivandavid@chromium.org/427723004/120001
6 years, 4 months ago (2014-08-06 21:40:27 UTC) #15
commit-bot: I haz the power
Change committed as 287982
6 years, 4 months ago (2014-08-07 07:17:40 UTC) #16
ivandavid
6 years, 4 months ago (2014-08-12 18:51:03 UTC) #17
Message was sent while issue was closed.
A revert of this CL has been created in
https://codereview.chromium.org/463123004/ by ivandavid@chromium.org.

The reason for reverting is: The changes fix an issue, but cause a more serious
one. 

crbug.com/402402.

Powered by Google App Engine
This is Rietveld 408576698