Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Issue 1217503012: Avoid cross-origin iframe issues when loading PDF in print preview (Closed)

Created:
5 years, 5 months ago by raymes
Modified:
4 years, 11 months ago
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, darin-cc_chromium.org, jam, arv+watch_chromium.org, extensions-reviews_chromium.org, chrome-apps-syd-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

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 Committed: https://crrev.com/de5f44d770c51d181f04ff3bb029dee8ac733d63 Cr-Commit-Position: refs/heads/master@{#367293}

Patch Set 1 #

Patch Set 2 : #

Total comments: 6

Patch Set 3 : #

Patch Set 4 : #

Total comments: 1

Patch Set 5 : #

Patch Set 6 : #

Total comments: 2

Patch Set 7 : #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+29 lines, -14 lines) Patch
M chrome/browser/browser_resources.grd View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/resources/pdf/index.html View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/resources/pdf/manifest.json View 1 2 3 4 5 6 1 chunk +4 lines, -10 lines 0 comments Download
M chrome/browser/resources/pdf/pdf_scripting_api.js View 1 2 3 4 5 6 2 chunks +3 lines, -4 lines 0 comments Download
A chrome/browser/resources/print_preview/pdf_preview.html View 1 5 6 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/ui/webui/print_preview/print_preview_ui.cc View 1 2 3 4 5 6 2 chunks +4 lines, -0 lines 0 comments Download
M content/browser/webui/web_ui_data_source_impl.cc View 1 2 3 4 5 6 1 chunk +5 lines, -0 lines 1 comment Download
M content/browser/webui/web_ui_data_source_unittest.cc View 1 2 3 4 5 6 1 chunk +10 lines, -0 lines 0 comments Download

Messages

Total messages: 49 (20 generated)
Sam McNally
lgtm
5 years, 5 months ago (2015-07-07 06:42:24 UTC) #4
raymes
+thestig@ for print preview related changes.
5 years, 5 months ago (2015-07-07 07:01:08 UTC) #6
Lei Zhang
Deferring to Tom for the CSP bits in print_preview_ui.cc.
5 years, 5 months ago (2015-07-14 23:53:56 UTC) #8
Tom Sepez
On 2015/07/14 23:53:56, Lei Zhang wrote: > Deferring to Tom for the CSP bits in ...
5 years, 5 months ago (2015-07-15 00:00:19 UTC) #9
Tom Sepez
+charlie Would this also grant webui permissions to an ordinary renderer process?
5 years, 5 months ago (2015-07-15 00:02:18 UTC) #11
raymes
The DOM for the PDF viewer isn't untrusted. It's in the Chrome repo, written by ...
5 years, 5 months ago (2015-07-15 00:07:37 UTC) #12
Tom Sepez
On 2015/07/15 00:07:37, raymes wrote: > The DOM for the PDF viewer isn't untrusted. It's ...
5 years, 5 months ago (2015-07-15 16:48:06 UTC) #13
raymes
On 2015/07/15 16:48:06, Tom Sepez wrote: > On 2015/07/15 00:07:37, raymes wrote: > > The ...
5 years, 5 months ago (2015-07-16 00:32:51 UTC) #14
Lei Zhang
lgtm
5 years, 5 months ago (2015-07-16 04:19:00 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1217503012/20001
5 years, 5 months ago (2015-07-16 05:04:46 UTC) #17
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/79255)
5 years, 5 months ago (2015-07-16 05:12:32 UTC) #19
Charlie Reis
I don't have a great understanding of the print preview architecture, but (4) in the ...
5 years, 5 months ago (2015-07-16 19:25:03 UTC) #20
raymes
What were the two origins before, and what origin do they share now? Is the ...
5 years, 5 months ago (2015-07-17 01:58:29 UTC) #21
Charlie Reis
Ok, thanks for the explanation. I'm happy with that. https://codereview.chromium.org/1217503012/diff/20001/content/browser/webui/url_data_manager_backend.cc File content/browser/webui/url_data_manager_backend.cc (right): https://codereview.chromium.org/1217503012/diff/20001/content/browser/webui/url_data_manager_backend.cc#newcode85 content/browser/webui/url_data_manager_backend.cc:85: ...
5 years, 5 months ago (2015-07-17 23:45:22 UTC) #22
raymes
https://codereview.chromium.org/1217503012/diff/20001/content/browser/webui/url_data_manager_backend.cc File content/browser/webui/url_data_manager_backend.cc (right): https://codereview.chromium.org/1217503012/diff/20001/content/browser/webui/url_data_manager_backend.cc#newcode85 content/browser/webui/url_data_manager_backend.cc:85: std::string URLToRequestPath(const GURL& url) { I no longer change ...
5 years, 5 months ago (2015-07-20 06:46:22 UTC) #23
Charlie Reis
https://codereview.chromium.org/1217503012/diff/60001/content/public/browser/url_data_source.cc File content/public/browser/url_data_source.cc (right): https://codereview.chromium.org/1217503012/diff/60001/content/public/browser/url_data_source.cc#newcode69 content/public/browser/url_data_source.cc:69: *path = path->substr(0, path->find_last_of('?')); I don't think this is ...
5 years, 5 months ago (2015-07-20 16:49:10 UTC) #24
raymes
Charlie: could you take another look at this. I moved that functionality out of the ...
5 years ago (2015-12-08 04:40:03 UTC) #25
raymes
+estade for content/browser/webui/*
5 years ago (2015-12-10 03:47:07 UTC) #27
Charlie Reis
content/ LGTM.
5 years ago (2015-12-10 07:48:02 UTC) #28
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1217503012/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1217503012/80001
5 years ago (2015-12-10 22:00:14 UTC) #31
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/153804)
5 years ago (2015-12-10 22:49:12 UTC) #33
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1217503012/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1217503012/100001
5 years ago (2015-12-15 23:00:15 UTC) #36
commit-bot: I haz the power
Try jobs failed on following builders: linux_android_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_android_rel_ng/builds/111253)
5 years ago (2015-12-16 01:39:53 UTC) #38
Evan Stade
https://codereview.chromium.org/1217503012/diff/100001/content/browser/webui/web_ui_data_source_impl.cc File content/browser/webui/web_ui_data_source_impl.cc (right): https://codereview.chromium.org/1217503012/diff/100001/content/browser/webui/web_ui_data_source_impl.cc#newcode77 content/browser/webui/web_ui_data_source_impl.cc:77: *path = path->substr(0, path->find_last_of('?')); I'm sure someone more knowledgeable ...
5 years ago (2015-12-18 23:15:10 UTC) #39
raymes
https://codereview.chromium.org/1217503012/diff/100001/content/browser/webui/web_ui_data_source_impl.cc File content/browser/webui/web_ui_data_source_impl.cc (right): https://codereview.chromium.org/1217503012/diff/100001/content/browser/webui/web_ui_data_source_impl.cc#newcode77 content/browser/webui/web_ui_data_source_impl.cc:77: *path = path->substr(0, path->find_last_of('?')); Oops good catch. Thank you ...
4 years, 11 months ago (2016-01-04 01:56:18 UTC) #40
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1217503012/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1217503012/120001
4 years, 11 months ago (2016-01-04 01:57:14 UTC) #43
commit-bot: I haz the power
Committed patchset #7 (id:120001)
4 years, 11 months ago (2016-01-04 04:45:02 UTC) #45
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/de5f44d770c51d181f04ff3bb029dee8ac733d63 Cr-Commit-Position: refs/heads/master@{#367293}
4 years, 11 months ago (2016-01-04 04:46:05 UTC) #47
Primiano Tucci (use gerrit)
4 years, 11 months ago (2016-01-04 18:50:38 UTC) #49
Message was sent while issue was closed.
https://codereview.chromium.org/1217503012/diff/120001/content/browser/webui/...
File content/browser/webui/web_ui_data_source_impl.cc (right):

https://codereview.chromium.org/1217503012/diff/120001/content/browser/webui/...
content/browser/webui/web_ui_data_source_impl.cc:79: // We want to remove any
query strings from the path.
The funny thing is that [1] relies on the opposite behavior.
(And sadly there doesn't seem to be any test convering the tracing UI
integration :/)

[1]
https://code.google.com/p/chromium/codesearch#chromium/src/content/browser/tr...

Powered by Google App Engine
This is Rietveld 408576698