New issue
Advanced search Search tips

Issue 881876 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Sep 11
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 2
Type: Bug



Sign in to add a comment

window.print() is not supported in iframes

Project Member Reported by eugene...@chromium.org, Sep 7

Issue description

App Version (from "Chrome Settings > About Chrome"): M69 and older
iOS Version: All
Device: All

Steps to reproduce: 
1.) Load https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_print
2.) Tap Print This Page

Observed behavior: 
Nothing happens

Expected behavior: 
Print dialog should be presented


 
Owner: eugene...@chromium.org
Status: Started (was: Available)
We should be careful about supporting window.print() in iframes to prevent abusive behavior.
Project Member

Comment 2 by bugdroid1@chromium.org, Sep 7

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/38715a153906cdfcf5b6c09765374c92cc821f9d

commit 38715a153906cdfcf5b6c09765374c92cc821f9d
Author: Eugene But <eugenebut@google.com>
Date: Fri Sep 07 21:02:14 2018

Support window.print() in iframes.

window.print() will work in iframes only if the user is interacting with
the page. This will prevent abusive experience from malicious iframes.

This CL does not have tests, because there is no infrastructure for
testing PrintTabHelper, AddScriptCommandCallback and iframes.

Bug:  881876 
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: Ia741e74accf69b6cee63351e04851e3068e8c3e5
Reviewed-on: https://chromium-review.googlesource.com/1213270
Reviewed-by: Mike Dougherty <michaeldo@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589632}
[modify] https://crrev.com/38715a153906cdfcf5b6c09765374c92cc821f9d/ios/chrome/browser/web/print_tab_helper.mm

Labels: -Pri-3 M-71 Pri-2
Status: Fixed (was: Started)
Status: Started (was: Fixed)
Still need to inject scripts.
Project Member

Comment 5 by bugdroid1@chromium.org, Sep 11

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0227cbd7d0c2e47c1c8f5ad57df3fc2403c2a606

commit 0227cbd7d0c2e47c1c8f5ad57df3fc2403c2a606
Author: Eugene But <eugenebut@chromium.org>
Date: Tue Sep 11 00:36:17 2018

Inject print.js into all frames.

Bug:  881876 
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: Id32427383dc90c986bb6ddf3cf07b0e1fc3f5282
Reviewed-on: https://chromium-review.googlesource.com/1214756
Reviewed-by: Mike Dougherty <michaeldo@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590139}
[modify] https://crrev.com/0227cbd7d0c2e47c1c8f5ad57df3fc2403c2a606/ios/chrome/browser/web/BUILD.gn
[modify] https://crrev.com/0227cbd7d0c2e47c1c8f5ad57df3fc2403c2a606/ios/chrome/browser/web/chrome_web_client_unittest.mm
[modify] https://crrev.com/0227cbd7d0c2e47c1c8f5ad57df3fc2403c2a606/ios/chrome/browser/web/resources/chrome_bundle_all_frames.js
[modify] https://crrev.com/0227cbd7d0c2e47c1c8f5ad57df3fc2403c2a606/ios/chrome/browser/web/resources/chrome_bundle_main_frame.js

Status: Fixed (was: Started)
Status: Verified (was: Fixed)
Verified on 71.0.3555.0 Canary, iPhone X  iOS 11.4.1, iPhone 7 iOS 12.0 

Print dialog opens, looks good.

Sign in to add a comment