| Index: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
|
| diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
|
| index f09d2ece98f445c40de0f3ebdabb3a5295bc29b7..b3bcee216e63ab69093a9f512e711f177b77d3b6 100644
|
| --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
|
| +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
|
| @@ -80,7 +80,14 @@ namespace blink {
|
|
|
| namespace {
|
|
|
| -bool shouldDisallowFetchForMainFrameScript(const ResourceRequest& request, FetchRequest::DeferOption defer, const Document& document)
|
| +void emitWarningForDocWriteScripts(const String& url, Document& document)
|
| +{
|
| + String message = "A Parser-blocking, cross-origin script, " + url + ", is invoked via document.write. This may be blocked by the browser if the device has poor network connectivity.";
|
| + document.addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, message));
|
| + WTFLogAlways("%s", message.utf8().data());
|
| +}
|
| +
|
| +bool shouldDisallowFetchForMainFrameScript(const ResourceRequest& request, FetchRequest::DeferOption defer, Document& document)
|
| {
|
| // Only scripts inserted via document.write are candidates for having their
|
| // fetch disallowed.
|
| @@ -106,6 +113,8 @@ bool shouldDisallowFetchForMainFrameScript(const ResourceRequest& request, Fetch
|
| if (request.url().host() == document.getSecurityOrigin()->domain())
|
| return false;
|
|
|
| + emitWarningForDocWriteScripts(request.url().getString(), document);
|
| +
|
| // Do not block scripts if it is a page reload. This is to enable pages to
|
| // recover if blocking of a script is leading to a page break and the user
|
| // reloads the page.
|
|
|