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

Unified Diff: third_party/WebKit/Source/core/frame/LocalFrame.cpp

Issue 1444183003: Cancel javascript: URL navigations if the frame was navigated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More comments Created 5 years, 1 month 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/frame/LocalFrame.cpp
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
index 16bb9bbbca38286bc035ee4e0b8247c36dd9b10b..455246e40e18ec3bbc57456cb5c97b84a929fba1 100644
--- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp
+++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -257,6 +257,8 @@ void LocalFrame::navigate(Document& originDocument, const KURL& url, bool replac
void LocalFrame::navigate(const FrameLoadRequest& request)
{
+ if (!isNavigationAllowed())
+ return;
m_loader.load(request);
}
@@ -878,6 +880,7 @@ inline LocalFrame::LocalFrame(FrameLoaderClient* client, FrameHost* host, FrameO
, m_eventHandler(adoptPtrWillBeNoop(new EventHandler(this)))
, m_console(FrameConsole::create(*this))
, m_inputMethodController(InputMethodController::create(*this))
+ , m_navigationDisableCount(0)
, m_pageZoomFactor(parentPageZoomFactor(this))
, m_textZoomFactor(parentTextZoomFactor(this))
, m_inViewSourceMode(false)
@@ -909,4 +912,15 @@ void LocalFrame::updateFrameSecurityOrigin()
DEFINE_WEAK_IDENTIFIER_MAP(LocalFrame);
+FrameNavigationDisabler::FrameNavigationDisabler(LocalFrame& frame)
+ : m_frame(&frame)
+{
+ m_frame->disableNavigation();
+}
+
+FrameNavigationDisabler::~FrameNavigationDisabler()
+{
+ m_frame->enableNavigation();
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.h ('k') | third_party/WebKit/Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698