⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 206684 in webkit


Ignore:
Timestamp:
Sep 30, 2016, 3:38:58 PM (10 years ago)
Author:
beidson@apple.com
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.

Location:
trunk/Source/WebKit2
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r206683 r206684  
     12016-09-30  Brady Eidson  <beidson@apple.com>
     2
     3        REGRESSION (Safari 10 combined with WK changes): Unable to store WebCrypto keys in IndexedDB database.
     4        <rdar://problem/28334440> and https://bugs.webkit.org/show_bug.cgi?id=162554
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Safari 10 has a WKPageNavigation client but does not implement the "copyWebCryptoMasterKey" callback.
     9
     10        WebKit just fails in this case, instead of falling back to "getDefaultWebCryptoMasterKey".
     11        It should fall back.
     12
     13        Additionally there's a WKContextClient callback to get the crypto key, also, but it is completely unused.
     14        So it should be pulled.
     15
     16        * UIProcess/API/APILoaderClient.h:
     17        (API::LoaderClient::webCryptoMasterKey): Deleted.
     18        * UIProcess/API/C/WKContext.h:
     19
     20        * UIProcess/API/C/WKPage.cpp:
     21        (WKPageSetPageLoaderClient):
     22        (WKPageSetPageNavigationClient): If the client doesn't implement this method, fallback to getDefaultWebCryptoMasterKey.
     23
     24        * UIProcess/Cocoa/NavigationState.mm:
     25        (WebKit::NavigationState::NavigationClient::webCryptoMasterKey): If the client doesn't implement this method,
     26          fallback to getDefaultWebCryptoMasterKey.
     27
     28        * UIProcess/WebContextClient.cpp:
     29        (WebKit::WebContextClient::copyWebCryptoMasterKey): Deleted.
     30        * UIProcess/WebContextClient.h:
     31
     32        * UIProcess/WebPageProxy.cpp:
     33        (WebKit::WebPageProxy::wrapCryptoKey): Only ask the NavigationClient before falling back. Don't ask the loader client.
     34        (WebKit::WebPageProxy::unwrapCryptoKey): Ditto.
     35
    1362016-09-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
    237
  • trunk/Source/WebKit2/UIProcess/API/APILoaderClient.h

    r204637 r206684  
    9494    virtual void willGoToBackForwardListItem(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem*, API::Object*) { }
    9595
    96     virtual RefPtr<Data> webCryptoMasterKey(WebKit::WebPageProxy&) { return nullptr; }
    97 
    9896    virtual void didNavigateWithNavigationData(WebKit::WebPageProxy&, const WebKit::WebNavigationDataStore&, WebKit::WebFrameProxy&) { }
    9997    virtual void didPerformClientRedirect(WebKit::WebPageProxy&, const WTF::String&, const WTF::String&, WebKit::WebFrameProxy&) { }
  • trunk/Source/WebKit2/UIProcess/API/C/WKContext.h

    r196942 r206684  
    7676
    7777    // Version 1.
    78     WKContextCopyWebCryptoMasterKeyCallback                             copyWebCryptoMasterKey;
     78    void                                                                (*copyWebCryptoMasterKey_unavailable)(void);
    7979} WKContextClientV1;
    8080
    … …  
    8888
    8989    // Version 1.
    90     WKContextCopyWebCryptoMasterKeyCallback                             copyWebCryptoMasterKey;
     90    void                                                                (*copyWebCryptoMasterKey_unavailable)(void);
    9191
    9292    // Version 2.
  • trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp

    r205822 r206684  
    7373#include <WebCore/Page.h>
    7474#include <WebCore/SecurityOriginData.h>
     75#include <WebCore/SerializedCryptoKeyWrap.h>
    7576#include <WebCore/WindowFeatures.h>
    7677
    … …  
    12141215            if (m_client.willGoToBackForwardListItem)
    12151216                m_client.willGoToBackForwardListItem(toAPI(&page), toAPI(item), toAPI(userData), m_client.base.clientInfo);
    1216         }
    1217 
    1218         RefPtr<API::Data> webCryptoMasterKey(WebPageProxy& page) override
    1219         {
    1220             return page.process().processPool().client().copyWebCryptoMasterKey(&page.process().processPool());
    12211217        }
    12221218
    … …  
    23282324        RefPtr<API::Data> webCryptoMasterKey(WebPageProxy& page) override
    23292325        {
    2330             if (!m_client.copyWebCryptoMasterKey)
     2326            if (m_client.copyWebCryptoMasterKey)
     2327                return adoptRef(toImpl(m_client.copyWebCryptoMasterKey(toAPI(&page), m_client.base.clientInfo)));
     2328
     2329            Vector<uint8_t> masterKey;
     2330            if (!getDefaultWebCryptoMasterKey(masterKey))
    23312331                return nullptr;
    2332             return adoptRef(toImpl(m_client.copyWebCryptoMasterKey(toAPI(&page), m_client.base.clientInfo)));
     2332
     2333            return API::Data::create(masterKey.data(), masterKey.size());
    23332334        }
    23342335
  • trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm

    r205275 r206684  
    6565#import <WebCore/Credential.h>
    6666#import <WebCore/SecurityOriginData.h>
     67#import <WebCore/SerializedCryptoKeyWrap.h>
    6768#import <WebCore/URL.h>
    6869#import <wtf/NeverDestroyed.h>
    … …  
    720721RefPtr<API::Data> NavigationState::NavigationClient::webCryptoMasterKey(WebKit::WebPageProxy&)
    721722{
    722     if (!m_navigationState.m_navigationDelegateMethods.webCryptoMasterKeyForWebView)
    723         return nullptr;
     723    if (!m_navigationState.m_navigationDelegateMethods.webCryptoMasterKeyForWebView) {
     724        Vector<uint8_t> masterKey;
     725        if (!getDefaultWebCryptoMasterKey(masterKey))
     726            return nullptr;
     727
     728        return API::Data::create(masterKey.data(), masterKey.size());
     729    }
    724730
    725731    auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
  • trunk/Source/WebKit2/UIProcess/WebContextClient.cpp

    r204317 r206684  
    2727#include "WebContextClient.h"
    2828
    29 #include "APIArray.h"
    3029#include "WebProcessPool.h"
    3130
    … …  
    5655}
    5756
    58 PassRefPtr<API::Data> WebContextClient::copyWebCryptoMasterKey(WebProcessPool* processPool)
    59 {
    60     if (!m_client.copyWebCryptoMasterKey)
    61         return nullptr;
    62 
    63     return adoptRef(toImpl(m_client.copyWebCryptoMasterKey(toAPI(processPool), m_client.base.clientInfo)));
    64 }
    65 
    6657} // namespace WebKit
  • trunk/Source/WebKit2/UIProcess/WebContextClient.h

    r204317 r206684  
    3232
    3333namespace API {
    34 class Array;
    35 
    3634template<> struct ClientTraits<WKContextClientBase> {
    3735    typedef std::tuple<WKContextClientV0, WKContextClientV1, WKContextClientV2> Versions;
    … …  
    4947    void networkProcessDidCrash(WebProcessPool*);
    5048    void databaseProcessDidCrash(WebProcessPool*);
    51     PassRefPtr<API::Data> copyWebCryptoMasterKey(WebProcessPool*);
    5249};
    5350
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r206527 r206684  
    61466146        if (RefPtr<API::Data> keyData = m_navigationClient->webCryptoMasterKey(*this))
    61476147            masterKey = keyData->dataReference().vector();
    6148     } else if (RefPtr<API::Data> keyData = m_loaderClient->webCryptoMasterKey(*this))
    6149         masterKey = keyData->dataReference().vector();
    6150     else if (!getDefaultWebCryptoMasterKey(masterKey)) {
     6148    } else if (!getDefaultWebCryptoMasterKey(masterKey)) {
    61516149        succeeded = false;
    61526150        return;
    … …  
    61656163        if (RefPtr<API::Data> keyData = m_navigationClient->webCryptoMasterKey(*this))
    61666164            masterKey = keyData->dataReference().vector();
    6167     } else if (RefPtr<API::Data> keyData = m_loaderClient->webCryptoMasterKey(*this))
    6168         masterKey = keyData->dataReference().vector();
    6169     else if (!getDefaultWebCryptoMasterKey(masterKey)) {
     6165    } else if (!getDefaultWebCryptoMasterKey(masterKey)) {
    61706166        succeeded = false;
    61716167        return;
Note: See TracChangeset for help on using the changeset viewer.