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

Issue 19762002: [HTML Imports] Let script of imported document running. (Closed)

Created:
7 years, 5 months ago by Hajime Morrita
Modified:
7 years, 4 months ago
CC:
blink-reviews, dglazkov+blink, Nate Chapin, eae+blinkwatch, adamk+blink_chromium.org, gavinp+loader_chromium.org
Visibility:
Public.

Description

[HTML Imports] Let script of imported document running. This change allows <script> inside imported document running. The implementation is based on a proposal at https://www.w3.org/Bugs/Public/show_bug.cgi?id=22413. This CL teaches ScriptLoader about HTML Imports so that it loads and evaluates script if the document is an import. For that purpose, now ScriptLoader distinguishes "executing document" which is a master and "element" document which is an import, then executes scripts on "executing" document. Here are some remarks: - This change doesn't make other resources, including stylesheets and images, being loaded on imports. The spec doesn't mention about them. - This change doesn't take care of execution order. It will be attacked in following changes. - Some of new CSP related tests capture some FAILures. This represents the current limitation of Blink's CSP handling of HTML Import: It cannot prohibit eval() in imports and just follows master's context. This is because the imported scripts run on master's context and there is no way to the source of the eval() calls. BUG=240592 TEST=csp-import-block-but-*.html, import-script-nosniff.html, import-script.html, import-script-prototypes.html R=dglazkov,abarth Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=155149

Patch Set 1 #

Patch Set 2 : Added a missing test result. #

Patch Set 3 : Fixed a failing test. #

Total comments: 6

Patch Set 4 : Revised, adding more tests. #

Patch Set 5 : Revised, adding test. #

Patch Set 6 : Fixed a test #

Patch Set 7 : Updated to ToT #

Total comments: 5

Patch Set 8 : Added a test, landing. #

Patch Set 9 : Made a test more robust. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+767 lines, -50 lines) Patch
M LayoutTests/fast/html/imports/import-master.html View 1 2 3 1 chunk +15 lines, -4 lines 0 comments Download
M LayoutTests/fast/html/imports/import-master-expected.txt View 1 2 1 chunk +8 lines, -5 lines 0 comments Download
A LayoutTests/fast/html/imports/import-script.html View 1 chunk +43 lines, -0 lines 0 comments Download
A LayoutTests/fast/html/imports/import-script-expected.txt View 1 1 chunk +20 lines, -0 lines 0 comments Download
A LayoutTests/fast/html/imports/import-script-prototypes.html View 1 2 3 1 chunk +12 lines, -0 lines 0 comments Download
A LayoutTests/fast/html/imports/import-script-prototypes-expected.txt View 1 2 3 4 5 1 chunk +17 lines, -0 lines 0 comments Download
A LayoutTests/fast/html/imports/resources/script-leaf.html View 1 chunk +10 lines, -0 lines 0 comments Download
A LayoutTests/fast/html/imports/resources/script-leaf-external.js View 1 chunk +1 line, -0 lines 0 comments Download
A LayoutTests/fast/html/imports/resources/script-leaf-external-async.js View 1 chunk +1 line, -0 lines 0 comments Download
A LayoutTests/fast/html/imports/resources/script-leaf-external-dynamic.js View 1 chunk +1 line, -0 lines 0 comments Download
A LayoutTests/fast/html/imports/resources/script-prototype-test.html View 1 2 3 1 chunk +31 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-domain.html View 1 2 3 1 chunk +20 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-domain-expected.txt View 1 2 3 1 chunk +10 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-domain-nested.html View 1 2 3 1 chunk +21 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-domain-nested-expected.txt View 1 2 3 1 chunk +10 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-nonce.html View 1 2 3 1 chunk +22 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-nonce-expected.txt View 1 2 3 1 chunk +12 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-nonce-nested.html View 1 2 3 1 chunk +22 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-nonce-nested-expected.txt View 1 2 3 1 chunk +12 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-self.html View 1 2 3 1 chunk +20 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-self-expected.txt View 1 2 3 1 chunk +10 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-self-nested.html View 1 2 3 1 chunk +20 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-self-nested-expected.txt View 1 2 3 1 chunk +10 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-unsafe-inline.html View 1 2 3 1 chunk +20 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-unsafe-inline-and-eval.html View 1 2 3 1 chunk +20 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-unsafe-inline-and-eval-expected.txt View 1 2 3 1 chunk +10 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-unsafe-inline-and-eval-nested.html View 1 2 3 1 chunk +20 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-unsafe-inline-and-eval-nested-expected.txt View 1 2 3 1 chunk +10 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-unsafe-inline-expected.txt View 1 2 3 1 chunk +10 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-unsafe-inline-nested.html View 1 2 3 1 chunk +20 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/csp-import-block-but-unsafe-inline-nested-expected.txt View 1 2 3 1 chunk +10 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/import-script-block-crossorigin-dynamic.html View 1 2 3 4 5 6 7 8 1 chunk +41 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/import-script-block-crossorigin-dynamic-expected.txt View 1 2 3 4 5 6 7 1 chunk +14 lines, -0 lines 0 comments Download
A + LayoutTests/http/tests/htmlimports/import-script-nosniff.html View 1 2 3 4 5 6 7 1 chunk +3 lines, -2 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/import-script-nosniff-expected.txt View 1 2 3 1 chunk +6 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/resources/child-having-domain-policy.html View 1 2 3 1 chunk +6 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/resources/child-having-nonce-policy.html View 1 2 3 1 chunk +6 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/resources/child-having-self-policy.html View 1 2 3 1 chunk +6 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/resources/child-having-unsafe-eval-policy.html View 1 2 3 1 chunk +6 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/resources/child-having-unsafe-inline-policy.html View 1 2 3 1 chunk +6 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/resources/cors-having-crossorigin-scripts.cgi View 1 2 3 4 5 6 7 1 chunk +26 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/resources/cors-js.cgi View 1 2 3 1 chunk +9 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/resources/cors-js-for-localhost.cgi View 1 2 3 4 5 6 7 1 chunk +9 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/resources/external-script.js View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/resources/external-script-with-nonce.js View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/resources/having-domain-policy.html View 1 2 3 1 chunk +13 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/resources/having-nonce-policy.html View 1 2 3 1 chunk +17 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/resources/having-self-policy.html View 1 2 3 1 chunk +13 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/resources/having-sniffing-script.html View 1 2 3 1 chunk +11 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/resources/having-unsafe-eval-policy.html View 1 2 3 1 chunk +13 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/resources/having-unsafe-inline-policy.html View 1 2 3 1 chunk +13 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/resources/run-check.js View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
A LayoutTests/http/tests/htmlimports/resources/sniff-js.cgi View 1 2 3 1 chunk +7 lines, -0 lines 0 comments Download
M Source/core/dom/DocumentInit.cpp View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/dom/ScriptLoader.h View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/dom/ScriptLoader.cpp View 1 2 3 4 5 6 7 10 chunks +41 lines, -27 lines 0 comments Download
M Source/core/html/HTMLImport.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/html/HTMLImportsController.cpp View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/parser/HTMLDocumentParser.cpp View 1 2 3 4 5 6 7 3 chunks +11 lines, -3 lines 0 comments Download
M Source/core/html/parser/HTMLResourcePreloader.cpp View 1 2 3 4 5 6 7 2 chunks +9 lines, -6 lines 0 comments Download
M Source/core/loader/cache/ResourceFetcher.cpp View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 17 (0 generated)
Hajime Morrita
Oops. I meant to have sent this yeasterday :-( Could you take a look?
7 years, 5 months ago (2013-07-19 00:23:22 UTC) #1
Hajime Morrita
Oops. I meant to have sent this yeasterday :-( Could you take a look?
7 years, 5 months ago (2013-07-19 00:23:22 UTC) #2
abarth-chromium
This is a scary change... I've noted several places where we should have more tests. ...
7 years, 5 months ago (2013-07-19 07:55:55 UTC) #3
abarth-chromium
I think we need a lot more tests for this CL. For example, we should ...
7 years, 5 months ago (2013-07-19 07:58:43 UTC) #4
Hajime Morrita
Thanks much for the thoughtful review, Adam! I should think more about CSP cases and ...
7 years, 5 months ago (2013-07-19 08:09:09 UTC) #5
dglazkov
Adam, do you think we should bring this up for discussion in public-webappsec? Or is ...
7 years, 5 months ago (2013-07-19 16:02:04 UTC) #6
abarth-chromium
On 2013/07/19 16:02:04, Dimitri Glazkov wrote: > Adam, do you think we should bring this ...
7 years, 5 months ago (2013-07-19 18:25:32 UTC) #7
dglazkov
On 2013/07/19 18:25:32, abarth wrote: > On 2013/07/19 16:02:04, Dimitri Glazkov wrote: > > Adam, ...
7 years, 5 months ago (2013-07-19 18:26:51 UTC) #8
Hajime Morrita
And I'm back! Adam, could you please take a look again? This one becomes much ...
7 years, 4 months ago (2013-07-26 09:42:24 UTC) #9
abarth-chromium
I'm sure there are going to be be issues with this code over time, but ...
7 years, 4 months ago (2013-07-26 17:17:34 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/morrita@chromium.org/19762002/33001
7 years, 4 months ago (2013-07-29 05:32:39 UTC) #11
Hajime Morrita
Adam, thanks for your LGTM! To address the feedback, I added a test for covering ...
7 years, 4 months ago (2013-07-29 05:38:13 UTC) #12
commit-bot: I haz the power
Retried try job too often on win_blink_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_blink_rel&number=387
7 years, 4 months ago (2013-07-29 07:44:59 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/morrita@chromium.org/19762002/33001
7 years, 4 months ago (2013-07-30 01:10:03 UTC) #14
commit-bot: I haz the power
Failed to trigger a try job on win_blink_rel HTTP Error 400: Bad Request
7 years, 4 months ago (2013-07-30 06:34:17 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/morrita@chromium.org/19762002/53001
7 years, 4 months ago (2013-07-30 06:34:26 UTC) #16
commit-bot: I haz the power
7 years, 4 months ago (2013-07-30 08:54:25 UTC) #17
Message was sent while issue was closed.
Change committed as 155149

Powered by Google App Engine
This is Rietveld 408576698