New issue
Advanced search Search tips

Issue 740264 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug



Sign in to add a comment

PrintPreviewUI calling non-existent Javascript function

Project Member Reported by rbpotter@chromium.org, Jul 7 2017

Issue description

Chrome Version: 61.0.3150.0 (Developer Build) (64-bit) 
OS: Win10, but probably applies to all

What steps will reproduce the problem?
(1) Ensure default printer is some local (non PDF) printer.
(2) Print preview some large document (13+ pages with lots of graphics worked on a debug build)
(3) As soon as dialog appears (but before preview is loaded), press enter to print.
(4) After several seconds (wait for print request to send), close the tab while leaving the browser open

What is the expected result?
No errors

What happens instead?
Console error - "Uncaught ReferenceError: cancelPendingPrintRequest is not defined"

Appears to originate from CallJavascriptFunctionUnsafe here: https://cs.chromium.org/chromium/src/chrome/browser/ui/webui/print_preview/print_preview_ui.cc?l=540

The Javascript function does not actually exist, and seems to have been removed many years ago in this CL:

https://chromium.googlesource.com/chromium/src/+/4e2fbb6c9dd4f2c227309c975ce055b62ec818eb
 
Cc: tommycli@chromium.org
+tommycli as FYI, who added the Allow/DisallowJavascript lifecycle methods. It seems that this would not be an issue if the code was not using CallJavascriptUnsafe to begin with.
Apparently there is also an issue with a render process host hanging around in this case, as when the browser is closed we hit a DCHECK in profile_destroyer: 
FATAL:profile_destroyer.cc(56)] Check failed: hosts.empty() || profile->IsOffTheRecord() || content::RenderProcessHost::run_renderer_in_process(). Profile still has 1 hosts

Also, the intended behavior (i.e. result of calling HandleCancelPendingPrintRequest) seems to be to bring up a dialog that says: 

"Print Failed: Something went wrong when trying to print. Please check your printer and try again."

Should decide if this behavior makes sense or not. It is probably unexpected if the user has hit print and watched the dialog disappear and then closes the tab ~30 seconds later while the browser is still open.

Note that calling HandleCancelPendingPrintRequest instead of CallJavascriptFunctionUnsafe(...) still has the issue with profile_destroyer, so things are not getting cleaned up correctly even when the bad JS call is removed.
Status: Fixed (was: Assigned)

Sign in to add a comment