Reviewers: Charlie Harrison, Nate Chapin
CL:
https://codereview.chromium.org/2260303002/Description:
Sending an async GET request for doc.written blocked scripts.
BUG=639401
While fetching the original request, ScriptLoader sets
m_disallowedFetchForDocWrittenScript.
On receiving notifyFinished for the original request, HTMLScriptRunner creates a
new
ScriptLoader instance using the original Element with
m_blockedDocWriteScriptAsyncFetch set to true. It then calls
ScriptLoader::prepareScript which further calls fetchScript.
prepareScript sets the defer flag as LazyLoad and fetchScript sets the
intervention info and header in the resource request. The intervention info is
used to set the priority in ResourceFetcher::requestResource.
This CL also adds a link in the dev tools console warning.
The code was tested using netlog to verify the second request is sent and has
the correct priority (net::IDLE).
One of the example sites created by jkarlin@ is:
http://www.karlin.me/test/docwrite/The rest of this intervention has been tested with layout tests. I did not find
a way to test this part, with layout tests. If you have thoughts on how to add
tests for this change, please let me know.
Base URL:
https://chromium.googlesource.com/chromium/src.git@masterAffected files (+133, -31 lines):
M third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block-all-conn-types-expected.txt
M third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block-expected.txt
M third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-conn-type-expected.txt
M third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-reload-expected.txt
M third_party/WebKit/Source/core/dom/ScriptLoader.h
M third_party/WebKit/Source/core/dom/ScriptLoader.cpp
M third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp
M third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
M third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp
M third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
M third_party/WebKit/Source/platform/network/ResourceRequest.h
M third_party/WebKit/Source/platform/network/ResourceRequest.cpp