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

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

Issue 2487403002: Allow navigations to frames that aren't being unloaded in the unload handler. (Closed)
Patch Set: early return on back/forward navigations Created 3 years, 11 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/FrameLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
index e330262b19fb0eb8426a68b995ee40a55ccb690f..7d197e71ffa81e5d2db1a4f695de9c2f29d0d9b1 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -288,7 +288,7 @@ void FrameLoader::saveScrollState() {
}
void FrameLoader::dispatchUnloadEvent() {
- NavigationDisablerForUnload navigationDisabler;
+ FrameNavigationDisabler navigationDisabler(*m_frame);
// If the frame is unloading, the provisional loader should no longer be
// protected. It will be detached soon.
@@ -1093,7 +1093,7 @@ void FrameLoader::load(const FrameLoadRequest& passedRequest,
HistoryLoadType historyLoadType) {
DCHECK(m_frame->document());
- if (!m_frame->isNavigationAllowed())
+ if (isBackForwardLoadType(frameLoadType) && !m_frame->isNavigationAllowed())
return;
if (m_inStopAllLoaders)
@@ -1124,6 +1124,12 @@ void FrameLoader::load(const FrameLoadRequest& passedRequest,
? nullptr
: m_frame->findFrameForNavigation(
AtomicString(request.frameName()), *m_frame);
+
+ if (targetFrame && targetFrame->isLocalFrame() &&
+ !toLocalFrame(targetFrame)->isNavigationAllowed()) {
dcheng 2017/01/04 23:12:02 We use targetFrame->navigate(), which (for local f
lfg 2017/01/09 19:04:12 targetFrame->navigate() just calls FrameLoader::lo
dcheng 2017/01/09 19:17:30 OK, this check should be in the block at 1133 - 11
lfg 2017/01/09 21:18:22 Yes, that should be correct. Done.
+ return;
+ }
+
NavigationPolicy policy = navigationPolicyForRequest(request);
if (targetFrame && targetFrame != m_frame &&
shouldNavigateTargetFrame(policy)) {
@@ -1150,6 +1156,8 @@ void FrameLoader::load(const FrameLoadRequest& passedRequest,
return;
}
+ CHECK(m_frame->isNavigationAllowed());
dcheng 2017/01/04 23:12:02 I would be more comfortable with this being an ear
lfg 2017/01/09 19:04:12 I've agree with that, but I still think that going
+
const KURL& url = request.resourceRequest().url();
FrameLoadType newLoadType = (frameLoadType == FrameLoadTypeStandard)
? determineFrameLoadType(request)
@@ -1558,7 +1566,7 @@ bool FrameLoader::shouldClose(bool isReload) {
bool shouldClose = false;
{
- NavigationDisablerForUnload navigationDisabler;
+ NavigationDisablerForBeforeUnload navigationDisabler;
size_t i;
bool didAllowNavigation = false;

Powered by Google App Engine
This is Rietveld 408576698