Changeset 163999 in webkit
- Timestamp:
- Feb 12, 2014 4:39:21 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r163997 r163999 1 2014-02-12 Alexey Proskuryakov <ap@apple.com> 2 3 [WK2] Add a C API to get WebCrypto master key from a client 4 https://bugs.webkit.org/show_bug.cgi?id=128702 5 6 Reviewed by Anders Carlsson. 7 8 Added a new version of WKContextClient, with a function that returns the key. 9 10 * UIProcess/API/C/WKContext.h: 11 * UIProcess/WebContextClient.cpp: 12 (WebKit::WebContextClient::copyWebCryptoMasterKey): 13 * UIProcess/WebContextClient.h: 14 * UIProcess/WebPageProxy.cpp: 15 (WebKit::WebPageProxy::wrapCryptoKey): 16 (WebKit::WebPageProxy::unwrapCryptoKey): 17 * UIProcess/mac/WebPageProxyMac.mm: 18 1 19 2014-02-12 Anders Carlsson <andersca@apple.com> 2 20 -
trunk/Source/WebKit2/UIProcess/API/C/WKContext.h
r160940 r163999 48 48 typedef void (*WKContextNetworkProcessDidCrashCallback)(WKContextRef context, const void *clientInfo); 49 49 typedef void (*WKContextPlugInInformationBecameAvailableCallback)(WKContextRef context, WKArrayRef plugIn, const void *clientInfo); 50 typedef WKDataRef (*WKContextCopyWebCryptoMasterKeyCallback)(WKContextRef context, const void *clientInfo); 50 51 51 52 typedef struct WKContextClientBase { … … 63 64 } WKContextClientV0; 64 65 65 enum { kWKContextClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 0 }; 66 typedef struct WKContextClientV1 { 67 WKContextClientBase base; 68 69 // Version 0. 70 WKContextPlugInAutoStartOriginHashesChangedCallback plugInAutoStartOriginHashesChanged; 71 WKContextNetworkProcessDidCrashCallback networkProcessDidCrash; 72 WKContextPlugInInformationBecameAvailableCallback plugInInformationBecameAvailable; 73 74 // Version 1. 75 WKContextCopyWebCryptoMasterKeyCallback copyWebCryptoMasterKey; 76 } WKContextClientV1; 77 78 enum { kWKContextClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 1 }; 66 79 typedef struct WKContextClient { 67 80 int version; -
trunk/Source/WebKit2/UIProcess/WebContextClient.cpp
r159988 r163999 59 59 } 60 60 61 PassRefPtr<API::Data> WebContextClient::copyWebCryptoMasterKey(WebContext* context) 62 { 63 if (!m_client.copyWebCryptoMasterKey) 64 return nullptr; 65 66 return adoptRef(toImpl(m_client.copyWebCryptoMasterKey(toAPI(context), m_client.base.clientInfo))); 67 } 68 61 69 } // namespace WebKit -
trunk/Source/WebKit2/UIProcess/WebContextClient.h
r159994 r163999 1 1 /* 2 * Copyright (C) 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2012, 2014 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 29 29 #include "APIClient.h" 30 #include "APIData.h" 30 31 #include "WKContext.h" 31 32 … … 34 35 35 36 template<> struct ClientTraits<WKContextClientBase> { 36 typedef std::tuple<WKContextClientV0 > Versions;37 typedef std::tuple<WKContextClientV0, WKContextClientV1> Versions; 37 38 }; 38 39 } … … 47 48 void networkProcessDidCrash(WebContext*); 48 49 void plugInInformationBecameAvailable(WebContext*, API::Array*); 50 PassRefPtr<API::Data> copyWebCryptoMasterKey(WebContext*); 49 51 }; 50 52 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r163992 r163999 4484 4484 void WebPageProxy::wrapCryptoKey(const Vector<uint8_t>& key, bool& succeeded, Vector<uint8_t>& wrappedKey) 4485 4485 { 4486 Vector<uint8_t> masterKey(16); 4487 memset(masterKey.data(), 0, masterKey.size()); // FIXME: Not implemented yet, will be getting a key from client. 4486 RefPtr<API::Data> keyData = m_process->context().client().copyWebCryptoMasterKey(&m_process->context()); 4487 if (!keyData) { 4488 succeeded = false; 4489 return; 4490 } 4491 4492 Vector<uint8_t> masterKey = keyData->dataReference().vector(); 4488 4493 succeeded = wrapSerializedCryptoKey(masterKey, key, wrappedKey); 4489 4494 } … … 4491 4496 void WebPageProxy::unwrapCryptoKey(const Vector<uint8_t>& wrappedKey, bool& succeeded, Vector<uint8_t>& key) 4492 4497 { 4493 Vector<uint8_t> masterKey(16); 4494 memset(masterKey.data(), 0, masterKey.size()); // FIXME: Not implemented yet, will be getting a key from client. 4498 RefPtr<API::Data> keyData = m_process->context().client().copyWebCryptoMasterKey(&m_process->context()); 4499 if (!keyData) { 4500 succeeded = false; 4501 return; 4502 } 4503 4504 Vector<uint8_t> masterKey = keyData->dataReference().vector(); 4495 4505 succeeded = unwrapSerializedCryptoKey(masterKey, wrappedKey, key); 4496 4506 } -
trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
r163992 r163999 40 40 #import "TextChecker.h" 41 41 #import "WKBrowsingContextControllerInternal.h" 42 #import "WebContext.h" 42 43 #import "WebPageMessages.h" 43 44 #import "WebProcessProxy.h" -
trunk/Tools/ChangeLog
r163998 r163999 1 2014-02-12 Alexey Proskuryakov <ap@apple.com> 2 3 [WK2] Add a C API to get WebCrypto master key from a client 4 https://bugs.webkit.org/show_bug.cgi?id=128702 5 6 Reviewed by Anders Carlsson. 7 8 * WebKitTestRunner/TestController.cpp: 9 (WTR::copyWebCryptoMasterKey): 10 (WTR::TestController::initialize): 11 Return a hardcoded key. 12 1 13 2014-02-12 David Farler <dfarler@apple.com> 2 14 -
trunk/Tools/WebKitTestRunner/TestController.cpp
r163821 r163999 80 80 static WKURLRef staticBlankURL = WKURLCreateWithUTF8CString("about:blank"); 81 81 return staticBlankURL; 82 } 83 84 static WKDataRef copyWebCryptoMasterKey(WKContextRef, const void*) 85 { 86 // Any 128 bit key would do, all we need for testing is to implement the callback. 87 return WKDataCreate((const uint8_t*)"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", 16); 82 88 } 83 89 … … 336 342 337 343 platformInitializeContext(); 344 345 WKContextClientV1 contextClient = { 346 { 1, this }, 347 nullptr, // plugInAutoStartOriginHashesChanged 348 nullptr, // networkProcessDidCrash, 349 nullptr, // plugInInformationBecameAvailable, 350 copyWebCryptoMasterKey 351 }; 352 WKContextSetClient(m_context.get(), &contextClient.base); 338 353 339 354 WKContextInjectedBundleClientV1 injectedBundleClient = {
Note: See TracChangeset
for help on using the changeset viewer.