- Revision
- 206684
- Author
- [email protected]
- Date
- 2016-09-30 15:38:58 -0700 (Fri, 30 Sep 2016)
Log Message
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.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (206683 => 206684)
--- trunk/Source/WebKit2/ChangeLog 2016-09-30 22:30:20 UTC (rev 206683)
+++ trunk/Source/WebKit2/ChangeLog 2016-09-30 22:38:58 UTC (rev 206684)
@@ -1,3 +1,38 @@
+2016-09-30 Brady Eidson <[email protected]>
+
+ 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-09-30 Said Abou-Hallawa <[email protected]>
The dragged image should be the current frame only of the animated image
Modified: trunk/Source/WebKit2/UIProcess/API/APILoaderClient.h (206683 => 206684)
--- trunk/Source/WebKit2/UIProcess/API/APILoaderClient.h 2016-09-30 22:30:20 UTC (rev 206683)
+++ trunk/Source/WebKit2/UIProcess/API/APILoaderClient.h 2016-09-30 22:38:58 UTC (rev 206684)
@@ -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: trunk/Source/WebKit2/UIProcess/API/C/WKContext.h (206683 => 206684)
--- trunk/Source/WebKit2/UIProcess/API/C/WKContext.h 2016-09-30 22:30:20 UTC (rev 206683)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContext.h 2016-09-30 22:38:58 UTC (rev 206684)
@@ -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: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (206683 => 206684)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2016-09-30 22:30:20 UTC (rev 206683)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2016-09-30 22:38:58 UTC (rev 206684)
@@ -72,6 +72,7 @@
#include "WebProtectionSpace.h"
#include <WebCore/Page.h>
#include <WebCore/SecurityOriginData.h>
+#include <WebCore/SerializedCryptoKeyWrap.h>
#include <WebCore/WindowFeatures.h>
#ifdef __BLOCKS__
@@ -1215,11 +1216,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)
@@ -2327,9 +2323,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: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm (206683 => 206684)
--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm 2016-09-30 22:30:20 UTC (rev 206683)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm 2016-09-30 22:38:58 UTC (rev 206684)
@@ -64,6 +64,7 @@
#import "_WKSameDocumentNavigationTypeInternal.h"
#import <WebCore/Credential.h>
#import <WebCore/SecurityOriginData.h>
+#import <WebCore/SerializedCryptoKeyWrap.h>
#import <WebCore/URL.h>
#import <wtf/NeverDestroyed.h>
@@ -719,9 +720,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: trunk/Source/WebKit2/UIProcess/WebContextClient.cpp (206683 => 206684)
--- trunk/Source/WebKit2/UIProcess/WebContextClient.cpp 2016-09-30 22:30:20 UTC (rev 206683)
+++ trunk/Source/WebKit2/UIProcess/WebContextClient.cpp 2016-09-30 22:38:58 UTC (rev 206684)
@@ -26,7 +26,6 @@
#include "config.h"
#include "WebContextClient.h"
-#include "APIArray.h"
#include "WebProcessPool.h"
namespace WebKit {
@@ -55,12 +54,4 @@
m_client.databaseProcessDidCrash(toAPI(processPool), 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: trunk/Source/WebKit2/UIProcess/WebContextClient.h (206683 => 206684)
--- trunk/Source/WebKit2/UIProcess/WebContextClient.h 2016-09-30 22:30:20 UTC (rev 206683)
+++ trunk/Source/WebKit2/UIProcess/WebContextClient.h 2016-09-30 22:38:58 UTC (rev 206684)
@@ -31,8 +31,6 @@
#include "WKContext.h"
namespace API {
-class Array;
-
template<> struct ClientTraits<WKContextClientBase> {
typedef std::tuple<WKContextClientV0, WKContextClientV1, WKContextClientV2> Versions;
};
@@ -48,7 +46,6 @@
void plugInAutoStartOriginHashesChanged(WebProcessPool*);
void networkProcessDidCrash(WebProcessPool*);
void databaseProcessDidCrash(WebProcessPool*);
- PassRefPtr<API::Data> copyWebCryptoMasterKey(WebProcessPool*);
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (206683 => 206684)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-09-30 22:30:20 UTC (rev 206683)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-09-30 22:38:58 UTC (rev 206684)
@@ -6145,9 +6145,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;
}
@@ -6164,9 +6162,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;
}