Title: [251348] branches/safari-608-branch
Revision
251348
Author
bshaf...@apple.com
Date
2019-10-20 10:33:32 -0700 (Sun, 20 Oct 2019)

Log Message

Cherry-pick r250887. rdar://problem/56061121

    Partially undo r250811
    https://bugs.webkit.org/show_bug.cgi?id=202715
    <rdar://problem/56084287>

    Reviewed by Chris Dumez.

    Source/WebCore:

    This patch changes the SerializedScriptValue to always wrap CryptoKey objects again.
    CryptoKey objects could belong to an array or another object. In those cases, IDBObjectStore
    cannot set the flag for the embedded Cryptokey objects. Neither can postMessage to unset
    the flag. Therefore, there is no way to separate the serialization process into two and
    this patch restores the old behaviour. However, the hardening part of r250811 is kept
    and therefore the crash should still be prevented.

    No new test, updated existing test

    * Modules/indexeddb/IDBObjectStore.cpp:
    (WebCore::IDBObjectStore::putOrAdd):
    (WebCore::JSC::setIsWrappingRequiredForCryptoKey): Deleted.
    * bindings/js/SerializedScriptValue.cpp:
    (WebCore::CloneSerializer::dumpIfTerminal):
    (WebCore::CloneDeserializer::readTerminal):
    * crypto/CryptoKey.h:
    (WebCore::CryptoKey::allows const):
    (WebCore::CryptoKey::isWrappingRequired const): Deleted.
    (WebCore::CryptoKey::setIsWrappingRequired): Deleted.
    (): Deleted.
    * dom/ScriptExecutionContext.h:

    Tools:

    * TestWebKitAPI/Tests/WebKit/navigation-client-default-crypto.html:
    Modified to crash if SerializedScriptValue doesn't wrap CryptoKey objects.

    LayoutTests:

    Some rebaselines.

    * crypto/workers/subtle/ec-postMessage-worker-expected.txt:
    * crypto/workers/subtle/hrsa-postMessage-worker-expected.txt:
    * crypto/workers/subtle/rsa-postMessage-worker-expected.txt:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250887 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-608-branch/LayoutTests/ChangeLog (251347 => 251348)


--- branches/safari-608-branch/LayoutTests/ChangeLog	2019-10-20 17:33:28 UTC (rev 251347)
+++ branches/safari-608-branch/LayoutTests/ChangeLog	2019-10-20 17:33:32 UTC (rev 251348)
@@ -1,5 +1,68 @@
 2019-10-15  Kocsen Chung  <kocsen_ch...@apple.com>
 
+        Cherry-pick r250887. rdar://problem/56061121
+
+    Partially undo r250811
+    https://bugs.webkit.org/show_bug.cgi?id=202715
+    <rdar://problem/56084287>
+    
+    Reviewed by Chris Dumez.
+    
+    Source/WebCore:
+    
+    This patch changes the SerializedScriptValue to always wrap CryptoKey objects again.
+    CryptoKey objects could belong to an array or another object. In those cases, IDBObjectStore
+    cannot set the flag for the embedded Cryptokey objects. Neither can postMessage to unset
+    the flag. Therefore, there is no way to separate the serialization process into two and
+    this patch restores the old behaviour. However, the hardening part of r250811 is kept
+    and therefore the crash should still be prevented.
+    
+    No new test, updated existing test
+    
+    * Modules/indexeddb/IDBObjectStore.cpp:
+    (WebCore::IDBObjectStore::putOrAdd):
+    (WebCore::JSC::setIsWrappingRequiredForCryptoKey): Deleted.
+    * bindings/js/SerializedScriptValue.cpp:
+    (WebCore::CloneSerializer::dumpIfTerminal):
+    (WebCore::CloneDeserializer::readTerminal):
+    * crypto/CryptoKey.h:
+    (WebCore::CryptoKey::allows const):
+    (WebCore::CryptoKey::isWrappingRequired const): Deleted.
+    (WebCore::CryptoKey::setIsWrappingRequired): Deleted.
+    (): Deleted.
+    * dom/ScriptExecutionContext.h:
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKit/navigation-client-default-crypto.html:
+    Modified to crash if SerializedScriptValue doesn't wrap CryptoKey objects.
+    
+    LayoutTests:
+    
+    Some rebaselines.
+    
+    * crypto/workers/subtle/ec-postMessage-worker-expected.txt:
+    * crypto/workers/subtle/hrsa-postMessage-worker-expected.txt:
+    * crypto/workers/subtle/rsa-postMessage-worker-expected.txt:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250887 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-10-08  Jiewen Tan  <jiewen_...@apple.com>
+
+            Partially undo r250811
+            https://bugs.webkit.org/show_bug.cgi?id=202715
+            <rdar://problem/56084287>
+
+            Reviewed by Chris Dumez.
+
+            Some rebaselines.
+
+            * crypto/workers/subtle/ec-postMessage-worker-expected.txt:
+            * crypto/workers/subtle/hrsa-postMessage-worker-expected.txt:
+            * crypto/workers/subtle/rsa-postMessage-worker-expected.txt:
+
+2019-10-15  Kocsen Chung  <kocsen_ch...@apple.com>
+
         Cherry-pick r250844. rdar://problem/56061121
 
     Unreviewed, test gardening

Modified: branches/safari-608-branch/LayoutTests/crypto/workers/subtle/ec-postMessage-worker-expected.txt (251347 => 251348)


--- branches/safari-608-branch/LayoutTests/crypto/workers/subtle/ec-postMessage-worker-expected.txt	2019-10-20 17:33:28 UTC (rev 251347)
+++ branches/safari-608-branch/LayoutTests/crypto/workers/subtle/ec-postMessage-worker-expected.txt	2019-10-20 17:33:32 UTC (rev 251348)
@@ -3,14 +3,6 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS All checks passed in worker for public key
-PASS publicKey.type is 'public'
-PASS publicKey.extractable is true
-PASS publicKey.algorithm.name is 'ECDH'
-PASS publicKey.algorithm.namedCurve is 'P-256'
-PASS publicKey.usages is [ ]
-PASS exportedKey.x is publicKeyJSON.x
-PASS exportedKey.y is publicKeyJSON.y
 PASS All checks passed in worker for private key
 PASS privateKey.type is 'private'
 PASS privateKey.extractable is true
@@ -20,6 +12,14 @@
 PASS exportedKey.x is privateKeyJSON.x
 PASS exportedKey.y is privateKeyJSON.y
 PASS exportedKey.d is privateKeyJSON.d
+PASS All checks passed in worker for public key
+PASS publicKey.type is 'public'
+PASS publicKey.extractable is true
+PASS publicKey.algorithm.name is 'ECDH'
+PASS publicKey.algorithm.namedCurve is 'P-256'
+PASS publicKey.usages is [ ]
+PASS exportedKey.x is publicKeyJSON.x
+PASS exportedKey.y is publicKeyJSON.y
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: branches/safari-608-branch/LayoutTests/crypto/workers/subtle/hrsa-postMessage-worker-expected.txt (251347 => 251348)


--- branches/safari-608-branch/LayoutTests/crypto/workers/subtle/hrsa-postMessage-worker-expected.txt	2019-10-20 17:33:28 UTC (rev 251347)
+++ branches/safari-608-branch/LayoutTests/crypto/workers/subtle/hrsa-postMessage-worker-expected.txt	2019-10-20 17:33:32 UTC (rev 251348)
@@ -3,6 +3,14 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+PASS All checks passed in worker for private key
+PASS privateKey.type is 'private'
+PASS privateKey.extractable is false
+PASS privateKey.algorithm.name is 'RSASSA-PKCS1-v1_5'
+PASS privateKey.algorithm.modulusLength is 2048
+PASS bytesToHexString(privateKey.algorithm.publicExponent) is '010001'
+PASS privateKey.algorithm.hash.name is 'SHA-256'
+PASS privateKey.usages is ['sign']
 PASS All checks passed in worker for public key
 PASS publicKey.type is 'public'
 PASS publicKey.extractable is true
@@ -11,14 +19,6 @@
 PASS bytesToHexString(publicKey.algorithm.publicExponent) is '010001'
 PASS publicKey.algorithm.hash.name is 'SHA-256'
 PASS publicKey.usages is ['verify']
-PASS All checks passed in worker for private key
-PASS privateKey.type is 'private'
-PASS privateKey.extractable is false
-PASS privateKey.algorithm.name is 'RSASSA-PKCS1-v1_5'
-PASS privateKey.algorithm.modulusLength is 2048
-PASS bytesToHexString(privateKey.algorithm.publicExponent) is '010001'
-PASS privateKey.algorithm.hash.name is 'SHA-256'
-PASS privateKey.usages is ['sign']
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: branches/safari-608-branch/LayoutTests/crypto/workers/subtle/rsa-postMessage-worker-expected.txt (251347 => 251348)


--- branches/safari-608-branch/LayoutTests/crypto/workers/subtle/rsa-postMessage-worker-expected.txt	2019-10-20 17:33:28 UTC (rev 251347)
+++ branches/safari-608-branch/LayoutTests/crypto/workers/subtle/rsa-postMessage-worker-expected.txt	2019-10-20 17:33:32 UTC (rev 251348)
@@ -3,16 +3,6 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS All checks passed in worker for public key
-PASS publicKey.type is 'public'
-PASS publicKey.extractable is true
-PASS publicKey.algorithm.name is 'RSAES-PKCS1-v1_5'
-PASS publicKey.algorithm.modulusLength is 2048
-PASS bytesToHexString(publicKey.algorithm.publicExponent) is '010001'
-PASS publicKey.algorithm.hash is undefined.
-PASS publicKey.usages is ['encrypt']
-PASS exportedKey.n is publicKeyJSON.n
-PASS exportedKey.e is publicKeyJSON.e
 PASS All checks passed in worker for private key
 PASS privateKey.type is 'private'
 PASS privateKey.extractable is true
@@ -29,6 +19,16 @@
 PASS exportedKey.dp is privateKeyJSON.dp
 PASS exportedKey.dq is privateKeyJSON.dq
 PASS exportedKey.qi is privateKeyJSON.qi
+PASS All checks passed in worker for public key
+PASS publicKey.type is 'public'
+PASS publicKey.extractable is true
+PASS publicKey.algorithm.name is 'RSAES-PKCS1-v1_5'
+PASS publicKey.algorithm.modulusLength is 2048
+PASS bytesToHexString(publicKey.algorithm.publicExponent) is '010001'
+PASS publicKey.algorithm.hash is undefined.
+PASS publicKey.usages is ['encrypt']
+PASS exportedKey.n is publicKeyJSON.n
+PASS exportedKey.e is publicKeyJSON.e
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (251347 => 251348)


--- branches/safari-608-branch/Source/WebCore/ChangeLog	2019-10-20 17:33:28 UTC (rev 251347)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog	2019-10-20 17:33:32 UTC (rev 251348)
@@ -1,5 +1,84 @@
 2019-10-15  Kocsen Chung  <kocsen_ch...@apple.com>
 
+        Cherry-pick r250887. rdar://problem/56061121
+
+    Partially undo r250811
+    https://bugs.webkit.org/show_bug.cgi?id=202715
+    <rdar://problem/56084287>
+    
+    Reviewed by Chris Dumez.
+    
+    Source/WebCore:
+    
+    This patch changes the SerializedScriptValue to always wrap CryptoKey objects again.
+    CryptoKey objects could belong to an array or another object. In those cases, IDBObjectStore
+    cannot set the flag for the embedded Cryptokey objects. Neither can postMessage to unset
+    the flag. Therefore, there is no way to separate the serialization process into two and
+    this patch restores the old behaviour. However, the hardening part of r250811 is kept
+    and therefore the crash should still be prevented.
+    
+    No new test, updated existing test
+    
+    * Modules/indexeddb/IDBObjectStore.cpp:
+    (WebCore::IDBObjectStore::putOrAdd):
+    (WebCore::JSC::setIsWrappingRequiredForCryptoKey): Deleted.
+    * bindings/js/SerializedScriptValue.cpp:
+    (WebCore::CloneSerializer::dumpIfTerminal):
+    (WebCore::CloneDeserializer::readTerminal):
+    * crypto/CryptoKey.h:
+    (WebCore::CryptoKey::allows const):
+    (WebCore::CryptoKey::isWrappingRequired const): Deleted.
+    (WebCore::CryptoKey::setIsWrappingRequired): Deleted.
+    (): Deleted.
+    * dom/ScriptExecutionContext.h:
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKit/navigation-client-default-crypto.html:
+    Modified to crash if SerializedScriptValue doesn't wrap CryptoKey objects.
+    
+    LayoutTests:
+    
+    Some rebaselines.
+    
+    * crypto/workers/subtle/ec-postMessage-worker-expected.txt:
+    * crypto/workers/subtle/hrsa-postMessage-worker-expected.txt:
+    * crypto/workers/subtle/rsa-postMessage-worker-expected.txt:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250887 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-10-08  Jiewen Tan  <jiewen_...@apple.com>
+
+            Partially undo r250811
+            https://bugs.webkit.org/show_bug.cgi?id=202715
+            <rdar://problem/56084287>
+
+            Reviewed by Chris Dumez.
+
+            This patch changes the SerializedScriptValue to always wrap CryptoKey objects again.
+            CryptoKey objects could belong to an array or another object. In those cases, IDBObjectStore
+            cannot set the flag for the embedded Cryptokey objects. Neither can postMessage to unset
+            the flag. Therefore, there is no way to separate the serialization process into two and
+            this patch restores the old behaviour. However, the hardening part of r250811 is kept
+            and therefore the crash should still be prevented.
+
+            No new test, updated existing test
+
+            * Modules/indexeddb/IDBObjectStore.cpp:
+            (WebCore::IDBObjectStore::putOrAdd):
+            (WebCore::JSC::setIsWrappingRequiredForCryptoKey): Deleted.
+            * bindings/js/SerializedScriptValue.cpp:
+            (WebCore::CloneSerializer::dumpIfTerminal):
+            (WebCore::CloneDeserializer::readTerminal):
+            * crypto/CryptoKey.h:
+            (WebCore::CryptoKey::allows const):
+            (WebCore::CryptoKey::isWrappingRequired const): Deleted.
+            (WebCore::CryptoKey::setIsWrappingRequired): Deleted.
+            (): Deleted.
+            * dom/ScriptExecutionContext.h:
+
+2019-10-15  Kocsen Chung  <kocsen_ch...@apple.com>
+
         Cherry-pick r250929. rdar://problem/56280990
 
     RunResolver::rangeForRendererWithOffsets should check for range end

Modified: branches/safari-608-branch/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (251347 => 251348)


--- branches/safari-608-branch/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2019-10-20 17:33:28 UTC (rev 251347)
+++ branches/safari-608-branch/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2019-10-20 17:33:32 UTC (rev 251348)
@@ -51,26 +51,9 @@
 #include <_javascript_Core/JSCJSValueInlines.h>
 #include <wtf/Locker.h>
 
-#if ENABLE(WEB_CRYPTO)
-#include "JSCryptoKey.h"
-#endif
-
 namespace WebCore {
 using namespace JSC;
 
-#if ENABLE(WEB_CRYPTO)
-namespace {
-static inline void setIsWrappingRequiredForCryptoKey(VM& vm, const JSValue& value)
-{
-    if (!value.isObject())
-        return;
-    auto* obj = asObject(value);
-    if (auto* key = JSCryptoKey::toWrapped(vm, obj))
-        key->setIsWrappingRequired();
-}
-}
-#endif
-
 IDBObjectStore::IDBObjectStore(ScriptExecutionContext& context, const IDBObjectStoreInfo& info, IDBTransaction& transaction)
     : ActiveDOMObject(&context)
     , m_info(info)
@@ -356,9 +339,6 @@
     if (m_transaction.isReadOnly())
         return Exception { ReadonlyError, "Failed to store record in an IDBObjectStore: The transaction is read-only."_s };
 
-#if ENABLE(WEB_CRYPTO)
-    setIsWrappingRequiredForCryptoKey(vm, value);
-#endif
     auto serializedValue = SerializedScriptValue::create(state, value);
     if (UNLIKELY(scope.exception()))
         return Exception { DataCloneError, "Failed to store record in an IDBObjectStore: An object could not be cloned."_s };

Modified: branches/safari-608-branch/Source/WebCore/bindings/js/SerializedScriptValue.cpp (251347 => 251348)


--- branches/safari-608-branch/Source/WebCore/bindings/js/SerializedScriptValue.cpp	2019-10-20 17:33:28 UTC (rev 251347)
+++ branches/safari-608-branch/Source/WebCore/bindings/js/SerializedScriptValue.cpp	2019-10-20 17:33:32 UTC (rev 251348)
@@ -166,9 +166,6 @@
 #if ENABLE(WEB_RTC)
     RTCCertificateTag = 44,
 #endif
-#if ENABLE(WEB_CRYPTO)
-    UnwrappedCryptoKeyTag = 46,
-#endif
     ErrorTag = 255
 };
 
@@ -351,7 +348,6 @@
  *    | DOMQuad
  *    | ImageBitmapTransferTag <value:uint32_t>
  *    | RTCCertificateTag
- *    | UnwrappedCryptoKeyTag <unwrappedKeyLength:uint32_t> <factor:byte{unwrappedKeyLength}>
  *
  * Inside certificate, data is serialized in this format as per spec:
  *
@@ -1059,10 +1055,7 @@
             }
 #if ENABLE(WEB_CRYPTO)
             if (auto* key = JSCryptoKey::toWrapped(vm, obj)) {
-                if (key->isWrappingRequired())
-                    write(CryptoKeyTag);
-                else
-                    write(UnwrappedCryptoKeyTag);
+                write(CryptoKeyTag);
                 Vector<uint8_t> serializedKey;
                 Vector<String> dummyBlobURLs;
                 PAL::SessionID dummySessionID;
@@ -1078,14 +1071,10 @@
 #endif
                     dummyBlobURLs, dummySessionID, serializedKey, SerializationContext::Default, dummySharedBuffers);
                 rawKeySerializer.write(key);
-                if (key->isWrappingRequired()) {
-                    Vector<uint8_t> wrappedKey;
-                    if (!wrapCryptoKey(m_exec, serializedKey, wrappedKey))
-                        return false;
-                    write(wrappedKey);
-                    return true;
-                }
-                write(serializedKey);
+                Vector<uint8_t> wrappedKey;
+                if (!wrapCryptoKey(m_exec, serializedKey, wrappedKey))
+                    return false;
+                write(wrappedKey);
                 return true;
             }
 #endif
@@ -3045,28 +3034,6 @@
             return readRTCCertificate();
 
 #endif
-#if ENABLE(WEB_CRYPTO)
-        case UnwrappedCryptoKeyTag: {
-            Vector<uint8_t> serializedKey;
-            if (!read(serializedKey)) {
-                fail();
-                return JSValue();
-            }
-            JSValue cryptoKey;
-            Vector<RefPtr<MessagePort>> dummyMessagePorts;
-            CloneDeserializer rawKeyDeserializer(m_exec, m_globalObject, dummyMessagePorts, nullptr, { },
-#if ENABLE(WEBASSEMBLY)
-                nullptr,
-#endif
-                serializedKey);
-            if (!rawKeyDeserializer.readCryptoKey(cryptoKey)) {
-                fail();
-                return JSValue();
-            }
-            m_gcBuffer.appendWithCrashOnOverflow(cryptoKey);
-            return cryptoKey;
-        }
-#endif
         default:
             m_ptr--; // Push the tag back
             return JSValue();

Modified: branches/safari-608-branch/Source/WebCore/crypto/CryptoKey.h (251347 => 251348)


--- branches/safari-608-branch/Source/WebCore/crypto/CryptoKey.h	2019-10-20 17:33:28 UTC (rev 251347)
+++ branches/safari-608-branch/Source/WebCore/crypto/CryptoKey.h	2019-10-20 17:33:32 UTC (rev 251348)
@@ -72,8 +72,6 @@
     CryptoKeyUsageBitmap usagesBitmap() const { return m_usages; }
     void setUsagesBitmap(CryptoKeyUsageBitmap usage) { m_usages = usage; };
     bool allows(CryptoKeyUsageBitmap usage) const { return usage == (m_usages & usage); }
-    bool isWrappingRequired() const { return m_isWrappingRequired; }
-    void setIsWrappingRequired() { m_isWrappingRequired = true; }
 
     static Vector<uint8_t> randomData(size_t);
 
@@ -82,7 +80,6 @@
     Type m_type;
     bool m_extractable;
     CryptoKeyUsageBitmap m_usages;
-    bool m_isWrappingRequired { false };
 };
 
 inline auto CryptoKey::type() const -> Type

Modified: branches/safari-608-branch/Source/WebCore/dom/ScriptExecutionContext.h (251347 => 251348)


--- branches/safari-608-branch/Source/WebCore/dom/ScriptExecutionContext.h	2019-10-20 17:33:28 UTC (rev 251347)
+++ branches/safari-608-branch/Source/WebCore/dom/ScriptExecutionContext.h	2019-10-20 17:33:32 UTC (rev 251348)
@@ -225,7 +225,9 @@
     void setDatabaseContext(DatabaseContext*);
 
 #if ENABLE(WEB_CRYPTO)
-    // These two methods are used when CryptoKeys are serialized into IndexedDB.
+    // These two methods are used when CryptoKeys are serialized into IndexedDB. As a side effect, it is also
+    // used for things that utilize the same structure clone algorithm, for example, message passing between
+    // worker and document.
     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

Modified: branches/safari-608-branch/Tools/ChangeLog (251347 => 251348)


--- branches/safari-608-branch/Tools/ChangeLog	2019-10-20 17:33:28 UTC (rev 251347)
+++ branches/safari-608-branch/Tools/ChangeLog	2019-10-20 17:33:32 UTC (rev 251348)
@@ -1,3 +1,63 @@
+2019-10-15  Kocsen Chung  <kocsen_ch...@apple.com>
+
+        Cherry-pick r250887. rdar://problem/56061121
+
+    Partially undo r250811
+    https://bugs.webkit.org/show_bug.cgi?id=202715
+    <rdar://problem/56084287>
+    
+    Reviewed by Chris Dumez.
+    
+    Source/WebCore:
+    
+    This patch changes the SerializedScriptValue to always wrap CryptoKey objects again.
+    CryptoKey objects could belong to an array or another object. In those cases, IDBObjectStore
+    cannot set the flag for the embedded Cryptokey objects. Neither can postMessage to unset
+    the flag. Therefore, there is no way to separate the serialization process into two and
+    this patch restores the old behaviour. However, the hardening part of r250811 is kept
+    and therefore the crash should still be prevented.
+    
+    No new test, updated existing test
+    
+    * Modules/indexeddb/IDBObjectStore.cpp:
+    (WebCore::IDBObjectStore::putOrAdd):
+    (WebCore::JSC::setIsWrappingRequiredForCryptoKey): Deleted.
+    * bindings/js/SerializedScriptValue.cpp:
+    (WebCore::CloneSerializer::dumpIfTerminal):
+    (WebCore::CloneDeserializer::readTerminal):
+    * crypto/CryptoKey.h:
+    (WebCore::CryptoKey::allows const):
+    (WebCore::CryptoKey::isWrappingRequired const): Deleted.
+    (WebCore::CryptoKey::setIsWrappingRequired): Deleted.
+    (): Deleted.
+    * dom/ScriptExecutionContext.h:
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKit/navigation-client-default-crypto.html:
+    Modified to crash if SerializedScriptValue doesn't wrap CryptoKey objects.
+    
+    LayoutTests:
+    
+    Some rebaselines.
+    
+    * crypto/workers/subtle/ec-postMessage-worker-expected.txt:
+    * crypto/workers/subtle/hrsa-postMessage-worker-expected.txt:
+    * crypto/workers/subtle/rsa-postMessage-worker-expected.txt:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250887 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-10-08  Jiewen Tan  <jiewen_...@apple.com>
+
+            Partially undo r250811
+            https://bugs.webkit.org/show_bug.cgi?id=202715
+            <rdar://problem/56084287>
+
+            Reviewed by Chris Dumez.
+
+            * TestWebKitAPI/Tests/WebKit/navigation-client-default-crypto.html:
+            Modified to crash if SerializedScriptValue doesn't wrap CryptoKey objects.
+
 2019-10-15  Alan Coon  <alanc...@apple.com>
 
         Cherry-pick r250833. rdar://problem/56280706

Modified: branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKit/navigation-client-default-crypto.html (251347 => 251348)


--- branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKit/navigation-client-default-crypto.html	2019-10-20 17:33:28 UTC (rev 251347)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKit/navigation-client-default-crypto.html	2019-10-20 17:33:32 UTC (rev 251348)
@@ -55,7 +55,7 @@
     function storeKey() {
         var objectStore = db.transaction("rsa-indexeddb", "readwrite").objectStore("rsa-indexeddb");
         try {
-            var req = objectStore.put(key, "mykey");
+            var req = objectStore.put({ key: key }, "theKey");
             req._onerror_ = function(event) {
                 alert('failed to store key');
             }
@@ -70,12 +70,12 @@
 
     function readKey() {
         var objectStore = db.transaction("rsa-indexeddb").objectStore("rsa-indexeddb");
-        var req = objectStore.get("mykey");
+        var req = objectStore.get("theKey");
         req._onerror_ = function(event) {
             alert('failed to read key');
         }
         req._onsuccess_ = function(event) {
-            window.retrievedKey = event.target.result;
+            window.retrievedKey = event.target.result.key;
             if (retrievedKey.type != 'private')
                 return alert("retrievedKey.type != 'private': " + retrievedKey.type);
             if (retrievedKey.extractable != true)

Modified: branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebCryptoMasterKey.mm (251347 => 251348)


--- branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebCryptoMasterKey.mm	2019-10-20 17:33:28 UTC (rev 251347)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebCryptoMasterKey.mm	2019-10-20 17:33:32 UTC (rev 251348)
@@ -32,6 +32,7 @@
 
 static bool receivedMessage = false;
 static String gMessage;
+static bool masterKeyCalled = false;
 
 @interface WebCryptoMasterKeyNavigationDelegate : NSObject <WKNavigationDelegate, WKUIDelegate>
 @end
@@ -40,6 +41,7 @@
 
 - (NSData *)_webCryptoMasterKeyForWebView:(WKWebView *)webView
 {
+    masterKeyCalled = true;
     return nil;
 }
 
@@ -66,6 +68,7 @@
     [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]];
     Util::run(&receivedMessage);
     EXPECT_WK_STREQ("DataCloneError", gMessage);
+    EXPECT_TRUE(masterKeyCalled);
 }
 
 } // namespace TestWebKitAPI
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to