<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[163863] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/163863">163863</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2014-02-10 22:32:39 -0800 (Mon, 10 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add hooks for wrapping CryptoKeys in SerializedScriptValue
https://bugs.webkit.org/show_bug.cgi?id=128567
Reviewed by Anders Carlsson.
Source/WebCore:
* bindings/js/SerializedScriptValue.cpp: Changed SerializedScriptValue to serialize
wrapped keys. Added a version number to crypto key serialization.
* dom/Document.cpp:
(WebCore::Document::wrapCryptoKey):
(WebCore::Document::unwrapCryptoKey):
* dom/Document.h:
* dom/ScriptExecutionContext.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::wrapCryptoKey):
(WebCore::ChromeClient::unwrapCryptoKey):
Hand wrapping/unwrapping over to client code.
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::wrapCryptoKey):
(WebCore::WorkerGlobalScope::unwrapCryptoKey):
* workers/WorkerGlobalScope.h:
Not implemented in workers. SubtleCrypto is currently not exposed in workers. It used
to be possible in WebKit implementation to post a CryptoKey to a worker anyway,
but this doesn't work any more.
Source/WebKit/mac:
* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::wrapCryptoKey):
(WebChromeClient::unwrapCryptoKey):
Dummy implementation, to be filled in later.
Source/WebKit2:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::wrapCryptoKey):
(WebKit::WebPageProxy::unwrapCryptoKey):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::wrapCryptoKey):
(WebKit::WebChromeClient::unwrapCryptoKey):
* WebProcess/WebCoreSupport/WebChromeClient.h:
Dummy implementation, to be filled in later.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsSerializedScriptValuecpp">trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
<li><a href="#trunkSourceWebCoredomScriptExecutionContexth">trunk/Source/WebCore/dom/ScriptExecutionContext.h</a></li>
<li><a href="#trunkSourceWebCorepageChromeClienth">trunk/Source/WebCore/page/ChromeClient.h</a></li>
<li><a href="#trunkSourceWebCoreworkersWorkerGlobalScopecpp">trunk/Source/WebCore/workers/WorkerGlobalScope.cpp</a></li>
<li><a href="#trunkSourceWebCoreworkersWorkerGlobalScopeh">trunk/Source/WebCore/workers/WorkerGlobalScope.h</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebChromeClienth">trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebChromeClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxymessagesin">trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163862 => 163863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-11 06:21:41 UTC (rev 163862)
+++ trunk/Source/WebCore/ChangeLog        2014-02-11 06:32:39 UTC (rev 163863)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2014-02-10 Alexey Proskuryakov <ap@apple.com>
+
+ Add hooks for wrapping CryptoKeys in SerializedScriptValue
+ https://bugs.webkit.org/show_bug.cgi?id=128567
+
+ Reviewed by Anders Carlsson.
+
+ * bindings/js/SerializedScriptValue.cpp: Changed SerializedScriptValue to serialize
+ wrapped keys. Added a version number to crypto key serialization.
+
+ * dom/Document.cpp:
+ (WebCore::Document::wrapCryptoKey):
+ (WebCore::Document::unwrapCryptoKey):
+ * dom/Document.h:
+ * dom/ScriptExecutionContext.h:
+ * page/ChromeClient.h:
+ (WebCore::ChromeClient::wrapCryptoKey):
+ (WebCore::ChromeClient::unwrapCryptoKey):
+ Hand wrapping/unwrapping over to client code.
+
+ * workers/WorkerGlobalScope.cpp:
+ (WebCore::WorkerGlobalScope::wrapCryptoKey):
+ (WebCore::WorkerGlobalScope::unwrapCryptoKey):
+ * workers/WorkerGlobalScope.h:
+ Not implemented in workers. SubtleCrypto is currently not exposed in workers. It used
+ to be possible in WebKit implementation to post a CryptoKey to a worker anyway,
+ but this doesn't work any more.
+
</ins><span class="cx"> 2014-02-10 ChangSeok Oh <changseok.oh@collabora.com>
</span><span class="cx">
</span><span class="cx"> Support ANGLE_instanced_arrays for linux
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsSerializedScriptValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (163862 => 163863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp        2014-02-11 06:21:41 UTC (rev 163862)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp        2014-02-11 06:32:39 UTC (rev 163863)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx"> #include "JSMessagePort.h"
</span><span class="cx"> #include "JSNavigator.h"
</span><span class="cx"> #include "NotImplemented.h"
</span><ins>+#include "ScriptExecutionContext.h"
</ins><span class="cx"> #include "SharedBuffer.h"
</span><span class="cx"> #include "WebCoreJSClientData.h"
</span><span class="cx"> #include <limits>
</span><span class="lines">@@ -166,6 +167,8 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx">
</span><ins>+const uint32_t currentKeyFormatVersion = 1;
+
</ins><span class="cx"> enum class CryptoKeyClassSubtag {
</span><span class="cx"> HMAC = 0,
</span><span class="cx"> AES = 1,
</span><span class="lines">@@ -293,8 +296,12 @@
</span><span class="cx"> * | ArrayBuffer
</span><span class="cx"> * | ArrayBufferViewTag ArrayBufferViewSubtag <byteOffset:uint32_t> <byteLength:uint32_t> (ArrayBuffer | ObjectReference)
</span><span class="cx"> * | ArrayBufferTransferTag <value:uint32_t>
</span><del>- * | CryptoKeyTag <extractable:int32_t> <usagesCount:uint32_t> <usages:byte{usagesCount}> CryptoKeyClassSubtag (CryptoKeyHMAC | CryptoKeyAES | CryptoKeyRSA)
</del><ins>+ * | CryptoKeyTag <wrappedKeyLength:uint32_t> <factor:byte{wrappedKeyLength}>
</ins><span class="cx"> *
</span><ins>+ * Inside wrapped crypto key, data is serialized in this format:
+ *
+ * <keyFormatVersion:uint32_t> <extractable:int32_t> <usagesCount:uint32_t> <usages:byte{usagesCount}> CryptoKeyClassSubtag (CryptoKeyHMAC | CryptoKeyAES | CryptoKeyRSA)
+ *
</ins><span class="cx"> * String :-
</span><span class="cx"> * EmptyStringTag
</span><span class="cx"> * StringTag StringData
</span><span class="lines">@@ -386,6 +393,24 @@
</span><span class="cx"> MarkedArgumentBuffer m_gcBuffer;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+#if ENABLE(SUBTLE_CRYPTO)
+static bool wrapCryptoKey(ExecState* exec, const Vector<uint8_t>& key, Vector<uint8_t>& wrappedKey)
+{
+ ScriptExecutionContext* scriptExecutionContext = scriptExecutionContextFromExecState(exec);
+ if (!scriptExecutionContext)
+ return false;
+ return scriptExecutionContext->wrapCryptoKey(key, wrappedKey);
+}
+
+static bool unwrapCryptoKey(ExecState* exec, const Vector<uint8_t>& wrappedKey, Vector<uint8_t>& key)
+{
+ ScriptExecutionContext* scriptExecutionContext = scriptExecutionContextFromExecState(exec);
+ if (!scriptExecutionContext)
+ return false;
+ return scriptExecutionContext->unwrapCryptoKey(wrappedKey, key);
+}
+#endif
+
</ins><span class="cx"> #if ASSUME_LITTLE_ENDIAN
</span><span class="cx"> template <typename T> static void writeLittleEndian(Vector<uint8_t>& buffer, T value)
</span><span class="cx"> {
</span><span class="lines">@@ -830,7 +855,14 @@
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> if (CryptoKey* key = toCryptoKey(obj)) {
</span><span class="cx"> write(CryptoKeyTag);
</span><del>- write(key);
</del><ins>+ Vector<uint8_t> serializedKey;
+ Vector<String> dummyBlobURLs;
+ CloneSerializer rawKeySerializer(m_exec, nullptr, nullptr, dummyBlobURLs, serializedKey);
+ rawKeySerializer.write(key);
+ Vector<uint8_t> wrappedKey;
+ if (!wrapCryptoKey(m_exec, serializedKey, wrappedKey))
+ return false;
+ write(wrappedKey);
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="lines">@@ -1095,6 +1127,8 @@
</span><span class="cx">
</span><span class="cx"> void write(const CryptoKey* key)
</span><span class="cx"> {
</span><ins>+ write(currentKeyFormatVersion);
+
</ins><span class="cx"> write(key->extractable());
</span><span class="cx">
</span><span class="cx"> CryptoKeyUsage usages = key->usagesBitmap();
</span><span class="lines">@@ -1989,6 +2023,10 @@
</span><span class="cx">
</span><span class="cx"> bool readCryptoKey(JSValue& cryptoKey)
</span><span class="cx"> {
</span><ins>+ uint32_t keyFormatVersion;
+ if (!read(keyFormatVersion) || keyFormatVersion > currentKeyFormatVersion)
+ return false;
+
</ins><span class="cx"> int32_t extractable;
</span><span class="cx"> if (!read(extractable))
</span><span class="cx"> return false;
</span><span class="lines">@@ -2260,8 +2298,19 @@
</span><span class="cx"> }
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> case CryptoKeyTag: {
</span><ins>+ Vector<uint8_t> wrappedKey;
+ if (!read(wrappedKey)) {
+ fail();
+ return JSValue();
+ }
+ Vector<uint8_t> serializedKey;
+ if (!unwrapCryptoKey(m_exec, wrappedKey, serializedKey)) {
+ fail();
+ return JSValue();
+ }
</ins><span class="cx"> JSValue cryptoKey;
</span><del>- if (!readCryptoKey(cryptoKey)) {
</del><ins>+ CloneDeserializer rawKeyDeserializer(m_exec, m_globalObject, nullptr, nullptr, serializedKey);
+ if (!rawKeyDeserializer.readCryptoKey(cryptoKey)) {
</ins><span class="cx"> fail();
</span><span class="cx"> return JSValue();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (163862 => 163863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2014-02-11 06:21:41 UTC (rev 163862)
+++ trunk/Source/WebCore/dom/Document.cpp        2014-02-11 06:32:39 UTC (rev 163863)
</span><span class="lines">@@ -5994,4 +5994,22 @@
</span><span class="cx"> m_hasInjectedPlugInsScript = true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if ENABLE(SUBTLE_CRYPTO)
+bool Document::wrapCryptoKey(const Vector<uint8_t>& key, Vector<uint8_t>& wrappedKey)
+{
+ Page* page = this->page();
+ if (!page)
+ return false;
+ return page->chrome().client().wrapCryptoKey(key, wrappedKey);
+}
+
+bool Document::unwrapCryptoKey(const Vector<uint8_t>& wrappedKey, Vector<uint8_t>& key)
+{
+ Page* page = this->page();
+ if (!page)
+ return false;
+ return page->chrome().client().unwrapCryptoKey(wrappedKey, key);
+}
+#endif // ENABLE(SUBTLE_CRYPTO)
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (163862 => 163863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2014-02-11 06:21:41 UTC (rev 163862)
+++ trunk/Source/WebCore/dom/Document.h        2014-02-11 06:32:39 UTC (rev 163863)
</span><span class="lines">@@ -1226,6 +1226,11 @@
</span><span class="cx">
</span><span class="cx"> void setVisualUpdatesAllowedByClient(bool);
</span><span class="cx">
</span><ins>+#if ENABLE(SUBTLE_CRYPTO)
+ virtual bool wrapCryptoKey(const Vector<uint8_t>& key, Vector<uint8_t>& wrappedKey) override;
+ virtual bool unwrapCryptoKey(const Vector<uint8_t>& wrappedKey, Vector<uint8_t>& key) override;
+#endif
+
</ins><span class="cx"> protected:
</span><span class="cx"> enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 << 1 };
</span><span class="cx"> Document(Frame*, const URL&, unsigned = DefaultDocumentClass, unsigned constructionFlags = 0);
</span></span></pre></div>
<a id="trunkSourceWebCoredomScriptExecutionContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.h (163862 => 163863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ScriptExecutionContext.h        2014-02-11 06:21:41 UTC (rev 163862)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.h        2014-02-11 06:32:39 UTC (rev 163863)
</span><span class="lines">@@ -88,6 +88,7 @@
</span><span class="cx"> #if ENABLE(BLOB)
</span><span class="cx"> PublicURLManager& publicURLManager();
</span><span class="cx"> #endif
</span><ins>+
</ins><span class="cx"> // Active objects are not garbage collected even if inaccessible, e.g. because their activity may result in callbacks being invoked.
</span><span class="cx"> bool canSuspendActiveDOMObjects();
</span><span class="cx"> // Active objects can be asked to suspend even if canSuspendActiveDOMObjects() returns 'false' -
</span><span class="lines">@@ -157,6 +158,11 @@
</span><span class="cx"> void setDatabaseContext(DatabaseContext*);
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if ENABLE(SUBTLE_CRYPTO)
+ virtual bool wrapCryptoKey(const Vector<uint8_t>& key, Vector<uint8_t>& wrappedKey) = 0;
+ virtual bool unwrapCryptoKey(const Vector<uint8_t>& wrappedKey, Vector<uint8_t>& key) = 0;
+#endif
+
</ins><span class="cx"> protected:
</span><span class="cx"> class AddConsoleMessageTask : public Task {
</span><span class="cx"> public:
</span></span></pre></div>
<a id="trunkSourceWebCorepageChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ChromeClient.h (163862 => 163863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ChromeClient.h        2014-02-11 06:21:41 UTC (rev 163862)
+++ trunk/Source/WebCore/page/ChromeClient.h        2014-02-11 06:32:39 UTC (rev 163863)
</span><span class="lines">@@ -403,6 +403,11 @@
</span><span class="cx">
</span><span class="cx"> virtual bool shouldUseTiledBackingForFrameView(const FrameView*) const { return false; }
</span><span class="cx">
</span><ins>+#if ENABLE(SUBTLE_CRYPTO)
+ virtual bool wrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) const { return false; }
+ virtual bool unwrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) const { return false; }
+#endif
+
</ins><span class="cx"> protected:
</span><span class="cx"> virtual ~ChromeClient() { }
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersWorkerGlobalScopecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.cpp (163862 => 163863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/WorkerGlobalScope.cpp        2014-02-11 06:21:41 UTC (rev 163862)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.cpp        2014-02-11 06:32:39 UTC (rev 163863)
</span><span class="lines">@@ -343,4 +343,16 @@
</span><span class="cx"> return m_eventQueue;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if ENABLE(SUBTLE_CRYPTO)
+bool WorkerGlobalScope::wrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&)
+{
+ return false;
+}
+
+bool WorkerGlobalScope::unwrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&)
+{
+ return false;
+}
+#endif // ENABLE(SUBTLE_CRYPTO)
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersWorkerGlobalScopeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.h (163862 => 163863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/WorkerGlobalScope.h        2014-02-11 06:21:41 UTC (rev 163862)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.h        2014-02-11 06:32:39 UTC (rev 163863)
</span><span class="lines">@@ -135,6 +135,11 @@
</span><span class="cx">
</span><span class="cx"> virtual void addConsoleMessage(MessageSource, MessageLevel, const String& message, unsigned long requestIdentifier = 0) override;
</span><span class="cx">
</span><ins>+#if ENABLE(SUBTLE_CRYPTO)
+ virtual bool wrapCryptoKey(const Vector<uint8_t>& key, Vector<uint8_t>& wrappedKey) override;
+ virtual bool unwrapCryptoKey(const Vector<uint8_t>& wrappedKey, Vector<uint8_t>& key) override;
+#endif
+
</ins><span class="cx"> protected:
</span><span class="cx"> WorkerGlobalScope(const URL&, const String& userAgent, std::unique_ptr<GroupSettings>, WorkerThread*, PassRefPtr<SecurityOrigin> topOrigin);
</span><span class="cx"> void applyContentSecurityPolicyFromString(const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (163862 => 163863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-02-11 06:21:41 UTC (rev 163862)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-02-11 06:32:39 UTC (rev 163863)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-02-10 Alexey Proskuryakov <ap@apple.com>
+
+ Add hooks for wrapping CryptoKeys in SerializedScriptValue
+ https://bugs.webkit.org/show_bug.cgi?id=128567
+
+ Reviewed by Anders Carlsson.
+
+ * WebCoreSupport/WebChromeClient.h:
+ * WebCoreSupport/WebChromeClient.mm:
+ (WebChromeClient::wrapCryptoKey):
+ (WebChromeClient::unwrapCryptoKey):
+ Dummy implementation, to be filled in later.
+
</ins><span class="cx"> 2014-02-08 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> Cleanup the interface of FrameSelection
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h (163862 => 163863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h        2014-02-11 06:21:41 UTC (rev 163862)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h        2014-02-11 06:32:39 UTC (rev 163863)
</span><span class="lines">@@ -195,6 +195,11 @@
</span><span class="cx">
</span><span class="cx"> virtual void numWheelEventHandlersChanged(unsigned) override { }
</span><span class="cx">
</span><ins>+#if ENABLE(SUBTLE_CRYPTO)
+ virtual bool wrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) const override;
+ virtual bool unwrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) const override;
+#endif
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> WebView* webView() const { return m_webView; }
</span><span class="cx"> #else
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebChromeClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm (163862 => 163863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm        2014-02-11 06:21:41 UTC (rev 163862)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm        2014-02-11 06:32:39 UTC (rev 163863)
</span><span class="lines">@@ -996,4 +996,18 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if ENABLE(SUBTLE_CRYPTO)
+bool WebChromeClient::wrapCryptoKey(const Vector<uint8_t>& key, Vector<uint8_t>& wrappedKey) const
+{
+ wrappedKey = key;
+ return true;
+}
+
+bool WebChromeClient::unwrapCryptoKey(const Vector<uint8_t>& wrappedKey, Vector<uint8_t>& key) const
+{
+ key = wrappedKey;
+ return true;
+}
</ins><span class="cx"> #endif
</span><ins>+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (163862 => 163863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-02-11 06:21:41 UTC (rev 163862)
+++ trunk/Source/WebKit2/ChangeLog        2014-02-11 06:32:39 UTC (rev 163863)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2014-02-10 Alexey Proskuryakov <ap@apple.com>
+
+ Add hooks for wrapping CryptoKeys in SerializedScriptValue
+ https://bugs.webkit.org/show_bug.cgi?id=128567
+
+ Reviewed by Anders Carlsson.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::wrapCryptoKey):
+ (WebKit::WebPageProxy::unwrapCryptoKey):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::wrapCryptoKey):
+ (WebKit::WebChromeClient::unwrapCryptoKey):
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+ Dummy implementation, to be filled in later.
+
</ins><span class="cx"> 2014-02-10 Dan Bernstein <mitz@apple.com>
</span><span class="cx">
</span><span class="cx"> Stop using PLATFORM(MAC) in WebKit2/platform except where it means “OS X but not iOS”
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (163862 => 163863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-02-11 06:21:41 UTC (rev 163862)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-02-11 06:32:39 UTC (rev 163863)
</span><span class="lines">@@ -4479,4 +4479,20 @@
</span><span class="cx"> m_process->send(Messages::WebPage::SetScrollPinningBehavior(pinning), m_pageID);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if ENABLE(SUBTLE_CRYPTO)
+void WebPageProxy::wrapCryptoKey(const Vector<uint8_t>& key, bool& succeeded, Vector<uint8_t>& wrappedKey)
+{
+ // FIXME: Implement.
+ wrappedKey = key;
+ succeeded = true;
+}
+
+void WebPageProxy::unwrapCryptoKey(const Vector<uint8_t>& wrappedKey, bool& succeeded, Vector<uint8_t>& key)
+{
+ // FIXME: Implement.
+ key = wrappedKey;
+ succeeded = true;
+}
+#endif
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (163862 => 163863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-02-11 06:21:41 UTC (rev 163862)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-02-11 06:32:39 UTC (rev 163863)
</span><span class="lines">@@ -887,6 +887,11 @@
</span><span class="cx"> RetainPtr<CGImageRef> takeViewSnapshot();
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if ENABLE(SUBTLE_CRYPTO)
+ void wrapCryptoKey(const Vector<uint8_t>&, bool& succeeded, Vector<uint8_t>&);
+ void unwrapCryptoKey(const Vector<uint8_t>&, bool& succeeded, Vector<uint8_t>&);
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx"> WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, const WebPageConfiguration&);
</span><span class="cx"> void platformInitialize();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (163862 => 163863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2014-02-11 06:21:41 UTC (rev 163862)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2014-02-11 06:32:39 UTC (rev 163863)
</span><span class="lines">@@ -334,4 +334,9 @@
</span><span class="cx"> DidUpdateViewState()
</span><span class="cx">
</span><span class="cx"> DidSaveToPageCache()
</span><ins>+
+#if ENABLE(SUBTLE_CRYPTO)
+ WrapCryptoKey(Vector<uint8_t> key) -> (bool succeeded, Vector<uint8_t> wrappedKey)
+ UnwrapCryptoKey(Vector<uint8_t> wrappedKey) -> (bool succeeded, Vector<uint8_t> key)
+#endif
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (163862 => 163863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2014-02-11 06:21:41 UTC (rev 163862)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2014-02-11 06:32:39 UTC (rev 163863)
</span><span class="lines">@@ -938,4 +938,23 @@
</span><span class="cx"> return m_page->drawingArea()->shouldUseTiledBackingForFrameView(frameView);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if ENABLE(SUBTLE_CRYPTO)
+bool WebChromeClient::wrapCryptoKey(const Vector<uint8_t>& key, Vector<uint8_t>& wrappedKey) const
+{
+ bool succeeded;
+ if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::WrapCryptoKey(key), Messages::WebPageProxy::WrapCryptoKey::Reply(succeeded, wrappedKey), m_page->pageID()))
+ return false;
+ return succeeded;
+}
+
+bool WebChromeClient::unwrapCryptoKey(const Vector<uint8_t>& wrappedKey, Vector<uint8_t>& key) const
+{
+ bool succeeded;
+ if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::UnwrapCryptoKey(wrappedKey), Messages::WebPageProxy::UnwrapCryptoKey::Reply(succeeded, key), m_page->pageID()))
+ return false;
+ return succeeded;
+}
+#endif
+
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (163862 => 163863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2014-02-11 06:21:41 UTC (rev 163862)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2014-02-11 06:32:39 UTC (rev 163863)
</span><span class="lines">@@ -270,6 +270,11 @@
</span><span class="cx">
</span><span class="cx"> virtual bool shouldUseTiledBackingForFrameView(const WebCore::FrameView*) const override;
</span><span class="cx">
</span><ins>+#if ENABLE(SUBTLE_CRYPTO)
+ virtual bool wrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) const override;
+ virtual bool unwrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) const override;
+#endif
+
</ins><span class="cx"> String m_cachedToolTip;
</span><span class="cx"> mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame;
</span><span class="cx"> mutable bool m_cachedMainFrameHasHorizontalScrollbar;
</span></span></pre>
</div>
</div>
</body>
</html>