Title: [193380] trunk/Source/WebKit2
Revision
193380
Author
wei...@apple.com
Date
2015-12-03 14:54:40 -0800 (Thu, 03 Dec 2015)

Log Message

It should be possible to use version 6 of the WKPageUIClient without adopting the new createNewPage
https://bugs.webkit.org/show_bug.cgi?id=151826

Reviewed by Anders Carlsson.

* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
Pick which variant of createNewPage to use based on which function pointer is available,
not the version number.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (193379 => 193380)


--- trunk/Source/WebKit2/ChangeLog	2015-12-03 22:47:29 UTC (rev 193379)
+++ trunk/Source/WebKit2/ChangeLog	2015-12-03 22:54:40 UTC (rev 193380)
@@ -1,3 +1,15 @@
+2015-12-03  Sam Weinig  <s...@webkit.org>
+
+        It should be possible to use version 6 of the WKPageUIClient without adopting the new createNewPage
+        https://bugs.webkit.org/show_bug.cgi?id=151826
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageSetPageUIClient):
+        Pick which variant of createNewPage to use based on which function pointer is available,
+        not the version number.
+
 2015-12-03  Anders Carlsson  <ander...@apple.com>
 
         Remove Objective-C GC support

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (193379 => 193380)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2015-12-03 22:47:29 UTC (rev 193379)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2015-12-03 22:54:40 UTC (rev 193380)
@@ -1635,13 +1635,21 @@
     private:
         virtual PassRefPtr<WebPageProxy> createNewPage(WebPageProxy* page, WebFrameProxy* initiatingFrame, const SecurityOriginData& securityOriginData, const ResourceRequest& resourceRequest, const WindowFeatures& windowFeatures, const NavigationActionData& navigationActionData) override
         {
-            if (m_client.base.version < 6) {
-                if (!m_client.base.version && !m_client.createNewPage_deprecatedForUseWithV0)
-                    return nullptr;
+            if (m_client.createNewPage) {
+                auto configuration = page->configuration().copy();
+                configuration->setRelatedPage(page);
 
-                if (!m_client.createNewPage_deprecatedForUseWithV1)
-                    return nullptr;
+                auto sourceFrameInfo = API::FrameInfo::create(*initiatingFrame, securityOriginData.securityOrigin());
 
+                bool shouldOpenAppLinks = !hostsAreEqual(WebCore::URL(WebCore::ParsedURLString, initiatingFrame->url()), resourceRequest.url());
+                auto apiNavigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.ptr(), nullptr, resourceRequest, WebCore::URL(), shouldOpenAppLinks);
+
+                auto apiWindowFeatures = API::WindowFeatures::create(windowFeatures);
+
+                return adoptRef(toImpl(m_client.createNewPage(toAPI(page), toAPI(configuration.ptr()), toAPI(apiNavigationAction.ptr()), toAPI(apiWindowFeatures.ptr()), m_client.base.clientInfo)));
+            }
+        
+            if (m_client.createNewPage_deprecatedForUseWithV1 || m_client.createNewPage_deprecatedForUseWithV0) {
                 API::Dictionary::MapType map;
                 if (windowFeatures.x)
                     map.set("x", API::Double::create(*windowFeatures.x));
@@ -1661,27 +1669,16 @@
                 map.set("dialog", API::Boolean::create(windowFeatures.dialog));
                 Ref<API::Dictionary> featuresMap = API::Dictionary::create(WTF::move(map));
 
-                if (!m_client.base.version)
-                    return adoptRef(toImpl(m_client.createNewPage_deprecatedForUseWithV0(toAPI(page), toAPI(featuresMap.ptr()), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), m_client.base.clientInfo)));
-
-                Ref<API::URLRequest> request = API::URLRequest::create(resourceRequest);
-                return adoptRef(toImpl(m_client.createNewPage_deprecatedForUseWithV1(toAPI(page), toAPI(request.ptr()), toAPI(featuresMap.ptr()), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), m_client.base.clientInfo)));
+                if (m_client.createNewPage_deprecatedForUseWithV1) {
+                    Ref<API::URLRequest> request = API::URLRequest::create(resourceRequest);
+                    return adoptRef(toImpl(m_client.createNewPage_deprecatedForUseWithV1(toAPI(page), toAPI(request.ptr()), toAPI(featuresMap.ptr()), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), m_client.base.clientInfo)));
+                }
+    
+                ASSERT(m_client.createNewPage_deprecatedForUseWithV0);
+                return adoptRef(toImpl(m_client.createNewPage_deprecatedForUseWithV0(toAPI(page), toAPI(featuresMap.ptr()), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), m_client.base.clientInfo)));
             }
 
-            if (!m_client.createNewPage)
-                return nullptr;
-
-            auto configuration = page->configuration().copy();
-            configuration->setRelatedPage(page);
-
-            auto sourceFrameInfo = API::FrameInfo::create(*initiatingFrame, securityOriginData.securityOrigin());
-
-            bool shouldOpenAppLinks = !hostsAreEqual(WebCore::URL(WebCore::ParsedURLString, initiatingFrame->url()), resourceRequest.url());
-            auto apiNavigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.ptr(), nullptr, resourceRequest, WebCore::URL(), shouldOpenAppLinks);
-
-            auto apiWindowFeatures = API::WindowFeatures::create(windowFeatures);
-
-            return adoptRef(toImpl(m_client.createNewPage(toAPI(page), toAPI(configuration.ptr()), toAPI(apiNavigationAction.ptr()), toAPI(apiWindowFeatures.ptr()), m_client.base.clientInfo)));
+            return nullptr;
         }
 
         virtual void showPage(WebPageProxy* page) override
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to