New issue
Advanced search Search tips

Issue 807908 link

Starred by 4 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

Print preview closes unexpectedly when using an ‘PDF Viewer’ extension.

Reported by avsha...@etouch.net, Feb 1 2018

Issue description

Chrome version : 64.0.3282.140 (Official Build) a06bc1d5e8e285c70078802de990c1719ccc75e8-refs/branch-heads/3282@{#631} 32/64 bit
OS : Mac mini(10.12.6, 10.13.1), Windows(7,8,10) & Linux(14.04 LTS)

Test URL 1 : https://chrome.google.com/webstore/detail/pdf-viewer/oemmndcbldboiebfnladdacbdfmadadm?utm_source=chrome-ntp-icon
Test URL 2 : http://cb.vu/unixtoolbox.pdf

What steps will reproduce the problem?
1. Launch chrome, navigate to Test URL 1 and install an ‘PDF Viewer’ extension.
2. Now navigate to Test URL 2 and let the PDF load completely.
3. Right click on PDF and select ‘Print’ option, observe.

Actual Result : Print preview closes unexpectedly when using an ‘PDF Viewer’ extension.

Expected Result : Print preview should not close when trying to print the PDF using ‘PDF Viewer’ extension.

This is a non-regression issue seen from M-60 series builds #60.0.3072.0. 

Note :
1. Sometimes need to reload the PDF page and repeat step 3 twice in order to reproduce the issue.
2. Above issue is not observed on Windows(8.1), Mac Touch bar(10.13.3) and Mac Retina machine. 
3. Issue also exist on Canary #66.0.3335.0, Dev #65.0.3325.33 build.
 
Actual_Result.mov
7.8 MB View Download
Labels: FoundIn-66 Target-66
Status: Untriaged (was: Unconfirmed)
As this being a Non-Regression issue, changing the status to Untriaged so that the issue would get addressed.

Thank You!
Cc: rob@robwu.nl
Rob, is this a known issue? I imagine it's never worked with the current extension?
The print button in the viewer's toolbar works. Maybe the viewer can listen for window.onbeforeprint and react appropriately?

Comment 5 by rob@robwu.nl, Feb 9 2018

My extension doesn't automatically close the print preview dialog (extensions and web pages cannot do that).

Printing via the context menu doesn't work though, because the printed content is generated asynchronously. Coincidentally I wrote about the beforeprint event a few days ago (and why the event is useless): https://github.com/mozilla/pdf.js/pull/9439
Owner: thestig@chromium.org
Status: Assigned (was: Untriaged)
From looking at it, it looks like this *is* an issue with the native print preview dialog.  Over to thestig to investigate.
Labels: -M-66 -Target-66
Sure, the print preview dialog self closing is probably triggered by a navigation or something. Will look.
Yes, it's a navigation. We have had a few bugs like this in the past. It is very difficult to distinguish which same-page transitions should close print preview -
 one example that came up after a previous attempt to fix this was navigation within chrome://pages - and which should not -
 there was a bug for gmail where the hash at the end of the URL was changing but the expectation was that the preview should not close. Not sure if there will be anything we can do about this, but we can investigate.

Comment 9 by rob@robwu.nl, Feb 9 2018

A programmatic way to close print preview sounds like a nice work-around to implement asynchronous printing (onbeforeprint = <close print preview>, prepare page, window.print() ).

Is there a seemingly stable / reliable way to close the print preview page? It doesn't have to be officially supported; if I can already intercept print requests, rewrite the page and re-issue the print request, that would already improve the UX of my PDF Viewer extension.
The relevant code is here: https://cs.chromium.org/chromium/src/chrome/browser/printing/print_preview_dialog_controller.cc?l=345
If a page creates a navigation that doesn't match the checks in lines 348-354, the dialog closes. Those checks are trying to draw a line between the cases of  bug 634237  (where the dialog should close since the page changes) and  bug 614998  (where the dialog should stay open because it doesn't), but they aren't perfect, as there does not seem to be a foolproof way to detect whether a navigation changes the underlying page or not.

At one point creis@, who was working on navigation changes, suggested changing those checks out for a more sane-looking check of the is_same_document and did_replace_entry fields of LoadCommittedDetails, but that caused  bug 634237  to come back so we never landed it. I tested and making that change would fix the dialog closing issue here, but it still causes the same regression. FYI, a better example navigation that shows the 634237 case now that MD settings has launched and the reset page is a modal dialog is chrome://settings -> chrome://settings/searchEngines.
Labels: ET-MUM-Reported

Sign in to add a comment