Title: [114057] trunk/Source/WebCore
Revision
114057
Author
[email protected]
Date
2012-04-12 17:42:37 -0700 (Thu, 12 Apr 2012)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (114056 => 114057)


--- trunk/Source/WebCore/ChangeLog	2012-04-13 00:26:23 UTC (rev 114056)
+++ trunk/Source/WebCore/ChangeLog	2012-04-13 00:42:37 UTC (rev 114057)
@@ -1,3 +1,29 @@
+2012-04-12  Adam Barth  <[email protected]>
+
+        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  <[email protected]>
 
         REGRESSION (r102262): iAd Producer relies on CSSStyleDeclaration property setters respecting '!important'

Modified: trunk/Source/WebCore/WebCore.exp.in (114056 => 114057)


--- trunk/Source/WebCore/WebCore.exp.in	2012-04-13 00:26:23 UTC (rev 114056)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-04-13 00:42:37 UTC (rev 114057)
@@ -177,7 +177,7 @@
 __ZN7WebCore11FrameLoader16loadFrameRequestERKNS_16FrameLoadRequestEbbN3WTF10PassRefPtrINS_5EventEEENS5_INS_9FormStateEEENS_18ShouldSendReferrerE
 __ZN7WebCore11FrameLoader17stopForUserCancelEb
 __ZN7WebCore11FrameLoader21loadURLIntoChildFrameERKNS_4KURLERKN3WTF6StringEPNS_5FrameE
-__ZN7WebCore11FrameLoader22findFrameForNavigationERKN3WTF12AtomicStringE
+__ZN7WebCore11FrameLoader22findFrameForNavigationERKN3WTF12AtomicStringEPNS_8DocumentE
 __ZN7WebCore11FrameLoader23timeOfLastCompletedLoadEv    
 __ZN7WebCore11FrameLoader26reloadWithOverrideEncodingERKN3WTF6StringE
 __ZN7WebCore11FrameLoader32setOriginalURLForDownloadRequestERNS_15ResourceRequestE

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (114056 => 114057)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2012-04-13 00:26:23 UTC (rev 114056)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2012-04-13 00:42:37 UTC (rev 114057)
@@ -2935,14 +2935,20 @@
     }
 }
 
-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 @@
     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;

Modified: trunk/Source/WebCore/loader/FrameLoader.h (114056 => 114057)


--- trunk/Source/WebCore/loader/FrameLoader.h	2012-04-13 00:26:23 UTC (rev 114056)
+++ trunk/Source/WebCore/loader/FrameLoader.h	2012-04-13 00:42:37 UTC (rev 114057)
@@ -245,7 +245,7 @@
 
     FrameLoaderStateMachine* stateMachine() const { return &m_stateMachine; }
 
-    Frame* findFrameForNavigation(const AtomicString& name);
+    Frame* findFrameForNavigation(const AtomicString& name, Document* activeDocument = 0);
 
     void applyUserAgent(ResourceRequest&);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to