Title: [194080] branches/safari-601-branch/Source

Diff

Modified: branches/safari-601-branch/Source/WebCore/platform/URL.cpp (194079 => 194080)


--- branches/safari-601-branch/Source/WebCore/platform/URL.cpp	2015-12-15 00:35:41 UTC (rev 194079)
+++ branches/safari-601-branch/Source/WebCore/platform/URL.cpp	2015-12-15 00:35:44 UTC (rev 194080)
@@ -1597,6 +1597,23 @@
     return true;
 }
 
+bool hostsAreEqual(const URL& a, const URL& b)
+{
+    int hostStartA = a.hostStart();
+    int hostLengthA = a.hostEnd() - hostStartA;
+    int hostStartB = b.hostStart();
+    int hostLengthB = b.hostEnd() - hostStartB;
+    if (hostLengthA != hostLengthB)
+        return false;
+
+    for (int i = 0; i < hostLengthA; ++i) {
+        if (a.string()[hostStartA + i] != b.string()[hostStartB + i])
+            return false;
+    }
+    
+    return true;
+}
+
 String encodeWithURLEscapeSequences(const String& notEncodedString, PercentEncodeCharacterClass whatToEncode)
 {
     CString asUTF8 = notEncodedString.utf8();

Modified: branches/safari-601-branch/Source/WebCore/platform/URL.h (194079 => 194080)


--- branches/safari-601-branch/Source/WebCore/platform/URL.h	2015-12-15 00:35:41 UTC (rev 194079)
+++ branches/safari-601-branch/Source/WebCore/platform/URL.h	2015-12-15 00:35:44 UTC (rev 194080)
@@ -232,6 +232,7 @@
 
 WEBCORE_EXPORT bool equalIgnoringFragmentIdentifier(const URL&, const URL&);
 WEBCORE_EXPORT bool protocolHostAndPortAreEqual(const URL&, const URL&);
+WEBCORE_EXPORT bool hostsAreEqual(const URL&, const URL&);
 
 WEBCORE_EXPORT const URL& blankURL();
 

Modified: branches/safari-601-branch/Source/WebKit2/ChangeLog (194079 => 194080)


--- branches/safari-601-branch/Source/WebKit2/ChangeLog	2015-12-15 00:35:41 UTC (rev 194079)
+++ branches/safari-601-branch/Source/WebKit2/ChangeLog	2015-12-15 00:35:44 UTC (rev 194080)
@@ -1,5 +1,21 @@
 2015-12-08  Harris Papadopoulos  <[email protected]>
 
+        Merge r193380. rdar://problem/23816165
+
+    2015-12-03  Sam Weinig  <[email protected]>
+
+            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-08  Harris Papadopoulos  <[email protected]>
+
         Merge r193367. rdar://problem/23816165
 
     2015-12-03  Sam Weinig  <[email protected]>

Modified: branches/safari-601-branch/Source/WebKit2/UIProcess/API/C/WKPage.cpp (194079 => 194080)


--- branches/safari-601-branch/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2015-12-15 00:35:41 UTC (rev 194079)
+++ branches/safari-601-branch/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2015-12-15 00:35:44 UTC (rev 194080)
@@ -1591,13 +1591,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));
@@ -1617,11 +1625,13 @@
                 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)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to