From b46fdeff0ac0d3ba194add11b605bb7942c90213 Mon Sep 17 00:00:00 2001 From: "abarth@webkit.org" Date: Fri, 13 Apr 2012 00:42:37 +0000 Subject: [PATCH] window.open should prepare for seamless navigation by using findFrameForNavigation https://bugs.webkit.org/show_bug.cgi?id=83835 Reviewed by Ryosuke Niwa. Before this patch, window.open called FrameTree::find and Document::canNavigate separately. This patch refactors the code to call FrameLoader::findFrameForNavigation, which does both. This refactoring prepares window.open to understand seamless navigation, which will happen in findFrameForNavigation. This patch should have no behavior change today, but once we merge the seamless branch, this change will be tested by https://github.com/eseidel/webkit/blob/seamless/LayoutTests/fast/frames/seamless/seamless-window-open.html See https://github.com/eseidel/webkit/commit/a0d8b7defbb63047912aefbc8e22bca4f0638c37 for context. * WebCore.exp.in: * loader/FrameLoader.cpp: (WebCore::FrameLoader::findFrameForNavigation): (WebCore::createWindow): * loader/FrameLoader.h: (FrameLoader): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114057 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 26 ++++++++++++++++++++++++++ Source/WebCore/WebCore.exp.in | 2 +- Source/WebCore/loader/FrameLoader.cpp | 21 +++++++++++++-------- Source/WebCore/loader/FrameLoader.h | 2 +- 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 18926ca..d84c2d3 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,29 @@ +2012-04-12 Adam Barth + + window.open should prepare for seamless navigation by using findFrameForNavigation + https://bugs.webkit.org/show_bug.cgi?id=83835 + + Reviewed by Ryosuke Niwa. + + Before this patch, window.open called FrameTree::find and + Document::canNavigate separately. This patch refactors the code to + call FrameLoader::findFrameForNavigation, which does both. This + refactoring prepares window.open to understand seamless navigation, + which will happen in findFrameForNavigation. + + This patch should have no behavior change today, but once we merge the + seamless branch, this change will be tested by + https://github.com/eseidel/webkit/blob/seamless/LayoutTests/fast/frames/seamless/seamless-window-open.html + + See https://github.com/eseidel/webkit/commit/a0d8b7defbb63047912aefbc8e22bca4f0638c37 for context. + + * WebCore.exp.in: + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::findFrameForNavigation): + (WebCore::createWindow): + * loader/FrameLoader.h: + (FrameLoader): + 2012-04-12 Andy Estes REGRESSION (r102262): iAd Producer relies on CSSStyleDeclaration property setters respecting '!important' diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in index b8d8d8e..54051f8 100644 --- a/Source/WebCore/WebCore.exp.in +++ b/Source/WebCore/WebCore.exp.in @@ -177,7 +177,7 @@ __ZN7WebCore11FrameLoader16detachFromParentEv __ZN7WebCore11FrameLoader16loadFrameRequestERKNS_16FrameLoadRequestEbbN3WTF10PassRefPtrINS_5EventEEENS5_INS_9FormStateEEENS_18ShouldSendReferrerE __ZN7WebCore11FrameLoader17stopForUserCancelEb __ZN7WebCore11FrameLoader21loadURLIntoChildFrameERKNS_4KURLERKN3WTF6StringEPNS_5FrameE -__ZN7WebCore11FrameLoader22findFrameForNavigationERKN3WTF12AtomicStringE +__ZN7WebCore11FrameLoader22findFrameForNavigationERKN3WTF12AtomicStringEPNS_8DocumentE __ZN7WebCore11FrameLoader23timeOfLastCompletedLoadEv __ZN7WebCore11FrameLoader26reloadWithOverrideEncodingERKN3WTF6StringE __ZN7WebCore11FrameLoader32setOriginalURLForDownloadRequestERNS_15ResourceRequestE diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp index 516cc73..fb80ef3 100644 --- a/Source/WebCore/loader/FrameLoader.cpp +++ b/Source/WebCore/loader/FrameLoader.cpp @@ -2935,14 +2935,20 @@ void FrameLoader::checkDidPerformFirstNavigation() } } -Frame* FrameLoader::findFrameForNavigation(const AtomicString& name) +Frame* FrameLoader::findFrameForNavigation(const AtomicString& name, Document* activeDocument) { Frame* frame = m_frame->tree()->find(name); - // FIXME: We calling canNavigate on the Document that's requesting the - // navigation, not based on the document that happens to be displayed in - // this Frame. - if (!m_frame->document()->canNavigate(frame)) - return 0; + + if (activeDocument) { + if (!activeDocument->canNavigate(frame)) + return 0; + } else { + // FIXME: Eventually all callers should supply the actual activeDocument + // so we can call canNavigate with the right document. + if (!m_frame->document()->canNavigate(frame)) + return 0; + } + return frame; } @@ -3194,8 +3200,7 @@ Frame* createWindow(Frame* openerFrame, Frame* lookupFrame, const FrameLoadReque ASSERT(!features.dialog || request.frameName().isEmpty()); if (!request.frameName().isEmpty() && request.frameName() != "_blank") { - Frame* frame = lookupFrame->tree()->find(request.frameName()); - if (frame && openerFrame->document()->canNavigate(frame)) { + if (Frame* frame = lookupFrame->loader()->findFrameForNavigation(request.frameName(), openerFrame->document())) { if (Page* page = frame->page()) page->chrome()->focus(); created = false; diff --git a/Source/WebCore/loader/FrameLoader.h b/Source/WebCore/loader/FrameLoader.h index ed378ae..291a6ad 100644 --- a/Source/WebCore/loader/FrameLoader.h +++ b/Source/WebCore/loader/FrameLoader.h @@ -245,7 +245,7 @@ public: FrameLoaderStateMachine* stateMachine() const { return &m_stateMachine; } - Frame* findFrameForNavigation(const AtomicString& name); + Frame* findFrameForNavigation(const AtomicString& name, Document* activeDocument = 0); void applyUserAgent(ResourceRequest&); -- 2.7.4