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

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

Issue 2206843003: Disable navigations in the unload handler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: testharness.js Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/Source/core/loader/NavigationScheduler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
diff --git a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
index 52d1db4806643ad54bad11fe12dc1a5c583a2511..caadc1d5043c2f8fe07b0fff9c2b66f03b6c7b7f 100644
--- a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
+++ b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
@@ -96,8 +96,7 @@ void maybeLogScheduledNavigationClobber(ScheduledNavigationType type, LocalFrame
} // namespace
-unsigned NavigationDisablerForBeforeUnload::s_navigationDisableCount = 0;
-unsigned NavigationCounterForUnload::s_inUnloadHandler = 0;
+unsigned NavigationDisablerForUnload::s_navigationDisableCount = 0;
class ScheduledNavigation : public GarbageCollectedFinalized<ScheduledNavigation> {
WTF_MAKE_NONCOPYABLE(ScheduledNavigation);
@@ -327,10 +326,12 @@ bool NavigationScheduler::isNavigationScheduledWithin(double interval) const
// TODO(dcheng): There are really two different load blocking concepts at work
// here and they have been incorrectly tangled together.
//
-// 1. NavigationDisablerForBeforeUnload is for blocking navigation scheduling
-// during a beforeunload event. Scheduled navigations during beforeunload
-// would make it possible to get trapped in an endless loop of beforeunload
-// dialogs.
+// 1. NavigationDisablerForUnload is for blocking navigation scheduling during
+// a beforeunload or unload events. Scheduled navigations during
+// beforeunload would make it possible to get trapped in an endless loop of
+// beforeunload dialogs. Scheduled navigations during the unload handler
+// makes is possible to cancel a navigation that was initiated right before
+// it commits.
//
// Checking Frame::isNavigationAllowed() doesn't make sense in this context:
// NavigationScheduler is always cleared when a new load commits, so it's
@@ -343,12 +344,12 @@ bool NavigationScheduler::isNavigationScheduledWithin(double interval) const
// to block /synchronous/ navigations during things lke Document::detachLayoutTree().
inline bool NavigationScheduler::shouldScheduleReload() const
{
- return m_frame->page() && m_frame->isNavigationAllowed() && NavigationDisablerForBeforeUnload::isNavigationAllowed();
+ return m_frame->page() && m_frame->isNavigationAllowed() && NavigationDisablerForUnload::isNavigationAllowed();
}
inline bool NavigationScheduler::shouldScheduleNavigation(const String& url) const
{
- return m_frame->page() && m_frame->isNavigationAllowed() && (protocolIsJavaScript(url) || NavigationDisablerForBeforeUnload::isNavigationAllowed());
+ return m_frame->page() && m_frame->isNavigationAllowed() && (protocolIsJavaScript(url) || NavigationDisablerForUnload::isNavigationAllowed());
}
void NavigationScheduler::scheduleRedirect(double delay, const String& url)
@@ -393,8 +394,6 @@ void NavigationScheduler::scheduleLocationChange(Document* originDocument, const
if (originDocument->getSecurityOrigin()->canAccess(m_frame->document()->getSecurityOrigin())) {
KURL parsedURL(ParsedURLString, url);
if (parsedURL.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(m_frame->document()->url(), parsedURL)) {
- if (NavigationCounterForUnload::inUnloadHandler())
- Deprecation::countDeprecation(m_frame, UseCounter::UnloadHandler_Navigation);
FrameLoadRequest request(originDocument, m_frame->document()->completeURL(url), "_self");
request.setReplacesCurrentItem(replacesCurrentItem);
« no previous file with comments | « third_party/WebKit/Source/core/loader/NavigationScheduler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698