Chromium Code Reviews| 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 1d8a489187bf24ba71847999558509e59898b068..f9e4e249a1deea948600756df3064258c112f77a 100644 |
| --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp |
| +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp |
| @@ -146,10 +146,11 @@ bool shouldDisallowFetchForMainFrameScript(const ResourceRequest& request, Fetch |
| // the flag will be conveyed to the browser process only once. |
| document.loader()->didObserveLoadingBehavior(WebLoadingBehaviorFlag::WebLoadingBehaviorDocumentWriteBlock); |
| - const bool isSlowConnection = networkStateNotifier().connectionType() == WebConnectionTypeCellular2G; |
| - const bool disallowFetch = document.settings()->disallowFetchForDocWrittenScriptsInMainFrame() || (document.settings()->disallowFetchForDocWrittenScriptsInMainFrameOnSlowConnections() && isSlowConnection); |
| + const bool is2G = networkStateNotifier().connectionType() == WebConnectionTypeCellular2G; |
| + WebEffectiveConnectionType effectiveConnection = document.frame()->loader().client()->getEffectiveConnectionType(); |
| + const bool is2GOrLike2G = is2G || effectiveConnection == WebEffectiveConnectionType::Type2G || effectiveConnection == WebEffectiveConnectionType::TypeSlow2G; |
|
Yoav Weiss
2016/09/04 05:11:43
Would it have been better to change the WebEffecti
jkarlin
2016/09/06 11:58:45
I don't think a strict ordering on the enum makes
|
| - return disallowFetch; |
| + return document.settings()->disallowFetchForDocWrittenScriptsInMainFrame() || (document.settings()->disallowFetchForDocWrittenScriptsInMainFrameOnSlowConnections() && is2G) || (RuntimeEnabledFeatures::blockDocWriteIfEffectively2GEnabled() && is2GOrLike2G); |
| } |
| } // namespace |