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

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

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.h
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.h b/third_party/WebKit/Source/core/frame/LocalFrame.h
index be53fd431366d5cd10dc6c713d2baddf9155587e..03af3b9113454b72855eedf6cda93993578d4f34 100644
--- a/third_party/WebKit/Source/core/frame/LocalFrame.h
+++ b/third_party/WebKit/Source/core/frame/LocalFrame.h
@@ -184,13 +184,15 @@ public:
bool shouldThrottleRendering() const;
- // ========
-
// Returns the frame scheduler, creating one if needed.
WebFrameScheduler* frameScheduler();
void updateFrameSecurityOrigin();
+ bool isNavigationAllowed() const { return m_navigationDisableCount == 0; }
+
private:
+ friend class FrameNavigationDisabler;
+
LocalFrame(FrameLoaderClient*, FrameHost*, FrameOwner*);
// Internal Frame helper overrides:
@@ -204,6 +206,9 @@ private:
RespectImageOrientationEnum shouldRespectImageOrientation, const GlobalPaintFlags,
IntRect paintingRect, float opacity = 1);
+ void enableNavigation() { --m_navigationDisableCount; }
+ void disableNavigation() { ++m_navigationDisableCount; }
+
mutable FrameLoader m_loader;
OwnPtrWillBeMember<NavigationScheduler> m_navigationScheduler;
@@ -221,6 +226,8 @@ private:
const OwnPtrWillBeMember<InputMethodController> m_inputMethodController;
OwnPtr<WebFrameScheduler> m_frameScheduler;
+ int m_navigationDisableCount;
+
#if ENABLE(OILPAN)
// Oilpan: in order to reliably finalize plugin elements with
// renderer-less plugins, the frame keeps track of them. When
@@ -327,6 +334,17 @@ DEFINE_TYPE_CASTS(LocalFrame, Frame, localFrame, localFrame->isLocalFrame(), loc
DECLARE_WEAK_IDENTIFIER_MAP(LocalFrame);
+class FrameNavigationDisabler {
+ WTF_MAKE_NONCOPYABLE(FrameNavigationDisabler);
+ STACK_ALLOCATED();
+public:
+ explicit FrameNavigationDisabler(LocalFrame&);
+ ~FrameNavigationDisabler();
+
+private:
+ RawPtrWillBeMember<LocalFrame> m_frame;
+};
+
} // namespace blink
// During refactoring, there are some places where we need to do type conversions that
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698