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

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: 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
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..5e3705bedd145f622293f229c90b553ccef417af 100644
--- a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
+++ b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
@@ -97,7 +97,7 @@ void maybeLogScheduledNavigationClobber(ScheduledNavigationType type, LocalFrame
} // namespace
unsigned NavigationDisablerForBeforeUnload::s_navigationDisableCount = 0;
-unsigned NavigationCounterForUnload::s_inUnloadHandler = 0;
+unsigned NavigationDisablerForUnload::s_inUnloadHandler = 0;
class ScheduledNavigation : public GarbageCollectedFinalized<ScheduledNavigation> {
WTF_MAKE_NONCOPYABLE(ScheduledNavigation);
@@ -343,12 +343,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() && NavigationDisablerForBeforeUnload::isNavigationAllowed() && !NavigationDisablerForUnload::inUnloadHandler();
}
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) || NavigationDisablerForBeforeUnload::isNavigationAllowed()) && !NavigationDisablerForUnload::inUnloadHandler();
}
void NavigationScheduler::scheduleRedirect(double delay, const String& url)
@@ -393,8 +393,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);

Powered by Google App Engine
This is Rietveld 408576698