Title: [185155] trunk
Revision
185155
Author
beid...@apple.com
Date
2015-06-03 10:33:16 -0700 (Wed, 03 Jun 2015)

Log Message

REGRESSION (r183498): Certain types of frame loads in iframes with <base target="_blank"> can open urls in new window/tabs
https://bugs.webkit.org/show_bug.cgi?id=145580

Reviewed by Mark Lam.

Source/WebCore:

Tests: fast/loader/fragment-navigation-base-blank.html
       fast/loader/iframe-meta-refresh-base-blank.html
       fast/loader/iframe-set-location-base-blank.html
       fast/loader/refresh-iframe-base-blank.html

Before 183498, callers of FrameLoader::changeLocation() got automatically assigned a frame name of "_self".
After 183498, many remained without a frame name.

Later on, FrameLoader applies the <base> target as their frame name if they don't already have one.

When the <base> target is "_blank", that causes a new window/tab.

Restoring "_self" to these call sites fixes this.

* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::openInNewTab):

* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::navigate):

* loader/FrameLoadRequest.h:
(WebCore::FrameLoadRequest::FrameLoadRequest):

* loader/NavigationScheduler.cpp:
(WebCore::NavigationScheduler::scheduleLocationChange):

* page/DOMWindow.cpp:
(WebCore::DOMWindow::createWindow):

Tools:

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::didSameDocumentNavigationForFrame): Implement the dump for "didChangeLocationWithinPageForFrame"

LayoutTests:

* fast/loader/fragment-navigation-base-blank-expected.txt: Added.
* fast/loader/fragment-navigation-base-blank.html: Added.
* fast/loader/iframe-meta-refresh-base-blank-expected.txt: Added.
* fast/loader/iframe-meta-refresh-base-blank.html: Added.
* fast/loader/iframe-set-location-base-blank-expected.txt: Added.
* fast/loader/iframe-set-location-base-blank.html: Added.
* fast/loader/refresh-iframe-base-blank-expected.txt: Added.
* fast/loader/refresh-iframe-base-blank.html: Added.
* fast/loader/resources/fragment-navigation-base-blank.html: Added.
* fast/loader/resources/iframe-meta-refresh-base-blank.html: Added.
* fast/loader/resources/iframe-set-location-base-blank.html: Added.
* fast/loader/resources/notify-done-with-window-count.html: Added.
* fast/loader/resources/refresh-iframe-base-blank-frame.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (185154 => 185155)


--- trunk/LayoutTests/ChangeLog	2015-06-03 16:56:59 UTC (rev 185154)
+++ trunk/LayoutTests/ChangeLog	2015-06-03 17:33:16 UTC (rev 185155)
@@ -1,3 +1,24 @@
+2015-06-03  Brady Eidson  <beid...@apple.com>
+
+        REGRESSION (r183498): Certain types of frame loads in iframes with <base target="_blank"> can open urls in new window/tabs
+        https://bugs.webkit.org/show_bug.cgi?id=145580
+
+        Reviewed by Mark Lam.
+
+        * fast/loader/fragment-navigation-base-blank-expected.txt: Added.
+        * fast/loader/fragment-navigation-base-blank.html: Added.
+        * fast/loader/iframe-meta-refresh-base-blank-expected.txt: Added.
+        * fast/loader/iframe-meta-refresh-base-blank.html: Added.
+        * fast/loader/iframe-set-location-base-blank-expected.txt: Added.
+        * fast/loader/iframe-set-location-base-blank.html: Added.
+        * fast/loader/refresh-iframe-base-blank-expected.txt: Added.
+        * fast/loader/refresh-iframe-base-blank.html: Added.
+        * fast/loader/resources/fragment-navigation-base-blank.html: Added.
+        * fast/loader/resources/iframe-meta-refresh-base-blank.html: Added.
+        * fast/loader/resources/iframe-set-location-base-blank.html: Added.
+        * fast/loader/resources/notify-done-with-window-count.html: Added.
+        * fast/loader/resources/refresh-iframe-base-blank-frame.html: Added.
+
 2015-06-03  Zalan Bujtas  <za...@apple.com>
 
         Subpixel rendering: Composited layer with subpixel gap does not get painted properly when its position changes.

Added: trunk/LayoutTests/fast/loader/fragment-navigation-base-blank-expected.txt (0 => 185155)


--- trunk/LayoutTests/fast/loader/fragment-navigation-base-blank-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/fragment-navigation-base-blank-expected.txt	2015-06-03 17:33:16 UTC (rev 185155)
@@ -0,0 +1,11 @@
+frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame0-->-->" - didChangeLocationWithinPageForFrame
+frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame
+main frame - didFinishLoadForFrame
+ALERT: Test finished due to hash change with a window count of 1
+

Added: trunk/LayoutTests/fast/loader/fragment-navigation-base-blank.html (0 => 185155)


--- trunk/LayoutTests/fast/loader/fragment-navigation-base-blank.html	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/fragment-navigation-base-blank.html	2015-06-03 17:33:16 UTC (rev 185155)
@@ -0,0 +1,14 @@
+<script>
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+    testRunner.setCanOpenWindows(true);
+    testRunner.dumpFrameLoadCallbacks();
+}
+
+</script>
+
+<body>
+<iframe src=""
+</body>

Added: trunk/LayoutTests/fast/loader/iframe-meta-refresh-base-blank-expected.txt (0 => 185155)


--- trunk/LayoutTests/fast/loader/iframe-meta-refresh-base-blank-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/iframe-meta-refresh-base-blank-expected.txt	2015-06-03 17:33:16 UTC (rev 185155)
@@ -0,0 +1,17 @@
+frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
+main frame - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame0-->-->" - willPerformClientRedirectToURL: resources/notify-done-with-window-count.html 
+frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame
+main frame - didFinishLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didCancelClientRedirectForFrame
+frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+ALERT: Finishing test with a window count of 1
+frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame
+

Added: trunk/LayoutTests/fast/loader/iframe-meta-refresh-base-blank.html (0 => 185155)


--- trunk/LayoutTests/fast/loader/iframe-meta-refresh-base-blank.html	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/iframe-meta-refresh-base-blank.html	2015-06-03 17:33:16 UTC (rev 185155)
@@ -0,0 +1,14 @@
+<script>
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+    testRunner.setCanOpenWindows(true);
+    testRunner.dumpFrameLoadCallbacks();
+}
+
+</script>
+
+<body>
+<iframe src=""
+</body>

Added: trunk/LayoutTests/fast/loader/iframe-set-location-base-blank-expected.txt (0 => 185155)


--- trunk/LayoutTests/fast/loader/iframe-set-location-base-blank-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/iframe-set-location-base-blank-expected.txt	2015-06-03 17:33:16 UTC (rev 185155)
@@ -0,0 +1,17 @@
+frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - willPerformClientRedirectToURL: resources/notify-done-with-window-count.html 
+frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
+main frame - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame
+main frame - didFinishLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didCancelClientRedirectForFrame
+frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+ALERT: Finishing test with a window count of 1
+frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame
+

Added: trunk/LayoutTests/fast/loader/iframe-set-location-base-blank.html (0 => 185155)


--- trunk/LayoutTests/fast/loader/iframe-set-location-base-blank.html	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/iframe-set-location-base-blank.html	2015-06-03 17:33:16 UTC (rev 185155)
@@ -0,0 +1,14 @@
+<script>
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+    testRunner.setCanOpenWindows(true);
+    testRunner.dumpFrameLoadCallbacks();
+}
+
+</script>
+
+<body>
+<iframe src=""
+</body>

Added: trunk/LayoutTests/fast/loader/refresh-iframe-base-blank-expected.txt (0 => 185155)


--- trunk/LayoutTests/fast/loader/refresh-iframe-base-blank-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/refresh-iframe-base-blank-expected.txt	2015-06-03 17:33:16 UTC (rev 185155)
@@ -0,0 +1,17 @@
+frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - willPerformClientRedirectToURL: resources/refresh-iframe-base-blank-frame.html 
+frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
+main frame - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame
+main frame - didFinishLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didCancelClientRedirectForFrame
+frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
+ALERT: Test finished with 1 windows
+frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame
+

Added: trunk/LayoutTests/fast/loader/refresh-iframe-base-blank.html (0 => 185155)


--- trunk/LayoutTests/fast/loader/refresh-iframe-base-blank.html	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/refresh-iframe-base-blank.html	2015-06-03 17:33:16 UTC (rev 185155)
@@ -0,0 +1,14 @@
+<script>
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+    testRunner.setCanOpenWindows(true);
+    testRunner.dumpFrameLoadCallbacks();
+}
+
+</script>
+
+<body>
+<iframe src=""
+</body>

Added: trunk/LayoutTests/fast/loader/resources/fragment-navigation-base-blank.html (0 => 185155)


--- trunk/LayoutTests/fast/loader/resources/fragment-navigation-base-blank.html	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/resources/fragment-navigation-base-blank.html	2015-06-03 17:33:16 UTC (rev 185155)
@@ -0,0 +1,30 @@
+<head>
+<base target="_blank">
+<script>
+
+function hashChanged()
+{
+    alert("Test finished due to hash change with a window count of " + testRunner.windowCount());
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+function runTest()
+{
+    if (window == window.top) {
+        alert("Test finished in a main frame with a window count of " + testRunner.windowCount());
+        if (window.testRunner)
+            testRunner.notifyDone();
+    }
+
+    window.location.href = ""   
+}
+
+</script>
+</head>
+<body _onhashchange_="hashChanged();" _onload_="runTest();">
+This should be in an iframe.<br>
+It does a location change to a fragment in the document.<br>
+It should scroll in this frame and not open a new window.<br>
+<div id="foo">This div is foo!</div>
+</body>

Added: trunk/LayoutTests/fast/loader/resources/iframe-meta-refresh-base-blank.html (0 => 185155)


--- trunk/LayoutTests/fast/loader/resources/iframe-meta-refresh-base-blank.html	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/resources/iframe-meta-refresh-base-blank.html	2015-06-03 17:33:16 UTC (rev 185155)
@@ -0,0 +1,9 @@
+<head>
+<base target="_blank">
+<meta http-equiv="refresh" content="0;notify-done-with-window-count.html">
+</head>
+<body>
+This should be in an iframe.<br>
+It does a meta refresh to a different page.<br>
+That should load in this frame and not new window.<br>
+</body>

Added: trunk/LayoutTests/fast/loader/resources/iframe-set-location-base-blank.html (0 => 185155)


--- trunk/LayoutTests/fast/loader/resources/iframe-set-location-base-blank.html	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/resources/iframe-set-location-base-blank.html	2015-06-03 17:33:16 UTC (rev 185155)
@@ -0,0 +1,15 @@
+<head>
+<base target="_blank">
+<script>
+
+function runTest()
+{
+    location.href=""
+}
+
+</script>
+</head>
+<body _onload_="runTest();">
+This page sets location to another page.<br>
+It should open in this frame and not a new window.<br>
+</body>

Added: trunk/LayoutTests/fast/loader/resources/notify-done-with-window-count.html (0 => 185155)


--- trunk/LayoutTests/fast/loader/resources/notify-done-with-window-count.html	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/resources/notify-done-with-window-count.html	2015-06-03 17:33:16 UTC (rev 185155)
@@ -0,0 +1,6 @@
+<script>
+if (window.testRunner) {
+    alert("Finishing test with a window count of " + testRunner.windowCount());
+    testRunner.notifyDone();
+}
+</script>

Added: trunk/LayoutTests/fast/loader/resources/refresh-iframe-base-blank-frame.html (0 => 185155)


--- trunk/LayoutTests/fast/loader/resources/refresh-iframe-base-blank-frame.html	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/resources/refresh-iframe-base-blank-frame.html	2015-06-03 17:33:16 UTC (rev 185155)
@@ -0,0 +1,26 @@
+<head>
+<base target="_blank">
+<script>
+
+function runTest()
+{
+    // If not running with a test runner, wait for the user to click the button.
+    // They don't need the logic below - They can manually tell if the frame busts into a new tab.
+    if (!window.testRunner)
+        return;
+    
+    if (sessionStorage.frameLoadedOnce) {
+        alert("Test finished with " + testRunner.windowCount() + " windows");
+        testRunner.notifyDone();
+        return;
+    }
+    
+    sessionStorage.frameLoadedOnce = true;
+    location.reload();
+}
+
+</script>
+</head>
+<body _onload_="runTest();">
+<button _onclick_="location.reload();">Click to reload. The frame should not bust out into a new window.</button>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (185154 => 185155)


--- trunk/Source/WebCore/ChangeLog	2015-06-03 16:56:59 UTC (rev 185154)
+++ trunk/Source/WebCore/ChangeLog	2015-06-03 17:33:16 UTC (rev 185155)
@@ -1,3 +1,39 @@
+2015-06-03  Brady Eidson  <beid...@apple.com>
+
+        REGRESSION (r183498): Certain types of frame loads in iframes with <base target="_blank"> can open urls in new window/tabs
+        https://bugs.webkit.org/show_bug.cgi?id=145580
+
+        Reviewed by Mark Lam.
+
+        Tests: fast/loader/fragment-navigation-base-blank.html
+               fast/loader/iframe-meta-refresh-base-blank.html
+               fast/loader/iframe-set-location-base-blank.html
+               fast/loader/refresh-iframe-base-blank.html
+
+        Before 183498, callers of FrameLoader::changeLocation() got automatically assigned a frame name of "_self".
+        After 183498, many remained without a frame name.
+        
+        Later on, FrameLoader applies the <base> target as their frame name if they don't already have one. 
+        
+        When the <base> target is "_blank", that causes a new window/tab.
+        
+        Restoring "_self" to these call sites fixes this.
+
+        * inspector/InspectorFrontendClientLocal.cpp:
+        (WebCore::InspectorFrontendClientLocal::openInNewTab):
+        
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::navigate):
+        
+        * loader/FrameLoadRequest.h:
+        (WebCore::FrameLoadRequest::FrameLoadRequest):
+        
+        * loader/NavigationScheduler.cpp:
+        (WebCore::NavigationScheduler::scheduleLocationChange):
+        
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::createWindow):
+
 2015-06-03  Alexey Proskuryakov  <a...@apple.com>
 
         More iOS build fixing.

Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp (185154 => 185155)


--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp	2015-06-03 16:56:59 UTC (rev 185154)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp	2015-06-03 17:33:16 UTC (rev 185155)
@@ -223,7 +223,7 @@
 
     // FIXME: Why does one use mainFrame and the other frame?
     ResourceRequest resourceRequest(frame->document()->completeURL(url));
-    FrameLoadRequest frameRequest(mainFrame.document()->securityOrigin(), resourceRequest, emptyString(), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ReplaceDocumentIfJavaScriptURL, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
+    FrameLoadRequest frameRequest(mainFrame.document()->securityOrigin(), resourceRequest, "_self", LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ReplaceDocumentIfJavaScriptURL, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
     frame->loader().changeLocation(frameRequest);
 }
 

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (185154 => 185155)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2015-06-03 16:56:59 UTC (rev 185154)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2015-06-03 17:33:16 UTC (rev 185155)
@@ -419,7 +419,7 @@
     Frame& frame = m_page->mainFrame();
 
     ResourceRequest resourceRequest(frame.document()->completeURL(url));
-    FrameLoadRequest frameRequest(frame.document()->securityOrigin(), resourceRequest, emptyString(), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, ShouldReplaceDocumentIfJavaScriptURL::ReplaceDocumentIfJavaScriptURL, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
+    FrameLoadRequest frameRequest(frame.document()->securityOrigin(), resourceRequest, "_self", LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, ShouldReplaceDocumentIfJavaScriptURL::ReplaceDocumentIfJavaScriptURL, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
     frame.loader().changeLocation(frameRequest);
 }
 

Modified: trunk/Source/WebCore/loader/FrameLoadRequest.h (185154 => 185155)


--- trunk/Source/WebCore/loader/FrameLoadRequest.h	2015-06-03 16:56:59 UTC (rev 185154)
+++ trunk/Source/WebCore/loader/FrameLoadRequest.h	2015-06-03 17:33:16 UTC (rev 185155)
@@ -63,6 +63,21 @@
     {
     }
 
+    FrameLoadRequest(SecurityOrigin* requester, const ResourceRequest& resourceRequest, const String& frameName, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, AllowNavigationToInvalidURL allowNavigationToInvalidURL, NewFrameOpenerPolicy newFrameOpenerPolicy, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)
+        : m_requester(requester)
+        , m_resourceRequest(resourceRequest)
+        , m_frameName(frameName)
+        , m_shouldCheckNewWindowPolicy(false)
+        , m_lockHistory(lockHistory)
+        , m_lockBackForwardList(lockBackForwardList)
+        , m_shouldSendReferrer(shouldSendReferrer)
+        , m_allowNavigationToInvalidURL(allowNavigationToInvalidURL)
+        , m_newFrameOpenerPolicy(newFrameOpenerPolicy)
+        , m_shouldReplaceDocumentIfJavaScriptURL(ReplaceDocumentIfJavaScriptURL)
+        , m_shouldOpenExternalURLsPolicy(shouldOpenExternalURLsPolicy)
+    {
+    }
+
     FrameLoadRequest(SecurityOrigin* requester, const ResourceRequest& resourceRequest, const String& frameName, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, AllowNavigationToInvalidURL allowNavigationToInvalidURL, NewFrameOpenerPolicy newFrameOpenerPolicy, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)
         : m_requester(requester)
         , m_resourceRequest(resourceRequest)

Modified: trunk/Source/WebCore/loader/NavigationScheduler.cpp (185154 => 185155)


--- trunk/Source/WebCore/loader/NavigationScheduler.cpp	2015-06-03 16:56:59 UTC (rev 185154)
+++ trunk/Source/WebCore/loader/NavigationScheduler.cpp	2015-06-03 17:33:16 UTC (rev 185155)
@@ -116,7 +116,7 @@
         UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
 
         ResourceRequest resourceRequest(m_url, m_referrer, UseProtocolCachePolicy);
-        FrameLoadRequest frameRequest(m_securityOrigin.get(), resourceRequest, lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, m_shouldOpenExternalURLsPolicy);
+        FrameLoadRequest frameRequest(m_securityOrigin.get(), resourceRequest, "_self", lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, m_shouldOpenExternalURLsPolicy);
 
         frame.loader().changeLocation(frameRequest);
     }
@@ -174,7 +174,7 @@
         UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
         bool refresh = equalIgnoringFragmentIdentifier(frame.document()->url(), url());
         ResourceRequest resourceRequest(url(), referrer(), refresh ? ReloadIgnoringCacheData : UseProtocolCachePolicy);
-        FrameLoadRequest frameRequest(securityOrigin(), resourceRequest, lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, m_shouldOpenExternalURLsPolicy);
+        FrameLoadRequest frameRequest(securityOrigin(), resourceRequest, "_self", lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, m_shouldOpenExternalURLsPolicy);
 
         frame.loader().changeLocation(frameRequest);
     }
@@ -190,7 +190,7 @@
         UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
 
         ResourceRequest resourceRequest(url(), referrer(), UseProtocolCachePolicy);
-        FrameLoadRequest frameRequest(securityOrigin(), resourceRequest, lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, m_shouldOpenExternalURLsPolicy);
+        FrameLoadRequest frameRequest(securityOrigin(), resourceRequest, "_self", lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, m_shouldOpenExternalURLsPolicy);
         frame.loader().changeLocation(frameRequest);
     }
 };
@@ -207,7 +207,7 @@
         UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
 
         ResourceRequest resourceRequest(url(), referrer(), ReloadIgnoringCacheData);
-        FrameLoadRequest frameRequest(securityOrigin(), resourceRequest, lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, m_shouldOpenExternalURLsPolicy);
+        FrameLoadRequest frameRequest(securityOrigin(), resourceRequest, "_self", lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, m_shouldOpenExternalURLsPolicy);
         frame.loader().changeLocation(frameRequest);
     }
 };
@@ -411,7 +411,7 @@
         ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy = ShouldOpenExternalURLsPolicy::ShouldNotAllow;
         if (initiatingDocument)
             shouldOpenExternalURLsPolicy = initiatingDocument->shouldOpenExternalURLsPolicyToPropagate();
-        FrameLoadRequest frameRequest(securityOrigin, resourceRequest, emptyString(), lockHistory, lockBackForwardList, MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, ReplaceDocumentIfJavaScriptURL, shouldOpenExternalURLsPolicy);
+        FrameLoadRequest frameRequest(securityOrigin, resourceRequest, "_self", lockHistory, lockBackForwardList, MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, ReplaceDocumentIfJavaScriptURL, shouldOpenExternalURLsPolicy);
         loader.changeLocation(frameRequest);
         return;
     }

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (185154 => 185155)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2015-06-03 16:56:59 UTC (rev 185154)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2015-06-03 17:33:16 UTC (rev 185155)
@@ -2114,7 +2114,7 @@
 
     if (created) {
         ResourceRequest resourceRequest(completedURL, referrer, UseProtocolCachePolicy);
-        FrameLoadRequest frameRequest(activeWindow.document()->securityOrigin(), resourceRequest, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, activeDocument->shouldOpenExternalURLsPolicyToPropagate());
+        FrameLoadRequest frameRequest(activeWindow.document()->securityOrigin(), resourceRequest, "_self", LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, activeDocument->shouldOpenExternalURLsPolicyToPropagate());
         newFrame->loader().changeLocation(frameRequest);
     } else if (!urlString.isEmpty()) {
         LockHistory lockHistory = ScriptController::processingUserGesture() ? LockHistory::No : LockHistory::Yes;

Modified: trunk/Tools/ChangeLog (185154 => 185155)


--- trunk/Tools/ChangeLog	2015-06-03 16:56:59 UTC (rev 185154)
+++ trunk/Tools/ChangeLog	2015-06-03 17:33:16 UTC (rev 185155)
@@ -1,3 +1,13 @@
+2015-06-03  Brady Eidson  <beid...@apple.com>
+
+        REGRESSION (r183498): Certain types of frame loads in iframes with <base target="_blank"> can open urls in new window/tabs
+        https://bugs.webkit.org/show_bug.cgi?id=145580
+
+        Reviewed by Mark Lam.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::didSameDocumentNavigationForFrame): Implement the dump for "didChangeLocationWithinPageForFrame"
+
 2015-06-03  Alexey Proskuryakov  <a...@apple.com>
 
         Attempt to fix CSSPropertyParserTest.GridTrackLimits API test after http://trac.webkit.org/r185147

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (185154 => 185155)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2015-06-03 16:56:59 UTC (rev 185154)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2015-06-03 17:33:16 UTC (rev 185155)
@@ -1004,6 +1004,17 @@
 
 void InjectedBundlePage::didSameDocumentNavigationForFrame(WKBundleFrameRef frame, WKSameDocumentNavigationType type)
 {
+    auto& injectedBundle = InjectedBundle::singleton();
+    if (!injectedBundle.isTestRunning())
+        return;
+
+    if (!injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks())
+        return;
+
+    if (type != kWKSameDocumentNavigationAnchorNavigation)
+        return;
+
+    dumpLoadEvent(frame, "didChangeLocationWithinPageForFrame");
 }
 
 void InjectedBundlePage::didFinishDocumentLoadForFrame(WKBundleFrameRef frame)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to