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

Issue 2657623005: WIP: Give developers an opt-in mechanism to block some parser-inserted scripts.

Created:
3 years, 10 months ago by Mike West
Modified:
3 years, 10 months ago
CC:
blink-reviews, chromium-reviews, lwe, mikispag
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

WIP: Give developers an opt-in mechanism to block some parser-inserted scripts. These should be straightforward: - document.write('<script>'); - document.writeln('<script>'); Cascading through (multiply-)nested frames like these will be less so: - document.write('<iframe srcdoc="<script>">'); - document.writeln('<iframe srcdoc="<script>">'); - element.{inner,outer}HTML = '<iframe srcdoc="<script>">'; - element.insertAdjacentHTML('<iframe srcdoc="<script>">'); BUG=684435

Patch Set 1 #

Patch Set 2 : Kinda ugly hack for doc.write and srcdoc. #

Patch Set 3 : more hacks: innerHTML. #

Patch Set 4 : yay #

Patch Set 5 : Rebase/factor. #

Patch Set 6 : Refactor. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+297 lines, -15 lines) Patch
A third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/parserInserted/document-write.html View 1 1 chunk +85 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/parserInserted/document-write-srcdoc.html View 1 2 1 chunk +49 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/parserInserted/innerHTML.html View 1 2 1 chunk +22 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/parserInserted/innerHTML-srcdoc.html View 1 2 1 chunk +53 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Document.h View 1 2 3 4 5 3 chunks +16 lines, -4 lines 1 comment Download
M third_party/WebKit/Source/core/dom/Document.cpp View 1 2 3 4 5 2 chunks +9 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h View 2 chunks +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp View 1 2 3 4 3 chunks +24 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/frame/csp/SourceListDirective.h View 3 chunks +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/frame/csp/SourceListDirective.cpp View 1 3 chunks +15 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/frame/csp/SourceListDirectiveTest.cpp View 1 chunk +16 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLIFrameElement.h View 1 2 3 4 2 chunks +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 40 (27 generated)
Mike West
aaj@: This takes care of `document.write`, but not any variant of iframe. For iframes, I ...
3 years, 10 months ago (2017-01-25 20:15:33 UTC) #5
Mike West
And now it deals with `document.write('<iframe srcdoc>');` and nested variants thereof. It's a bit hacky; ...
3 years, 10 months ago (2017-01-26 12:57:55 UTC) #8
Mike West
And now it deals with innerHTML with super-ugly hacks. Hooray for prototypes. aaj@, mikispag@, lwe@: ...
3 years, 10 months ago (2017-01-26 15:15:01 UTC) #13
aaj
On 2017/01/26 15:15:01, Mike West (sloooooow) wrote: > And now it deals with innerHTML with ...
3 years, 10 months ago (2017-01-26 21:45:36 UTC) #16
blink-reviews
Sure, I can write Web Platform Tests on monday. Is 'disallow-all-the-parser-inserted-scripts-ever-except-for-the-ones-we-like' in Web Platform Tests ...
3 years, 10 months ago (2017-01-27 11:18:37 UTC) #19
chromium-reviews
Sure, I can write Web Platform Tests on monday. Is 'disallow-all-the-parser-inserted-scripts-ever-except-for-the-ones-we-like' in Web Platform Tests ...
3 years, 10 months ago (2017-01-27 11:18:37 UTC) #20
blink-reviews
I don't think we should contribute tests to WPT before we've defined what we actually ...
3 years, 10 months ago (2017-01-27 12:56:47 UTC) #21
chromium-reviews
I don't think we should contribute tests to WPT before we've defined what we actually ...
3 years, 10 months ago (2017-01-27 12:56:47 UTC) #22
Mike West
Rebasing this on top of things. Smaller now, maybe even cleaner.
3 years, 10 months ago (2017-01-27 14:33:24 UTC) #27
Mike West
Ok. I think inline script is ~done. Will work on external script at some point... ...
3 years, 10 months ago (2017-01-27 14:48:21 UTC) #31
jochen (gone - plz use gerrit)
direction looks reasonable https://codereview.chromium.org/2657623005/diff/100001/third_party/WebKit/Source/core/dom/Document.h File third_party/WebKit/Source/core/dom/Document.h (right): https://codereview.chromium.org/2657623005/diff/100001/third_party/WebKit/Source/core/dom/Document.h#newcode227 third_party/WebKit/Source/core/dom/Document.h:227: enum SrcdocType { nit. enum class. ...
3 years, 10 months ago (2017-01-27 15:14:19 UTC) #32
blink-reviews
I think we are missing link[rel=import] and outerHTML/insertAdjacentHTML variants.Shall I prepare a new change? On ...
3 years, 10 months ago (2017-01-30 10:34:56 UTC) #35
chromium-reviews
3 years, 10 months ago (2017-01-30 10:34:56 UTC) #36
I think we are missing link[rel=import] and outerHTML/insertAdjacentHTML
variants.Shall I prepare a new change?

On Fri, Jan 27, 2017 at 4:14 PM <jochen@chromium.org> wrote:

direction looks reasonable


https://codereview.chromium.org/2657623005/diff/100001/third_party/WebKit/Sou...
File third_party/WebKit/Source/core/dom/Document.h (right):

https://codereview.chromium.org/2657623005/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/core/dom/Document.h:227: enum SrcdocType {
nit. enum class. enum constants should start with k

https://codereview.chromium.org/2657623005/

-- 
You received this message because you are subscribed to the Google Groups
"Chromium-reviews" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698