Iframe with loaded pdf in it doesn't matchMedia print
Reported by
nikitame...@gmail.com,
Aug 17 2016
|
|||||||
Issue descriptionUserAgent: 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
,
Aug 18 2016
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.
,
Aug 18 2016
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.
,
Aug 25 2016
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
,
Aug 25 2016
,
Aug 26 2016
nikitametzger@Could you please check and confirm if this is related to bug 615377 as per comment #5?
,
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.
,
Aug 26 2016
,
Aug 26 2016
Sorry for delayed answer. Yes the issue sounds similar to mine.
,
Aug 26 2016
Marking this as available. I tested as per comment 2 and the original report. Since this is present in 52 - definitely not my change.
,
Aug 26 2016
ssamanoori: Can you check if this is a regression? If yes, can you bisect?
,
Aug 28 2017
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
,
Aug 28 2017
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 |
|||||||
Comment 1 by ssamanoori@chromium.org
, Aug 18 2016Labels: Needs-Feedback
666 KB
666 KB View Download