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

Issue 2724673002: [WIP] Introduce ScriptResourceData

Created:
3 years, 9 months ago by hiroshige
Modified:
3 years, 4 months ago
CC:
chromium-reviews, caseq+blink_chromium.org, blink-reviews-html_chromium.org, pfeldman+blink_chromium.org, sof, eae+blinkwatch, loading-reviews+parser_chromium.org, lushnikov+blink_chromium.org, blink-reviews-dom_chromium.org, dglazkov+blink, dominicc+watchlist_chromium.org, blink-reviews-bindings_chromium.org, devtools-reviews_chromium.org, blink-reviews, apavlov+blink_chromium.org, kinuko+watch, kozyatinskiy+blink_chromium.org, rwlbuis
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Introduce ScriptResourceData Previously, ClassicPendingScript::GetSource(), ScriptSourceCode, and related methods refer ScriptResource directly when e.g. getting the script source text on execution. However, ScriptResource::GetStatus(), SourceText() etc. can be reset if revalidation occurs, causing DCHECK() failures and potentially script execution failure. This CL introduces ScriptResourceData, the abstraction of everything accessed on or after NotifyFinished(), i.e. a kind of "result of script loading". A user of ScriptResource gets a reference to ScriptResourceData on NotifyFinished(), saves the reference and accesses ScriptResourceData instead of ScriptResource after NotifyFinished(). The reference to ScriptResourceData is not reset due to revalidation and thus always available on or after NotifyFinished(). This CL also adds unit tests of ClassicPendingScript that asserts ClassicPendingScript::GetSource() always returns the source text of the original response, regardless of revalidation. BUG=692856, 694702

Patch Set 1 #

Patch Set 2 : Rebase #

Patch Set 3 : fix test #

Patch Set 4 : fix #

Patch Set 5 : Split to ScriptResourceData.h #

Patch Set 6 : bug fix #

Patch Set 7 : Add unit tests #

Patch Set 8 : rebase #

Patch Set 9 : Add missing file #

Patch Set 10 : Remove PassesAccessControlCheck #

Patch Set 11 : Rebase #

Patch Set 12 : refine #

Patch Set 13 : Fix #

Total comments: 6

Patch Set 14 : Compile fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+416 lines, -70 lines) Patch
M third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/ScriptSourceCode.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/ScriptSourceCode.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +4 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/V8ScriptRunnerTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +11 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ClassicPendingScript.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +9 lines, -2 lines 0 comments Download
A third_party/WebKit/Source/core/dom/ClassicPendingScriptTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +228 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ClassicScript.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +6 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/loader/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/loader/WorkletScriptLoader.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/loader/modulescript/ModuleScriptFetcher.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +4 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/loader/resource/ScriptResource.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +9 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/core/loader/resource/ScriptResource.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +16 lines, -26 lines 0 comments Download
A third_party/WebKit/Source/core/loader/resource/ScriptResourceData.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +71 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/loader/resource/ScriptResourceData.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +34 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/mojo/tests/JsToCppTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +2 lines, -2 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 35 (28 generated)
hiroshige
PTAL
3 years, 7 months ago (2017-05-15 20:18:28 UTC) #28
kouhei (in TOK)
lgtm % class comment https://codereview.chromium.org/2724673002/diff/240001/third_party/WebKit/Source/core/loader/resource/ScriptResourceData.h File third_party/WebKit/Source/core/loader/resource/ScriptResourceData.h (right): https://codereview.chromium.org/2724673002/diff/240001/third_party/WebKit/Source/core/loader/resource/ScriptResourceData.h#newcode19 third_party/WebKit/Source/core/loader/resource/ScriptResourceData.h:19: class CORE_EXPORT ScriptResourceData final Please ...
3 years, 7 months ago (2017-05-15 20:56:32 UTC) #29
kouhei (in TOK)
lgtm % class comment https://codereview.chromium.org/2724673002/diff/240001/third_party/WebKit/Source/core/loader/resource/ScriptResourceData.h File third_party/WebKit/Source/core/loader/resource/ScriptResourceData.h (right): https://codereview.chromium.org/2724673002/diff/240001/third_party/WebKit/Source/core/loader/resource/ScriptResourceData.h#newcode19 third_party/WebKit/Source/core/loader/resource/ScriptResourceData.h:19: class CORE_EXPORT ScriptResourceData final Please ...
3 years, 7 months ago (2017-05-15 20:56:32 UTC) #30
hiroshige
Two issues (offline discussion w/ kouhei@): 1. ResourceResponse is copied from Resource to ScriptResourceData. Doesn't ...
3 years, 7 months ago (2017-05-15 23:53:37 UTC) #32
kinuko
Works for me / looking reasonable. For perf issue we might want to land to ...
3 years, 7 months ago (2017-05-18 05:43:30 UTC) #33
yhirano
Sorry, I didn't notice this was ready for review. Please remove "WIP" from the issue ...
3 years, 6 months ago (2017-05-29 09:05:52 UTC) #34
kouhei (in TOK)
3 years, 6 months ago (2017-05-29 09:11:54 UTC) #35
I think the CL is looking good enough to proceed w/ TODO(hiroshige) comments for
the caveats (e.g. CachedMetadataHandler)

On 2017/05/29 09:05:52, yhirano wrote:
> Sorry, I didn't notice this was ready for review. Please remove "WIP" from the
> issue title. 
> 
> Would it be better to make the getter available only during CheckNotify? I
think
> the data is conceptually a parameter of NotifyFinished.

+1

Powered by Google App Engine
This is Rietveld 408576698