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 27d945ba2eca6e0cfe8e6ccd10bfb288f1749d37..90c70752091b874fb4603c40663c661ad53aa06f 100644 |
| --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp |
| +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp |
| @@ -87,6 +87,17 @@ bool shouldDisallowFetchForMainFrameScript(const ResourceRequest& request, Fetch |
| if (!document.settings()) |
| return false; |
| + if (!document.frame()) |
| + return false; |
| + |
| + // 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. |
| + const FrameLoadType loadType = document.frame()->loader().loadType(); |
|
Bryan McQuade
2016/04/21 20:54:42
something to consider: do we only want to block on
shivanisha
2016/04/22 15:35:34
If the only purpose of disallowFetchForDocWrittenS
jkarlin
2016/04/22 15:44:47
Yes, we're likely to want to expand to other netwo
|
| + const bool isReload = (loadType == FrameLoadTypeReload || loadType == FrameLoadTypeReloadBypassingCache || loadType == FrameLoadTypeSame); |
| + if (isReload) |
| + return false; |
| + |
| const bool isSlowConnection = networkStateNotifier().connectionType() == WebConnectionTypeCellular2G; |
| const bool disallowFetch = document.settings()->disallowFetchForDocWrittenScriptsInMainFrame() || (document.settings()->disallowFetchForDocWrittenScriptsInMainFrameOnSlowConnections() && isSlowConnection); |
| if (!disallowFetch) |