New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 638522 link

Starred by 3 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Iframe with loaded pdf in it doesn't matchMedia print

Reported by nikitame...@gmail.com, Aug 17 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36

Steps to reproduce the problem:
1. Create page which generates iframe with PDF loaded in it.
2. Add matchMedia print listener for the iframe.
3. Print the iframe.

What is the expected behavior?
The matchMedia should match 'print' on iframe print.

What went wrong?
There is no reaction on matchMedia print.
Here is example: https://yorl1n.github.io/tests/
I generated page with 2 buttons - one generates iframe with image and after load print it, the second generates pdf and also print it onload.
In both cases I add matchMedia listener in a standard way:

        var beforePrint = function() {
            console.log('Functionality to run before printing '+type);
        };

        var afterPrint = function() {
            console.log('Functionality to run after printing '+type);
        };

        if (win.matchMedia) {
            var mediaQueryList = win.matchMedia('print');
            mediaQueryList.addListener(function(mql) {
                if (mql.matches) {
                    beforePrint();
                } else {
                    afterPrint();
                }
            });
        }
        win.onbeforeprint = beforePrint;
        win.onafterprint = afterPrint;

For image matchMedia print works properly, but for pdf doesn't.
F.e. in FF it works due to it has own pdf-viewer with print events.
The source code can be taken from the example or be downloaded from https://github.com/yorl1n/tests

Did this work before? N/A 

Chrome version: 52.0.2743.116  Channel: stable
OS Version: 6.3
Flash Version: Shockwave Flash 22.0 r0
 
Components: Internals>Plugins>PDF Blink>HTML>IFrame
Labels: Needs-Feedback
Tested the issue on Windows 7, Mac 10.11.6, Ubuntu 14.04 using 52.0.2743.116, latest canary 54.0.2831.0 with below steps:

1.Opened URL: https://yorl1n.github.io/tests/
2.Clicked on 'test image iframe' button.
3.Page changed to image with print options.
4.Clicked on 'test pdf iframe' button.
5.Page changed to pdf with print options.

Please find attached screencast and update if anything missed here in triaging the issue.

nikitametzger@Could you please provide actual and expected behavior screencast for further triaging the issue.
638522.mp4
666 KB View Download
Hi, thanks for the response. I thought the code is self explained. Sorry, I will be more precise. Print works in both cases, but matchMedia listener doesn't.
If you take a look into my snippet where I add listener to matchMedia:

mediaQueryList.addListener(function(mql) {
                if (mql.matches) {
                    beforePrint();
                } else {
                    afterPrint();
                }
            });

So when print is called beforePrint should be executed, and when we cancel print or send task to printer afterPrint should be executed. These functions defined as follows:

 var beforePrint = function() {
            console.log('Functionality to run before printing '+type);
        };

        var afterPrint = function() {
            console.log('Functionality to run after printing '+type);
        };

So to see if matchMedia works you should take a look into debugger console.
For image listener works properly and you will see in the console:

Functionality to run before printing IMG
Functionality to run after printing IMG

Calling the same code but with pdf content the listener doesn't work.
I can make a video with the same steps as you have done, but with opened console, but I hope now I was more precise. 
Thanks in advance.
The goal is - when user wants to print some pdf in our system, pdf is loaded into iframe, after printing is done this iframe should be self-destructed. To know when the print is done matchMedia listener is used.
But regardless of my goal, the matchMedia should work in the same way for any type of content, at least for the print media type. Image is taken only for demonstration, plain html will work properly too. 
Project Member

Comment 4 by sheriffbot@chromium.org, Aug 25 2016

Labels: -Needs-Feedback Needs-Review
Owner: ssamanoori@chromium.org
Thank you for providing more feedback. Adding requester "ssamanoori@chromium.org" for another review and adding "Needs-Review" label for tracking.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: nainar@chromium.org
Is this related to  bug 615377 ?
Labels: -Needs-Review Needs-Feedback
Owner: ----
nikitametzger@Could you please check and confirm if this is related to  bug 615377  as per comment #5?

Comment 7 by nainar@chromium.org, Aug 26 2016

Testing this and reading the description in 615377 makes it sound like they are both the same. Deduping 615377 against this since that one lacks a test case. 

Comment 8 by nainar@chromium.org, Aug 26 2016

Cc: msrchandra@chromium.org
 Issue 615377  has been merged into this issue.
Sorry for delayed answer. Yes the issue sounds similar to mine.
Status: Available (was: Unconfirmed)
Marking this as available. I tested as per comment 2 and the original report. 

Since this is present in 52  - definitely not my change. 
Cc: ssamanoori@chromium.org
Labels: -Needs-Feedback
ssamanoori: Can you check if this is a regression? If yes, can you bisect?
Project Member

Comment 12 by sheriffbot@chromium.org, Aug 28 2017

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: -ssamanoori@chromium.org
Status: WontFix (was: Untriaged)
This hasn't been touched in a year, marking as WontFix. If this is still an issue please let us know.

Sign in to add a comment