Title: [207993] branches/safari-602-branch/Source/WebKit2

Diff

Modified: branches/safari-602-branch/Source/WebKit2/ChangeLog (207992 => 207993)


--- branches/safari-602-branch/Source/WebKit2/ChangeLog	2016-10-27 18:14:12 UTC (rev 207992)
+++ branches/safari-602-branch/Source/WebKit2/ChangeLog	2016-10-27 18:16:22 UTC (rev 207993)
@@ -1,3 +1,42 @@
+2016-10-27  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r206684. rdar://problem/28545011
+
+    2016-09-30  Brady Eidson  <beid...@apple.com>
+
+            REGRESSION (Safari 10 combined with WK changes): Unable to store WebCrypto keys in IndexedDB database.
+            <rdar://problem/28334440> and https://bugs.webkit.org/show_bug.cgi?id=162554
+
+            Reviewed by Alexey Proskuryakov.
+
+            Safari 10 has a WKPageNavigation client but does not implement the "copyWebCryptoMasterKey" callback.
+
+            WebKit just fails in this case, instead of falling back to "getDefaultWebCryptoMasterKey".
+            It should fall back.
+
+            Additionally there's a WKContextClient callback to get the crypto key, also, but it is completely unused.
+            So it should be pulled.
+
+            * UIProcess/API/APILoaderClient.h:
+            (API::LoaderClient::webCryptoMasterKey): Deleted.
+            * UIProcess/API/C/WKContext.h:
+
+            * UIProcess/API/C/WKPage.cpp:
+            (WKPageSetPageLoaderClient):
+            (WKPageSetPageNavigationClient): If the client doesn't implement this method, fallback to getDefaultWebCryptoMasterKey.
+
+            * UIProcess/Cocoa/NavigationState.mm:
+            (WebKit::NavigationState::NavigationClient::webCryptoMasterKey): If the client doesn't implement this method,
+              fallback to getDefaultWebCryptoMasterKey.
+
+            * UIProcess/WebContextClient.cpp:
+            (WebKit::WebContextClient::copyWebCryptoMasterKey): Deleted.
+            * UIProcess/WebContextClient.h:
+
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::wrapCryptoKey): Only ask the NavigationClient before falling back. Don't ask the loader client.
+            (WebKit::WebPageProxy::unwrapCryptoKey): Ditto.
+
 2016-10-26  David Kilzer  <ddkil...@apple.com>
 
         Merge r207708. rdar://problem/28962914

Modified: branches/safari-602-branch/Source/WebKit2/UIProcess/API/APILoaderClient.h (207992 => 207993)


--- branches/safari-602-branch/Source/WebKit2/UIProcess/API/APILoaderClient.h	2016-10-27 18:14:12 UTC (rev 207992)
+++ branches/safari-602-branch/Source/WebKit2/UIProcess/API/APILoaderClient.h	2016-10-27 18:16:22 UTC (rev 207993)
@@ -93,8 +93,6 @@
     virtual bool shouldKeepCurrentBackForwardListItemInList(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem*) { return true; }
     virtual void willGoToBackForwardListItem(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem*, API::Object*) { }
 
-    virtual RefPtr<Data> webCryptoMasterKey(WebKit::WebPageProxy&) { return nullptr; }
-
     virtual void didNavigateWithNavigationData(WebKit::WebPageProxy&, const WebKit::WebNavigationDataStore&, WebKit::WebFrameProxy&) { }
     virtual void didPerformClientRedirect(WebKit::WebPageProxy&, const WTF::String&, const WTF::String&, WebKit::WebFrameProxy&) { }
     virtual void didPerformServerRedirect(WebKit::WebPageProxy&, const WTF::String&, const WTF::String&, WebKit::WebFrameProxy&) { }

Modified: branches/safari-602-branch/Source/WebKit2/UIProcess/API/C/WKContext.h (207992 => 207993)


--- branches/safari-602-branch/Source/WebKit2/UIProcess/API/C/WKContext.h	2016-10-27 18:14:12 UTC (rev 207992)
+++ branches/safari-602-branch/Source/WebKit2/UIProcess/API/C/WKContext.h	2016-10-27 18:16:22 UTC (rev 207993)
@@ -75,7 +75,7 @@
     WKContextPlugInInformationBecameAvailableCallback                   plugInInformationBecameAvailable;
 
     // Version 1.
-    WKContextCopyWebCryptoMasterKeyCallback                             copyWebCryptoMasterKey;
+    void                                                                (*copyWebCryptoMasterKey_unavailable)(void);
 } WKContextClientV1;
 
 typedef struct WKContextClientV2 {
@@ -87,7 +87,7 @@
     WKContextPlugInInformationBecameAvailableCallback                   plugInInformationBecameAvailable;
 
     // Version 1.
-    WKContextCopyWebCryptoMasterKeyCallback                             copyWebCryptoMasterKey;
+    void                                                                (*copyWebCryptoMasterKey_unavailable)(void);
 
     // Version 2.
     WKContextDatabaseProcessDidCrashCallback                            databaseProcessDidCrash;

Modified: branches/safari-602-branch/Source/WebKit2/UIProcess/API/C/WKPage.cpp (207992 => 207993)


--- branches/safari-602-branch/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2016-10-27 18:14:12 UTC (rev 207992)
+++ branches/safari-602-branch/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2016-10-27 18:16:22 UTC (rev 207993)
@@ -71,6 +71,7 @@
 #include "WebProtectionSpace.h"
 #include <WebCore/Page.h>
 #include <WebCore/SecurityOriginData.h>
+#include <WebCore/SerializedCryptoKeyWrap.h>
 #include <WebCore/WindowFeatures.h>
 
 #ifdef __BLOCKS__
@@ -1214,11 +1215,6 @@
                 m_client.willGoToBackForwardListItem(toAPI(&page), toAPI(item), toAPI(userData), m_client.base.clientInfo);
         }
 
-        RefPtr<API::Data> webCryptoMasterKey(WebPageProxy& page) override
-        {
-            return page.process().processPool().client().copyWebCryptoMasterKey(&page.process().processPool());
-        }
-
         void navigationGestureDidBegin(WebPageProxy& page) override
         {
             if (m_client.navigationGestureDidBegin)
@@ -2326,9 +2322,14 @@
 
         RefPtr<API::Data> webCryptoMasterKey(WebPageProxy& page) override
         {
-            if (!m_client.copyWebCryptoMasterKey)
+            if (m_client.copyWebCryptoMasterKey)
+                return adoptRef(toImpl(m_client.copyWebCryptoMasterKey(toAPI(&page), m_client.base.clientInfo)));
+
+            Vector<uint8_t> masterKey;
+            if (!getDefaultWebCryptoMasterKey(masterKey))
                 return nullptr;
-            return adoptRef(toImpl(m_client.copyWebCryptoMasterKey(toAPI(&page), m_client.base.clientInfo)));
+
+            return API::Data::create(masterKey.data(), masterKey.size());
         }
 
         void didBeginNavigationGesture(WebPageProxy& page) override

Modified: branches/safari-602-branch/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm (207992 => 207993)


--- branches/safari-602-branch/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm	2016-10-27 18:14:12 UTC (rev 207992)
+++ branches/safari-602-branch/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm	2016-10-27 18:16:22 UTC (rev 207993)
@@ -63,6 +63,7 @@
 #import "_WKSameDocumentNavigationTypeInternal.h"
 #import <WebCore/Credential.h>
 #import <WebCore/SecurityOriginData.h>
+#import <WebCore/SerializedCryptoKeyWrap.h>
 #import <WebCore/URL.h>
 #import <wtf/NeverDestroyed.h>
 
@@ -715,9 +716,14 @@
 
 RefPtr<API::Data> NavigationState::NavigationClient::webCryptoMasterKey(WebKit::WebPageProxy&)
 {
-    if (!m_navigationState.m_navigationDelegateMethods.webCryptoMasterKeyForWebView)
-        return nullptr;
+    if (!m_navigationState.m_navigationDelegateMethods.webCryptoMasterKeyForWebView) {
+        Vector<uint8_t> masterKey;
+        if (!getDefaultWebCryptoMasterKey(masterKey))
+            return nullptr;
 
+        return API::Data::create(masterKey.data(), masterKey.size());
+    }
+
     auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
     if (!navigationDelegate)
         return nullptr;

Modified: branches/safari-602-branch/Source/WebKit2/UIProcess/WebContextClient.cpp (207992 => 207993)


--- branches/safari-602-branch/Source/WebKit2/UIProcess/WebContextClient.cpp	2016-10-27 18:14:12 UTC (rev 207992)
+++ branches/safari-602-branch/Source/WebKit2/UIProcess/WebContextClient.cpp	2016-10-27 18:16:22 UTC (rev 207993)
@@ -65,13 +65,5 @@
 
     m_client.plugInInformationBecameAvailable(toAPI(processPool), toAPI(plugInInfo), m_client.base.clientInfo);
 }
-
-PassRefPtr<API::Data> WebContextClient::copyWebCryptoMasterKey(WebProcessPool* processPool)
-{
-    if (!m_client.copyWebCryptoMasterKey)
-        return nullptr;
-
-    return adoptRef(toImpl(m_client.copyWebCryptoMasterKey(toAPI(processPool), m_client.base.clientInfo)));
-}
-
+    
 } // namespace WebKit

Modified: branches/safari-602-branch/Source/WebKit2/UIProcess/WebContextClient.h (207992 => 207993)


--- branches/safari-602-branch/Source/WebKit2/UIProcess/WebContextClient.h	2016-10-27 18:14:12 UTC (rev 207992)
+++ branches/safari-602-branch/Source/WebKit2/UIProcess/WebContextClient.h	2016-10-27 18:16:22 UTC (rev 207993)
@@ -49,7 +49,6 @@
     void networkProcessDidCrash(WebProcessPool*);
     void databaseProcessDidCrash(WebProcessPool*);
     void plugInInformationBecameAvailable(WebProcessPool*, API::Array*);
-    PassRefPtr<API::Data> copyWebCryptoMasterKey(WebProcessPool*);
 };
 
 } // namespace WebKit

Modified: branches/safari-602-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (207992 => 207993)


--- branches/safari-602-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-10-27 18:14:12 UTC (rev 207992)
+++ branches/safari-602-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-10-27 18:16:22 UTC (rev 207993)
@@ -6064,9 +6064,7 @@
     if (m_navigationClient) {
         if (RefPtr<API::Data> keyData = m_navigationClient->webCryptoMasterKey(*this))
             masterKey = keyData->dataReference().vector();
-    } else if (RefPtr<API::Data> keyData = m_loaderClient->webCryptoMasterKey(*this))
-        masterKey = keyData->dataReference().vector();
-    else if (!getDefaultWebCryptoMasterKey(masterKey)) {
+    } else if (!getDefaultWebCryptoMasterKey(masterKey)) {
         succeeded = false;
         return;
     }
@@ -6083,9 +6081,7 @@
     if (m_navigationClient) {
         if (RefPtr<API::Data> keyData = m_navigationClient->webCryptoMasterKey(*this))
             masterKey = keyData->dataReference().vector();
-    } else if (RefPtr<API::Data> keyData = m_loaderClient->webCryptoMasterKey(*this))
-        masterKey = keyData->dataReference().vector();
-    else if (!getDefaultWebCryptoMasterKey(masterKey)) {
+    } else if (!getDefaultWebCryptoMasterKey(masterKey)) {
         succeeded = false;
         return;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to