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

Issue 2242223003: Preload tokens even if a <meta> csp tag is found (Closed)

Created:
4 years, 4 months ago by Charlie Harrison
Modified:
4 years, 3 months ago
CC:
blink-reviews, blink-reviews-html_chromium.org, chromium-reviews, dglazkov+blink, kinuko+watch, loading-reviews+parser_chromium.org, Yoav Weiss
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Preload tokens even if a <meta> csp tag is found This patch adds logic to the preload scanner to keep track of csp declarations in the markup and sends that data to the main thread in a TokenizedChunk. The main thread will defer preload fetches if any chunk indicates that it contains a <meta> csp tag, until that tag is parsed and applied. The current code simply stops preload scanning if this markup if ever found. This patch also refactors some logic in HTMLDocumentParser now that we have two conditions in which preloads can be deferred (previously we only deferred preloads while waiting for AppCache to be initialized). BUG=434230 Committed: https://crrev.com/6873913202e7304e4eb1da070554dba88236a71a Cr-Commit-Position: refs/heads/master@{#413748}

Patch Set 1 #

Patch Set 2 : less refactoring #

Total comments: 11

Patch Set 3 : Added another layout test. Use index into |tokens| in TokenizedChunk #

Total comments: 6

Patch Set 4 : use -1 instead of WTF::Optional #

Total comments: 4

Patch Set 5 : kouhei review #

Patch Set 6 : Fix up layout test #

Total comments: 1

Messages

Total messages: 51 (28 generated)
Charlie Harrison
kouhei, mkwst, wdyt? I believe the current PS is at least as safe as the ...
4 years, 4 months ago (2016-08-16 04:06:44 UTC) #4
Charlie Harrison
Moving yoav to review since kouhei is OOO.
4 years, 4 months ago (2016-08-16 04:17:10 UTC) #8
kouhei (in TOK)
https://codereview.chromium.org/2242223003/diff/20001/third_party/WebKit/LayoutTests/http/tests/preload/meta-csp.html File third_party/WebKit/LayoutTests/http/tests/preload/meta-csp.html (right): https://codereview.chromium.org/2242223003/diff/20001/third_party/WebKit/LayoutTests/http/tests/preload/meta-csp.html#newcode17 third_party/WebKit/LayoutTests/http/tests/preload/meta-csp.html:17: assert_greater_than(boundedStart, r.startTime); Should we use internals.isPreloaded? https://codereview.chromium.org/2242223003/diff/20001/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h File third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h ...
4 years, 4 months ago (2016-08-19 04:56:15 UTC) #12
Mike West
https://codereview.chromium.org/2242223003/diff/20001/third_party/WebKit/LayoutTests/http/tests/preload/meta-csp.html File third_party/WebKit/LayoutTests/http/tests/preload/meta-csp.html (right): https://codereview.chromium.org/2242223003/diff/20001/third_party/WebKit/LayoutTests/http/tests/preload/meta-csp.html#newcode2 third_party/WebKit/LayoutTests/http/tests/preload/meta-csp.html:2: <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'; font-src 'none'"> Can you ...
4 years, 4 months ago (2016-08-19 09:25:41 UTC) #13
Mike West
The concept LGTM, but I'll defer to yoav@ and kouhei@ on the details of the ...
4 years, 4 months ago (2016-08-19 09:26:14 UTC) #14
Charlie Harrison
https://codereview.chromium.org/2242223003/diff/20001/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h File third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h (right): https://codereview.chromium.org/2242223003/diff/20001/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h#newcode118 third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h:118: CompactHTMLToken* pendingCSPMetaTag; On 2016/08/19 04:56:15, kouhei wrote: > Let's ...
4 years, 4 months ago (2016-08-19 12:33:33 UTC) #15
Charlie Harrison
Thanks for the reviews. The current PS uses indices in the BackgroundHTMLParser but converts them ...
4 years, 4 months ago (2016-08-19 15:13:40 UTC) #18
kouhei (in TOK)
https://codereview.chromium.org/2242223003/diff/20001/third_party/WebKit/LayoutTests/http/tests/preload/meta-csp.html File third_party/WebKit/LayoutTests/http/tests/preload/meta-csp.html (right): https://codereview.chromium.org/2242223003/diff/20001/third_party/WebKit/LayoutTests/http/tests/preload/meta-csp.html#newcode17 third_party/WebKit/LayoutTests/http/tests/preload/meta-csp.html:17: assert_greater_than(boundedStart, r.startTime); On 2016/08/19 15:13:40, Charlie Harrison wrote: > ...
4 years, 4 months ago (2016-08-22 05:34:03 UTC) #25
Charlie Harrison
Thanks! https://codereview.chromium.org/2242223003/diff/20001/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h File third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h (right): https://codereview.chromium.org/2242223003/diff/20001/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h#newcode118 third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h:118: CompactHTMLToken* pendingCSPMetaTag; On 2016/08/22 05:34:03, kouhei wrote: > ...
4 years, 4 months ago (2016-08-22 14:08:05 UTC) #26
kouhei (in TOK)
lgtm % static constexpr https://codereview.chromium.org/2242223003/diff/20001/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h File third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h (right): https://codereview.chromium.org/2242223003/diff/20001/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h#newcode118 third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h:118: CompactHTMLToken* pendingCSPMetaTag; On 2016/08/22 14:08:05, ...
4 years, 4 months ago (2016-08-23 02:18:39 UTC) #27
Charlie Harrison
Thanks! Can you let me know if you mind adding the noPendingToken int on TokenizedChunk? ...
4 years, 4 months ago (2016-08-23 03:08:41 UTC) #28
kouhei (in TOK)
lgtm cq
4 years, 4 months ago (2016-08-23 04:31:16 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2242223003/80001
4 years, 4 months ago (2016-08-23 04:31:55 UTC) #32
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/284597)
4 years, 4 months ago (2016-08-23 05:49:56 UTC) #34
Charlie Harrison
Looks like there's one layout tests that assumes we won't be preloading. Updated it.
4 years, 4 months ago (2016-08-23 12:41:00 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2242223003/100001
4 years, 4 months ago (2016-08-23 12:41:37 UTC) #41
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_x64_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_rel_ng/builds/266759)
4 years, 4 months ago (2016-08-23 14:46:04 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2242223003/100001
4 years, 4 months ago (2016-08-23 15:02:25 UTC) #45
commit-bot: I haz the power
Committed patchset #6 (id:100001)
4 years, 4 months ago (2016-08-23 16:01:03 UTC) #46
commit-bot: I haz the power
Patchset 6 (id:??) landed as https://crrev.com/6873913202e7304e4eb1da070554dba88236a71a Cr-Commit-Position: refs/heads/master@{#413748}
4 years, 4 months ago (2016-08-23 16:02:30 UTC) #48
Yoav Weiss
Apologies for failing to review in time... I think the tests can be improved (One ...
4 years, 3 months ago (2016-09-02 10:23:53 UTC) #49
kouhei (in TOK)
On 2016/09/02 10:23:53, Yoav Weiss wrote: > Apologies for failing to review in time... I ...
4 years, 3 months ago (2016-09-02 10:25:38 UTC) #50
Charlie Harrison
4 years, 3 months ago (2016-09-02 12:41:47 UTC) #51
Message was sent while issue was closed.
Ideally I'd like to fix isPreloaded for this change, as the preloads are to be
sent out immediately after the csp is applied. This makes tests where preloads
come right after csp in the markup more easily understood, without going into
complications w/ scripts about where the parsed chunk stops/starts and whether
the preload is discovered by the time the csp is processed.

Powered by Google App Engine
This is Rietveld 408576698