New issue
Advanced search Search tips
Starred by 5 users

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Blocking:
issue 568037



Sign in to add a comment

OOP PDF: chrome://resources is not accessible from print preview

Project Member Reported by sa...@chromium.org, Dec 23 2014 Back to list

Issue description

Since the extension is iframed, the normal process that grants it access to chrome://* is skipped.
 

Comment 1 by sa...@chromium.org, Dec 23 2014

Blocking: chromium:303491
Project Member

Comment 2 by bugdroid1@chromium.org, Jan 6 2015

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

commit 7626c7325b71eaef6589d1490258efcf3a16cbe2
Author: sammc <sammc@chromium.org>
Date: Tue Jan 06 03:51:06 2015

OOP PDF: Fix access to chrome://resources in print preview.

When the PDF extension is iframed by the print preview page, it isn't
granted permission to access chrome://resources. This CL causes the
extension to be granted access to chrome://resources in the renderer
process for print-preview by adding it as a content script for
chrome://print/*. This is a temporary work-around until either print
preview uses an embed element for the OOP PDF plugin or OOP iframe
allows extensions to run with their normal permissions when iframed.
This also removes the need for the work-around added in r306307.

BUG= 437417 , 444752 

Review URL: https://codereview.chromium.org/819983002

Cr-Commit-Position: refs/heads/master@{#310044}

[modify] http://crrev.com/7626c7325b71eaef6589d1490258efcf3a16cbe2/chrome/browser/resources/component_extension_resources.grd
[add] http://crrev.com/7626c7325b71eaef6589d1490258efcf3a16cbe2/chrome/browser/resources/pdf/content_script.js
[modify] http://crrev.com/7626c7325b71eaef6589d1490258efcf3a16cbe2/chrome/browser/resources/pdf/index.html
[modify] http://crrev.com/7626c7325b71eaef6589d1490258efcf3a16cbe2/chrome/browser/resources/pdf/manifest-common.json.unflattened
[modify] http://crrev.com/7626c7325b71eaef6589d1490258efcf3a16cbe2/chrome/browser/resources/pdf/pdf.js

Comment 3 by sa...@chromium.org, Jan 6 2015

Status: Fixed (was: NULL)

Comment 4 by raymes@chromium.org, Jan 29 2015

Cc: sa...@chromium.org
Owner: ----
Status: Available (was: NULL)

Comment 5 by raymes@chromium.org, Jan 29 2015

Blocking: -chromium:303491
Blocking: chromium:568037
Project Member

Comment 7 by bugdroid1@chromium.org, Jan 4 2016

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

commit de5f44d770c51d181f04ff3bb029dee8ac733d63
Author: raymes <raymes@chromium.org>
Date: Mon Jan 04 04:44:55 2016

Avoid cross-origin iframe issues when loading PDF in print preview

There are several issues that arise because we load the PDF viewer in a cross-origin iframe in print preview:
1) It doesn't get access to chrome:// resources by default (we have a hack in place, see  crbug.com/444752 )
2) The above hack causes its own problems (see  crbug.com/461987 ).
3) Cross-origin policy prevents direct communication between the two frames DOMs which has made some implementation more difficult (we could simplify some code after this patch).
4) It's necessary that the two frames run in the same process because Chrome's printing needs direct access to the plugin element. With site isolation, the extension could be loaded up in a separate process, we don't want this.

This patch causes the iframe to load in the same origin as print preview and then all the resources are pulled in from the Chrome extension.

Ideally we would turn the PDF viewer into a polymer element which would encapsulate it better and make it clearer what is going on in this situation but this will require some additional work.

BUG= 444752 , 461987 

Review URL: https://codereview.chromium.org/1217503012

Cr-Commit-Position: refs/heads/master@{#367293}

[modify] http://crrev.com/de5f44d770c51d181f04ff3bb029dee8ac733d63/chrome/browser/browser_resources.grd
[modify] http://crrev.com/de5f44d770c51d181f04ff3bb029dee8ac733d63/chrome/browser/resources/pdf/index.html
[modify] http://crrev.com/de5f44d770c51d181f04ff3bb029dee8ac733d63/chrome/browser/resources/pdf/manifest.json
[modify] http://crrev.com/de5f44d770c51d181f04ff3bb029dee8ac733d63/chrome/browser/resources/pdf/pdf_scripting_api.js
[add] http://crrev.com/de5f44d770c51d181f04ff3bb029dee8ac733d63/chrome/browser/resources/print_preview/pdf_preview.html
[modify] http://crrev.com/de5f44d770c51d181f04ff3bb029dee8ac733d63/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
[modify] http://crrev.com/de5f44d770c51d181f04ff3bb029dee8ac733d63/content/browser/webui/web_ui_data_source_impl.cc
[modify] http://crrev.com/de5f44d770c51d181f04ff3bb029dee8ac733d63/content/browser/webui/web_ui_data_source_unittest.cc

Status: Fixed (was: NULL)
Owner: raymes@chromium.org

Sign in to add a comment