Title: [258487] trunk/Source
Revision
258487
Author
[email protected]
Date
2020-03-16 00:20:28 -0700 (Mon, 16 Mar 2020)

Log Message

Simplify ChromeClient.createWindow
https://bugs.webkit.org/show_bug.cgi?id=209123

Patch by Rob Buis <[email protected]> on 2020-03-16
Reviewed by Darin Adler.

Source/WebCore:

Simplify ChromeClient.createWindow by removing the FrameLoadRequest parameter.
It was only passed for its ResourceRequest member, which can also be obtained
from the NavigationAction parameter.

* loader/EmptyClients.h:
* loader/FrameLoader.cpp:
(WebCore::createWindow):
* page/Chrome.cpp:
(WebCore::Chrome::createWindow const):
* page/Chrome.h:
* page/ChromeClient.h:
* page/ContextMenuController.cpp:
(WebCore::openNewWindow):

Source/WebKit:

Adapt to API change.

* WebProcess/Inspector/WebInspector.cpp:
(WebKit::WebInspector::openInNewTab):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createWindow):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchCreatePage):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (258486 => 258487)


--- trunk/Source/WebCore/ChangeLog	2020-03-16 02:58:01 UTC (rev 258486)
+++ trunk/Source/WebCore/ChangeLog	2020-03-16 07:20:28 UTC (rev 258487)
@@ -1,3 +1,24 @@
+2020-03-16  Rob Buis  <[email protected]>
+
+        Simplify ChromeClient.createWindow
+        https://bugs.webkit.org/show_bug.cgi?id=209123
+
+        Reviewed by Darin Adler.
+
+        Simplify ChromeClient.createWindow by removing the FrameLoadRequest parameter.
+        It was only passed for its ResourceRequest member, which can also be obtained
+        from the NavigationAction parameter.
+
+        * loader/EmptyClients.h:
+        * loader/FrameLoader.cpp:
+        (WebCore::createWindow):
+        * page/Chrome.cpp:
+        (WebCore::Chrome::createWindow const):
+        * page/Chrome.h:
+        * page/ChromeClient.h:
+        * page/ContextMenuController.cpp:
+        (WebCore::openNewWindow):
+
 2020-03-15  Fujii Hironori  <[email protected]>
 
         KeyedDecoderGeneric fails to allocate Vector while decoding broken data

Modified: trunk/Source/WebCore/loader/EmptyClients.h (258486 => 258487)


--- trunk/Source/WebCore/loader/EmptyClients.h	2020-03-16 02:58:01 UTC (rev 258486)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2020-03-16 07:20:28 UTC (rev 258487)
@@ -62,7 +62,7 @@
     void focusedElementChanged(Element*) final { }
     void focusedFrameChanged(Frame*) final { }
 
-    Page* createWindow(Frame&, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&) final { return nullptr; }
+    Page* createWindow(Frame&, const WindowFeatures&, const NavigationAction&) final { return nullptr; }
     void show() final { }
 
     bool canRunModal() final { return false; }

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (258486 => 258487)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2020-03-16 02:58:01 UTC (rev 258486)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2020-03-16 07:20:28 UTC (rev 258487)
@@ -4138,7 +4138,7 @@
 
     ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy = shouldOpenExternalURLsPolicyToApply(openerFrame, request);
     NavigationAction action { request.requester(), request.resourceRequest(), request.initiatedByMainFrame(), NavigationType::Other, shouldOpenExternalURLsPolicy };
-    Page* page = oldPage->chrome().createWindow(openerFrame, request, features, action);
+    Page* page = oldPage->chrome().createWindow(openerFrame, features, action);
     if (!page)
         return nullptr;
 

Modified: trunk/Source/WebCore/page/Chrome.cpp (258486 => 258487)


--- trunk/Source/WebCore/page/Chrome.cpp	2020-03-16 02:58:01 UTC (rev 258486)
+++ trunk/Source/WebCore/page/Chrome.cpp	2020-03-16 07:20:28 UTC (rev 258487)
@@ -181,9 +181,9 @@
     m_client.focusedFrameChanged(frame);
 }
 
-Page* Chrome::createWindow(Frame& frame, const FrameLoadRequest& request, const WindowFeatures& features, const NavigationAction& action) const
+Page* Chrome::createWindow(Frame& frame, const WindowFeatures& features, const NavigationAction& action) const
 {
-    Page* newPage = m_client.createWindow(frame, request, features, action);
+    Page* newPage = m_client.createWindow(frame, features, action);
     if (!newPage)
         return nullptr;
 

Modified: trunk/Source/WebCore/page/Chrome.h (258486 => 258487)


--- trunk/Source/WebCore/page/Chrome.h	2020-03-16 02:58:01 UTC (rev 258486)
+++ trunk/Source/WebCore/page/Chrome.h	2020-03-16 07:20:28 UTC (rev 258487)
@@ -44,7 +44,6 @@
 class FileChooser;
 class FileIconLoader;
 class FloatRect;
-class FrameLoadRequest;
 class Element;
 class Frame;
 class Geolocation;
@@ -113,7 +112,7 @@
     void focusedElementChanged(Element*) const;
     void focusedFrameChanged(Frame*) const;
 
-    WEBCORE_EXPORT Page* createWindow(Frame&, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&) const;
+    WEBCORE_EXPORT Page* createWindow(Frame&, const WindowFeatures&, const NavigationAction&) const;
     WEBCORE_EXPORT void show() const;
 
     bool canRunModal() const;

Modified: trunk/Source/WebCore/page/ChromeClient.h (258486 => 258487)


--- trunk/Source/WebCore/page/ChromeClient.h	2020-03-16 02:58:01 UTC (rev 258486)
+++ trunk/Source/WebCore/page/ChromeClient.h	2020-03-16 07:20:28 UTC (rev 258487)
@@ -84,7 +84,6 @@
 class FileIconLoader;
 class FloatRect;
 class Frame;
-class FrameLoadRequest;
 class Geolocation;
 class GraphicsLayer;
 class GraphicsLayerFactory;
@@ -139,9 +138,8 @@
     // Frame wants to create the new Page. Also, the newly created window
     // should not be shown to the user until the ChromeClient of the newly
     // created Page has its show method called.
-    // The FrameLoadRequest parameter is only for ChromeClient to check if the
-    // request could be fulfilled. The ChromeClient should not load the request.
-    virtual Page* createWindow(Frame&, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&) = 0;
+    // The ChromeClient should not load the request.
+    virtual Page* createWindow(Frame&, const WindowFeatures&, const NavigationAction&) = 0;
     virtual void show() = 0;
 
     virtual bool canRunModal() = 0;

Modified: trunk/Source/WebCore/page/ContextMenuController.cpp (258486 => 258487)


--- trunk/Source/WebCore/page/ContextMenuController.cpp	2020-03-16 02:58:01 UTC (rev 258486)
+++ trunk/Source/WebCore/page/ContextMenuController.cpp	2020-03-16 07:20:28 UTC (rev 258487)
@@ -200,7 +200,7 @@
 
     FrameLoadRequest frameLoadRequest { *frame.document(), frame.document()->securityOrigin(), ResourceRequest(urlToLoad, frame.loader().outgoingReferrer()), { }, LockHistory::No, LockBackForwardList::No, ReferrerPolicy::EmptyString, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress, shouldOpenExternalURLsPolicy, InitiatedByMainFrame::Unknown };
 
-    Page* newPage = oldPage->chrome().createWindow(frame, frameLoadRequest, { }, { *frame.document(), frameLoadRequest.resourceRequest(), frameLoadRequest.initiatedByMainFrame() });
+    Page* newPage = oldPage->chrome().createWindow(frame, { }, { *frame.document(), frameLoadRequest.resourceRequest(), frameLoadRequest.initiatedByMainFrame() });
     if (!newPage)
         return;
     newPage->chrome().show();

Modified: trunk/Source/WebKit/ChangeLog (258486 => 258487)


--- trunk/Source/WebKit/ChangeLog	2020-03-16 02:58:01 UTC (rev 258486)
+++ trunk/Source/WebKit/ChangeLog	2020-03-16 07:20:28 UTC (rev 258487)
@@ -1,3 +1,20 @@
+2020-03-16  Rob Buis  <[email protected]>
+
+        Simplify ChromeClient.createWindow
+        https://bugs.webkit.org/show_bug.cgi?id=209123
+
+        Reviewed by Darin Adler.
+
+        Adapt to API change.
+
+        * WebProcess/Inspector/WebInspector.cpp:
+        (WebKit::WebInspector::openInNewTab):
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::createWindow):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchCreatePage):
+
 2020-03-15  Yusuke Suzuki  <[email protected]>
 
         Should not use variable-length-array (VLA)

Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspector.cpp (258486 => 258487)


--- trunk/Source/WebKit/WebProcess/Inspector/WebInspector.cpp	2020-03-16 02:58:01 UTC (rev 258486)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspector.cpp	2020-03-16 07:20:28 UTC (rev 258487)
@@ -170,7 +170,7 @@
     FrameLoadRequest frameLoadRequest { *inspectedMainFrame.document(), inspectedMainFrame.document()->securityOrigin(), ResourceRequest { urlString }, "_blank"_s, LockHistory::No, LockBackForwardList::No, ReferrerPolicy::EmptyString, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow, InitiatedByMainFrame::Unknown };
 
     NavigationAction action { *inspectedMainFrame.document(), frameLoadRequest.resourceRequest(), frameLoadRequest.initiatedByMainFrame(), NavigationType::LinkClicked };
-    Page* newPage = inspectedPage->chrome().createWindow(inspectedMainFrame, frameLoadRequest, { }, action);
+    Page* newPage = inspectedPage->chrome().createWindow(inspectedMainFrame, { }, action);
     if (!newPage)
         return;
 

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (258486 => 258487)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2020-03-16 02:58:01 UTC (rev 258486)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2020-03-16 07:20:28 UTC (rev 258487)
@@ -69,7 +69,6 @@
 #include <WebCore/FileChooser.h>
 #include <WebCore/FileIconLoader.h>
 #include <WebCore/Frame.h>
-#include <WebCore/FrameLoadRequest.h>
 #include <WebCore/FrameLoader.h>
 #include <WebCore/FrameView.h>
 #include <WebCore/FullscreenManager.h>
@@ -272,7 +271,7 @@
     WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::FocusedFrameChanged(webFrame ? makeOptional(webFrame->frameID()) : WTF::nullopt), m_page.identifier());
 }
 
-Page* WebChromeClient::createWindow(Frame& frame, const FrameLoadRequest& request, const WindowFeatures& windowFeatures, const NavigationAction& navigationAction)
+Page* WebChromeClient::createWindow(Frame& frame, const WindowFeatures& windowFeatures, const NavigationAction& navigationAction)
 {
 #if ENABLE(FULLSCREEN_API)
     if (frame.document() && frame.document()->fullscreenManager().currentFullscreenElement())
@@ -288,7 +287,7 @@
     navigationActionData.syntheticClickType = InjectedBundleNavigationAction::syntheticClickTypeForNavigationAction(navigationAction);
     navigationActionData.clickLocationInRootViewCoordinates = InjectedBundleNavigationAction::clickLocationInRootViewCoordinatesForNavigationAction(navigationAction);
     navigationActionData.userGestureTokenIdentifier = webProcess.userGestureTokenIdentifier(navigationAction.userGestureToken());
-    navigationActionData.canHandleRequest = m_page.canHandleRequest(request.resourceRequest());
+    navigationActionData.canHandleRequest = m_page.canHandleRequest(navigationAction.resourceRequest());
     navigationActionData.shouldOpenExternalURLsPolicy = navigationAction.shouldOpenExternalURLsPolicy();
     navigationActionData.downloadAttribute = navigationAction.downloadAttribute();
 
@@ -296,7 +295,7 @@
 
     Optional<PageIdentifier> newPageID;
     Optional<WebPageCreationParameters> parameters;
-    if (!webProcess.parentProcessConnection()->sendSync(Messages::WebPageProxy::CreateNewPage(webFrame->info(), webFrame->page()->webPageProxyIdentifier(), request.resourceRequest(), windowFeatures, navigationActionData), Messages::WebPageProxy::CreateNewPage::Reply(newPageID, parameters), m_page.identifier()))
+    if (!webProcess.parentProcessConnection()->sendSync(Messages::WebPageProxy::CreateNewPage(webFrame->info(), webFrame->page()->webPageProxyIdentifier(), navigationAction.resourceRequest(), windowFeatures, navigationActionData), Messages::WebPageProxy::CreateNewPage::Reply(newPageID, parameters), m_page.identifier()))
         return nullptr;
 
     if (!newPageID)

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (258486 => 258487)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2020-03-16 02:58:01 UTC (rev 258486)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2020-03-16 07:20:28 UTC (rev 258487)
@@ -76,7 +76,7 @@
     // Frame wants to create the new Page.  Also, the newly created window
     // should not be shown to the user until the ChromeClient of the newly
     // created Page has its show method called.
-    WebCore::Page* createWindow(WebCore::Frame&, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&, const WebCore::NavigationAction&) final;
+    WebCore::Page* createWindow(WebCore::Frame&, const WebCore::WindowFeatures&, const WebCore::NavigationAction&) final;
     void show() final;
     
     bool canRunModal() final;

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (258486 => 258487)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2020-03-16 02:58:01 UTC (rev 258486)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2020-03-16 07:20:28 UTC (rev 258487)
@@ -68,9 +68,7 @@
 #include <WebCore/DocumentLoader.h>
 #include <WebCore/FormState.h>
 #include <WebCore/Frame.h>
-#include <WebCore/FrameLoadRequest.h>
 #include <WebCore/FrameLoader.h>
-#include <WebCore/FrameLoaderTypes.h>
 #include <WebCore/FrameView.h>
 #include <WebCore/HTMLAppletElement.h>
 #include <WebCore/HTMLFormElement.h>
@@ -782,9 +780,7 @@
         return nullptr;
 
     // Just call through to the chrome client.
-    auto request = navigationAction.resourceRequest();
-    FrameLoadRequest frameLoadRequest { *m_frame->coreFrame()->document(), m_frame->coreFrame()->document()->securityOrigin(), WTFMove(request), { }, LockHistory::No, LockBackForwardList::No, ReferrerPolicy::EmptyString, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, navigationAction.shouldOpenExternalURLsPolicy(), InitiatedByMainFrame::Unknown };
-    Page* newPage = webPage->corePage()->chrome().createWindow(*m_frame->coreFrame(), frameLoadRequest, { }, navigationAction);
+    Page* newPage = webPage->corePage()->chrome().createWindow(*m_frame->coreFrame(), { }, navigationAction);
     if (!newPage)
         return nullptr;
     

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h (258486 => 258487)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h	2020-03-16 02:58:01 UTC (rev 258486)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h	2020-03-16 07:20:28 UTC (rev 258487)
@@ -64,7 +64,7 @@
     void focusedElementChanged(WebCore::Element*) override;
     void focusedFrameChanged(WebCore::Frame*) final;
 
-    WebCore::Page* createWindow(WebCore::Frame&, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&, const WebCore::NavigationAction&) final;
+    WebCore::Page* createWindow(WebCore::Frame&, const WebCore::WindowFeatures&, const WebCore::NavigationAction&) final;
     void show() final;
 
     bool canRunModal() final;

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm (258486 => 258487)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm	2020-03-16 02:58:01 UTC (rev 258486)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm	2020-03-16 07:20:28 UTC (rev 258487)
@@ -66,7 +66,6 @@
 #import <WebCore/FileIconLoader.h>
 #import <WebCore/FloatRect.h>
 #import <WebCore/Frame.h>
-#import <WebCore/FrameLoadRequest.h>
 #import <WebCore/FrameView.h>
 #import <WebCore/FullscreenManager.h>
 #import <WebCore/GraphicsLayer.h>
@@ -238,7 +237,7 @@
 {
 }
 
-Page* WebChromeClient::createWindow(Frame& frame, const FrameLoadRequest&, const WindowFeatures& features, const NavigationAction&)
+Page* WebChromeClient::createWindow(Frame& frame, const WindowFeatures& features, const NavigationAction&)
 {
     id delegate = [m_webView UIDelegate];
     WebView *newWebView;

Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.cpp (258486 => 258487)


--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.cpp	2020-03-16 02:58:01 UTC (rev 258486)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.cpp	2020-03-16 07:20:28 UTC (rev 258487)
@@ -43,7 +43,6 @@
 #include <WebCore/FileIconLoader.h>
 #include <WebCore/FloatRect.h>
 #include <WebCore/Frame.h>
-#include <WebCore/FrameLoadRequest.h>
 #include <WebCore/FrameView.h>
 #include <WebCore/FullScreenController.h>
 #include <WebCore/FullscreenManager.h>
@@ -190,7 +189,7 @@
     return COMPtr<IPropertyBag>(AdoptCOM, COMPropertyBag<COMVariant>::adopt(map));
 }
 
-Page* WebChromeClient::createWindow(Frame& frame, const FrameLoadRequest&, const WindowFeatures& features, const NavigationAction& navigationAction)
+Page* WebChromeClient::createWindow(Frame& frame, const WindowFeatures& features, const NavigationAction& navigationAction)
 {
     COMPtr<IWebUIDelegate> delegate = uiDelegate();
     if (!delegate)

Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.h (258486 => 258487)


--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.h	2020-03-16 02:58:01 UTC (rev 258486)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.h	2020-03-16 07:20:28 UTC (rev 258487)
@@ -60,7 +60,7 @@
     void focusedElementChanged(WebCore::Element*) final;
     void focusedFrameChanged(WebCore::Frame*) final;
 
-    WebCore::Page* createWindow(WebCore::Frame&, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&, const WebCore::NavigationAction&) final;
+    WebCore::Page* createWindow(WebCore::Frame&, const WebCore::WindowFeatures&, const WebCore::NavigationAction&) final;
     void show() final;
 
     bool canRunModal() final;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to