Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp

Issue 1883873002: Do not block document.written scripts in page reloads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: corrected if condition Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..9c2f67180b0ba0d063e4428e53b9a2346f2791d5 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();
+ const bool isReload = (loadType == FrameLoadTypeReload || loadType == FrameLoadTypeReloadBypassingCache);
jkarlin 2016/04/13 18:38:36 re FrameLoadTypeSame: So the user essentially goes
shivanisha 2016/04/14 17:59:56 Sounds good to me. Yes, if user goes to the naviga
+ if (isReload)
+ return false;
+
const bool isSlowConnection = networkStateNotifier().connectionType() == WebConnectionTypeCellular2G;
const bool disallowFetch = document.settings()->disallowFetchForDocWrittenScriptsInMainFrame() || (document.settings()->disallowFetchForDocWrittenScriptsInMainFrameOnSlowConnections() && isSlowConnection);
if (!disallowFetch)

Powered by Google App Engine
This is Rietveld 408576698