| 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 7fccf4bb176bb95e82ed23de68978db6595626f3..9fbdae7cff358fcab7f2f66bd4f841c713969196 100644
|
| --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
|
| +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
|
| @@ -107,9 +107,11 @@ bool isConnectionEffectively2G(WebEffectiveConnectionType effectiveType) {
|
| return false;
|
| }
|
|
|
| -bool shouldDisallowFetchForMainFrameScript(const ResourceRequest& request,
|
| - FetchRequest::DeferOption defer,
|
| - Document& document) {
|
| +bool shouldDisallowFetchForMainFrameScript(
|
| + const ResourceRequest& request,
|
| + FetchRequest::DeferOption defer,
|
| + Document& document,
|
| + std::pair<AtomicString, AtomicString>& customHeader) {
|
| // Only scripts inserted via document.write are candidates for having their
|
| // fetch disallowed.
|
| if (!document.isInDocumentWrite())
|
| @@ -151,6 +153,10 @@ bool shouldDisallowFetchForMainFrameScript(const ResourceRequest& request,
|
| return false;
|
|
|
| emitWarningForDocWriteScripts(request.url().getString(), document);
|
| + customHeader.first = "Intervention";
|
| + customHeader.second =
|
| + "<https://www.chromestatus.com/feature/5718547946799104>; "
|
| + "level=\"warning\"";
|
|
|
| // 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
|
| @@ -297,7 +303,8 @@ static WebCachePolicy memoryCachePolicyToResourceRequestCachePolicy(
|
| WebCachePolicy FrameFetchContext::resourceRequestCachePolicy(
|
| const ResourceRequest& request,
|
| Resource::Type type,
|
| - FetchRequest::DeferOption defer) const {
|
| + FetchRequest::DeferOption defer,
|
| + std::pair<AtomicString, AtomicString>& customHeader) const {
|
| DCHECK(frame());
|
| if (type == Resource::MainResource) {
|
| FrameLoadType frameLoadType = frame()->loader().loadType();
|
| @@ -330,7 +337,8 @@ WebCachePolicy FrameFetchContext::resourceRequestCachePolicy(
|
| // the main frame on script loads inserted via document.write, since it can
|
| // add significant delays before page content is displayed on the screen.
|
| if (type == Resource::Script && isMainFrame() && m_document &&
|
| - shouldDisallowFetchForMainFrameScript(request, defer, *m_document))
|
| + shouldDisallowFetchForMainFrameScript(request, defer, *m_document,
|
| + customHeader))
|
| return WebCachePolicy::ReturnCacheDataDontLoad;
|
|
|
| if (request.isConditional())
|
|
|