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 f040553594f41cd97ae0e4d1ae27be96348e4b53..4923f218eccb92c32d0395a2b39512febfb7addb 100644 |
--- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp |
+++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp |
@@ -56,6 +56,7 @@ |
#include "core/loader/PingLoader.h" |
#include "core/loader/ProgressTracker.h" |
#include "core/loader/appcache/ApplicationCacheHost.h" |
+#include "core/page/NetworkStateNotifier.h" |
#include "core/page/Page.h" |
#include "core/svg/graphics/SVGImageChromeClient.h" |
#include "core/timing/DOMWindowPerformance.h" |
@@ -173,7 +174,7 @@ static ResourceRequestCachePolicy memoryCachePolicyToResourceRequestCachePolicy( |
return UseProtocolCachePolicy; |
} |
-ResourceRequestCachePolicy FrameFetchContext::resourceRequestCachePolicy(const ResourceRequest& request, Resource::Type type) const |
+ResourceRequestCachePolicy FrameFetchContext::resourceRequestCachePolicy(const ResourceRequest& request, Resource::Type type, FetchRequest::DeferOption defer) const |
{ |
ASSERT(frame()); |
if (type == Resource::MainResource) { |
@@ -208,10 +209,15 @@ ResourceRequestCachePolicy FrameFetchContext::resourceRequestCachePolicy(const R |
// future, we'll extend this logic to only block if estimated network RTT |
// is above some threshold. |
if (type == Resource::Script && isMainFrame()) { |
- const bool isInDocumentWrite = m_document && m_document->isInDocumentWrite(); |
const bool disallowFetchForDocWriteScripts = frame()->settings() && frame()->settings()->disallowFetchForDocWrittenScriptsInMainFrame(); |
- if (isInDocumentWrite && disallowFetchForDocWriteScripts) |
- return ReturnCacheDataDontLoad; |
+ const bool isInDocumentWrite = m_document && m_document->isInDocumentWrite(); |
+ if (isInDocumentWrite && disallowFetchForDocWriteScripts) { |
+ const bool isSync = (defer == FetchRequest::NoDefer); |
+ const bool isThirdParty = (request.url().host() != m_document->getSecurityOrigin()->domain()); |
Bryan McQuade
2016/04/05 12:46:11
let's add a comment here noting that we continue t
|
+ const bool isSlowConnection = networkStateNotifier().connectionType() == WebConnectionTypeCellular2G; |
Bryan McQuade
2016/04/05 12:46:11
Let's add a comment that for now we restrict slow
|
+ if (isSync && isThirdParty && isSlowConnection) |
+ return ReturnCacheDataDontLoad; |
+ } |
} |
if (request.isConditional()) |