Add a dummy SubtleCrypto interface
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Oct 2016 21:32:02 +0000 (21:32 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Oct 2016 21:32:02 +0000 (21:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=162992
<rdar://problem/28643573>

Reviewed by Brent Fulgham.

LayoutTests/imported/w3c:

* WebCryptoAPI/digest/test_digest-expected.txt:
* WebCryptoAPI/idlharness-expected.txt:

Source/WebCore:

Add a dummy SubtleCrypto interface and rename KeyPair to CryptoKeyPair.

Tests: crypto/subtle/gc-2.html
       crypto/subtle/gc-3.html
       crypto/subtle/gc.html
       crypto/webkitSubtle/aes-cbc-192-encrypt-decrypt.html
       crypto/webkitSubtle/aes-cbc-256-encrypt-decrypt.html
       crypto/webkitSubtle/aes-cbc-encrypt-decrypt-with-padding.html
       crypto/webkitSubtle/aes-cbc-encrypt-decrypt.html
       crypto/webkitSubtle/aes-cbc-generate-key.html
       crypto/webkitSubtle/aes-cbc-import-jwk.html
       crypto/webkitSubtle/aes-cbc-invalid-length.html
       crypto/webkitSubtle/aes-cbc-unwrap-failure.html
       crypto/webkitSubtle/aes-cbc-unwrap-rsa.html
       crypto/webkitSubtle/aes-cbc-wrap-rsa-non-extractable.html
       crypto/webkitSubtle/aes-cbc-wrap-rsa.html
       crypto/webkitSubtle/aes-cbc-wrong-key-class.html
       crypto/webkitSubtle/aes-export-key.html
       crypto/webkitSubtle/aes-kw-key-manipulation.html
       crypto/webkitSubtle/aes-kw-wrap-unwrap-aes.html
       crypto/webkitSubtle/aes-postMessage.html
       crypto/webkitSubtle/argument-conversion.html
       crypto/webkitSubtle/array-buffer-view-offset.html
       crypto/webkitSubtle/crypto-key-algorithm-gc.html
       crypto/webkitSubtle/crypto-key-usages-gc.html
       crypto/webkitSubtle/hmac-check-algorithm.html
       crypto/webkitSubtle/hmac-export-key.html
       crypto/webkitSubtle/hmac-generate-key.html
       crypto/webkitSubtle/hmac-import-jwk.html
       crypto/webkitSubtle/hmac-postMessage.html
       crypto/webkitSubtle/hmac-sign-verify-empty-key.html
       crypto/webkitSubtle/hmac-sign-verify.html
       crypto/webkitSubtle/import-jwk.html
       crypto/webkitSubtle/jwk-export-use-values.html
       crypto/webkitSubtle/jwk-import-use-values.html
       crypto/webkitSubtle/rsa-export-generated-keys.html
       crypto/webkitSubtle/rsa-export-key.html
       crypto/webkitSubtle/rsa-export-private-key.html
       crypto/webkitSubtle/rsa-indexeddb-non-exportable-private.html
       crypto/webkitSubtle/rsa-indexeddb-non-exportable.html
       crypto/webkitSubtle/rsa-indexeddb-private.html
       crypto/webkitSubtle/rsa-indexeddb.html
       crypto/webkitSubtle/rsa-oaep-generate-non-extractable-key.html
       crypto/webkitSubtle/rsa-oaep-key-manipulation.html
       crypto/webkitSubtle/rsa-oaep-plaintext-length.html
       crypto/webkitSubtle/rsa-oaep-wrap-unwrap-aes.html
       crypto/webkitSubtle/rsa-postMessage.html
       crypto/webkitSubtle/rsaes-pkcs1-v1_5-decrypt.html
       crypto/webkitSubtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes.html
       crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html
       crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key.html
       crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk-small-key.html
       crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk.html
       crypto/webkitSubtle/rsassa-pkcs1-v1_5-sign-verify.html
       crypto/webkitSubtle/sha-1.html
       crypto/webkitSubtle/sha-224.html
       crypto/webkitSubtle/sha-256.html
       crypto/webkitSubtle/sha-384.html
       crypto/webkitSubtle/sha-512.html
       crypto/webkitSubtle/unimplemented-unwrap-crash.html
       crypto/webkitSubtle/unwrapKey-check-usage.html
       crypto/webkitSubtle/wrapKey-check-usage.html
       crypto/workers/subtle/aes-postMessage-worker.html
       crypto/workers/subtle/gc-worker.html
       crypto/workers/subtle/hmac-postMessage-worker.html
       crypto/workers/subtle/hrsa-postMessage-worker.html
       crypto/workers/subtle/multiple-postMessage-worker.html
       crypto/workers/subtle/rsa-postMessage-worker.html

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* PlatformEfl.cmake:
* PlatformGTK.cmake:
* PlatformMac.cmake:
* WebCore.xcodeproj/project.pbxproj:
* crypto/CryptoKeyPair.idl:
* crypto/SubtleCrypto.cpp:
(WebCore::SubtleCrypto::SubtleCrypto):
* crypto/SubtleCrypto.h:
(WebCore::SubtleCrypto::create):
* crypto/SubtleCrypto.idl: Added.
* page/Crypto.cpp:
(WebCore::Crypto::Crypto):
(WebCore::Crypto::subtle):
* page/Crypto.h:
* page/Crypto.idl:

LayoutTests:

* crypto/resources/common.js:
* crypto/subtle/gc-2-expected.txt: Added.
* crypto/subtle/gc-2.html: Added.
* crypto/subtle/gc-3-expected.txt: Added.
* crypto/subtle/gc-3.html: Added.
* crypto/subtle/gc-expected.txt: Added.
* crypto/subtle/gc.html: Added.
* crypto/webkitSubtle/aes-cbc-192-encrypt-decrypt-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-192-encrypt-decrypt-expected.txt.
* crypto/webkitSubtle/aes-cbc-192-encrypt-decrypt.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-192-encrypt-decrypt.html.
* crypto/webkitSubtle/aes-cbc-256-encrypt-decrypt-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-256-encrypt-decrypt-expected.txt.
* crypto/webkitSubtle/aes-cbc-256-encrypt-decrypt.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-256-encrypt-decrypt.html.
* crypto/webkitSubtle/aes-cbc-encrypt-decrypt-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-encrypt-decrypt-expected.txt.
* crypto/webkitSubtle/aes-cbc-encrypt-decrypt-with-padding-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-encrypt-decrypt-with-padding-expected.txt.
* crypto/webkitSubtle/aes-cbc-encrypt-decrypt-with-padding.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-encrypt-decrypt-with-padding.html.
* crypto/webkitSubtle/aes-cbc-encrypt-decrypt.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-encrypt-decrypt.html.
* crypto/webkitSubtle/aes-cbc-generate-key-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-generate-key-expected.txt.
* crypto/webkitSubtle/aes-cbc-generate-key.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-generate-key.html.
* crypto/webkitSubtle/aes-cbc-import-jwk-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-import-jwk-expected.txt.
* crypto/webkitSubtle/aes-cbc-import-jwk.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-import-jwk.html.
* crypto/webkitSubtle/aes-cbc-invalid-length-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-invalid-length-expected.txt.
* crypto/webkitSubtle/aes-cbc-invalid-length.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-invalid-length.html.
* crypto/webkitSubtle/aes-cbc-unwrap-failure-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-unwrap-failure-expected.txt.
* crypto/webkitSubtle/aes-cbc-unwrap-failure.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-unwrap-failure.html.
* crypto/webkitSubtle/aes-cbc-unwrap-rsa-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-unwrap-rsa-expected.txt.
* crypto/webkitSubtle/aes-cbc-unwrap-rsa.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-unwrap-rsa.html.
* crypto/webkitSubtle/aes-cbc-wrap-rsa-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-wrap-rsa-expected.txt.
* crypto/webkitSubtle/aes-cbc-wrap-rsa-non-extractable-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-wrap-rsa-non-extractable-expected.txt.
* crypto/webkitSubtle/aes-cbc-wrap-rsa-non-extractable.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-wrap-rsa-non-extractable.html.
* crypto/webkitSubtle/aes-cbc-wrap-rsa.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-wrap-rsa.html.
* crypto/webkitSubtle/aes-cbc-wrong-key-class-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-wrong-key-class-expected.txt.
* crypto/webkitSubtle/aes-cbc-wrong-key-class.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-wrong-key-class.html.
* crypto/webkitSubtle/aes-export-key-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-export-key-expected.txt.
* crypto/webkitSubtle/aes-export-key.html: Renamed from LayoutTests/crypto/subtle/aes-export-key.html.
* crypto/webkitSubtle/aes-kw-key-manipulation-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-kw-key-manipulation-expected.txt.
* crypto/webkitSubtle/aes-kw-key-manipulation.html: Renamed from LayoutTests/crypto/subtle/aes-kw-key-manipulation.html.
* crypto/webkitSubtle/aes-kw-wrap-unwrap-aes-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-kw-wrap-unwrap-aes-expected.txt.
* crypto/webkitSubtle/aes-kw-wrap-unwrap-aes.html: Renamed from LayoutTests/crypto/subtle/aes-kw-wrap-unwrap-aes.html.
* crypto/webkitSubtle/aes-postMessage-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-postMessage-expected.txt.
* crypto/webkitSubtle/aes-postMessage.html: Renamed from LayoutTests/crypto/subtle/aes-postMessage.html.
* crypto/webkitSubtle/argument-conversion-expected.txt: Renamed from LayoutTests/crypto/subtle/argument-conversion-expected.txt.
* crypto/webkitSubtle/argument-conversion.html: Renamed from LayoutTests/crypto/subtle/argument-conversion.html.
* crypto/webkitSubtle/array-buffer-view-offset-expected.txt: Renamed from LayoutTests/crypto/subtle/array-buffer-view-offset-expected.txt.
* crypto/webkitSubtle/array-buffer-view-offset.html: Renamed from LayoutTests/crypto/subtle/array-buffer-view-offset.html.
* crypto/webkitSubtle/crypto-key-algorithm-gc-expected.txt: Renamed from LayoutTests/crypto/subtle/crypto-key-algorithm-gc-expected.txt.
* crypto/webkitSubtle/crypto-key-algorithm-gc.html: Renamed from LayoutTests/crypto/subtle/crypto-key-algorithm-gc.html.
* crypto/webkitSubtle/crypto-key-usages-gc-expected.txt: Renamed from LayoutTests/crypto/subtle/crypto-key-usages-gc-expected.txt.
* crypto/webkitSubtle/crypto-key-usages-gc.html: Renamed from LayoutTests/crypto/subtle/crypto-key-usages-gc.html.
* crypto/webkitSubtle/hmac-check-algorithm-expected.txt: Renamed from LayoutTests/crypto/subtle/hmac-check-algorithm-expected.txt.
* crypto/webkitSubtle/hmac-check-algorithm.html: Renamed from LayoutTests/crypto/subtle/hmac-check-algorithm.html.
* crypto/webkitSubtle/hmac-export-key-expected.txt: Renamed from LayoutTests/crypto/subtle/hmac-export-key-expected.txt.
* crypto/webkitSubtle/hmac-export-key.html: Renamed from LayoutTests/crypto/subtle/hmac-export-key.html.
* crypto/webkitSubtle/hmac-generate-key-expected.txt: Renamed from LayoutTests/crypto/subtle/hmac-export-key.html.
* crypto/webkitSubtle/hmac-generate-key.html: Renamed from LayoutTests/crypto/subtle/hmac-generate-key.html.
* crypto/webkitSubtle/hmac-import-jwk-expected.txt: Renamed from LayoutTests/crypto/subtle/hmac-import-jwk-expected.txt.
* crypto/webkitSubtle/hmac-import-jwk.html: Renamed from LayoutTests/crypto/subtle/hmac-import-jwk.html.
* crypto/webkitSubtle/hmac-postMessage-expected.txt: Renamed from LayoutTests/crypto/subtle/hmac-postMessage-expected.txt.
* crypto/webkitSubtle/hmac-postMessage.html: Renamed from LayoutTests/crypto/subtle/hmac-postMessage.html.
* crypto/webkitSubtle/hmac-sign-verify-empty-key-expected.txt: Renamed from LayoutTests/crypto/subtle/hmac-sign-verify-empty-key-expected.txt.
* crypto/webkitSubtle/hmac-sign-verify-empty-key.html: Renamed from LayoutTests/crypto/subtle/hmac-sign-verify-empty-key.html.
* crypto/webkitSubtle/hmac-sign-verify-expected.txt: Renamed from LayoutTests/crypto/subtle/hmac-sign-verify-expected.txt.
* crypto/webkitSubtle/hmac-sign-verify.html: Renamed from LayoutTests/crypto/subtle/hmac-sign-verify.html.
* crypto/webkitSubtle/import-jwk-expected.txt: Renamed from LayoutTests/crypto/subtle/import-jwk-expected.txt.
* crypto/webkitSubtle/import-jwk.html: Renamed from LayoutTests/crypto/subtle/import-jwk-expected.html.
* crypto/webkitSubtle/jwk-export-use-values-expected.txt: Renamed from LayoutTests/crypto/subtle/jwk-export-use-values-expected.txt.
* crypto/webkitSubtle/jwk-export-use-values.html: Renamed from LayoutTests/crypto/subtle/jwk-export-use-values.html.
* crypto/webkitSubtle/jwk-import-use-values-expected.txt: Renamed from LayoutTests/crypto/subtle/jwk-import-use-values-expected.txt.
* crypto/webkitSubtle/jwk-import-use-values.html: Renamed from LayoutTests/crypto/subtle/jwk-import-use-values.html.
* crypto/webkitSubtle/resources/rsa-indexeddb-non-exportable.js: Renamed from LayoutTests/crypto/subtle/resources/rsa-indexeddb-non-exportable.js.
* crypto/webkitSubtle/resources/rsa-indexeddb.js: Renamed from LayoutTests/crypto/subtle/resources/rsa-indexeddb.js.
* crypto/webkitSubtle/rsa-export-generated-keys-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-export-generated-keys-expected.txt.
* crypto/webkitSubtle/rsa-export-generated-keys.html: Renamed from LayoutTests/crypto/subtle/rsa-export-generated-keys.html.
* crypto/webkitSubtle/rsa-export-key-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-export-key-expected.txt.
* crypto/webkitSubtle/rsa-export-key.html: Renamed from LayoutTests/crypto/subtle/rsa-export-key.html.
* crypto/webkitSubtle/rsa-export-private-key-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-export-private-key-expected.txt.
* crypto/webkitSubtle/rsa-export-private-key.html: Renamed from LayoutTests/crypto/subtle/rsa-export-private-key.html.
* crypto/webkitSubtle/rsa-indexeddb-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-indexeddb-expected.txt.
* crypto/webkitSubtle/rsa-indexeddb-non-exportable-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-indexeddb-non-exportable-expected.txt.
* crypto/webkitSubtle/rsa-indexeddb-non-exportable-private-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-indexeddb-non-exportable-private-expected.txt.
* crypto/webkitSubtle/rsa-indexeddb-non-exportable-private.html: Renamed from LayoutTests/crypto/subtle/rsa-indexeddb-non-exportable-private.html.
* crypto/webkitSubtle/rsa-indexeddb-non-exportable.html: Renamed from LayoutTests/crypto/subtle/rsa-indexeddb-non-exportable.html.
* crypto/webkitSubtle/rsa-indexeddb-private-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-indexeddb-private-expected.txt.
* crypto/webkitSubtle/rsa-indexeddb-private.html: Renamed from LayoutTests/crypto/subtle/rsa-indexeddb-private.html.
* crypto/webkitSubtle/rsa-indexeddb.html: Renamed from LayoutTests/crypto/subtle/rsa-indexeddb.html.
* crypto/webkitSubtle/rsa-oaep-generate-non-extractable-key-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-oaep-generate-non-extractable-key-expected.txt.
* crypto/webkitSubtle/rsa-oaep-generate-non-extractable-key.html: Renamed from LayoutTests/crypto/subtle/rsa-oaep-generate-non-extractable-key.html.
* crypto/webkitSubtle/rsa-oaep-key-manipulation-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-oaep-key-manipulation-expected.txt.
* crypto/webkitSubtle/rsa-oaep-key-manipulation.html: Renamed from LayoutTests/crypto/subtle/rsa-oaep-key-manipulation.html.
* crypto/webkitSubtle/rsa-oaep-plaintext-length-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-oaep-plaintext-length-expected.txt.
* crypto/webkitSubtle/rsa-oaep-plaintext-length.html: Renamed from LayoutTests/crypto/subtle/rsa-oaep-plaintext-length.html.
* crypto/webkitSubtle/rsa-oaep-wrap-unwrap-aes-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-oaep-wrap-unwrap-aes-expected.txt.
* crypto/webkitSubtle/rsa-oaep-wrap-unwrap-aes.html: Renamed from LayoutTests/crypto/subtle/rsa-oaep-wrap-unwrap-aes.html.
* crypto/webkitSubtle/rsa-postMessage-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-postMessage-expected.txt.
* crypto/webkitSubtle/rsa-postMessage.html: Renamed from LayoutTests/crypto/subtle/rsa-postMessage.html.
* crypto/webkitSubtle/rsaes-pkcs1-v1_5-decrypt-expected.txt: Renamed from LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-decrypt-expected.txt.
* crypto/webkitSubtle/rsaes-pkcs1-v1_5-decrypt.html: Renamed from LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-decrypt.html.
* crypto/webkitSubtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes-expected.txt: Renamed from LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes-expected.txt.
* crypto/webkitSubtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes.html: Renamed from LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes.html.
* crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key-expected.txt: Renamed from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt.
* crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent-expected.txt: Renamed from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent-expected.txt.
* crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html: Renamed from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html.
* crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key.html: Renamed from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html.
* crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt: Renamed from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt.
* crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk-small-key-expected.txt: Added.
* crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk-small-key.html: Renamed from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-small-key.html.
* crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk.html: Renamed from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html.
* crypto/webkitSubtle/rsassa-pkcs1-v1_5-sign-verify-expected.txt: Renamed from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-sign-verify-expected.txt.
* crypto/webkitSubtle/rsassa-pkcs1-v1_5-sign-verify.html: Renamed from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-sign-verify.html.
* crypto/webkitSubtle/sha-1-expected.txt: Renamed from LayoutTests/crypto/subtle/sha-1-expected.txt.
* crypto/webkitSubtle/sha-1.html: Renamed from LayoutTests/crypto/subtle/sha-1.html.
* crypto/webkitSubtle/sha-224-expected.txt: Renamed from LayoutTests/crypto/subtle/sha-224-expected.txt.
* crypto/webkitSubtle/sha-224.html: Renamed from LayoutTests/crypto/subtle/sha-224.html.
* crypto/webkitSubtle/sha-256-expected.txt: Renamed from LayoutTests/crypto/subtle/sha-256-expected.txt.
* crypto/webkitSubtle/sha-256.html: Renamed from LayoutTests/crypto/subtle/sha-256.html.
* crypto/webkitSubtle/sha-384-expected.txt: Renamed from LayoutTests/crypto/subtle/sha-384-expected.txt.
* crypto/webkitSubtle/sha-384.html: Renamed from LayoutTests/crypto/subtle/sha-384.html.
* crypto/webkitSubtle/sha-512-expected.txt: Renamed from LayoutTests/crypto/subtle/sha-512-expected.txt.
* crypto/webkitSubtle/sha-512.html: Renamed from LayoutTests/crypto/subtle/sha-512.html.
* crypto/webkitSubtle/unimplemented-unwrap-crash-expected.txt: Renamed from LayoutTests/crypto/subtle/unimplemented-unwrap-crash-expected.txt.
* crypto/webkitSubtle/unimplemented-unwrap-crash.html: Renamed from LayoutTests/crypto/subtle/unimplemented-unwrap-crash.html.
* crypto/webkitSubtle/unwrapKey-check-usage-expected.txt: Renamed from LayoutTests/crypto/subtle/unwrapKey-check-usage-expected.txt.
* crypto/webkitSubtle/unwrapKey-check-usage.html: Renamed from LayoutTests/crypto/subtle/unwrapKey-check-usage.html.
* crypto/webkitSubtle/wrapKey-check-usage-expected.txt: Renamed from LayoutTests/crypto/subtle/wrapKey-check-usage-expected.txt.
* crypto/webkitSubtle/wrapKey-check-usage.html: Renamed from LayoutTests/crypto/subtle/wrapKey-check-usage.html.
* crypto/workers/subtle/aes-postMessage-worker-expected.txt: Renamed from LayoutTests/crypto/workers/aes-postMessage-worker-expected.txt.
* crypto/workers/subtle/aes-postMessage-worker.html: Renamed from LayoutTests/crypto/workers/aes-postMessage-worker.html.
* crypto/workers/subtle/gc-worker-expected.txt: Added.
* crypto/workers/subtle/gc-worker.html: Added.
* crypto/workers/subtle/hmac-postMessage-worker-expected.txt: Renamed from LayoutTests/crypto/workers/hmac-postMessage-worker-expected.txt.
* crypto/workers/subtle/hmac-postMessage-worker.html: Renamed from LayoutTests/crypto/workers/hmac-postMessage-worker.html.
* crypto/workers/subtle/hrsa-postMessage-worker-expected.txt: Renamed from LayoutTests/crypto/workers/hrsa-postMessage-worker-expected.txt.
* crypto/workers/subtle/hrsa-postMessage-worker.html: Renamed from LayoutTests/crypto/workers/hrsa-postMessage-worker.html.
* crypto/workers/subtle/multiple-postMessage-worker-expected.txt: Renamed from LayoutTests/crypto/workers/multiple-postMessage-worker-expected.txt.
* crypto/workers/subtle/multiple-postMessage-worker.html: Renamed from LayoutTests/crypto/workers/multiple-postMessage-worker.html.
* crypto/workers/subtle/resources/aes-postMessage-worker.js: Renamed from LayoutTests/crypto/workers/resources/aes-postMessage-worker.js.
* crypto/workers/subtle/resources/gc-worker.js: Added.
* crypto/workers/subtle/resources/hmac-postMessage-worker.js: Renamed from LayoutTests/crypto/workers/resources/hmac-postMessage-worker.js.
* crypto/workers/subtle/resources/hrsa-postMessage-worker.js: Renamed from LayoutTests/crypto/workers/resources/hrsa-postMessage-worker.js.
* crypto/workers/subtle/resources/rsa-postMessage-worker.js: Renamed from LayoutTests/crypto/workers/resources/rsa-postMessage-worker.js.
* crypto/workers/subtle/rsa-postMessage-worker-expected.txt: Renamed from LayoutTests/crypto/workers/rsa-postMessage-worker-expected.txt.
* crypto/workers/subtle/rsa-postMessage-worker.html: Renamed from LayoutTests/crypto/workers/rsa-postMessage-worker.html.
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/ios-simulator-wk1/TestExpectations:
* platform/win/TestExpectations:

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

173 files changed:
LayoutTests/ChangeLog
LayoutTests/crypto/resources/common.js
LayoutTests/crypto/subtle/aes-cbc-generate-key-expected.txt [deleted file]
LayoutTests/crypto/subtle/aes-export-key-expected.txt [deleted file]
LayoutTests/crypto/subtle/argument-conversion-expected.txt [deleted file]
LayoutTests/crypto/subtle/argument-conversion.html [deleted file]
LayoutTests/crypto/subtle/gc-2-expected.txt [new file with mode: 0644]
LayoutTests/crypto/subtle/gc-2.html [new file with mode: 0644]
LayoutTests/crypto/subtle/gc-3-expected.txt [new file with mode: 0644]
LayoutTests/crypto/subtle/gc-3.html [new file with mode: 0644]
LayoutTests/crypto/subtle/gc-expected.txt [new file with mode: 0644]
LayoutTests/crypto/subtle/gc.html [new file with mode: 0644]
LayoutTests/crypto/subtle/hmac-check-algorithm-expected.txt [deleted file]
LayoutTests/crypto/subtle/hmac-check-algorithm.html [deleted file]
LayoutTests/crypto/subtle/hmac-generate-key-expected.txt [deleted file]
LayoutTests/crypto/subtle/import-jwk-expected.txt [deleted file]
LayoutTests/crypto/subtle/import-jwk.html [deleted file]
LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-small-key-expected.txt [deleted file]
LayoutTests/crypto/webkitSubtle/aes-cbc-192-encrypt-decrypt-expected.txt [moved from LayoutTests/crypto/subtle/aes-cbc-192-encrypt-decrypt-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-192-encrypt-decrypt.html [moved from LayoutTests/crypto/subtle/aes-cbc-192-encrypt-decrypt.html with 84% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-256-encrypt-decrypt-expected.txt [moved from LayoutTests/crypto/subtle/aes-cbc-256-encrypt-decrypt-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-256-encrypt-decrypt.html [moved from LayoutTests/crypto/subtle/aes-cbc-256-encrypt-decrypt.html with 84% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-encrypt-decrypt-expected.txt [moved from LayoutTests/crypto/subtle/aes-cbc-encrypt-decrypt-expected.txt with 51% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-encrypt-decrypt-with-padding-expected.txt [moved from LayoutTests/crypto/subtle/aes-cbc-encrypt-decrypt-with-padding-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-encrypt-decrypt-with-padding.html [moved from LayoutTests/crypto/subtle/aes-cbc-encrypt-decrypt-with-padding.html with 82% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-encrypt-decrypt.html [moved from LayoutTests/crypto/subtle/aes-cbc-encrypt-decrypt.html with 70% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-generate-key-expected.txt [new file with mode: 0644]
LayoutTests/crypto/webkitSubtle/aes-cbc-generate-key.html [moved from LayoutTests/crypto/subtle/aes-cbc-generate-key.html with 55% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-import-jwk-expected.txt [moved from LayoutTests/crypto/subtle/aes-cbc-import-jwk-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-import-jwk.html [moved from LayoutTests/crypto/subtle/aes-cbc-import-jwk.html with 88% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-invalid-length-expected.txt [moved from LayoutTests/crypto/subtle/aes-cbc-invalid-length-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-invalid-length.html [moved from LayoutTests/crypto/subtle/aes-cbc-invalid-length.html with 85% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-unwrap-failure-expected.txt [moved from LayoutTests/crypto/subtle/aes-cbc-unwrap-failure-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-unwrap-failure.html [moved from LayoutTests/crypto/subtle/aes-cbc-unwrap-failure.html with 76% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-unwrap-rsa-expected.txt [moved from LayoutTests/crypto/subtle/aes-cbc-unwrap-rsa-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-unwrap-rsa.html [moved from LayoutTests/crypto/subtle/aes-cbc-unwrap-rsa.html with 90% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-wrap-rsa-expected.txt [moved from LayoutTests/crypto/subtle/aes-cbc-wrap-rsa-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-wrap-rsa-non-extractable-expected.txt [moved from LayoutTests/crypto/subtle/aes-cbc-wrap-rsa-non-extractable-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-wrap-rsa-non-extractable.html [moved from LayoutTests/crypto/subtle/aes-cbc-wrap-rsa-non-extractable.html with 83% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-wrap-rsa.html [moved from LayoutTests/crypto/subtle/aes-cbc-wrap-rsa.html with 83% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-wrong-key-class-expected.txt [moved from LayoutTests/crypto/subtle/aes-cbc-wrong-key-class-expected.txt with 62% similarity]
LayoutTests/crypto/webkitSubtle/aes-cbc-wrong-key-class.html [moved from LayoutTests/crypto/subtle/aes-cbc-wrong-key-class.html with 76% similarity]
LayoutTests/crypto/webkitSubtle/aes-export-key-expected.txt [new file with mode: 0644]
LayoutTests/crypto/webkitSubtle/aes-export-key.html [moved from LayoutTests/crypto/subtle/aes-export-key.html with 61% similarity]
LayoutTests/crypto/webkitSubtle/aes-kw-key-manipulation-expected.txt [moved from LayoutTests/crypto/subtle/aes-kw-key-manipulation-expected.txt with 80% similarity]
LayoutTests/crypto/webkitSubtle/aes-kw-key-manipulation.html [moved from LayoutTests/crypto/subtle/aes-kw-key-manipulation.html with 75% similarity]
LayoutTests/crypto/webkitSubtle/aes-kw-wrap-unwrap-aes-expected.txt [moved from LayoutTests/crypto/subtle/aes-kw-wrap-unwrap-aes-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/aes-kw-wrap-unwrap-aes.html [moved from LayoutTests/crypto/subtle/aes-kw-wrap-unwrap-aes.html with 74% similarity]
LayoutTests/crypto/webkitSubtle/aes-postMessage-expected.txt [moved from LayoutTests/crypto/subtle/aes-postMessage-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/aes-postMessage.html [moved from LayoutTests/crypto/subtle/aes-postMessage.html with 81% similarity]
LayoutTests/crypto/webkitSubtle/argument-conversion-expected.txt [new file with mode: 0644]
LayoutTests/crypto/webkitSubtle/argument-conversion.html [new file with mode: 0644]
LayoutTests/crypto/webkitSubtle/array-buffer-view-offset-expected.txt [moved from LayoutTests/crypto/subtle/array-buffer-view-offset-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/array-buffer-view-offset.html [moved from LayoutTests/crypto/subtle/array-buffer-view-offset.html with 92% similarity]
LayoutTests/crypto/webkitSubtle/crypto-key-algorithm-gc-expected.txt [moved from LayoutTests/crypto/subtle/crypto-key-algorithm-gc-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/crypto-key-algorithm-gc.html [moved from LayoutTests/crypto/subtle/crypto-key-algorithm-gc.html with 87% similarity]
LayoutTests/crypto/webkitSubtle/crypto-key-usages-gc-expected.txt [moved from LayoutTests/crypto/subtle/crypto-key-usages-gc-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/crypto-key-usages-gc.html [moved from LayoutTests/crypto/subtle/crypto-key-usages-gc.html with 87% similarity]
LayoutTests/crypto/webkitSubtle/hmac-check-algorithm-expected.txt [new file with mode: 0644]
LayoutTests/crypto/webkitSubtle/hmac-check-algorithm.html [new file with mode: 0644]
LayoutTests/crypto/webkitSubtle/hmac-export-key-expected.txt [moved from LayoutTests/crypto/subtle/hmac-export-key-expected.txt with 63% similarity]
LayoutTests/crypto/webkitSubtle/hmac-export-key.html [moved from LayoutTests/crypto/subtle/hmac-export-key.html with 68% similarity]
LayoutTests/crypto/webkitSubtle/hmac-generate-key-expected.txt [new file with mode: 0644]
LayoutTests/crypto/webkitSubtle/hmac-generate-key.html [moved from LayoutTests/crypto/subtle/hmac-generate-key.html with 63% similarity]
LayoutTests/crypto/webkitSubtle/hmac-import-jwk-expected.txt [moved from LayoutTests/crypto/subtle/hmac-import-jwk-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/hmac-import-jwk.html [moved from LayoutTests/crypto/subtle/hmac-import-jwk.html with 81% similarity]
LayoutTests/crypto/webkitSubtle/hmac-postMessage-expected.txt [moved from LayoutTests/crypto/subtle/hmac-postMessage-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/hmac-postMessage.html [moved from LayoutTests/crypto/subtle/hmac-postMessage.html with 81% similarity]
LayoutTests/crypto/webkitSubtle/hmac-sign-verify-empty-key-expected.txt [moved from LayoutTests/crypto/subtle/hmac-sign-verify-empty-key-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/hmac-sign-verify-empty-key.html [moved from LayoutTests/crypto/subtle/hmac-sign-verify-empty-key.html with 79% similarity]
LayoutTests/crypto/webkitSubtle/hmac-sign-verify-expected.txt [moved from LayoutTests/crypto/subtle/hmac-sign-verify-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/hmac-sign-verify.html [moved from LayoutTests/crypto/subtle/hmac-sign-verify.html with 79% similarity]
LayoutTests/crypto/webkitSubtle/import-jwk-expected.txt [new file with mode: 0644]
LayoutTests/crypto/webkitSubtle/import-jwk.html [new file with mode: 0644]
LayoutTests/crypto/webkitSubtle/jwk-export-use-values-expected.txt [moved from LayoutTests/crypto/subtle/jwk-export-use-values-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/jwk-export-use-values.html [moved from LayoutTests/crypto/subtle/jwk-export-use-values.html with 82% similarity]
LayoutTests/crypto/webkitSubtle/jwk-import-use-values-expected.txt [moved from LayoutTests/crypto/subtle/jwk-import-use-values-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/jwk-import-use-values.html [moved from LayoutTests/crypto/subtle/jwk-import-use-values.html with 87% similarity]
LayoutTests/crypto/webkitSubtle/resources/rsa-indexeddb-non-exportable.js [moved from LayoutTests/crypto/subtle/resources/rsa-indexeddb-non-exportable.js with 94% similarity]
LayoutTests/crypto/webkitSubtle/resources/rsa-indexeddb.js [moved from LayoutTests/crypto/subtle/resources/rsa-indexeddb.js with 94% similarity]
LayoutTests/crypto/webkitSubtle/rsa-export-generated-keys-expected.txt [moved from LayoutTests/crypto/subtle/rsa-export-generated-keys-expected.txt with 63% similarity]
LayoutTests/crypto/webkitSubtle/rsa-export-generated-keys.html [moved from LayoutTests/crypto/subtle/rsa-export-generated-keys.html with 75% similarity]
LayoutTests/crypto/webkitSubtle/rsa-export-key-expected.txt [moved from LayoutTests/crypto/subtle/rsa-export-key-expected.txt with 52% similarity]
LayoutTests/crypto/webkitSubtle/rsa-export-key.html [moved from LayoutTests/crypto/subtle/rsa-export-key.html with 74% similarity]
LayoutTests/crypto/webkitSubtle/rsa-export-private-key-expected.txt [moved from LayoutTests/crypto/subtle/rsa-export-private-key-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/rsa-export-private-key.html [moved from LayoutTests/crypto/subtle/rsa-export-private-key.html with 94% similarity]
LayoutTests/crypto/webkitSubtle/rsa-indexeddb-expected.txt [moved from LayoutTests/crypto/subtle/rsa-indexeddb-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/rsa-indexeddb-non-exportable-expected.txt [moved from LayoutTests/crypto/subtle/rsa-indexeddb-non-exportable-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/rsa-indexeddb-non-exportable-private-expected.txt [moved from LayoutTests/crypto/subtle/rsa-indexeddb-non-exportable-private-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/rsa-indexeddb-non-exportable-private.html [moved from LayoutTests/crypto/subtle/rsa-indexeddb-non-exportable-private.html with 100% similarity]
LayoutTests/crypto/webkitSubtle/rsa-indexeddb-non-exportable.html [moved from LayoutTests/crypto/subtle/rsa-indexeddb-non-exportable.html with 100% similarity]
LayoutTests/crypto/webkitSubtle/rsa-indexeddb-private-expected.txt [moved from LayoutTests/crypto/subtle/rsa-indexeddb-private-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/rsa-indexeddb-private.html [moved from LayoutTests/crypto/subtle/rsa-indexeddb-private.html with 100% similarity]
LayoutTests/crypto/webkitSubtle/rsa-indexeddb.html [moved from LayoutTests/crypto/subtle/rsa-indexeddb.html with 100% similarity]
LayoutTests/crypto/webkitSubtle/rsa-oaep-generate-non-extractable-key-expected.txt [moved from LayoutTests/crypto/subtle/rsa-oaep-generate-non-extractable-key-expected.txt with 94% similarity]
LayoutTests/crypto/webkitSubtle/rsa-oaep-generate-non-extractable-key.html [moved from LayoutTests/crypto/subtle/rsa-oaep-generate-non-extractable-key.html with 90% similarity]
LayoutTests/crypto/webkitSubtle/rsa-oaep-key-manipulation-expected.txt [moved from LayoutTests/crypto/subtle/rsa-oaep-key-manipulation-expected.txt with 79% similarity]
LayoutTests/crypto/webkitSubtle/rsa-oaep-key-manipulation.html [moved from LayoutTests/crypto/subtle/rsa-oaep-key-manipulation.html with 78% similarity]
LayoutTests/crypto/webkitSubtle/rsa-oaep-plaintext-length-expected.txt [moved from LayoutTests/crypto/subtle/rsa-oaep-plaintext-length-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/rsa-oaep-plaintext-length.html [moved from LayoutTests/crypto/subtle/rsa-oaep-plaintext-length.html with 85% similarity]
LayoutTests/crypto/webkitSubtle/rsa-oaep-wrap-unwrap-aes-expected.txt [moved from LayoutTests/crypto/subtle/rsa-oaep-wrap-unwrap-aes-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/rsa-oaep-wrap-unwrap-aes.html [moved from LayoutTests/crypto/subtle/rsa-oaep-wrap-unwrap-aes.html with 81% similarity]
LayoutTests/crypto/webkitSubtle/rsa-postMessage-expected.txt [moved from LayoutTests/crypto/subtle/rsa-postMessage-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/rsa-postMessage.html [moved from LayoutTests/crypto/subtle/rsa-postMessage.html with 94% similarity]
LayoutTests/crypto/webkitSubtle/rsaes-pkcs1-v1_5-decrypt-expected.txt [moved from LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-decrypt-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/rsaes-pkcs1-v1_5-decrypt.html [moved from LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-decrypt.html with 94% similarity]
LayoutTests/crypto/webkitSubtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes-expected.txt [moved from LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes.html [moved from LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes.html with 85% similarity]
LayoutTests/crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key-expected.txt [moved from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt with 94% similarity]
LayoutTests/crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent-expected.txt [moved from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent-expected.txt with 91% similarity]
LayoutTests/crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html [moved from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html with 86% similarity]
LayoutTests/crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key.html [moved from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html with 90% similarity]
LayoutTests/crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt [moved from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk-small-key-expected.txt [new file with mode: 0644]
LayoutTests/crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk-small-key.html [moved from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-small-key.html with 90% similarity]
LayoutTests/crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk.html [moved from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html with 92% similarity]
LayoutTests/crypto/webkitSubtle/rsassa-pkcs1-v1_5-sign-verify-expected.txt [moved from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-sign-verify-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/rsassa-pkcs1-v1_5-sign-verify.html [moved from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-sign-verify.html with 88% similarity]
LayoutTests/crypto/webkitSubtle/sha-1-expected.txt [moved from LayoutTests/crypto/subtle/sha-1-expected.txt with 74% similarity]
LayoutTests/crypto/webkitSubtle/sha-1.html [moved from LayoutTests/crypto/subtle/sha-1.html with 76% similarity]
LayoutTests/crypto/webkitSubtle/sha-224-expected.txt [moved from LayoutTests/crypto/subtle/sha-224-expected.txt with 94% similarity]
LayoutTests/crypto/webkitSubtle/sha-224.html [moved from LayoutTests/crypto/subtle/sha-224.html with 80% similarity]
LayoutTests/crypto/webkitSubtle/sha-256-expected.txt [moved from LayoutTests/crypto/subtle/sha-256-expected.txt with 94% similarity]
LayoutTests/crypto/webkitSubtle/sha-256.html [moved from LayoutTests/crypto/subtle/sha-256.html with 80% similarity]
LayoutTests/crypto/webkitSubtle/sha-384-expected.txt [moved from LayoutTests/crypto/subtle/sha-384-expected.txt with 95% similarity]
LayoutTests/crypto/webkitSubtle/sha-384.html [moved from LayoutTests/crypto/subtle/sha-384.html with 81% similarity]
LayoutTests/crypto/webkitSubtle/sha-512-expected.txt [moved from LayoutTests/crypto/subtle/sha-512-expected.txt with 95% similarity]
LayoutTests/crypto/webkitSubtle/sha-512.html [moved from LayoutTests/crypto/subtle/sha-512.html with 83% similarity]
LayoutTests/crypto/webkitSubtle/unimplemented-unwrap-crash-expected.txt [moved from LayoutTests/crypto/subtle/unimplemented-unwrap-crash-expected.txt with 100% similarity]
LayoutTests/crypto/webkitSubtle/unimplemented-unwrap-crash.html [moved from LayoutTests/crypto/subtle/unimplemented-unwrap-crash.html with 60% similarity]
LayoutTests/crypto/webkitSubtle/unwrapKey-check-usage-expected.txt [moved from LayoutTests/crypto/subtle/unwrapKey-check-usage-expected.txt with 60% similarity]
LayoutTests/crypto/webkitSubtle/unwrapKey-check-usage.html [moved from LayoutTests/crypto/subtle/unwrapKey-check-usage.html with 82% similarity]
LayoutTests/crypto/webkitSubtle/wrapKey-check-usage-expected.txt [moved from LayoutTests/crypto/subtle/wrapKey-check-usage-expected.txt with 66% similarity]
LayoutTests/crypto/webkitSubtle/wrapKey-check-usage.html [moved from LayoutTests/crypto/subtle/wrapKey-check-usage.html with 76% similarity]
LayoutTests/crypto/workers/subtle/aes-postMessage-worker-expected.txt [moved from LayoutTests/crypto/workers/aes-postMessage-worker-expected.txt with 100% similarity]
LayoutTests/crypto/workers/subtle/aes-postMessage-worker.html [moved from LayoutTests/crypto/workers/aes-postMessage-worker.html with 72% similarity]
LayoutTests/crypto/workers/subtle/gc-worker-expected.txt [new file with mode: 0644]
LayoutTests/crypto/workers/subtle/gc-worker.html [new file with mode: 0644]
LayoutTests/crypto/workers/subtle/hmac-postMessage-worker-expected.txt [moved from LayoutTests/crypto/workers/hmac-postMessage-worker-expected.txt with 100% similarity]
LayoutTests/crypto/workers/subtle/hmac-postMessage-worker.html [moved from LayoutTests/crypto/workers/hmac-postMessage-worker.html with 73% similarity]
LayoutTests/crypto/workers/subtle/hrsa-postMessage-worker-expected.txt [moved from LayoutTests/crypto/workers/hrsa-postMessage-worker-expected.txt with 100% similarity]
LayoutTests/crypto/workers/subtle/hrsa-postMessage-worker.html [moved from LayoutTests/crypto/workers/hrsa-postMessage-worker.html with 89% similarity]
LayoutTests/crypto/workers/subtle/multiple-postMessage-worker-expected.txt [moved from LayoutTests/crypto/workers/multiple-postMessage-worker-expected.txt with 100% similarity]
LayoutTests/crypto/workers/subtle/multiple-postMessage-worker.html [moved from LayoutTests/crypto/workers/multiple-postMessage-worker.html with 79% similarity]
LayoutTests/crypto/workers/subtle/resources/aes-postMessage-worker.js [moved from LayoutTests/crypto/workers/resources/aes-postMessage-worker.js with 100% similarity]
LayoutTests/crypto/workers/subtle/resources/gc-worker.js [new file with mode: 0644]
LayoutTests/crypto/workers/subtle/resources/hmac-postMessage-worker.js [moved from LayoutTests/crypto/workers/resources/hmac-postMessage-worker.js with 100% similarity]
LayoutTests/crypto/workers/subtle/resources/hrsa-postMessage-worker.js [moved from LayoutTests/crypto/workers/resources/hrsa-postMessage-worker.js with 98% similarity]
LayoutTests/crypto/workers/subtle/resources/rsa-postMessage-worker.js [moved from LayoutTests/crypto/workers/resources/rsa-postMessage-worker.js with 98% similarity]
LayoutTests/crypto/workers/subtle/rsa-postMessage-worker-expected.txt [moved from LayoutTests/crypto/workers/rsa-postMessage-worker-expected.txt with 100% similarity]
LayoutTests/crypto/workers/subtle/rsa-postMessage-worker.html [moved from LayoutTests/crypto/workers/rsa-postMessage-worker.html with 89% similarity]
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/WebCryptoAPI/digest/test_digest-expected.txt
LayoutTests/imported/w3c/WebCryptoAPI/idlharness-expected.txt
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/ios-simulator-wk1/TestExpectations
LayoutTests/platform/win/TestExpectations
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.cpp
Source/WebCore/DerivedSources.make
Source/WebCore/PlatformEfl.cmake
Source/WebCore/PlatformGTK.cmake
Source/WebCore/PlatformMac.cmake
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/crypto/CryptoKeyPair.idl
Source/WebCore/crypto/SubtleCrypto.cpp [new file with mode: 0644]
Source/WebCore/crypto/SubtleCrypto.h [new file with mode: 0644]
Source/WebCore/crypto/SubtleCrypto.idl [new file with mode: 0644]
Source/WebCore/page/Crypto.cpp
Source/WebCore/page/Crypto.h
Source/WebCore/page/Crypto.idl

index e2abcfe..5ff2fc4 100644 (file)
@@ -1,3 +1,156 @@
+2016-10-06  Jiewen Tan  <jiewen_tan@apple.com>
+
+        Add a dummy SubtleCrypto interface
+        https://bugs.webkit.org/show_bug.cgi?id=162992
+        <rdar://problem/28643573>
+
+        Reviewed by Brent Fulgham.
+
+        * crypto/resources/common.js:
+        * crypto/subtle/gc-2-expected.txt: Added.
+        * crypto/subtle/gc-2.html: Added.
+        * crypto/subtle/gc-3-expected.txt: Added.
+        * crypto/subtle/gc-3.html: Added.
+        * crypto/subtle/gc-expected.txt: Added.
+        * crypto/subtle/gc.html: Added.
+        * crypto/webkitSubtle/aes-cbc-192-encrypt-decrypt-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-192-encrypt-decrypt-expected.txt.
+        * crypto/webkitSubtle/aes-cbc-192-encrypt-decrypt.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-192-encrypt-decrypt.html.
+        * crypto/webkitSubtle/aes-cbc-256-encrypt-decrypt-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-256-encrypt-decrypt-expected.txt.
+        * crypto/webkitSubtle/aes-cbc-256-encrypt-decrypt.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-256-encrypt-decrypt.html.
+        * crypto/webkitSubtle/aes-cbc-encrypt-decrypt-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-encrypt-decrypt-expected.txt.
+        * crypto/webkitSubtle/aes-cbc-encrypt-decrypt-with-padding-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-encrypt-decrypt-with-padding-expected.txt.
+        * crypto/webkitSubtle/aes-cbc-encrypt-decrypt-with-padding.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-encrypt-decrypt-with-padding.html.
+        * crypto/webkitSubtle/aes-cbc-encrypt-decrypt.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-encrypt-decrypt.html.
+        * crypto/webkitSubtle/aes-cbc-generate-key-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-generate-key-expected.txt.
+        * crypto/webkitSubtle/aes-cbc-generate-key.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-generate-key.html.
+        * crypto/webkitSubtle/aes-cbc-import-jwk-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-import-jwk-expected.txt.
+        * crypto/webkitSubtle/aes-cbc-import-jwk.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-import-jwk.html.
+        * crypto/webkitSubtle/aes-cbc-invalid-length-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-invalid-length-expected.txt.
+        * crypto/webkitSubtle/aes-cbc-invalid-length.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-invalid-length.html.
+        * crypto/webkitSubtle/aes-cbc-unwrap-failure-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-unwrap-failure-expected.txt.
+        * crypto/webkitSubtle/aes-cbc-unwrap-failure.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-unwrap-failure.html.
+        * crypto/webkitSubtle/aes-cbc-unwrap-rsa-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-unwrap-rsa-expected.txt.
+        * crypto/webkitSubtle/aes-cbc-unwrap-rsa.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-unwrap-rsa.html.
+        * crypto/webkitSubtle/aes-cbc-wrap-rsa-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-wrap-rsa-expected.txt.
+        * crypto/webkitSubtle/aes-cbc-wrap-rsa-non-extractable-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-wrap-rsa-non-extractable-expected.txt.
+        * crypto/webkitSubtle/aes-cbc-wrap-rsa-non-extractable.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-wrap-rsa-non-extractable.html.
+        * crypto/webkitSubtle/aes-cbc-wrap-rsa.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-wrap-rsa.html.
+        * crypto/webkitSubtle/aes-cbc-wrong-key-class-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-wrong-key-class-expected.txt.
+        * crypto/webkitSubtle/aes-cbc-wrong-key-class.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-wrong-key-class.html.
+        * crypto/webkitSubtle/aes-export-key-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-export-key-expected.txt.
+        * crypto/webkitSubtle/aes-export-key.html: Renamed from LayoutTests/crypto/subtle/aes-export-key.html.
+        * crypto/webkitSubtle/aes-kw-key-manipulation-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-kw-key-manipulation-expected.txt.
+        * crypto/webkitSubtle/aes-kw-key-manipulation.html: Renamed from LayoutTests/crypto/subtle/aes-kw-key-manipulation.html.
+        * crypto/webkitSubtle/aes-kw-wrap-unwrap-aes-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-kw-wrap-unwrap-aes-expected.txt.
+        * crypto/webkitSubtle/aes-kw-wrap-unwrap-aes.html: Renamed from LayoutTests/crypto/subtle/aes-kw-wrap-unwrap-aes.html.
+        * crypto/webkitSubtle/aes-postMessage-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-postMessage-expected.txt.
+        * crypto/webkitSubtle/aes-postMessage.html: Renamed from LayoutTests/crypto/subtle/aes-postMessage.html.
+        * crypto/webkitSubtle/argument-conversion-expected.txt: Renamed from LayoutTests/crypto/subtle/argument-conversion-expected.txt.
+        * crypto/webkitSubtle/argument-conversion.html: Renamed from LayoutTests/crypto/subtle/argument-conversion.html.
+        * crypto/webkitSubtle/array-buffer-view-offset-expected.txt: Renamed from LayoutTests/crypto/subtle/array-buffer-view-offset-expected.txt.
+        * crypto/webkitSubtle/array-buffer-view-offset.html: Renamed from LayoutTests/crypto/subtle/array-buffer-view-offset.html.
+        * crypto/webkitSubtle/crypto-key-algorithm-gc-expected.txt: Renamed from LayoutTests/crypto/subtle/crypto-key-algorithm-gc-expected.txt.
+        * crypto/webkitSubtle/crypto-key-algorithm-gc.html: Renamed from LayoutTests/crypto/subtle/crypto-key-algorithm-gc.html.
+        * crypto/webkitSubtle/crypto-key-usages-gc-expected.txt: Renamed from LayoutTests/crypto/subtle/crypto-key-usages-gc-expected.txt.
+        * crypto/webkitSubtle/crypto-key-usages-gc.html: Renamed from LayoutTests/crypto/subtle/crypto-key-usages-gc.html.
+        * crypto/webkitSubtle/hmac-check-algorithm-expected.txt: Renamed from LayoutTests/crypto/subtle/hmac-check-algorithm-expected.txt.
+        * crypto/webkitSubtle/hmac-check-algorithm.html: Renamed from LayoutTests/crypto/subtle/hmac-check-algorithm.html.
+        * crypto/webkitSubtle/hmac-export-key-expected.txt: Renamed from LayoutTests/crypto/subtle/hmac-export-key-expected.txt.
+        * crypto/webkitSubtle/hmac-export-key.html: Renamed from LayoutTests/crypto/subtle/hmac-export-key.html.
+        * crypto/webkitSubtle/hmac-generate-key-expected.txt: Renamed from LayoutTests/crypto/subtle/hmac-export-key.html.
+        * crypto/webkitSubtle/hmac-generate-key.html: Renamed from LayoutTests/crypto/subtle/hmac-generate-key.html.
+        * crypto/webkitSubtle/hmac-import-jwk-expected.txt: Renamed from LayoutTests/crypto/subtle/hmac-import-jwk-expected.txt.
+        * crypto/webkitSubtle/hmac-import-jwk.html: Renamed from LayoutTests/crypto/subtle/hmac-import-jwk.html.
+        * crypto/webkitSubtle/hmac-postMessage-expected.txt: Renamed from LayoutTests/crypto/subtle/hmac-postMessage-expected.txt.
+        * crypto/webkitSubtle/hmac-postMessage.html: Renamed from LayoutTests/crypto/subtle/hmac-postMessage.html.
+        * crypto/webkitSubtle/hmac-sign-verify-empty-key-expected.txt: Renamed from LayoutTests/crypto/subtle/hmac-sign-verify-empty-key-expected.txt.
+        * crypto/webkitSubtle/hmac-sign-verify-empty-key.html: Renamed from LayoutTests/crypto/subtle/hmac-sign-verify-empty-key.html.
+        * crypto/webkitSubtle/hmac-sign-verify-expected.txt: Renamed from LayoutTests/crypto/subtle/hmac-sign-verify-expected.txt.
+        * crypto/webkitSubtle/hmac-sign-verify.html: Renamed from LayoutTests/crypto/subtle/hmac-sign-verify.html.
+        * crypto/webkitSubtle/import-jwk-expected.txt: Renamed from LayoutTests/crypto/subtle/import-jwk-expected.txt.
+        * crypto/webkitSubtle/import-jwk.html: Renamed from LayoutTests/crypto/subtle/import-jwk-expected.html.
+        * crypto/webkitSubtle/jwk-export-use-values-expected.txt: Renamed from LayoutTests/crypto/subtle/jwk-export-use-values-expected.txt.
+        * crypto/webkitSubtle/jwk-export-use-values.html: Renamed from LayoutTests/crypto/subtle/jwk-export-use-values.html.
+        * crypto/webkitSubtle/jwk-import-use-values-expected.txt: Renamed from LayoutTests/crypto/subtle/jwk-import-use-values-expected.txt.
+        * crypto/webkitSubtle/jwk-import-use-values.html: Renamed from LayoutTests/crypto/subtle/jwk-import-use-values.html.
+        * crypto/webkitSubtle/resources/rsa-indexeddb-non-exportable.js: Renamed from LayoutTests/crypto/subtle/resources/rsa-indexeddb-non-exportable.js.
+        * crypto/webkitSubtle/resources/rsa-indexeddb.js: Renamed from LayoutTests/crypto/subtle/resources/rsa-indexeddb.js.
+        * crypto/webkitSubtle/rsa-export-generated-keys-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-export-generated-keys-expected.txt.
+        * crypto/webkitSubtle/rsa-export-generated-keys.html: Renamed from LayoutTests/crypto/subtle/rsa-export-generated-keys.html.
+        * crypto/webkitSubtle/rsa-export-key-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-export-key-expected.txt.
+        * crypto/webkitSubtle/rsa-export-key.html: Renamed from LayoutTests/crypto/subtle/rsa-export-key.html.
+        * crypto/webkitSubtle/rsa-export-private-key-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-export-private-key-expected.txt.
+        * crypto/webkitSubtle/rsa-export-private-key.html: Renamed from LayoutTests/crypto/subtle/rsa-export-private-key.html.
+        * crypto/webkitSubtle/rsa-indexeddb-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-indexeddb-expected.txt.
+        * crypto/webkitSubtle/rsa-indexeddb-non-exportable-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-indexeddb-non-exportable-expected.txt.
+        * crypto/webkitSubtle/rsa-indexeddb-non-exportable-private-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-indexeddb-non-exportable-private-expected.txt.
+        * crypto/webkitSubtle/rsa-indexeddb-non-exportable-private.html: Renamed from LayoutTests/crypto/subtle/rsa-indexeddb-non-exportable-private.html.
+        * crypto/webkitSubtle/rsa-indexeddb-non-exportable.html: Renamed from LayoutTests/crypto/subtle/rsa-indexeddb-non-exportable.html.
+        * crypto/webkitSubtle/rsa-indexeddb-private-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-indexeddb-private-expected.txt.
+        * crypto/webkitSubtle/rsa-indexeddb-private.html: Renamed from LayoutTests/crypto/subtle/rsa-indexeddb-private.html.
+        * crypto/webkitSubtle/rsa-indexeddb.html: Renamed from LayoutTests/crypto/subtle/rsa-indexeddb.html.
+        * crypto/webkitSubtle/rsa-oaep-generate-non-extractable-key-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-oaep-generate-non-extractable-key-expected.txt.
+        * crypto/webkitSubtle/rsa-oaep-generate-non-extractable-key.html: Renamed from LayoutTests/crypto/subtle/rsa-oaep-generate-non-extractable-key.html.
+        * crypto/webkitSubtle/rsa-oaep-key-manipulation-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-oaep-key-manipulation-expected.txt.
+        * crypto/webkitSubtle/rsa-oaep-key-manipulation.html: Renamed from LayoutTests/crypto/subtle/rsa-oaep-key-manipulation.html.
+        * crypto/webkitSubtle/rsa-oaep-plaintext-length-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-oaep-plaintext-length-expected.txt.
+        * crypto/webkitSubtle/rsa-oaep-plaintext-length.html: Renamed from LayoutTests/crypto/subtle/rsa-oaep-plaintext-length.html.
+        * crypto/webkitSubtle/rsa-oaep-wrap-unwrap-aes-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-oaep-wrap-unwrap-aes-expected.txt.
+        * crypto/webkitSubtle/rsa-oaep-wrap-unwrap-aes.html: Renamed from LayoutTests/crypto/subtle/rsa-oaep-wrap-unwrap-aes.html.
+        * crypto/webkitSubtle/rsa-postMessage-expected.txt: Renamed from LayoutTests/crypto/subtle/rsa-postMessage-expected.txt.
+        * crypto/webkitSubtle/rsa-postMessage.html: Renamed from LayoutTests/crypto/subtle/rsa-postMessage.html.
+        * crypto/webkitSubtle/rsaes-pkcs1-v1_5-decrypt-expected.txt: Renamed from LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-decrypt-expected.txt.
+        * crypto/webkitSubtle/rsaes-pkcs1-v1_5-decrypt.html: Renamed from LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-decrypt.html.
+        * crypto/webkitSubtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes-expected.txt: Renamed from LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes-expected.txt.
+        * crypto/webkitSubtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes.html: Renamed from LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes.html.
+        * crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key-expected.txt: Renamed from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt.
+        * crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent-expected.txt: Renamed from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent-expected.txt.
+        * crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html: Renamed from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html.
+        * crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key.html: Renamed from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html.
+        * crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt: Renamed from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt.
+        * crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk-small-key-expected.txt: Added.
+        * crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk-small-key.html: Renamed from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-small-key.html.
+        * crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk.html: Renamed from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html.
+        * crypto/webkitSubtle/rsassa-pkcs1-v1_5-sign-verify-expected.txt: Renamed from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-sign-verify-expected.txt.
+        * crypto/webkitSubtle/rsassa-pkcs1-v1_5-sign-verify.html: Renamed from LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-sign-verify.html.
+        * crypto/webkitSubtle/sha-1-expected.txt: Renamed from LayoutTests/crypto/subtle/sha-1-expected.txt.
+        * crypto/webkitSubtle/sha-1.html: Renamed from LayoutTests/crypto/subtle/sha-1.html.
+        * crypto/webkitSubtle/sha-224-expected.txt: Renamed from LayoutTests/crypto/subtle/sha-224-expected.txt.
+        * crypto/webkitSubtle/sha-224.html: Renamed from LayoutTests/crypto/subtle/sha-224.html.
+        * crypto/webkitSubtle/sha-256-expected.txt: Renamed from LayoutTests/crypto/subtle/sha-256-expected.txt.
+        * crypto/webkitSubtle/sha-256.html: Renamed from LayoutTests/crypto/subtle/sha-256.html.
+        * crypto/webkitSubtle/sha-384-expected.txt: Renamed from LayoutTests/crypto/subtle/sha-384-expected.txt.
+        * crypto/webkitSubtle/sha-384.html: Renamed from LayoutTests/crypto/subtle/sha-384.html.
+        * crypto/webkitSubtle/sha-512-expected.txt: Renamed from LayoutTests/crypto/subtle/sha-512-expected.txt.
+        * crypto/webkitSubtle/sha-512.html: Renamed from LayoutTests/crypto/subtle/sha-512.html.
+        * crypto/webkitSubtle/unimplemented-unwrap-crash-expected.txt: Renamed from LayoutTests/crypto/subtle/unimplemented-unwrap-crash-expected.txt.
+        * crypto/webkitSubtle/unimplemented-unwrap-crash.html: Renamed from LayoutTests/crypto/subtle/unimplemented-unwrap-crash.html.
+        * crypto/webkitSubtle/unwrapKey-check-usage-expected.txt: Renamed from LayoutTests/crypto/subtle/unwrapKey-check-usage-expected.txt.
+        * crypto/webkitSubtle/unwrapKey-check-usage.html: Renamed from LayoutTests/crypto/subtle/unwrapKey-check-usage.html.
+        * crypto/webkitSubtle/wrapKey-check-usage-expected.txt: Renamed from LayoutTests/crypto/subtle/wrapKey-check-usage-expected.txt.
+        * crypto/webkitSubtle/wrapKey-check-usage.html: Renamed from LayoutTests/crypto/subtle/wrapKey-check-usage.html.
+        * crypto/workers/subtle/aes-postMessage-worker-expected.txt: Renamed from LayoutTests/crypto/workers/aes-postMessage-worker-expected.txt.
+        * crypto/workers/subtle/aes-postMessage-worker.html: Renamed from LayoutTests/crypto/workers/aes-postMessage-worker.html.
+        * crypto/workers/subtle/gc-worker-expected.txt: Added.
+        * crypto/workers/subtle/gc-worker.html: Added.
+        * crypto/workers/subtle/hmac-postMessage-worker-expected.txt: Renamed from LayoutTests/crypto/workers/hmac-postMessage-worker-expected.txt.
+        * crypto/workers/subtle/hmac-postMessage-worker.html: Renamed from LayoutTests/crypto/workers/hmac-postMessage-worker.html.
+        * crypto/workers/subtle/hrsa-postMessage-worker-expected.txt: Renamed from LayoutTests/crypto/workers/hrsa-postMessage-worker-expected.txt.
+        * crypto/workers/subtle/hrsa-postMessage-worker.html: Renamed from LayoutTests/crypto/workers/hrsa-postMessage-worker.html.
+        * crypto/workers/subtle/multiple-postMessage-worker-expected.txt: Renamed from LayoutTests/crypto/workers/multiple-postMessage-worker-expected.txt.
+        * crypto/workers/subtle/multiple-postMessage-worker.html: Renamed from LayoutTests/crypto/workers/multiple-postMessage-worker.html.
+        * crypto/workers/subtle/resources/aes-postMessage-worker.js: Renamed from LayoutTests/crypto/workers/resources/aes-postMessage-worker.js.
+        * crypto/workers/subtle/resources/gc-worker.js: Added.
+        * crypto/workers/subtle/resources/hmac-postMessage-worker.js: Renamed from LayoutTests/crypto/workers/resources/hmac-postMessage-worker.js.
+        * crypto/workers/subtle/resources/hrsa-postMessage-worker.js: Renamed from LayoutTests/crypto/workers/resources/hrsa-postMessage-worker.js.
+        * crypto/workers/subtle/resources/rsa-postMessage-worker.js: Renamed from LayoutTests/crypto/workers/resources/rsa-postMessage-worker.js.
+        * crypto/workers/subtle/rsa-postMessage-worker-expected.txt: Renamed from LayoutTests/crypto/workers/rsa-postMessage-worker-expected.txt.
+        * crypto/workers/subtle/rsa-postMessage-worker.html: Renamed from LayoutTests/crypto/workers/rsa-postMessage-worker.html.
+        * platform/efl/TestExpectations:
+        * platform/gtk/TestExpectations:
+        * platform/ios-simulator-wk1/TestExpectations:
+        * platform/win/TestExpectations:
+
 2016-10-06  Antti Koivisto  <antti@apple.com>
 
         Mutating styleSheet in shadow tree doesn't update the style
index 2dfe3a2..3fcdd42 100644 (file)
@@ -80,6 +80,3 @@ var Base64URL = {
         return new Uint8Array(Array.prototype.map.call(atob(s), function (c) { return c.charCodeAt(0) }));
     }
 };
-
-if (!(typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) && !crypto.subtle)
-    crypto.subtle = crypto.webkitSubtle;
diff --git a/LayoutTests/crypto/subtle/aes-cbc-generate-key-expected.txt b/LayoutTests/crypto/subtle/aes-cbc-generate-key-expected.txt
deleted file mode 100644 (file)
index 0566972..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-Test generating an AES key using AES-CBC algorithm.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS crypto.subtle.generateKey("aes-cbc", extractable, ["encrypt", "decrypt"]) threw exception TypeError: Type error.
-PASS crypto.subtle.generateKey({name: "aes-cbc"}, extractable, ["encrypt", "decrypt"]) threw exception TypeError: Value NaN is outside the range [0, 65535].
-PASS crypto.subtle.generateKey({name: "aes-cbc", length: undefined}, extractable, ["encrypt", "decrypt"]) threw exception TypeError: Value NaN is outside the range [0, 65535].
-PASS crypto.subtle.generateKey({name: "aes-cbc", length: {}}, extractable, ["encrypt", "decrypt"]) threw exception TypeError: Value NaN is outside the range [0, 65535].
-Generating a key...
-PASS key.type is 'secret'
-PASS key.extractable is true
-PASS key.algorithm.name is 'AES-CBC'
-PASS key.algorithm.length is 128
-PASS key.usages is ['decrypt', 'encrypt']
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/LayoutTests/crypto/subtle/aes-export-key-expected.txt b/LayoutTests/crypto/subtle/aes-export-key-expected.txt
deleted file mode 100644 (file)
index 83ed113..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-Test exporting an AES key.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS crypto.subtle.exportKey("raw") threw exception TypeError: Not enough arguments.
-PASS crypto.subtle.exportKey("raw", null) threw exception TypeError: Type error.
-PASS crypto.subtle.exportKey("raw", undefined) threw exception TypeError: Type error.
-PASS crypto.subtle.exportKey("raw", {}) threw exception TypeError: Type error.
-PASS crypto.subtle.exportKey("raw", 1) threw exception TypeError: Type error.
-
-Importing a JWK key...
-PASS crypto.subtle.exportKey(null, key) threw exception TypeError: Unknown key format.
-PASS crypto.subtle.exportKey(undefined, key) threw exception TypeError: Unknown key format.
-PASS crypto.subtle.exportKey({}, key) threw exception TypeError: Unknown key format.
-PASS crypto.subtle.exportKey("", key) threw exception TypeError: Unknown key format.
-PASS crypto.subtle.exportKey("foobar", key) threw exception TypeError: Unknown key format.
-
-Exporting the key as raw data...
-PASS bytesToHexString(new Uint8Array(exportedData)) is '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b'
-Exporting the key as JWK...
-PASS exportedJWK.kty is 'oct'
-PASS exportedJWK.k is 'jnOw99oOZFLIEPMrgJB55WL46tJSLGt7'
-PASS exportedJWK.alg is 'A192CBC'
-PASS exportedJWK.ext is true
-PASS exportedJWK.use is undefined
-PASS exportedJWK.key_ops is ['encrypt', 'decrypt', 'wrapKey', 'unwrapKey']
-
-Importing a key that's not extractable...
-
-Trying to export as raw...
-PASS Rejected, as expected
-Trying to export as jwk...
-PASS Rejected, as expected
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/LayoutTests/crypto/subtle/argument-conversion-expected.txt b/LayoutTests/crypto/subtle/argument-conversion-expected.txt
deleted file mode 100644 (file)
index d8771b2..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-Test crypto.subtle argument conversion
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-
-Passing algorithm name as a string object...
-PASS ...succeeded
-
-Passing algorithm name as a string object in a dictionary...
-PASS ...succeeded
-
-Passing algorithm name as an object with toString
-PASS ...succeeded
-
-Passing invalid data to digest()
-PASS crypto.subtle.digest({name: 'sha-1'}) threw exception TypeError: Not enough arguments.
-PASS crypto.subtle.digest({name: 'sha-1'}, null) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
-PASS crypto.subtle.digest({name: 'sha-1'}, 10) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
-PASS crypto.subtle.digest({name: 'sha-1'}, [10]) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
-PASS crypto.subtle.digest({name: 'sha-1'}, [new Uint8Array([0])]) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
-
-Passing invalid algorithmIdentifiers to digest()
-PASS crypto.subtle.digest({ toString:function() { return 'sha-1' } }, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS crypto.subtle.digest({name: ''}, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS crypto.subtle.digest({name: null}, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS crypto.subtle.digest({name: undefined}, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS crypto.subtle.digest({name: 'sha'}, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS crypto.subtle.digest({name: 1}, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS crypto.subtle.digest('', data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS crypto.subtle.digest(null, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS crypto.subtle.digest(undefined, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS crypto.subtle.digest(1, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS crypto.subtle.digest({}, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/LayoutTests/crypto/subtle/argument-conversion.html b/LayoutTests/crypto/subtle/argument-conversion.html
deleted file mode 100644 (file)
index 0c28fb4..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src="../../resources/js-test-pre.js"></script>
-<script src="../resources/common.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
-
-<script>
-description("Test crypto.subtle argument conversion");
-
-jsTestIsAsync = true;
-
-Promise.resolve(null).then(function() {
-    debug("\nPassing algorithm name as a string object...");
-    return crypto.subtle.digest(new String('sha-1'), new Uint8Array([]));
-}).then(function(result) {
-    testPassed("...succeeded");
-    debug("\nPassing algorithm name as a string object in a dictionary...");
-    return crypto.subtle.digest({name: new String('sha-1')}, new Uint8Array([]));
-}).then(function(result) {
-    testPassed("...succeeded");
-    debug("\nPassing algorithm name as an object with toString");
-    return crypto.subtle.digest({name: { toString:function() { return 'sha-1' } } }, new Uint8Array([]));
-}).then(function(result) {
-    testPassed("...succeeded");
-
-    debug("\nPassing invalid data to digest()");
-    shouldThrow("crypto.subtle.digest({name: 'sha-1'})");
-    shouldThrow("crypto.subtle.digest({name: 'sha-1'}, null)");
-    shouldThrow("crypto.subtle.digest({name: 'sha-1'}, 10)");
-    shouldThrow("crypto.subtle.digest({name: 'sha-1'}, [10])");
-    shouldThrow("crypto.subtle.digest({name: 'sha-1'}, [new Uint8Array([0])])");
-
-    debug("\nPassing invalid algorithmIdentifiers to digest()");
-    data = new Uint8Array([0]);
-    shouldThrow("crypto.subtle.digest({ toString:function() { return 'sha-1' } }, data)"); // Algorithm normalization doesn't attempt to call toString.
-    shouldThrow("crypto.subtle.digest({name: ''}, data)");
-    shouldThrow("crypto.subtle.digest({name: null}, data)");
-    shouldThrow("crypto.subtle.digest({name: undefined}, data)");
-    shouldThrow("crypto.subtle.digest({name: 'sha'}, data)");
-    shouldThrow("crypto.subtle.digest({name: 1}, data)");
-    shouldThrow("crypto.subtle.digest('', data)");
-    shouldThrow("crypto.subtle.digest(null, data)");
-    shouldThrow("crypto.subtle.digest(undefined, data)");
-    shouldThrow("crypto.subtle.digest(1, data)");
-    shouldThrow("crypto.subtle.digest({}, data)");
-}).then(finishJSTest);
-
-</script>
-
-<script src="../../resources/js-test-post.js"></script>
-</body>
-</html>
diff --git a/LayoutTests/crypto/subtle/gc-2-expected.txt b/LayoutTests/crypto/subtle/gc-2-expected.txt
new file mode 100644 (file)
index 0000000..40f7fdf
--- /dev/null
@@ -0,0 +1,12 @@
+Test that window.crypto.subtle wrapper preserves custom properties.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS [object Crypto] is defined.
+PASS [object SubtleCrypto] is defined.
+PASS anotherWindowCrypto.subtle.foo is "bar"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/crypto/subtle/gc-2.html b/LayoutTests/crypto/subtle/gc-2.html
new file mode 100644 (file)
index 0000000..7d92ff0
--- /dev/null
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description("Test that window.crypto.subtle wrapper preserves custom properties.");
+jsTestIsAsync = true;
+
+var anotherWindowCrypto;
+
+function startTest()
+{
+    anotherWindowCrypto = frames[0].crypto;
+    shouldBeDefined(anotherWindowCrypto);
+    shouldBeDefined(anotherWindowCrypto.subtle);
+
+    anotherWindowCrypto.subtle.foo = "bar";
+    document.body.removeChild(document.getElementsByTagName("iframe")[0]);
+    gc();
+    setTimeout(continueTest, 10);
+}
+
+function continueTest()
+{
+    gc();
+    setTimeout(finishTest, 10);
+}
+
+function finishTest()
+{
+    gc();
+    shouldBe('anotherWindowCrypto.subtle.foo', '"bar"');
+    finishJSTest();
+}
+
+window.onload = startTest;
+
+</script>
+<iframe src="about:blank"></iframe>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/crypto/subtle/gc-3-expected.txt b/LayoutTests/crypto/subtle/gc-3-expected.txt
new file mode 100644 (file)
index 0000000..9cc9f59
--- /dev/null
@@ -0,0 +1,11 @@
+Test that window.crypto wrapper protects all dependencies, so it can always be used to get crypto.subtle.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS [object Crypto] is defined.
+PASS [object SubtleCrypto] is defined.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/crypto/subtle/gc-3.html b/LayoutTests/crypto/subtle/gc-3.html
new file mode 100644 (file)
index 0000000..3e722b8
--- /dev/null
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description("Test that window.crypto wrapper protects all dependencies, so it can always be used to get crypto.subtle.");
+jsTestIsAsync = true;
+
+var anotherWindowCrypto;
+
+function startTest()
+{
+    anotherWindowCrypto = frames[0].crypto;
+    shouldBeDefined(anotherWindowCrypto);
+    document.body.removeChild(document.getElementsByTagName("iframe")[0]);
+    gc();
+    setTimeout(continueTest, 10);
+}
+
+function continueTest()
+{
+    gc();
+    setTimeout(finishTest, 10);
+}
+
+function finishTest()
+{
+    gc();
+    shouldBeDefined(anotherWindowCrypto.subtle);
+    finishJSTest();
+}
+
+window.onload = startTest;
+
+</script>
+<iframe src="about:blank"></iframe>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/crypto/subtle/gc-expected.txt b/LayoutTests/crypto/subtle/gc-expected.txt
new file mode 100644 (file)
index 0000000..f9c1a72
--- /dev/null
@@ -0,0 +1,10 @@
+Test that window.crypto.subtle wrapper preserves custom properties.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.crypto.subtle.foo is "bar"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/crypto/subtle/gc.html b/LayoutTests/crypto/subtle/gc.html
new file mode 100644 (file)
index 0000000..dabadf6
--- /dev/null
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description("Test that window.crypto.subtle wrapper preserves custom properties.");
+jsTestIsAsync = true;
+
+function startTest()
+{
+    window.crypto.subtle.foo = "bar";
+    gc();
+    setTimeout(continueTest, 10);
+}
+
+function continueTest()
+{
+    gc();
+    setTimeout(finishTest, 10);
+}
+
+function finishTest()
+{
+    gc();
+    shouldBe('window.crypto.subtle.foo', '"bar"');
+    finishJSTest();
+}
+
+window.onload = startTest;
+
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/crypto/subtle/hmac-check-algorithm-expected.txt b/LayoutTests/crypto/subtle/hmac-check-algorithm-expected.txt
deleted file mode 100644 (file)
index d4d3f45..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-Test that HMAC operations only work when hash functions match between invocation and key.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-Importing a raw HMAC SHA-1 key from string literal...
-Done
-PASS crypto.subtle.sign({name: 'hmac', hash: {name: 'sha-1'}}, key, asciiToUint8Array('foo')) did not throw exception.
-PASS crypto.subtle.sign({name: 'hmac', hash: {name: 'sha-256'}}, key, asciiToUint8Array('foo')) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS crypto.subtle.verify({name: 'hmac', hash: {name: 'sha-1'}}, key, asciiToUint8Array('fake signature'), asciiToUint8Array('foo')) did not throw exception.
-PASS crypto.subtle.verify({name: 'hmac', hash: {name: 'sha-256'}}, key, asciiToUint8Array('fake signature'), asciiToUint8Array('foo')) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/LayoutTests/crypto/subtle/hmac-check-algorithm.html b/LayoutTests/crypto/subtle/hmac-check-algorithm.html
deleted file mode 100644 (file)
index 552401f..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src="../../resources/js-test-pre.js"></script>
-<script src="../resources/common.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
-
-<script>
-description("Test that HMAC operations only work when hash functions match between invocation and key.");
-
-jsTestIsAsync = true;
-
-var hmacKey = asciiToUint8Array('a');
-var extractable = true;
-
-debug("Importing a raw HMAC SHA-1 key from string literal...");
-crypto.subtle.importKey("raw", hmacKey, {name: 'hmac', hash: {name: 'sha-1'}}, extractable, ["sign", "verify"]).then(function(result) {
-    debug("Done");
-    key = result;
-
-    shouldNotThrow("crypto.subtle.sign({name: 'hmac', hash: {name: 'sha-1'}}, key, asciiToUint8Array('foo'))");
-    shouldThrow("crypto.subtle.sign({name: 'hmac', hash: {name: 'sha-256'}}, key, asciiToUint8Array('foo'))");
-
-    shouldNotThrow("crypto.subtle.verify({name: 'hmac', hash: {name: 'sha-1'}}, key, asciiToUint8Array('fake signature'), asciiToUint8Array('foo'))");
-    shouldThrow("crypto.subtle.verify({name: 'hmac', hash: {name: 'sha-256'}}, key, asciiToUint8Array('fake signature'), asciiToUint8Array('foo'))");
-
-    finishJSTest();
-});
-</script>
-
-<script src="../../resources/js-test-post.js"></script>
-</body>
-</html>
diff --git a/LayoutTests/crypto/subtle/hmac-generate-key-expected.txt b/LayoutTests/crypto/subtle/hmac-generate-key-expected.txt
deleted file mode 100644 (file)
index 53921e4..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-Test generating a HMAC key.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS crypto.subtle.generateKey("hmac", extractable, ["sign", "verify"]) threw exception TypeError: Type error.
-PASS crypto.subtle.generateKey({name: "hmac"}, extractable, ["sign", "verify"]) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS crypto.subtle.generateKey({name: "hmac", length: undefined}, extractable, ["sign", "verify"]) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS crypto.subtle.generateKey({name: "hmac", length: {}}, extractable, ["sign", "verify"]) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
-
-Generating a key with default length...
-PASS key.type is 'secret'
-PASS key.extractable is true
-PASS key.algorithm.name is 'HMAC'
-PASS key.algorithm.length is 64
-PASS key.algorithm.hash.name is 'SHA-1'
-PASS key.usages is ["sign", "verify"]
-
-Generating a key with custom length...
-PASS key.type is 'secret'
-PASS key.extractable is true
-PASS key.algorithm.name is 'HMAC'
-PASS key.algorithm.length is 5
-PASS key.algorithm.hash.name is 'SHA-1'
-PASS key.usages is ["sign"]
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/LayoutTests/crypto/subtle/import-jwk-expected.txt b/LayoutTests/crypto/subtle/import-jwk-expected.txt
deleted file mode 100644 (file)
index e4e51af..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-Test error handling for JWK import.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array(''), null) threw exception TypeError: Invalid JWK serialization.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('{'), null) threw exception TypeError: Invalid JWK serialization.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('null'), null) threw exception TypeError: Invalid JWK serialization.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('undefined'), null) threw exception TypeError: Invalid JWK serialization.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('{}'), null) threw exception TypeError: Neither key nor function argument has crypto algorithm specified.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('{}'), "aes-cbc") threw exception TypeError: Required JWK "kty" member is missing.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('{ "kty": "foobar", "alg": "HS256", "use": "sig", "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }'), null) threw exception TypeError: Unsupported JWK key type foobar.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "foobar", "use": "sig", "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }'), null) threw exception TypeError: Unsupported JWK algorithm foobar.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }'), "aes-cbc") threw exception TypeError: Algorithm specified in key is not compatible with one passed to importKey as argument.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }'), { name: "hmac", hash: "sha-1" }) threw exception TypeError: Algorithm specified in key is not compatible with one passed to importKey as argument.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "HS256" }'), null) threw exception TypeError: Secret key data is not present is JWK.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "A128CBC" }'), null) threw exception TypeError: Secret key data is not present is JWK.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": "1234" }'), null) threw exception TypeError: Key size is not valid for HS256.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "A128CBC", "use": "sig", "ext": false, "k": "1234" }'), null) threw exception TypeError: Key size is not valid for A128CBC.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "A128CBC", "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }'), null) threw exception TypeError: Key size is not valid for A128CBC.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": "ahjkn23387f+nsibf23qsvahjkn37387fgnsibf23qs" }'), null) threw exception TypeError: Cannot decode base64url key data in JWK.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('{ "kty": 1, "alg": "HS256", "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }'), null) threw exception TypeError: Expected a string value for "kty" JSON key.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": 1, "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }'), null) threw exception TypeError: Expected a string value for "alg" JSON key.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "HS256", "use": 1, "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }'), null) threw exception TypeError: Expected a string value for "use" JSON key.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": "false", "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }'), null) threw exception TypeError: Expected a boolean value for "ext" JSON key.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": 1 }'), null) threw exception TypeError: Expected a string value for "k" JSON key.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/LayoutTests/crypto/subtle/import-jwk.html b/LayoutTests/crypto/subtle/import-jwk.html
deleted file mode 100644 (file)
index 77df70b..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src="../../resources/js-test-pre.js"></script>
-<script src="../resources/common.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
-
-<script>
-description("Test error handling for JWK import.");
-
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'\'), null)')
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'{\'), null)')
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'null\'), null)')
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'undefined\'), null)')
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'{}\'), null)')
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'{}\'), "aes-cbc")')
-
-// Unknown/invalid JWK values.
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "foobar", "alg": "HS256", "use": "sig", "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }\'), null)')
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "foobar", "use": "sig", "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }\'), null)')
-
-// Algorithm mismatch.
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }\'), "aes-cbc")')
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }\'), { name: "hmac", hash: "sha-1" })')
-
-// No key data.
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "HS256" }\'), null)')
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "A128CBC" }\'), null)')
-
-// Key data length is incorrect, not allowed in JWK.
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": "1234" }\'), null)')
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "A128CBC", "use": "sig", "ext": false, "k": "1234" }\'), null)')
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "A128CBC", "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }\'), null)')
-
-// Key data is not valid base64url.
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": "ahjkn23387f+nsibf23qsvahjkn37387fgnsibf23qs" }\'), null)')
-
-// Incorrect data types.
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'{ "kty": 1, "alg": "HS256", "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }\'), null)')
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": 1, "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }\'), null)')
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "HS256", "use": 1, "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }\'), null)')
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": "false", "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }\'), null)')
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": 1 }\'), null)')
-</script>
-
-<script src="../../resources/js-test-post.js"></script>
-</body>
-</html>
diff --git a/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-small-key-expected.txt b/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-small-key-expected.txt
deleted file mode 100644 (file)
index c3952b2..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-A key of size 2048 bits or larger MUST be used with RS256, RS384, RS512 JWK algorithms.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, ["sign", "verify"]) threw exception TypeError: Key size is not valid for RS256.
-PASS crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, ["sign", "verify"]) threw exception TypeError: Key size is not valid for RS512.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
@@ -19,7 +19,7 @@ var plaintext = hexStringToUint8Array("6bc1bee22e409f96e93d7e117393172aae2d8a571
 var extractable = true;
 
 debug("Importing a raw AES key from string literal...");
-crypto.subtle.importKey("raw", keyData, "aes-cbc", extractable, ["encrypt", "decrypt"]).then(function(result) {
+crypto.webkitSubtle.importKey("raw", keyData, "aes-cbc", extractable, ["encrypt", "decrypt"]).then(function(result) {
     key = result;
     shouldBe("key.type", "'secret'");
     shouldBe("key.extractable", "true");
@@ -28,13 +28,13 @@ crypto.subtle.importKey("raw", keyData, "aes-cbc", extractable, ["encrypt", "dec
     shouldBe("key.usages", "['decrypt', 'encrypt']");
 
     debug("Using the key to encrypt plaintext...");
-    return crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, key, plaintext);
+    return crypto.webkitSubtle.encrypt({name: "aes-cbc", iv: iv}, key, plaintext);
 }).then(function(result) {
     encryptionResult = result;
     shouldBe("bytesToHexString(new Uint8Array(encryptionResult))", "'4f021db243bc633d7178183a9fa071e8b4d9ada9ad7dedf4e5e738763f69145a571b242012fb7ae07fa9baac3df102e008b0e27988598881d920a9e64f5615cd612ccd79224b350935d45dd6a98f8176'");
 
     debug("Decrypting it back...");
-    return crypto.subtle.decrypt({name: "aes-cbc", iv: iv}, key, result);
+    return crypto.webkitSubtle.decrypt({name: "aes-cbc", iv: iv}, key, result);
 }).then(function(result) {
     decryptionResult = result;
     shouldBe("new Uint8Array(decryptionResult)", "plaintext");
@@ -19,7 +19,7 @@ var plaintext = hexStringToUint8Array("6bc1bee22e409f96e93d7e117393172aae2d8a571
 var extractable = true;
 
 debug("Importing a raw AES key from string literal...");
-crypto.subtle.importKey("raw", keyData, "aes-cbc", extractable, ["encrypt", "decrypt"]).then(function(result) {
+crypto.webkitSubtle.importKey("raw", keyData, "aes-cbc", extractable, ["encrypt", "decrypt"]).then(function(result) {
     key = result;
     shouldBe("key.type", "'secret'");
     shouldBe("key.extractable", "true");
@@ -28,13 +28,13 @@ crypto.subtle.importKey("raw", keyData, "aes-cbc", extractable, ["encrypt", "dec
     shouldBe("key.usages", "['decrypt', 'encrypt']");
 
     debug("Using the key to encrypt plaintext...");
-    return crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, key, plaintext);
+    return crypto.webkitSubtle.encrypt({name: "aes-cbc", iv: iv}, key, plaintext);
 }).then(function(result) {
     encryptionResult = result;
     shouldBe("bytesToHexString(new Uint8Array(encryptionResult))", "'f58c4c04d6e5f1ba779eabfb5f7bfbd69cfc4e967edb808d679f777bc6702c7d39f23369a9d9bacfa530e26304231461b2eb05e2c39be9fcda6c19078c6a9d1b3f461796d6b0d6b2e0c2a72b4d80e644'");
 
     debug("Decrypting it back...");
-    return crypto.subtle.decrypt({name: "aes-cbc", iv: iv}, key, result);
+    return crypto.webkitSubtle.decrypt({name: "aes-cbc", iv: iv}, key, result);
 }).then(function(result) {
     decryptionResult = result;
     shouldBe("new Uint8Array(decryptionResult)", "plaintext");
@@ -14,10 +14,10 @@ PASS bytesToHexString(new Uint8Array(encryptionResult)) is '7649abac8119b246cee9
 Decrypting it back...
 PASS new Uint8Array(decryptionResult) is plaintext
 Testing initialization vector bindings...
-PASS crypto.subtle.encrypt({name: 'AES-CBC', iv: null}, key, plaintext) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
-PASS crypto.subtle.encrypt({name: 'AES-CBC'}, key, plaintext) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
-PASS crypto.subtle.encrypt({name: 'AES-CBC', iv: 3}, key, plaintext) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
-PASS crypto.subtle.encrypt({name: 'AES-CBC', iv: new Uint8Array([0])}, key, plaintext) threw exception Error: AES-CBC initialization data must be 16 bytes.
+PASS crypto.webkitSubtle.encrypt({name: 'AES-CBC', iv: null}, key, plaintext) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
+PASS crypto.webkitSubtle.encrypt({name: 'AES-CBC'}, key, plaintext) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
+PASS crypto.webkitSubtle.encrypt({name: 'AES-CBC', iv: 3}, key, plaintext) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
+PASS crypto.webkitSubtle.encrypt({name: 'AES-CBC', iv: new Uint8Array([0])}, key, plaintext) threw exception Error: AES-CBC initialization data must be 16 bytes.
 PASS successfullyParsed is true
 
 TEST COMPLETE
@@ -19,7 +19,7 @@ var plaintext = asciiToUint8Array("test");
 var extractable = true;
 
 debug("Importing a raw AES key from string literal...");
-crypto.subtle.importKey("raw", keyData, "aes-cbc", extractable, ["encrypt", "decrypt"]).then(function(result) {
+crypto.webkitSubtle.importKey("raw", keyData, "aes-cbc", extractable, ["encrypt", "decrypt"]).then(function(result) {
     key = result;
     shouldBe("key.type", "'secret'");
     shouldBe("key.extractable", "true");
@@ -28,13 +28,13 @@ crypto.subtle.importKey("raw", keyData, "aes-cbc", extractable, ["encrypt", "dec
     shouldBe("key.usages", "['decrypt', 'encrypt']");
 
     debug("Using the key to encrypt plaintext...");
-    return crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, key, plaintext);
+    return crypto.webkitSubtle.encrypt({name: "aes-cbc", iv: iv}, key, plaintext);
 }).then(function(result) {
     cyphertext = result;
     shouldBe("bytesToHexString(new Uint8Array(cyphertext))", "'630199c5f202cc7167bb84c6c72b349d'");
 
     debug("Decrypting it back...");
-    return crypto.subtle.decrypt({name: "aes-cbc", iv: iv}, key, result);
+    return crypto.webkitSubtle.decrypt({name: "aes-cbc", iv: iv}, key, result);
 }).then(function(result) {
     decryptionResult = result;
     shouldBe("new Uint8Array(decryptionResult)", "plaintext");
@@ -19,7 +19,7 @@ var plaintext = hexStringToUint8Array("6bc1bee22e409f96e93d7e117393172aae2d8a571
 var extractable = true;
 
 debug("Importing a raw AES key from string literal...");
-crypto.subtle.importKey("raw", keyData, "aes-cbc", extractable, ["encrypt", "decrypt"]).then(function(result) {
+crypto.webkitSubtle.importKey("raw", keyData, "aes-cbc", extractable, ["encrypt", "decrypt"]).then(function(result) {
     key = result;
     shouldBe("key.type", "'secret'");
     shouldBe("key.extractable", "true");
@@ -28,22 +28,22 @@ crypto.subtle.importKey("raw", keyData, "aes-cbc", extractable, ["encrypt", "dec
     shouldBe("key.usages", "['decrypt', 'encrypt']");
 
     debug("Using the key to encrypt plaintext...");
-    return crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, key, plaintext);
+    return crypto.webkitSubtle.encrypt({name: "aes-cbc", iv: iv}, key, plaintext);
 }).then(function(result) {
     encryptionResult = result;
     shouldBe("bytesToHexString(new Uint8Array(encryptionResult))", "'7649abac8119b246cee98e9b12e9197d5086cb9b507219ee95db113a917678b273bed6b8e3c1743b7116e69e222295163ff1caa1681fac09120eca307586e1a78cb82807230e1321d3fae00d18cc2012'");
 
     debug("Decrypting it back...");
-    return crypto.subtle.decrypt({name: "aes-cbc", iv: iv}, key, result);
+    return crypto.webkitSubtle.decrypt({name: "aes-cbc", iv: iv}, key, result);
 }).then(function(result) {
     decryptionResult = result;
     shouldBe("new Uint8Array(decryptionResult)", "plaintext");
 
     debug("Testing initialization vector bindings...");
-    shouldThrow("crypto.subtle.encrypt({name: 'AES-CBC', iv: null}, key, plaintext)");
-    shouldThrow("crypto.subtle.encrypt({name: 'AES-CBC'}, key, plaintext)");
-    shouldThrow("crypto.subtle.encrypt({name: 'AES-CBC', iv: 3}, key, plaintext)");
-    shouldThrow("crypto.subtle.encrypt({name: 'AES-CBC', iv: new Uint8Array([0])}, key, plaintext)");
+    shouldThrow("crypto.webkitSubtle.encrypt({name: 'AES-CBC', iv: null}, key, plaintext)");
+    shouldThrow("crypto.webkitSubtle.encrypt({name: 'AES-CBC'}, key, plaintext)");
+    shouldThrow("crypto.webkitSubtle.encrypt({name: 'AES-CBC', iv: 3}, key, plaintext)");
+    shouldThrow("crypto.webkitSubtle.encrypt({name: 'AES-CBC', iv: new Uint8Array([0])}, key, plaintext)");
 
     finishJSTest();
 });
diff --git a/LayoutTests/crypto/webkitSubtle/aes-cbc-generate-key-expected.txt b/LayoutTests/crypto/webkitSubtle/aes-cbc-generate-key-expected.txt
new file mode 100644 (file)
index 0000000..5b0fa5a
--- /dev/null
@@ -0,0 +1,19 @@
+Test generating an AES key using AES-CBC algorithm.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS crypto.webkitSubtle.generateKey("aes-cbc", extractable, ["encrypt", "decrypt"]) threw exception TypeError: Type error.
+PASS crypto.webkitSubtle.generateKey({name: "aes-cbc"}, extractable, ["encrypt", "decrypt"]) threw exception TypeError: Value NaN is outside the range [0, 65535].
+PASS crypto.webkitSubtle.generateKey({name: "aes-cbc", length: undefined}, extractable, ["encrypt", "decrypt"]) threw exception TypeError: Value NaN is outside the range [0, 65535].
+PASS crypto.webkitSubtle.generateKey({name: "aes-cbc", length: {}}, extractable, ["encrypt", "decrypt"]) threw exception TypeError: Value NaN is outside the range [0, 65535].
+Generating a key...
+PASS key.type is 'secret'
+PASS key.extractable is true
+PASS key.algorithm.name is 'AES-CBC'
+PASS key.algorithm.length is 128
+PASS key.usages is ['decrypt', 'encrypt']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
@@ -15,13 +15,13 @@ jsTestIsAsync = true;
 
 var extractable = true;
 
-shouldThrow('crypto.subtle.generateKey("aes-cbc", extractable, ["encrypt", "decrypt"])');
-shouldThrow('crypto.subtle.generateKey({name: "aes-cbc"}, extractable, ["encrypt", "decrypt"])');
-shouldThrow('crypto.subtle.generateKey({name: "aes-cbc", length: undefined}, extractable, ["encrypt", "decrypt"])');
-shouldThrow('crypto.subtle.generateKey({name: "aes-cbc", length: {}}, extractable, ["encrypt", "decrypt"])');
+shouldThrow('crypto.webkitSubtle.generateKey("aes-cbc", extractable, ["encrypt", "decrypt"])');
+shouldThrow('crypto.webkitSubtle.generateKey({name: "aes-cbc"}, extractable, ["encrypt", "decrypt"])');
+shouldThrow('crypto.webkitSubtle.generateKey({name: "aes-cbc", length: undefined}, extractable, ["encrypt", "decrypt"])');
+shouldThrow('crypto.webkitSubtle.generateKey({name: "aes-cbc", length: {}}, extractable, ["encrypt", "decrypt"])');
 
 debug("Generating a key...");
-crypto.subtle.generateKey({name: "aes-cbc", length: 128}, extractable, ["encrypt", "decrypt"]).then(function(result) {
+crypto.webkitSubtle.generateKey({name: "aes-cbc", length: 128}, extractable, ["encrypt", "decrypt"]).then(function(result) {
     key = result;
 
     shouldBe("key.type", "'secret'");
@@ -29,7 +29,7 @@ var jwkKey = {
 var jwkKeyAsArrayBuffer = asciiToUint8Array(JSON.stringify(jwkKey));
 
 debug("Importing a key...\n");
-crypto.subtle.importKey("jwk", jwkKeyAsArrayBuffer, null, false, ["encrypt"]).then(function(result) {
+crypto.webkitSubtle.importKey("jwk", jwkKeyAsArrayBuffer, null, false, ["encrypt"]).then(function(result) {
     key = result;
 
     shouldBe("key.type", "'secret'");
@@ -39,7 +39,7 @@ crypto.subtle.importKey("jwk", jwkKeyAsArrayBuffer, null, false, ["encrypt"]).th
     shouldBe("key.usages", '["encrypt"]');
 
     debug("\nUsing the key to encrypt plaintext...");
-    return crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, key, plaintext);
+    return crypto.webkitSubtle.encrypt({name: "aes-cbc", iv: iv}, key, plaintext);
 }).then(function(result) {
     encryptionResult = result;
     shouldBe("bytesToHexString(new Uint8Array(encryptionResult))", "'4f021db243bc633d7178183a9fa071e8b4d9ada9ad7dedf4e5e738763f69145a571b242012fb7ae07fa9baac3df102e008b0e27988598881d920a9e64f5615cd612ccd79224b350935d45dd6a98f8176'");
@@ -19,7 +19,7 @@ var plaintext = hexStringToUint8Array("6bc1bee22e409f96e93d7e117393172aae2d8a571
 var extractable = true;
 
 debug("Importing a raw AES key from string literal...");
-crypto.subtle.importKey("raw", keyData, "aes-cbc", extractable, ["encrypt", "decrypt"]).then(function(result) {
+crypto.webkitSubtle.importKey("raw", keyData, "aes-cbc", extractable, ["encrypt", "decrypt"]).then(function(result) {
     key = result;
     shouldBe("key.type", "'secret'");
     shouldBe("key.extractable", "true");
@@ -28,7 +28,7 @@ crypto.subtle.importKey("raw", keyData, "aes-cbc", extractable, ["encrypt", "dec
     shouldBe("key.usages", "['decrypt', 'encrypt']");
 
     debug("Using the key to encrypt plaintext...");
-    return crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, key, [plaintext]);
+    return crypto.webkitSubtle.encrypt({name: "aes-cbc", iv: iv}, key, [plaintext]);
 }).then(undefined, function(result) {
     debug("Failed, as expected. Note that the spec doesn't appear to clearly define which step should fail.");
 
@@ -20,12 +20,12 @@ var unwrappingKeyOctets = hexStringToUint8Array("2a00e0e776e94e4dc89bf947cebdebe
 var wrappedKey = hexStringToUint8Array("b490dedb3abc3fd545e146538e6cc3ca"); // An empty encrypted JSON.
 
 debug("Importing an unwrapping key...");
-crypto.subtle.importKey("raw", unwrappingKeyOctets, "AES-CBC", nonExtractable, ["unwrapKey"]).then(function(result) {
+crypto.webkitSubtle.importKey("raw", unwrappingKeyOctets, "AES-CBC", nonExtractable, ["unwrapKey"]).then(function(result) {
     unwrappingKey = result;
     shouldBe("unwrappingKey.algorithm.name", "'AES-CBC'");
     var unwrapAlgorithm = {name: "AES-CBC", iv: hexStringToUint8Array("000102030405060708090a0b0c0d0e0f")};
     debug("Unwrapping a key...");
-    return crypto.subtle.unwrapKey("jwk", wrappedKey, unwrappingKey, unwrapAlgorithm, null, extractable, ["sign", "verify", "encrypt", "decrypt", "wrap", "unwrap"]);
+    return crypto.webkitSubtle.unwrapKey("jwk", wrappedKey, unwrappingKey, unwrapAlgorithm, null, extractable, ["sign", "verify", "encrypt", "decrypt", "wrap", "unwrap"]);
 }).then(undefined, function(result) {
     testPassed("Promise rejected");
     finishJSTest();
@@ -29,12 +29,12 @@ var unwrappingKeyOctets = hexStringToUint8Array("2a00e0e776e94e4dc89bf947cebdebe
 var wrappedKey = hexStringToUint8Array("3511f6028db04ea97e7cfad3c4cc60837bceff25cb6c88292fbcb4547570afdc32e4003fe4d65f1e7df60dc1fdb3df36c3f58ab228e33aa31005852d46d0c2ad1318435a071bbb5bbb05650ea63d551698b0c040dd95ed0d379b5e2eccb545ae5620acb8051174cd2ad647328ad99dcd462fec40748724eb1e68f209f779faa2c35b4d4d1b6604a74e62a1846249ea6192954a5af10c71ebfea79948142441ed307e9f52e797a51a8007a6f87b57c51f9e7eef54b7e4a1f818ba6ac25ee5935c23b3253d6d9d222262c79ccdb7147d9c07527c22fe7a4ab91af20479edf5930b3c053c0a0b27092cfb53203633d01dcf6e333b5be7c1933c321c953f962b934ebefd9df8cca6c0a25fcd5fb96105435c42d9902406f82bc8daa8ec12fa85d9afa65adbfe3f60828ef64adaf43ad8e3b0af104cbfafd994323732bba08f84d5cac1d157b276233dffecafe47942b83c85ead6d5886c6badf534d4a32d3f545e8032dd5e419d7bff3acde2c37a96fc34fda8747d89500bf9f7ef45873c6b3b2741aaf74ff96a2f950028f38eb62f1be936fe0a994ebfa928021c0c96172d84584e");
 
 debug("Importing an unwrapping key...");
-crypto.subtle.importKey("raw", unwrappingKeyOctets, "AES-CBC", nonExtractable, ["unwrapKey"]).then(function(result) {
+crypto.webkitSubtle.importKey("raw", unwrappingKeyOctets, "AES-CBC", nonExtractable, ["unwrapKey"]).then(function(result) {
     unwrappingKey = result;
     shouldBe("unwrappingKey.algorithm.name", "'AES-CBC'");
     var unwrapAlgorithm = {name: "AES-CBC", iv: hexStringToUint8Array("000102030405060708090a0b0c0d0e0f")};
     debug("Unwrapping a key...");
-    return crypto.subtle.unwrapKey("jwk", wrappedKey, unwrappingKey, unwrapAlgorithm, null, extractable, ["sign", "verify", "encrypt", "decrypt", "wrap", "unwrap"]);
+    return crypto.webkitSubtle.unwrapKey("jwk", wrappedKey, unwrappingKey, unwrapAlgorithm, null, extractable, ["sign", "verify", "encrypt", "decrypt", "wrap", "unwrap"]);
 }).then(function(result) {
     unwrappedKey = result;
 
@@ -29,17 +29,17 @@ var jwkKeyAsArrayBuffer = asciiToUint8Array(JSON.stringify(publicKeyJSON));
 var wrappingKeyOctets = hexStringToUint8Array("2a00e0e776e94e4dc89bf947cebdebe1");
 
 debug("Importing a key to wrap...");
-crypto.subtle.importKey("jwk", jwkKeyAsArrayBuffer, null, extractable, ["sign", "verify"]).then(function(result) {
+crypto.webkitSubtle.importKey("jwk", jwkKeyAsArrayBuffer, null, extractable, ["sign", "verify"]).then(function(result) {
     key = result;
     shouldBe("key.algorithm.name", "'RSASSA-PKCS1-v1_5'");
     debug("Importing a key encryption key...");
-    return crypto.subtle.importKey("raw", wrappingKeyOctets, "AES-CBC", nonExtractable, ["wrapKey"]);
+    return crypto.webkitSubtle.importKey("raw", wrappingKeyOctets, "AES-CBC", nonExtractable, ["wrapKey"]);
 }).then(function(result) {
     wrappingKey = result;
     shouldBe("wrappingKey.algorithm.name", "'AES-CBC'");
     var wrapAlgorithm = {name: "AES-CBC", iv: hexStringToUint8Array("000102030405060708090a0b0c0d0e0f")};
     debug("wrapping the key...");
-    return crypto.subtle.wrapKey("jwk", key, wrappingKey, wrapAlgorithm);
+    return crypto.webkitSubtle.wrapKey("jwk", key, wrappingKey, wrapAlgorithm);
 }).then(undefined, function() {
     testPassed("Rejected");
     finishJSTest();
@@ -29,16 +29,16 @@ var jwkKeyAsArrayBuffer = asciiToUint8Array(JSON.stringify(publicKeyJSON));
 var wrappingKeyOctets = hexStringToUint8Array("2a00e0e776e94e4dc89bf947cebdebe1");
 
 debug("Importing a key to wrap...");
-crypto.subtle.importKey("jwk", jwkKeyAsArrayBuffer, null, extractable, ["sign", "verify"]).then(function(result) {
+crypto.webkitSubtle.importKey("jwk", jwkKeyAsArrayBuffer, null, extractable, ["sign", "verify"]).then(function(result) {
     key = result;
     shouldBe("key.algorithm.name", "'RSASSA-PKCS1-v1_5'");
     debug("Importing a key encryption key...");
-    return crypto.subtle.importKey("raw", wrappingKeyOctets, "AES-CBC", nonExtractable, ["wrapKey"]);
+    return crypto.webkitSubtle.importKey("raw", wrappingKeyOctets, "AES-CBC", nonExtractable, ["wrapKey"]);
 }).then(function(result) {
     wrappingKey = result;
     shouldBe("wrappingKey.algorithm.name", "'AES-CBC'");
     var wrapAlgorithm = {name: "AES-CBC", iv: hexStringToUint8Array("000102030405060708090a0b0c0d0e0f")};
-    return crypto.subtle.wrapKey("jwk", key, wrappingKey, wrapAlgorithm);
+    return crypto.webkitSubtle.wrapKey("jwk", key, wrappingKey, wrapAlgorithm);
 }).then(function(result) {
     wrappedKey = result;
     shouldBe("wrappedKey.toString()", "'[object ArrayBuffer]'");
@@ -5,7 +5,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 Importing a raw HMAC key from string literal...
 Using the key to encrypt plaintext...
-PASS crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, key, plaintext) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.encrypt({name: "aes-cbc", iv: iv}, key, plaintext) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
 PASS successfullyParsed is true
 
 TEST COMPLETE
@@ -19,10 +19,10 @@ var hmacKey = asciiToUint8Array('a');
 var extractable = true;
 
 debug("Importing a raw HMAC key from string literal...");
-crypto.subtle.importKey("raw", hmacKey, {name: 'hmac', hash: {name: 'sha-1'}}, extractable, ["sign", "verify", "encrypt", "decrypt"]).then(function(result) {
+crypto.webkitSubtle.importKey("raw", hmacKey, {name: 'hmac', hash: {name: 'sha-1'}}, extractable, ["sign", "verify", "encrypt", "decrypt"]).then(function(result) {
     key = result;
     debug("Using the key to encrypt plaintext...");
-    shouldThrow('crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, key, plaintext)')
+    shouldThrow('crypto.webkitSubtle.encrypt({name: "aes-cbc", iv: iv}, key, plaintext)')
 
     finishJSTest();
 });
diff --git a/LayoutTests/crypto/webkitSubtle/aes-export-key-expected.txt b/LayoutTests/crypto/webkitSubtle/aes-export-key-expected.txt
new file mode 100644 (file)
index 0000000..565cd21
--- /dev/null
@@ -0,0 +1,38 @@
+Test exporting an AES key.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS crypto.webkitSubtle.exportKey("raw") threw exception TypeError: Not enough arguments.
+PASS crypto.webkitSubtle.exportKey("raw", null) threw exception TypeError: Type error.
+PASS crypto.webkitSubtle.exportKey("raw", undefined) threw exception TypeError: Type error.
+PASS crypto.webkitSubtle.exportKey("raw", {}) threw exception TypeError: Type error.
+PASS crypto.webkitSubtle.exportKey("raw", 1) threw exception TypeError: Type error.
+
+Importing a JWK key...
+PASS crypto.webkitSubtle.exportKey(null, key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey(undefined, key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey({}, key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey("", key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey("foobar", key) threw exception TypeError: Unknown key format.
+
+Exporting the key as raw data...
+PASS bytesToHexString(new Uint8Array(exportedData)) is '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b'
+Exporting the key as JWK...
+PASS exportedJWK.kty is 'oct'
+PASS exportedJWK.k is 'jnOw99oOZFLIEPMrgJB55WL46tJSLGt7'
+PASS exportedJWK.alg is 'A192CBC'
+PASS exportedJWK.ext is true
+PASS exportedJWK.use is undefined
+PASS exportedJWK.key_ops is ['encrypt', 'decrypt', 'wrapKey', 'unwrapKey']
+
+Importing a key that's not extractable...
+
+Trying to export as raw...
+PASS Rejected, as expected
+Trying to export as jwk...
+PASS Rejected, as expected
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
@@ -23,30 +23,30 @@ var jwkKey = {
 
 var jwkKeyAsArrayBuffer = asciiToUint8Array(JSON.stringify(jwkKey));
 
-shouldThrow('crypto.subtle.exportKey("raw")');
-shouldThrow('crypto.subtle.exportKey("raw", null)');
-shouldThrow('crypto.subtle.exportKey("raw", undefined)');
-shouldThrow('crypto.subtle.exportKey("raw", {})');
-shouldThrow('crypto.subtle.exportKey("raw", 1)');
+shouldThrow('crypto.webkitSubtle.exportKey("raw")');
+shouldThrow('crypto.webkitSubtle.exportKey("raw", null)');
+shouldThrow('crypto.webkitSubtle.exportKey("raw", undefined)');
+shouldThrow('crypto.webkitSubtle.exportKey("raw", {})');
+shouldThrow('crypto.webkitSubtle.exportKey("raw", 1)');
 
 debug("\nImporting a JWK key...");
-crypto.subtle.importKey("jwk", jwkKeyAsArrayBuffer, "AES-CBC", extractable, ['encrypt', 'decrypt', 'wrapKey', 'unwrapKey']).then(function(result) {
+crypto.webkitSubtle.importKey("jwk", jwkKeyAsArrayBuffer, "AES-CBC", extractable, ['encrypt', 'decrypt', 'wrapKey', 'unwrapKey']).then(function(result) {
     key = result;
 
-    shouldThrow('crypto.subtle.exportKey(null, key)');
-    shouldThrow('crypto.subtle.exportKey(undefined, key)');
-    shouldThrow('crypto.subtle.exportKey({}, key)');
-    shouldThrow('crypto.subtle.exportKey("", key)');
-    shouldThrow('crypto.subtle.exportKey("foobar", key)');
+    shouldThrow('crypto.webkitSubtle.exportKey(null, key)');
+    shouldThrow('crypto.webkitSubtle.exportKey(undefined, key)');
+    shouldThrow('crypto.webkitSubtle.exportKey({}, key)');
+    shouldThrow('crypto.webkitSubtle.exportKey("", key)');
+    shouldThrow('crypto.webkitSubtle.exportKey("foobar", key)');
 
     debug("\nExporting the key as raw data...");
-    return crypto.subtle.exportKey("raw", key);
+    return crypto.webkitSubtle.exportKey("raw", key);
 }).then(function(result) {
     exportedData = result;
     shouldBe("bytesToHexString(new Uint8Array(exportedData))", "'8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b'");
 
     debug("Exporting the key as JWK...");
-    return crypto.subtle.exportKey("jwk", key);
+    return crypto.webkitSubtle.exportKey("jwk", key);
 }).then(function(result) {
     exportedJWK = JSON.parse(bytesToASCIIString(result));
     shouldBe("exportedJWK.kty", "'oct'");
@@ -57,12 +57,12 @@ crypto.subtle.importKey("jwk", jwkKeyAsArrayBuffer, "AES-CBC", extractable, ['en
     shouldBe("exportedJWK.key_ops", "['encrypt', 'decrypt', 'wrapKey', 'unwrapKey']");
 
     debug("\nImporting a key that's not extractable...");
-    return crypto.subtle.importKey("jwk", jwkKeyAsArrayBuffer, "AES-CBC", nonExtractable, ['encrypt', 'decrypt', 'wrapKey', 'unwrapKey'])
+    return crypto.webkitSubtle.importKey("jwk", jwkKeyAsArrayBuffer, "AES-CBC", nonExtractable, ['encrypt', 'decrypt', 'wrapKey', 'unwrapKey'])
 }).then(function(result) {
     key = result;
 
     debug("\nTrying to export as raw...");
-    return crypto.subtle.exportKey("raw", key);
+    return crypto.webkitSubtle.exportKey("raw", key);
 }).then(function(result) {
     testFailed("Promise wasn't rejected");
     finishJSTest();
@@ -70,7 +70,7 @@ crypto.subtle.importKey("jwk", jwkKeyAsArrayBuffer, "AES-CBC", extractable, ['en
     testPassed("Rejected, as expected");
 
     debug("Trying to export as jwk...");
-    return crypto.subtle.exportKey("jwk", key);
+    return crypto.webkitSubtle.exportKey("jwk", key);
 }).then(function(result) {
     testFailed("Promise wasn't rejected");
     finishJSTest();
@@ -10,7 +10,7 @@ PASS key.algorithm.name is 'AES-KW'
 PASS key.algorithm.length is 256
 
 Testing that the key can't be used with AES-CBC...
-PASS crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, key, hexStringToUint8Array("00")) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.encrypt({name: "aes-cbc", iv: iv}, key, hexStringToUint8Array("00")) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
 
 Exporting the key to raw...
 PASS exportedKey.toString() is '[object ArrayBuffer]'
@@ -16,7 +16,7 @@ jsTestIsAsync = true;
 var extractable = true;
 
 debug("Generating a key...");
-crypto.subtle.generateKey({name: "aes-kw", length: 256}, extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(result) {
+crypto.webkitSubtle.generateKey({name: "aes-kw", length: 256}, extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(result) {
     key = result;
     shouldBe("key.toString()", "'[object CryptoKey]'");
     shouldBe("key.type", "'secret'");
@@ -25,15 +25,15 @@ crypto.subtle.generateKey({name: "aes-kw", length: 256}, extractable, ["encrypt"
 
     debug("\nTesting that the key can't be used with AES-CBC...");
     iv = hexStringToUint8Array("000102030405060708090a0b0c0d0e0f");
-    shouldThrow('crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, key, hexStringToUint8Array("00"))');
+    shouldThrow('crypto.webkitSubtle.encrypt({name: "aes-cbc", iv: iv}, key, hexStringToUint8Array("00"))');
 
     debug("\nExporting the key to raw...");
-    return crypto.subtle.exportKey('raw', key);
+    return crypto.webkitSubtle.exportKey('raw', key);
 }).then(function(result) {
     exportedKey = result;
     shouldBe("exportedKey.toString()", "'[object ArrayBuffer]'");
     debug("Importing it back...");
-    return crypto.subtle.importKey('raw', exportedKey, "aes-kw", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]);
+    return crypto.webkitSubtle.importKey('raw', exportedKey, "aes-kw", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]);
 }).then(function(result) {
     importedKey = result;
 
@@ -18,22 +18,22 @@ var keyData = hexStringToUint8Array("00112233445566778899AABBCCDDEEFF");
 var extractable = true;
 
 debug("Importing key encryption key...");
-crypto.subtle.importKey("raw", kekData, "aes-kw", extractable, ["wrapKey", "unwrapKey"]).then(function(result) {
+crypto.webkitSubtle.importKey("raw", kekData, "aes-kw", extractable, ["wrapKey", "unwrapKey"]).then(function(result) {
     kek = result;
 
     debug("Importing a key to be wrapped...");
-    return crypto.subtle.importKey("raw", keyData, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]);
+    return crypto.webkitSubtle.importKey("raw", keyData, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]);
 }).then(function(result) {
     key = result;
 
     debug("Wrapping it...");
-    return crypto.subtle.wrapKey("raw", key, kek, "aes-kw");
+    return crypto.webkitSubtle.wrapKey("raw", key, kek, "aes-kw");
 }).then(function(result) {
     wrappedKey = result;
     shouldBe("bytesToHexString(wrappedKey)", "'1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5'"); // Result from RFC 3394.
 
     debug("Unwrapping it...");
-    return crypto.subtle.unwrapKey("raw", wrappedKey, kek, "aes-kw", "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]);
+    return crypto.webkitSubtle.unwrapKey("raw", wrappedKey, kek, "aes-kw", "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]);
 }).then(function(result) {
     unwrappedKey = result;
     shouldBe("unwrappedKey.toString()", "'[object CryptoKey]'");
@@ -44,7 +44,7 @@ crypto.subtle.importKey("raw", kekData, "aes-kw", extractable, ["wrapKey", "unwr
     shouldBe("unwrappedKey.usages", "['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']");
 
     debug("Exporting it...");
-    return crypto.subtle.exportKey("raw", unwrappedKey);
+    return crypto.webkitSubtle.exportKey("raw", unwrappedKey);
 }).then(function(result) {
     unwrappedKeyData = result;
     shouldBe("bytesToHexString(unwrappedKeyData)", "bytesToHexString(keyData)");
@@ -23,7 +23,7 @@ window.addEventListener("message", function(evt) {
     finishJSTest();
 }, false);
 
-crypto.subtle.importKey("raw", asciiToUint8Array("16 bytes of key!"), {name: "aes-cbc", length: 128}, true, ["encrypt", "decrypt"]).then(function(key) {
+crypto.webkitSubtle.importKey("raw", asciiToUint8Array("16 bytes of key!"), {name: "aes-cbc", length: 128}, true, ["encrypt", "decrypt"]).then(function(key) {
     postMessage(key, "*");
 });
 </script>
diff --git a/LayoutTests/crypto/webkitSubtle/argument-conversion-expected.txt b/LayoutTests/crypto/webkitSubtle/argument-conversion-expected.txt
new file mode 100644 (file)
index 0000000..919cbef
--- /dev/null
@@ -0,0 +1,38 @@
+Test crypto.webkitSubtle argument conversion
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Passing algorithm name as a string object...
+PASS ...succeeded
+
+Passing algorithm name as a string object in a dictionary...
+PASS ...succeeded
+
+Passing algorithm name as an object with toString
+PASS ...succeeded
+
+Passing invalid data to digest()
+PASS crypto.webkitSubtle.digest({name: 'sha-1'}) threw exception TypeError: Not enough arguments.
+PASS crypto.webkitSubtle.digest({name: 'sha-1'}, null) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
+PASS crypto.webkitSubtle.digest({name: 'sha-1'}, 10) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
+PASS crypto.webkitSubtle.digest({name: 'sha-1'}, [10]) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
+PASS crypto.webkitSubtle.digest({name: 'sha-1'}, [new Uint8Array([0])]) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
+
+Passing invalid algorithmIdentifiers to digest()
+PASS crypto.webkitSubtle.digest({ toString:function() { return 'sha-1' } }, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.digest({name: ''}, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.digest({name: null}, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.digest({name: undefined}, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.digest({name: 'sha'}, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.digest({name: 1}, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.digest('', data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.digest(null, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.digest(undefined, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.digest(1, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.digest({}, data) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/crypto/webkitSubtle/argument-conversion.html b/LayoutTests/crypto/webkitSubtle/argument-conversion.html
new file mode 100644 (file)
index 0000000..e0967a9
--- /dev/null
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test crypto.webkitSubtle argument conversion");
+
+jsTestIsAsync = true;
+
+Promise.resolve(null).then(function() {
+    debug("\nPassing algorithm name as a string object...");
+    return crypto.webkitSubtle.digest(new String('sha-1'), new Uint8Array([]));
+}).then(function(result) {
+    testPassed("...succeeded");
+    debug("\nPassing algorithm name as a string object in a dictionary...");
+    return crypto.webkitSubtle.digest({name: new String('sha-1')}, new Uint8Array([]));
+}).then(function(result) {
+    testPassed("...succeeded");
+    debug("\nPassing algorithm name as an object with toString");
+    return crypto.webkitSubtle.digest({name: { toString:function() { return 'sha-1' } } }, new Uint8Array([]));
+}).then(function(result) {
+    testPassed("...succeeded");
+
+    debug("\nPassing invalid data to digest()");
+    shouldThrow("crypto.webkitSubtle.digest({name: 'sha-1'})");
+    shouldThrow("crypto.webkitSubtle.digest({name: 'sha-1'}, null)");
+    shouldThrow("crypto.webkitSubtle.digest({name: 'sha-1'}, 10)");
+    shouldThrow("crypto.webkitSubtle.digest({name: 'sha-1'}, [10])");
+    shouldThrow("crypto.webkitSubtle.digest({name: 'sha-1'}, [new Uint8Array([0])])");
+
+    debug("\nPassing invalid algorithmIdentifiers to digest()");
+    data = new Uint8Array([0]);
+    shouldThrow("crypto.webkitSubtle.digest({ toString:function() { return 'sha-1' } }, data)"); // Algorithm normalization doesn't attempt to call toString.
+    shouldThrow("crypto.webkitSubtle.digest({name: ''}, data)");
+    shouldThrow("crypto.webkitSubtle.digest({name: null}, data)");
+    shouldThrow("crypto.webkitSubtle.digest({name: undefined}, data)");
+    shouldThrow("crypto.webkitSubtle.digest({name: 'sha'}, data)");
+    shouldThrow("crypto.webkitSubtle.digest({name: 1}, data)");
+    shouldThrow("crypto.webkitSubtle.digest('', data)");
+    shouldThrow("crypto.webkitSubtle.digest(null, data)");
+    shouldThrow("crypto.webkitSubtle.digest(undefined, data)");
+    shouldThrow("crypto.webkitSubtle.digest(1, data)");
+    shouldThrow("crypto.webkitSubtle.digest({}, data)");
+}).then(finishJSTest);
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
@@ -16,7 +16,7 @@ jsTestIsAsync = true;
 Promise.resolve(null).then(function() {
     var originalData = new Uint8Array([0xf, 0xf, 0xf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0xf, 0xf, 0xf]);
     var slicedData = new Uint8Array(originalData.buffer, 3, 11);
-    return crypto.subtle.digest({name: 'sha-1'}, slicedData);
+    return crypto.webkitSubtle.digest({name: 'sha-1'}, slicedData);
 }).then(function(result) {
     digest = result;
     // Expected result for [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].
@@ -12,7 +12,7 @@ description("Test that CryptoKey.algorithm preserves custom properties.");
 jsTestIsAsync = true;
 
 debug("\nGenerating a HMAC key with default length...");
-crypto.subtle.generateKey({name: "hmac", hash: "sha-1"}, true, ["sign", "verify"]).then(function(result) {
+crypto.webkitSubtle.generateKey({name: "hmac", hash: "sha-1"}, true, ["sign", "verify"]).then(function(result) {
     key = result;
     startTest();
 });
@@ -12,7 +12,7 @@ description("Test that CryptoKey.usages preserves custom properties.");
 jsTestIsAsync = true;
 
 debug("\nGenerating a HMAC key with default length...");
-crypto.subtle.generateKey({name: "hmac", hash: "sha-1"}, true, ["sign", "verify"]).then(function(result) {
+crypto.webkitSubtle.generateKey({name: "hmac", hash: "sha-1"}, true, ["sign", "verify"]).then(function(result) {
     key = result;
     startTest();
 });
diff --git a/LayoutTests/crypto/webkitSubtle/hmac-check-algorithm-expected.txt b/LayoutTests/crypto/webkitSubtle/hmac-check-algorithm-expected.txt
new file mode 100644 (file)
index 0000000..370f0ad
--- /dev/null
@@ -0,0 +1,15 @@
+Test that HMAC operations only work when hash functions match between invocation and key.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a raw HMAC SHA-1 key from string literal...
+Done
+PASS crypto.webkitSubtle.sign({name: 'hmac', hash: {name: 'sha-1'}}, key, asciiToUint8Array('foo')) did not throw exception.
+PASS crypto.webkitSubtle.sign({name: 'hmac', hash: {name: 'sha-256'}}, key, asciiToUint8Array('foo')) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.verify({name: 'hmac', hash: {name: 'sha-1'}}, key, asciiToUint8Array('fake signature'), asciiToUint8Array('foo')) did not throw exception.
+PASS crypto.webkitSubtle.verify({name: 'hmac', hash: {name: 'sha-256'}}, key, asciiToUint8Array('fake signature'), asciiToUint8Array('foo')) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/crypto/webkitSubtle/hmac-check-algorithm.html b/LayoutTests/crypto/webkitSubtle/hmac-check-algorithm.html
new file mode 100644 (file)
index 0000000..84199a4
--- /dev/null
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test that HMAC operations only work when hash functions match between invocation and key.");
+
+jsTestIsAsync = true;
+
+var hmacKey = asciiToUint8Array('a');
+var extractable = true;
+
+debug("Importing a raw HMAC SHA-1 key from string literal...");
+crypto.webkitSubtle.importKey("raw", hmacKey, {name: 'hmac', hash: {name: 'sha-1'}}, extractable, ["sign", "verify"]).then(function(result) {
+    debug("Done");
+    key = result;
+
+    shouldNotThrow("crypto.webkitSubtle.sign({name: 'hmac', hash: {name: 'sha-1'}}, key, asciiToUint8Array('foo'))");
+    shouldThrow("crypto.webkitSubtle.sign({name: 'hmac', hash: {name: 'sha-256'}}, key, asciiToUint8Array('foo'))");
+
+    shouldNotThrow("crypto.webkitSubtle.verify({name: 'hmac', hash: {name: 'sha-1'}}, key, asciiToUint8Array('fake signature'), asciiToUint8Array('foo'))");
+    shouldThrow("crypto.webkitSubtle.verify({name: 'hmac', hash: {name: 'sha-256'}}, key, asciiToUint8Array('fake signature'), asciiToUint8Array('foo'))");
+
+    finishJSTest();
+});
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
@@ -4,11 +4,11 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 Importing a JWK key...
-PASS crypto.subtle.exportKey(null, key) threw exception TypeError: Unknown key format.
-PASS crypto.subtle.exportKey(undefined, key) threw exception TypeError: Unknown key format.
-PASS crypto.subtle.exportKey({}, key) threw exception TypeError: Unknown key format.
-PASS crypto.subtle.exportKey("", key) threw exception TypeError: Unknown key format.
-PASS crypto.subtle.exportKey("foobar", key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey(null, key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey(undefined, key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey({}, key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey("", key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey("foobar", key) threw exception TypeError: Unknown key format.
 Exporting the key as raw data...
 PASS bytesToHexString(new Uint8Array(exportedData)) is '6a18e49feff7f3b7e09ec89b7f6deab2f6a18e49feff7f3b7e09ec89b7f6deab'
 Exporting the key as JWK...
@@ -24,23 +24,23 @@ var jwkKey = {
 var jwkKeyAsArrayBuffer = asciiToUint8Array(JSON.stringify(jwkKey));
 
 debug("Importing a JWK key...");
-crypto.subtle.importKey("jwk", jwkKeyAsArrayBuffer, { name: "HMAC", hash: "SHA-256" }, extractable, ["sign", "verify"]).then(function(result) {
+crypto.webkitSubtle.importKey("jwk", jwkKeyAsArrayBuffer, { name: "HMAC", hash: "SHA-256" }, extractable, ["sign", "verify"]).then(function(result) {
     key = result;
 
-    shouldThrow('crypto.subtle.exportKey(null, key)');
-    shouldThrow('crypto.subtle.exportKey(undefined, key)');
-    shouldThrow('crypto.subtle.exportKey({}, key)');
-    shouldThrow('crypto.subtle.exportKey("", key)');
-    shouldThrow('crypto.subtle.exportKey("foobar", key)');
+    shouldThrow('crypto.webkitSubtle.exportKey(null, key)');
+    shouldThrow('crypto.webkitSubtle.exportKey(undefined, key)');
+    shouldThrow('crypto.webkitSubtle.exportKey({}, key)');
+    shouldThrow('crypto.webkitSubtle.exportKey("", key)');
+    shouldThrow('crypto.webkitSubtle.exportKey("foobar", key)');
 
     debug("Exporting the key as raw data...");
-    return crypto.subtle.exportKey("raw", key);
+    return crypto.webkitSubtle.exportKey("raw", key);
 }).then(function(result) {
     exportedData = result;
     shouldBe("bytesToHexString(new Uint8Array(exportedData))", "'6a18e49feff7f3b7e09ec89b7f6deab2f6a18e49feff7f3b7e09ec89b7f6deab'");
 
     debug("Exporting the key as JWK...");
-    return crypto.subtle.exportKey("jwk", key);
+    return crypto.webkitSubtle.exportKey("jwk", key);
 }).then(function(result) {
     exportedJWK = JSON.parse(bytesToASCIIString(result));
     shouldBe("exportedJWK.kty", "'oct'");
@@ -51,12 +51,12 @@ crypto.subtle.importKey("jwk", jwkKeyAsArrayBuffer, { name: "HMAC", hash: "SHA-2
     shouldBe("exportedJWK.key_ops", "['sign', 'verify']");
 
     debug("\nImporting a key that's not extractable...");
-    return crypto.subtle.importKey("jwk", jwkKeyAsArrayBuffer, { name: "HMAC", hash: "SHA-256" }, nonExtractable, ["sign", "verify"]);
+    return crypto.webkitSubtle.importKey("jwk", jwkKeyAsArrayBuffer, { name: "HMAC", hash: "SHA-256" }, nonExtractable, ["sign", "verify"]);
 }).then(function(result) {
     key = result;
 
     debug("\nTrying to export as raw...");
-    return crypto.subtle.exportKey("raw", key);
+    return crypto.webkitSubtle.exportKey("raw", key);
 }).then(function(result) {
     testFailed("Promise wasn't rejected");
     finishJSTest();
@@ -64,7 +64,7 @@ crypto.subtle.importKey("jwk", jwkKeyAsArrayBuffer, { name: "HMAC", hash: "SHA-2
     testPassed("Rejected, as expected");
 
     debug("Trying to export as jwk...");
-    return crypto.subtle.exportKey("jwk", key);
+    return crypto.webkitSubtle.exportKey("jwk", key);
 }).then(function(result) {
     testFailed("Promise wasn't rejected");
     finishJSTest();
diff --git a/LayoutTests/crypto/webkitSubtle/hmac-generate-key-expected.txt b/LayoutTests/crypto/webkitSubtle/hmac-generate-key-expected.txt
new file mode 100644 (file)
index 0000000..e2d2b5c
--- /dev/null
@@ -0,0 +1,29 @@
+Test generating a HMAC key.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS crypto.webkitSubtle.generateKey("hmac", extractable, ["sign", "verify"]) threw exception TypeError: Type error.
+PASS crypto.webkitSubtle.generateKey({name: "hmac"}, extractable, ["sign", "verify"]) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.generateKey({name: "hmac", length: undefined}, extractable, ["sign", "verify"]) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.generateKey({name: "hmac", length: {}}, extractable, ["sign", "verify"]) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+
+Generating a key with default length...
+PASS key.type is 'secret'
+PASS key.extractable is true
+PASS key.algorithm.name is 'HMAC'
+PASS key.algorithm.length is 64
+PASS key.algorithm.hash.name is 'SHA-1'
+PASS key.usages is ["sign", "verify"]
+
+Generating a key with custom length...
+PASS key.type is 'secret'
+PASS key.extractable is true
+PASS key.algorithm.name is 'HMAC'
+PASS key.algorithm.length is 5
+PASS key.algorithm.hash.name is 'SHA-1'
+PASS key.usages is ["sign"]
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
@@ -15,13 +15,13 @@ jsTestIsAsync = true;
 
 var extractable = true;
 
-shouldThrow('crypto.subtle.generateKey("hmac", extractable, ["sign", "verify"])');
-shouldThrow('crypto.subtle.generateKey({name: "hmac"}, extractable, ["sign", "verify"])');
-shouldThrow('crypto.subtle.generateKey({name: "hmac", length: undefined}, extractable, ["sign", "verify"])');
-shouldThrow('crypto.subtle.generateKey({name: "hmac", length: {}}, extractable, ["sign", "verify"])');
+shouldThrow('crypto.webkitSubtle.generateKey("hmac", extractable, ["sign", "verify"])');
+shouldThrow('crypto.webkitSubtle.generateKey({name: "hmac"}, extractable, ["sign", "verify"])');
+shouldThrow('crypto.webkitSubtle.generateKey({name: "hmac", length: undefined}, extractable, ["sign", "verify"])');
+shouldThrow('crypto.webkitSubtle.generateKey({name: "hmac", length: {}}, extractable, ["sign", "verify"])');
 
 debug("\nGenerating a key with default length...");
-crypto.subtle.generateKey({name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]).then(function(result) {
+crypto.webkitSubtle.generateKey({name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]).then(function(result) {
     key = result;
 
     shouldBe("key.type", "'secret'");
@@ -32,7 +32,7 @@ crypto.subtle.generateKey({name: "hmac", hash: "sha-1"}, extractable, ["sign", "
     shouldBe("key.usages", '["sign", "verify"]');
 
     debug("\nGenerating a key with custom length...");
-    return crypto.subtle.generateKey({name: "hmac", hash: "sha-1", length: 5}, extractable, ["sign"]);
+    return crypto.webkitSubtle.generateKey({name: "hmac", hash: "sha-1", length: 5}, extractable, ["sign"]);
 }).then(function(result) {
     key = result;
 
@@ -26,7 +26,7 @@ var hmacKey = {
 var hmacKeyAsArrayBuffer = asciiToUint8Array(JSON.stringify(hmacKey));
 
 debug("Importing a key...\n");
-crypto.subtle.importKey("jwk", hmacKeyAsArrayBuffer, null, extractable, ["sign", "verify"]).then(function(result) {
+crypto.webkitSubtle.importKey("jwk", hmacKeyAsArrayBuffer, null, extractable, ["sign", "verify"]).then(function(result) {
     key = result;
 
     shouldBe("key.type", "'secret'");
@@ -36,13 +36,13 @@ crypto.subtle.importKey("jwk", hmacKeyAsArrayBuffer, null, extractable, ["sign",
     shouldBe("key.usages", '["sign", "verify"]');
 
     debug("\nUsing the key to sign message 'foo'...");
-    return crypto.subtle.sign(key.algorithm, key, asciiToUint8Array('foo'));
+    return crypto.webkitSubtle.sign(key.algorithm, key, asciiToUint8Array('foo'));
 }).then(function(result) {
     signature = result;
     shouldBe("bytesToHexString(new Uint8Array(signature))", "'e03736fe098892b2a2da77812431f7c014d32e2fd69f3bcff883ac923a8fa2da'");
 
     debug("\nVerifying the signature...");
-    return crypto.subtle.verify(key.algorithm, key, result, asciiToUint8Array('foo'));
+    return crypto.webkitSubtle.verify(key.algorithm, key, result, asciiToUint8Array('foo'));
 }).then(function(result) {
     verificationResult = result;
     shouldBe("verificationResult", "true");
@@ -23,7 +23,7 @@ window.addEventListener("message", function(evt) {
     finishJSTest();
 }, false);
 
-crypto.subtle.importKey("raw", asciiToUint8Array("16 bytes of key!"), {name: 'hmac', hash: {name: 'sha-1'}}, true, ['sign', 'verify']).then(function(key) {
+crypto.webkitSubtle.importKey("raw", asciiToUint8Array("16 bytes of key!"), {name: 'hmac', hash: {name: 'sha-1'}}, true, ['sign', 'verify']).then(function(key) {
     postMessage(key, "*");
 });
 </script>
@@ -17,7 +17,7 @@ var hmacKey = asciiToUint8Array('');
 var extractable = true;
 
 debug("Importing a raw HMAC key from string literal...");
-crypto.subtle.importKey("raw", hmacKey, {name: 'hmac', hash: {name: 'sha-1'}}, extractable, ["sign", "verify"]).then(function(result) {
+crypto.webkitSubtle.importKey("raw", hmacKey, {name: 'hmac', hash: {name: 'sha-1'}}, extractable, ["sign", "verify"]).then(function(result) {
     key = result;
     shouldBe("key.type", "'secret'");
     shouldBe("key.extractable", "true");
@@ -27,13 +27,13 @@ crypto.subtle.importKey("raw", hmacKey, {name: 'hmac', hash: {name: 'sha-1'}}, e
     shouldBe("key.usages", "['sign', 'verify']");
 
     debug("Using the key to sign 'foo'...");
-    return crypto.subtle.sign(key.algorithm, key, asciiToUint8Array('foo'));
+    return crypto.webkitSubtle.sign(key.algorithm, key, asciiToUint8Array('foo'));
 }).then(function(result) {
     signature = result;
     shouldBe("bytesToHexString(new Uint8Array(signature))", "'a3cc770fc033e2cb419d42b64e0081a3bd3be30e'");
 
     debug("Verifying the signature...");
-    return crypto.subtle.verify(key.algorithm, key, result, asciiToUint8Array('foo'));
+    return crypto.webkitSubtle.verify(key.algorithm, key, result, asciiToUint8Array('foo'));
 }).then(function(result) {
     verificationResult = result;
     shouldBe("verificationResult", "true");
@@ -17,7 +17,7 @@ var hmacKey = asciiToUint8Array('a');
 var extractable = true;
 
 debug("Importing a raw HMAC key from string literal...");
-crypto.subtle.importKey("raw", hmacKey, {name: 'hmac', hash: {name: 'sha-1'}}, extractable, ["sign", "verify"]).then(function(result) {
+crypto.webkitSubtle.importKey("raw", hmacKey, {name: 'hmac', hash: {name: 'sha-1'}}, extractable, ["sign", "verify"]).then(function(result) {
     key = result;
     shouldBe("key.type", "'secret'");
     shouldBe("key.extractable", "true");
@@ -27,13 +27,13 @@ crypto.subtle.importKey("raw", hmacKey, {name: 'hmac', hash: {name: 'sha-1'}}, e
     shouldBe("key.usages", "['sign', 'verify']");
 
     debug("Using the key to sign 'foo'...");
-    return crypto.subtle.sign(key.algorithm, key, asciiToUint8Array('foo'));
+    return crypto.webkitSubtle.sign(key.algorithm, key, asciiToUint8Array('foo'));
 }).then(function(result) {
     signature = result;
     shouldBe("bytesToHexString(new Uint8Array(signature))", "'bebbc02e46b0f81183f40c25dce23e5045d65519'");
 
     debug("Verifying the signature...");
-    return crypto.subtle.verify(key.algorithm, key, result, asciiToUint8Array('foo'));
+    return crypto.webkitSubtle.verify(key.algorithm, key, result, asciiToUint8Array('foo'));
 }).then(function(result) {
     verificationResult = result;
     shouldBe("verificationResult", "true");
diff --git a/LayoutTests/crypto/webkitSubtle/import-jwk-expected.txt b/LayoutTests/crypto/webkitSubtle/import-jwk-expected.txt
new file mode 100644 (file)
index 0000000..4de85e8
--- /dev/null
@@ -0,0 +1,30 @@
+Test error handling for JWK import.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(''), null) threw exception TypeError: Invalid JWK serialization.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('{'), null) threw exception TypeError: Invalid JWK serialization.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('null'), null) threw exception TypeError: Invalid JWK serialization.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('undefined'), null) threw exception TypeError: Invalid JWK serialization.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('{}'), null) threw exception TypeError: Neither key nor function argument has crypto algorithm specified.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('{}'), "aes-cbc") threw exception TypeError: Required JWK "kty" member is missing.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('{ "kty": "foobar", "alg": "HS256", "use": "sig", "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }'), null) threw exception TypeError: Unsupported JWK key type foobar.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "foobar", "use": "sig", "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }'), null) threw exception TypeError: Unsupported JWK algorithm foobar.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }'), "aes-cbc") threw exception TypeError: Algorithm specified in key is not compatible with one passed to importKey as argument.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }'), { name: "hmac", hash: "sha-1" }) threw exception TypeError: Algorithm specified in key is not compatible with one passed to importKey as argument.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "HS256" }'), null) threw exception TypeError: Secret key data is not present is JWK.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "A128CBC" }'), null) threw exception TypeError: Secret key data is not present is JWK.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": "1234" }'), null) threw exception TypeError: Key size is not valid for HS256.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "A128CBC", "use": "sig", "ext": false, "k": "1234" }'), null) threw exception TypeError: Key size is not valid for A128CBC.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "A128CBC", "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }'), null) threw exception TypeError: Key size is not valid for A128CBC.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": "ahjkn23387f+nsibf23qsvahjkn37387fgnsibf23qs" }'), null) threw exception TypeError: Cannot decode base64url key data in JWK.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('{ "kty": 1, "alg": "HS256", "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }'), null) threw exception TypeError: Expected a string value for "kty" JSON key.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": 1, "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }'), null) threw exception TypeError: Expected a string value for "alg" JSON key.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "HS256", "use": 1, "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }'), null) threw exception TypeError: Expected a string value for "use" JSON key.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": "false", "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }'), null) threw exception TypeError: Expected a boolean value for "ext" JSON key.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array('{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": 1 }'), null) threw exception TypeError: Expected a string value for "k" JSON key.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/crypto/webkitSubtle/import-jwk.html b/LayoutTests/crypto/webkitSubtle/import-jwk.html
new file mode 100644 (file)
index 0000000..fc2d6c9
--- /dev/null
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test error handling for JWK import.");
+
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'\'), null)')
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'{\'), null)')
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'null\'), null)')
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'undefined\'), null)')
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'{}\'), null)')
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'{}\'), "aes-cbc")')
+
+// Unknown/invalid JWK values.
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "foobar", "alg": "HS256", "use": "sig", "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }\'), null)')
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "foobar", "use": "sig", "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }\'), null)')
+
+// Algorithm mismatch.
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }\'), "aes-cbc")')
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }\'), { name: "hmac", hash: "sha-1" })')
+
+// No key data.
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "HS256" }\'), null)')
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "A128CBC" }\'), null)')
+
+// Key data length is incorrect, not allowed in JWK.
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": "1234" }\'), null)')
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "A128CBC", "use": "sig", "ext": false, "k": "1234" }\'), null)')
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "A128CBC", "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }\'), null)')
+
+// Key data is not valid base64url.
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": "ahjkn23387f+nsibf23qsvahjkn37387fgnsibf23qs" }\'), null)')
+
+// Incorrect data types.
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'{ "kty": 1, "alg": "HS256", "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }\'), null)')
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": 1, "use": "sig", "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }\'), null)')
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "HS256", "use": 1, "ext": false, "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }\'), null)')
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": "false", "k": "ahjkn23387fgnsibf23qsvahjkn37387fgnsibf23qs" }\'), null)')
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(\'{ "kty": "oct", "alg": "HS256", "use": "sig", "ext": false, "k": 1 }\'), null)')
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
@@ -20,8 +20,8 @@ var hmacKeyAsArrayBuffer = Base64URL.parse("ahjkn-_387fgnsibf23qsvahjkn-_387fgns
 
 function testWithAESCBC(usages, expectedKeyOps)
 {
-    return crypto.subtle.importKey("raw", aesKeyAsArrayBuffer, "AES-CBC", extractable, usages).then(function(result) {
-        return crypto.subtle.exportKey("jwk", result);
+    return crypto.webkitSubtle.importKey("raw", aesKeyAsArrayBuffer, "AES-CBC", extractable, usages).then(function(result) {
+        return crypto.webkitSubtle.exportKey("jwk", result);
     }).then(function(result) {
         jwk = JSON.parse(bytesToASCIIString(result));
         debug(usages + ":");
@@ -33,8 +33,8 @@ function testWithAESCBC(usages, expectedKeyOps)
 
 function testWithHMAC(usages, expectedKeyOps)
 {
-    return crypto.subtle.importKey("raw", hmacKeyAsArrayBuffer, {name: 'hmac', hash: {name: 'sha-256'}}, extractable, usages).then(function(result) {
-        return crypto.subtle.exportKey("jwk", result);
+    return crypto.webkitSubtle.importKey("raw", hmacKeyAsArrayBuffer, {name: 'hmac', hash: {name: 'sha-256'}}, extractable, usages).then(function(result) {
+        return crypto.webkitSubtle.exportKey("jwk", result);
     }).then(function(result) {
         jwk = JSON.parse(bytesToASCIIString(result));
         debug(usages + ":");
@@ -39,7 +39,7 @@ function testWithAESCBC(expectedUsages, jwkUsages)
         aesKeyAsJSON.use = jwkUsages.use;
     }
 
-    return crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(aesKeyAsJSON)), "AES-CBC", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(result) {
+    return crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(aesKeyAsJSON)), "AES-CBC", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(result) {
         key = result;
         debug(JSON.stringify(jwkUsages) + ":");
         shouldBe("key.usages", JSON.stringify(expectedUsages));
@@ -57,7 +57,7 @@ function testWithHMAC(expectedUsages, jwkUsages)
         hmacKeyAsJSON.use = jwkUsages.use;
     }
 
-    return crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(hmacKeyAsJSON)), {name: 'hmac', hash: {name: 'sha-256'}}, extractable, ["sign", "verify"]).then(function(result) {
+    return crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(hmacKeyAsJSON)), {name: 'hmac', hash: {name: 'sha-256'}}, extractable, ["sign", "verify"]).then(function(result) {
         key = result;
         debug(JSON.stringify(jwkUsages) + ":");
         shouldBe("key.usages", JSON.stringify(expectedUsages));
@@ -15,8 +15,8 @@ var privateKeyJSON = {
     qi: "YCX_pLwbMBA1ThVH0WcwmnytqNcrMCEwTm7ByA2eU6nWbQrULvf7m9_kzfLUcjsnpAVlBQG5JMXMy0Sq4ptwbywsa5-G8KAOOOR2L3v4hC-Eys9ftgFM_3i0o40eeQH4b3haPbntrIeMg8IzlOuVYKf9-2QuKDoWeRdd7NsdxTk"
 };
 
-crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, false, ["sign", "verify"]).then(function(key) {
-    var openRequest = indexedDB.open("crypto_subtle");
+crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, false, ["sign", "verify"]).then(function(key) {
+    var openRequest = indexedDB.open("crypto_webkitSubtle");
     openRequest.onupgradeneeded = function(event) {
         var objectStore = event.target.result.createObjectStore("rsa-indexeddb");
     }
@@ -15,8 +15,8 @@ var privateKeyJSON = {
     qi: "YCX_pLwbMBA1ThVH0WcwmnytqNcrMCEwTm7ByA2eU6nWbQrULvf7m9_kzfLUcjsnpAVlBQG5JMXMy0Sq4ptwbywsa5-G8KAOOOR2L3v4hC-Eys9ftgFM_3i0o40eeQH4b3haPbntrIeMg8IzlOuVYKf9-2QuKDoWeRdd7NsdxTk"
 };
 
-crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, true, ["sign", "verify"]).then(function(key) {
-    var openRequest = indexedDB.open("crypto_subtle");
+crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, true, ["sign", "verify"]).then(function(key) {
+    var openRequest = indexedDB.open("crypto_webkitSubtle");
     openRequest.onupgradeneeded = function(event) {
         var objectStore = event.target.result.createObjectStore("rsa-indexeddb");
     }
@@ -5,11 +5,11 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 Generating RSA-PKCS1-v1.5 keyPair...
-PASS crypto.subtle.exportKey(null, key) threw exception TypeError: Unknown key format.
-PASS crypto.subtle.exportKey(undefined, key) threw exception TypeError: Unknown key format.
-PASS crypto.subtle.exportKey({}, key) threw exception TypeError: Unknown key format.
-PASS crypto.subtle.exportKey("", key) threw exception TypeError: Unknown key format.
-PASS crypto.subtle.exportKey("foobar", key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey(null, key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey(undefined, key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey({}, key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey("", key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey("foobar", key) threw exception TypeError: Unknown key format.
 PASS key.publicKey.algorithm.hash.name is defined.
 PASS key.privateKey.algorithm.hash.name is defined.
 
@@ -23,20 +23,20 @@ var algorithm = {
 };
 
 debug("\nGenerating RSA-PKCS1-v1.5 keyPair...");
-crypto.subtle.generateKey(algorithm, extractable, ['sign', 'verify'])
+crypto.webkitSubtle.generateKey(algorithm, extractable, ['sign', 'verify'])
 .then(function(result) {
     key = result;
 
-    shouldThrow('crypto.subtle.exportKey(null, key)');
-    shouldThrow('crypto.subtle.exportKey(undefined, key)');
-    shouldThrow('crypto.subtle.exportKey({}, key)');
-    shouldThrow('crypto.subtle.exportKey("", key)');
-    shouldThrow('crypto.subtle.exportKey("foobar", key)');
+    shouldThrow('crypto.webkitSubtle.exportKey(null, key)');
+    shouldThrow('crypto.webkitSubtle.exportKey(undefined, key)');
+    shouldThrow('crypto.webkitSubtle.exportKey({}, key)');
+    shouldThrow('crypto.webkitSubtle.exportKey("", key)');
+    shouldThrow('crypto.webkitSubtle.exportKey("foobar", key)');
     shouldBeDefined('key.publicKey.algorithm.hash.name');
     shouldBeDefined('key.privateKey.algorithm.hash.name');
 
     debug("\nExporting public key as JWK...");
-    return crypto.subtle.exportKey("jwk", key.publicKey);
+    return crypto.webkitSubtle.exportKey("jwk", key.publicKey);
 }).then(function(result) {
     exportedJWK = JSON.parse(bytesToASCIIString(result));
 
@@ -47,7 +47,7 @@ crypto.subtle.generateKey(algorithm, extractable, ['sign', 'verify'])
     shouldBe("exportedJWK.key_ops", "['sign', 'verify']");
 
     debug("\nExporting private key as JWK...");
-    return crypto.subtle.exportKey("jwk", key.privateKey);
+    return crypto.webkitSubtle.exportKey("jwk", key.privateKey);
 }).then(function(result) {
     exportedJWK = JSON.parse(bytesToASCIIString(result));
 
@@ -5,11 +5,11 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 Importing a JWK key...
-PASS crypto.subtle.exportKey(null, key) threw exception TypeError: Unknown key format.
-PASS crypto.subtle.exportKey(undefined, key) threw exception TypeError: Unknown key format.
-PASS crypto.subtle.exportKey({}, key) threw exception TypeError: Unknown key format.
-PASS crypto.subtle.exportKey("", key) threw exception TypeError: Unknown key format.
-PASS crypto.subtle.exportKey("foobar", key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey(null, key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey(undefined, key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey({}, key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey("", key) threw exception TypeError: Unknown key format.
+PASS crypto.webkitSubtle.exportKey("foobar", key) threw exception TypeError: Unknown key format.
 
 Exporting the key as JWK...
 PASS exportedJWK.kty is 'RSA'
@@ -26,17 +26,17 @@ var publicKeyJSON = {
 var jwkKeyAsArrayBuffer = asciiToUint8Array(JSON.stringify(publicKeyJSON));
 
 debug("\nImporting a JWK key...");
-crypto.subtle.importKey("jwk", jwkKeyAsArrayBuffer, "RSASSA-PKCS1-v1_5", extractable, ['sign', 'verify']).then(function(result) {
+crypto.webkitSubtle.importKey("jwk", jwkKeyAsArrayBuffer, "RSASSA-PKCS1-v1_5", extractable, ['sign', 'verify']).then(function(result) {
     key = result;
 
-    shouldThrow('crypto.subtle.exportKey(null, key)');
-    shouldThrow('crypto.subtle.exportKey(undefined, key)');
-    shouldThrow('crypto.subtle.exportKey({}, key)');
-    shouldThrow('crypto.subtle.exportKey("", key)');
-    shouldThrow('crypto.subtle.exportKey("foobar", key)');
+    shouldThrow('crypto.webkitSubtle.exportKey(null, key)');
+    shouldThrow('crypto.webkitSubtle.exportKey(undefined, key)');
+    shouldThrow('crypto.webkitSubtle.exportKey({}, key)');
+    shouldThrow('crypto.webkitSubtle.exportKey("", key)');
+    shouldThrow('crypto.webkitSubtle.exportKey("foobar", key)');
 
     debug("\nExporting the key as JWK...");
-    return crypto.subtle.exportKey("jwk", key);
+    return crypto.webkitSubtle.exportKey("jwk", key);
 }).then(function(result) {
     exportedJWK = JSON.parse(bytesToASCIIString(result));
 
@@ -33,11 +33,11 @@ var privateKeyJSON = {
 var jwkKeyAsArrayBuffer = asciiToUint8Array(JSON.stringify(privateKeyJSON));
 
 debug("\nImporting a JWK key...");
-crypto.subtle.importKey("jwk", jwkKeyAsArrayBuffer, "RSASSA-PKCS1-v1_5", extractable, ['sign', 'verify']).then(function(result) {
+crypto.webkitSubtle.importKey("jwk", jwkKeyAsArrayBuffer, "RSASSA-PKCS1-v1_5", extractable, ['sign', 'verify']).then(function(result) {
     key = result;
 
     debug("\nExporting the key as JWK...");
-    return crypto.subtle.exportKey("jwk", key);
+    return crypto.webkitSubtle.exportKey("jwk", key);
 }).then(function(result) {
     exportedJWK = JSON.parse(bytesToASCIIString(result));
 
@@ -4,7 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 Generating a key pair...
-PASS keyPair.toString() is '[object KeyPair]'
+PASS keyPair.toString() is '[object CryptoKeyPair]'
 PASS keyPair.publicKey.type is 'public'
 PASS keyPair.publicKey.extractable is true
 PASS keyPair.publicKey.algorithm.name is 'RSA-OAEP'
@@ -22,9 +22,9 @@ var algorithmKeyGen = {
 var nonExtractable = false;
 
 debug("Generating a key pair...");
-crypto.subtle.generateKey(algorithmKeyGen, nonExtractable, []).then(function(result) {
+crypto.webkitSubtle.generateKey(algorithmKeyGen, nonExtractable, []).then(function(result) {
     keyPair = result;
-    shouldBe("keyPair.toString()", "'[object KeyPair]'");
+    shouldBe("keyPair.toString()", "'[object CryptoKeyPair]'");
     shouldBe("keyPair.publicKey.type", "'public'");
     shouldBe("keyPair.publicKey.extractable", "true");
     shouldBe("keyPair.publicKey.algorithm.name", "'RSA-OAEP'");
@@ -4,7 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 Generating a key pair...
-PASS keyPair.toString() is '[object KeyPair]'
+PASS keyPair.toString() is '[object CryptoKeyPair]'
 PASS keyPair.publicKey.type is 'public'
 PASS keyPair.publicKey.algorithm.name is 'RSA-OAEP'
 PASS keyPair.publicKey.algorithm.modulusLength is 2048
@@ -17,8 +17,8 @@ PASS bytesToHexString(keyPair.privateKey.algorithm.publicExponent) is '010001'
 PASS keyPair.privateKey.algorithm.hash is undefined.
 
 Testing that the keys can't be used with different algorithms...
-PASS crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, keyPair.privateKey, hexStringToUint8Array("00")) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, keyPair.publicKey, hexStringToUint8Array("00")) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.encrypt({name: "aes-cbc", iv: iv}, keyPair.privateKey, hexStringToUint8Array("00")) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.encrypt({name: "aes-cbc", iv: iv}, keyPair.publicKey, hexStringToUint8Array("00")) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
 
 Trying to export keys to raw...
 PASS Promise rejected for exporting public key
@@ -22,9 +22,9 @@ var algorithmKeyGen = {
 var extractable = true;
 
 debug("Generating a key pair...");
-crypto.subtle.generateKey(algorithmKeyGen, extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(result) {
+crypto.webkitSubtle.generateKey(algorithmKeyGen, extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(result) {
     keyPair = result;
-    shouldBe("keyPair.toString()", "'[object KeyPair]'");
+    shouldBe("keyPair.toString()", "'[object CryptoKeyPair]'");
     shouldBe("keyPair.publicKey.type", "'public'");
     shouldBe("keyPair.publicKey.algorithm.name", "'RSA-OAEP'");
     shouldBe("keyPair.publicKey.algorithm.modulusLength", "2048");
@@ -38,19 +38,19 @@ crypto.subtle.generateKey(algorithmKeyGen, extractable, ["encrypt", "decrypt", "
 
     debug("\nTesting that the keys can't be used with different algorithms...");
     iv = hexStringToUint8Array("000102030405060708090a0b0c0d0e0f");
-    shouldThrow('crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, keyPair.privateKey, hexStringToUint8Array("00"))');
-    shouldThrow('crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, keyPair.publicKey, hexStringToUint8Array("00"))');
+    shouldThrow('crypto.webkitSubtle.encrypt({name: "aes-cbc", iv: iv}, keyPair.privateKey, hexStringToUint8Array("00"))');
+    shouldThrow('crypto.webkitSubtle.encrypt({name: "aes-cbc", iv: iv}, keyPair.publicKey, hexStringToUint8Array("00"))');
 
     debug("\nTrying to export keys to raw...");
-    return crypto.subtle.exportKey('raw', keyPair.publicKey);
+    return crypto.webkitSubtle.exportKey('raw', keyPair.publicKey);
 }).then(undefined, function(result) {
     testPassed("Promise rejected for exporting public key");
-    return crypto.subtle.exportKey('raw', keyPair.privateKey);
+    return crypto.webkitSubtle.exportKey('raw', keyPair.privateKey);
 }).then(undefined, function(result) {
     testPassed("Promise rejected for exporting private key");
 
     debug("\nExporting public key to JWK...");
-    return crypto.subtle.exportKey("jwk", keyPair.publicKey);
+    return crypto.webkitSubtle.exportKey("jwk", keyPair.publicKey);
 }).then(function(result) {
     jwkPublicKeyArray = result;
     jwkPublicKey = JSON.parse(bytesToASCIIString(jwkPublicKeyArray));
@@ -62,7 +62,7 @@ crypto.subtle.generateKey(algorithmKeyGen, extractable, ["encrypt", "decrypt", "
     shouldBe("bytesToHexString(Base64URL.parse(jwkPublicKey.e))", "'010001'");
 
     debug("\nImporting it back...");
-    return crypto.subtle.importKey("jwk", jwkPublicKeyArray, null, extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]);
+    return crypto.webkitSubtle.importKey("jwk", jwkPublicKeyArray, null, extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]);
 }).then(function(result) {
     exportedPublicKey = result;
     shouldBe("exportedPublicKey.type", "'public'");
@@ -37,18 +37,18 @@ var extractable = true;
 var nonExtractable = false;
 
 debug("Importing RSA keys...");
-crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, ["encrypt", "decrypt"]).then(function(result) {
+crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, ["encrypt", "decrypt"]).then(function(result) {
     publicKey = result;
-    return crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, ["encrypt", "decrypt"]);
+    return crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, ["encrypt", "decrypt"]);
 }).then(function(result) {
     privateKey = result;
 
     debug("Encrypting a 214 byte buffer with RSA-OAEP SHA-1, 2048 bit key...");
-    return crypto.subtle.encrypt({name: "RSA-OAEP", hash: "SHA-1"}, publicKey, new Uint8Array(214));
+    return crypto.webkitSubtle.encrypt({name: "RSA-OAEP", hash: "SHA-1"}, publicKey, new Uint8Array(214));
 }).then(function(result) {
     testPassed("Succeeded");
     debug("Encrypting a 215 byte buffer...");
-    return crypto.subtle.encrypt({name: "RSA-OAEP", hash: "SHA-1"}, publicKey, new Uint8Array(215));
+    return crypto.webkitSubtle.encrypt({name: "RSA-OAEP", hash: "SHA-1"}, publicKey, new Uint8Array(215));
 }).then(function(result) {
     testFailed("Succeeded");
     finishJSTest();
@@ -37,26 +37,26 @@ var extractable = true;
 var nonExtractable = false;
 
 debug("Importing RSA keys...");
-crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, ["wrapKey", "unwrapKey"]).then(function(result) {
+crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, ["wrapKey", "unwrapKey"]).then(function(result) {
     publicKey = result;
-    return crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, ["wrapKey", "unwrapKey"]);
+    return crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, ["wrapKey", "unwrapKey"]);
 }).then(function(result) {
     privateKey = result;
 
     debug("Importing an AES key...");
     aesKeyData = hexStringToUint8Array("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4");
-    return crypto.subtle.importKey("raw", aesKeyData, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])
+    return crypto.webkitSubtle.importKey("raw", aesKeyData, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])
 }).then(function(result) {
     aesKey = result;
     debug("Wrapping it...");
 
-    return crypto.subtle.wrapKey("raw", aesKey, publicKey, wrapAlgorithm);
+    return crypto.webkitSubtle.wrapKey("raw", aesKey, publicKey, wrapAlgorithm);
 }).then(function(result) {
     wrappedKey = result;
     shouldBe("wrappedKey.toString()", "'[object ArrayBuffer]'");
 
     debug("Unwrapping it...");
-    return crypto.subtle.unwrapKey("raw", wrappedKey, privateKey, wrapAlgorithm, "aes-cbc", extractable, ["encrypt", "decrypt"]);
+    return crypto.webkitSubtle.unwrapKey("raw", wrappedKey, privateKey, wrapAlgorithm, "aes-cbc", extractable, ["encrypt", "decrypt"]);
 }).then(function(result) {
     unwrappedKey = result;
     shouldBe("unwrappedKey.toString()", "'[object CryptoKey]'");
@@ -67,19 +67,19 @@ crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)),
     shouldBe("unwrappedKey.usages", "['decrypt', 'encrypt']");
 
     debug("Exporting it...");
-    return crypto.subtle.exportKey("raw", unwrappedKey);
+    return crypto.webkitSubtle.exportKey("raw", unwrappedKey);
 }).then(function(result) {
     unwrappedKeyData = result;
     shouldBe("bytesToHexString(unwrappedKeyData)", "bytesToHexString(aesKeyData)");
 
     debug("\nWrapping the same key as JWK...");
-    return crypto.subtle.wrapKey("jwk", aesKey, publicKey, wrapAlgorithm);
+    return crypto.webkitSubtle.wrapKey("jwk", aesKey, publicKey, wrapAlgorithm);
 }).then(function(result) {
     wrappedKey = result;
     shouldBe("wrappedKey.toString()", "'[object ArrayBuffer]'");
 
     debug("Unwrapping it...");
-    return crypto.subtle.unwrapKey("jwk", wrappedKey, privateKey, wrapAlgorithm, "aes-cbc", extractable, ["encrypt", "decrypt"]);
+    return crypto.webkitSubtle.unwrapKey("jwk", wrappedKey, privateKey, wrapAlgorithm, "aes-cbc", extractable, ["encrypt", "decrypt"]);
 }).then(function(result) {
     unwrappedKey = result;
     shouldBe("unwrappedKey.toString()", "'[object CryptoKey]'");
@@ -90,7 +90,7 @@ crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)),
     shouldBe("unwrappedKey.usages", "['decrypt', 'encrypt']");
 
     debug("Exporting it...");
-    return crypto.subtle.exportKey("raw", unwrappedKey);
+    return crypto.webkitSubtle.exportKey("raw", unwrappedKey);
 }).then(function(result) {
     unwrappedKeyData = result;
     shouldBe("bytesToHexString(unwrappedKeyData)", "bytesToHexString(aesKeyData)");
@@ -35,7 +35,7 @@ window.addEventListener("message", function(evt) {
     shouldBe("bytesToHexString(key.algorithm.publicExponent)", "'010001'");
     shouldBe("key.usages", '["sign", "verify"]');
 
-    crypto.subtle.exportKey("jwk", key).then(function(result) {
+    crypto.webkitSubtle.exportKey("jwk", key).then(function(result) {
         exportedJWK = JSON.parse(bytesToASCIIString(result));
         debug("\nExported back to JWK:");
         shouldBe("exportedJWK.kty", "'RSA'");
@@ -57,7 +57,7 @@ window.addEventListener("message", function(evt) {
     });
 }, false);
 
-crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, true, ["sign", "verify"]).then(function(result) {
+crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, true, ["sign", "verify"]).then(function(result) {
     postMessage(result, "*");
 });
 </script>
@@ -30,12 +30,12 @@ var extractable = true;
 var nonExtractable = false;
 
 debug("Importing an RSA key...");
-crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, ["decrypt"]).then(function(result) {
+crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, ["decrypt"]).then(function(result) {
     privateKey = result;
 
     debug("Decrypting...");
     encryptedMessage = hexStringToUint8Array("6042e745589af03af87520f93c45d8c35985ada1161a37d822e9f9460fc75fcf0179d8491b8f5d1e4de8ceb31e07c4865c5a3efdbbb69a8803b89ee65a430a5809c707569150b580bb686a94c5541c46adcd827960ce244ff688387d1616e85b4d1780c6483606cf924b54f080cf4154e66829bf6e532481048ec41fadc07d755bb34bb28145219cb30d47d0d618709180e90303ff9ef09018bed3da75761da794811f96bc9e8d7c4ba1b5946bda0bd313faec4c993ed2748eed8cce4bdb520ba7db165f9fe56aa8454d6ff33874feeebf29de2df5b7f00aa1d9fb073fc4067b58dc50624e127f711dde2cc2cfdab4919ccf28c83660dfc227b0f500ec1f904f");
-    return crypto.subtle.decrypt("RSAES-PKCS1-v1_5", privateKey, encryptedMessage);
+    return crypto.webkitSubtle.decrypt("RSAES-PKCS1-v1_5", privateKey, encryptedMessage);
 }).then(function(result) {
     message = result;
     shouldBe("bytesToHexString(new Uint8Array(message))", "'2aacec86f423dd925ec158822a748cbe6c31a0'");
@@ -37,26 +37,26 @@ var extractable = true;
 var nonExtractable = false;
 
 debug("Importing RSA keys...");
-crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, ["wrapKey", "unwrapKey"]).then(function(result) {
+crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, ["wrapKey", "unwrapKey"]).then(function(result) {
     publicKey = result;
-    return crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, ["wrapKey", "unwrapKey"]);
+    return crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, ["wrapKey", "unwrapKey"]);
 }).then(function(result) {
     privateKey = result;
 
     debug("Importing an AES key...");
     aesKeyData = hexStringToUint8Array("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4");
-    return crypto.subtle.importKey("raw", aesKeyData, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])
+    return crypto.webkitSubtle.importKey("raw", aesKeyData, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])
 }).then(function(result) {
     aesKey = result;
     debug("Wrapping it...");
 
-    return crypto.subtle.wrapKey("raw", aesKey, publicKey, wrapAlgorithm);
+    return crypto.webkitSubtle.wrapKey("raw", aesKey, publicKey, wrapAlgorithm);
 }).then(function(result) {
     wrappedKey = result;
     shouldBe("wrappedKey.toString()", "'[object ArrayBuffer]'");
 
     debug("Unwrapping it...");
-    return crypto.subtle.unwrapKey("raw", wrappedKey, privateKey, wrapAlgorithm, "aes-cbc", extractable, ["encrypt", "decrypt"]);
+    return crypto.webkitSubtle.unwrapKey("raw", wrappedKey, privateKey, wrapAlgorithm, "aes-cbc", extractable, ["encrypt", "decrypt"]);
 }).then(function(result) {
     unwrappedKey = result;
     shouldBe("unwrappedKey.toString()", "'[object CryptoKey]'");
@@ -67,19 +67,19 @@ crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)),
     shouldBe("unwrappedKey.usages", "['decrypt', 'encrypt']");
 
     debug("Exporting it...");
-    return crypto.subtle.exportKey("raw", unwrappedKey);
+    return crypto.webkitSubtle.exportKey("raw", unwrappedKey);
 }).then(function(result) {
     unwrappedKeyData = result;
     shouldBe("bytesToHexString(unwrappedKeyData)", "bytesToHexString(aesKeyData)");
 
     debug("\nWrapping the same key as JWK...");
-    return crypto.subtle.wrapKey("jwk", aesKey, publicKey, wrapAlgorithm);
+    return crypto.webkitSubtle.wrapKey("jwk", aesKey, publicKey, wrapAlgorithm);
 }).then(function(result) {
     wrappedKey = result;
     shouldBe("wrappedKey.toString()", "'[object ArrayBuffer]'");
 
     debug("Unwrapping it...");
-    return crypto.subtle.unwrapKey("jwk", wrappedKey, privateKey, wrapAlgorithm, "aes-cbc", extractable, ["encrypt", "decrypt"]);
+    return crypto.webkitSubtle.unwrapKey("jwk", wrappedKey, privateKey, wrapAlgorithm, "aes-cbc", extractable, ["encrypt", "decrypt"]);
 }).then(function(result) {
     unwrappedKey = result;
     shouldBe("unwrappedKey.toString()", "'[object CryptoKey]'");
@@ -90,7 +90,7 @@ crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)),
     shouldBe("unwrappedKey.usages", "['decrypt', 'encrypt']");
 
     debug("Exporting it...");
-    return crypto.subtle.exportKey("raw", unwrappedKey);
+    return crypto.webkitSubtle.exportKey("raw", unwrappedKey);
 }).then(function(result) {
     unwrappedKeyData = result;
     shouldBe("bytesToHexString(unwrappedKeyData)", "bytesToHexString(aesKeyData)");
@@ -4,7 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 Generating a key pair...
-PASS keyPair.toString() is '[object KeyPair]'
+PASS keyPair.toString() is '[object CryptoKeyPair]'
 PASS keyPair.publicKey.type is 'public'
 PASS keyPair.publicKey.algorithm.name is 'RSASSA-PKCS1-v1_5'
 PASS keyPair.publicKey.algorithm.modulusLength is 2048
@@ -4,7 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 Generating a key pair...
-PASS keyPair.toString() is '[object KeyPair]'
+PASS keyPair.toString() is '[object CryptoKeyPair]'
 PASS keyPair.publicKey.type is 'public'
 PASS keyPair.publicKey.algorithm.name is 'RSASSA-PKCS1-v1_5'
 PASS keyPair.publicKey.algorithm.modulusLength is 2048
@@ -22,9 +22,9 @@ var algorithmKeyGen = {
 var extractable = true;
 
 debug("Generating a key pair...");
-crypto.subtle.generateKey(algorithmKeyGen, extractable, ["sign", "verify"]).then(function(result) {
+crypto.webkitSubtle.generateKey(algorithmKeyGen, extractable, ["sign", "verify"]).then(function(result) {
     keyPair = result;
-    shouldBe("keyPair.toString()", "'[object KeyPair]'");
+    shouldBe("keyPair.toString()", "'[object CryptoKeyPair]'");
     shouldBe("keyPair.publicKey.type", "'public'");
     shouldBe("keyPair.publicKey.algorithm.name", "'RSASSA-PKCS1-v1_5'");
     shouldBe("keyPair.publicKey.algorithm.modulusLength", "2048");
@@ -22,9 +22,9 @@ var algorithmKeyGen = {
 var extractable = true;
 
 debug("Generating a key pair...");
-crypto.subtle.generateKey(algorithmKeyGen, extractable, ["sign", "verify"]).then(function(result) {
+crypto.webkitSubtle.generateKey(algorithmKeyGen, extractable, ["sign", "verify"]).then(function(result) {
     keyPair = result;
-    shouldBe("keyPair.toString()", "'[object KeyPair]'");
+    shouldBe("keyPair.toString()", "'[object CryptoKeyPair]'");
     shouldBe("keyPair.publicKey.type", "'public'");
     shouldBe("keyPair.publicKey.algorithm.name", "'RSASSA-PKCS1-v1_5'");
     shouldBe("keyPair.publicKey.algorithm.modulusLength", "2048");
diff --git a/LayoutTests/crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk-small-key-expected.txt b/LayoutTests/crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk-small-key-expected.txt
new file mode 100644 (file)
index 0000000..3150f97
--- /dev/null
@@ -0,0 +1,11 @@
+A key of size 2048 bits or larger MUST be used with RS256, RS384, RS512 JWK algorithms.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, ["sign", "verify"]) threw exception TypeError: Key size is not valid for RS256.
+PASS crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, ["sign", "verify"]) threw exception TypeError: Key size is not valid for RS512.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
@@ -35,8 +35,8 @@ var privateKeyJSON = {
     qi: Base64URL.stringify(hexStringToUint8Array("D6A920B241178923C59BCBD1A815764619225A90F2C090A9FBD594A61561542D0DF179590413C26C8A72FC6E14EC63A377169970671B3A1EB5E4F4DF1A4CA725"))
 };
 
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, ["sign", "verify"])');
-shouldThrow('crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, ["sign", "verify"])');
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, ["sign", "verify"])');
+shouldThrow('crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, ["sign", "verify"])');
 </script>
 
 <script src="../../resources/js-test-post.js"></script>
@@ -36,7 +36,7 @@ var privateKeyJSON = {
 };
 
 debug("Importing a public key...");
-crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, ["sign", "verify"]).then(function(result) {
+crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, ["sign", "verify"]).then(function(result) {
     publicKey = result;
     shouldBe("publicKey.toString()", "'[object CryptoKey]'");
     shouldBe("publicKey.type", "'public'");
@@ -46,7 +46,7 @@ crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)),
     shouldBe("bytesToHexString(publicKey.algorithm.publicExponent)", "'010001'");
     shouldBe("publicKey.algorithm.hash.name", "'SHA-256'");
     debug("\nImporting a private key...");
-    return crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, ["sign", "verify"]);
+    return crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, ["sign", "verify"]);
 }).then(function(result) {
     privateKey = result;
     shouldBe("privateKey.toString()", "'[object CryptoKey]'");
@@ -38,25 +38,25 @@ var privateKeyJSON = {
 var data = asciiToUint8Array("Hello, world!");
 
 debug("Importing a public key...");
-crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, ["sign", "verify"]).then(function(result) {
+crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, ["sign", "verify"]).then(function(result) {
     publicKey = result;
     debug("\nImporting a private key...");
-    return crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, ["sign", "verify"]);
+    return crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, ["sign", "verify"]);
 }).then(function(result) {
     privateKey = result;
     debug("\nSigning some text...");
-    return crypto.subtle.sign({ name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" }, privateKey, data);
+    return crypto.webkitSubtle.sign({ name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" }, privateKey, data);
 }).then(function(result) {
     signature = result;
     shouldBe("bytesToHexString(new Uint8Array(signature))", "'0fd9a8aef4cc1876c0b762545336c6d1fb315ae16ae4b5e4bf34d384d8585ea7a01e76ea09ee7f7ee8d1c122e7dd15b7c94a573b2aa07203e8d13bc6fd16156cd8e5f0c15a15dccb62d152127fca09882fb53bc3e60ab586d15b95cf411e3aab4a1c231a7e91aab09ee3d4b13d11e97505ddff77683470da510ee76e8bd530c56a85f901626a5a710f716f113dfe9cf6c473ee16fa248aea3480a1033abe30f4c1243289a661e64d7818b55698280688097135968c6d4b029496d85cab2a67e4696737781f70e4392c7df71bbd6c92465947f029a1de48160aced11b5721b1cd25039fe2c16c2b38de73df3b9a83e3ea755fd0cfe51ca06b61fadf6d84677f95'");
 
     debug("\nVerifying the signature...");
-    return crypto.subtle.verify({ name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" }, publicKey, signature, data);
+    return crypto.webkitSubtle.verify({ name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" }, publicKey, signature, data);
 }).then(function(result) {
     verificationResult = result;
     shouldBe("verificationResult", "true");
     debug("\nVerifying a bad signature...");
-    return crypto.subtle.verify({ name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" }, publicKey, new Uint8Array(256), data);
+    return crypto.webkitSubtle.verify({ name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" }, publicKey, new Uint8Array(256), data);
 }).then(function(result) {
     verificationResult = result;
     shouldBe("verificationResult", "false");
@@ -1,4 +1,4 @@
-Test crypto.subtle.digest.
+Test crypto.webkitSubtle.digest.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
@@ -9,7 +9,7 @@ SHA1 of [0x0]
 PASS bytesToHexString(new Uint8Array(digest)) is '5ba93c9db0cff93f52b521d7420e43f6eda2784f'
 SHA1 of [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
 PASS bytesToHexString(new Uint8Array(digest)) is '2c7e7c384f7829694282b1e3a6216def8082d055'
-PASS crypto.subtle.generateKey('sha-1') threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.generateKey('sha-1') threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
 PASS successfullyParsed is true
 
 TEST COMPLETE
similarity index 76%
rename from LayoutTests/crypto/subtle/sha-1.html
rename to LayoutTests/crypto/webkitSubtle/sha-1.html
index 5de7149..d4199a6 100644 (file)
@@ -9,32 +9,32 @@
 <div id="console"></div>
 
 <script>
-description("Test crypto.subtle.digest.");
+description("Test crypto.webkitSubtle.digest.");
 
 jsTestIsAsync = true;
 
 Promise.resolve(null).then(function() {
     debug("SHA1 of []");
-    return crypto.subtle.digest('sha-1', new Uint8Array([]));
+    return crypto.webkitSubtle.digest('sha-1', new Uint8Array([]));
 }).then(function(result) {
     digest = result;
     shouldBe("bytesToHexString(new Uint8Array(digest))", "'da39a3ee5e6b4b0d3255bfef95601890afd80709'");
 
     debug("SHA1 of [0x0]")
-    return crypto.subtle.digest({name: 'sha-1'}, new Uint8Array([0]));
+    return crypto.webkitSubtle.digest({name: 'sha-1'}, new Uint8Array([0]));
 }).then(function(result) {
     digest = result;
     shouldBe("bytesToHexString(new Uint8Array(digest))", "'5ba93c9db0cff93f52b521d7420e43f6eda2784f'");
 
     debug("SHA1 of [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]");
     var data = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
-    return crypto.subtle.digest({name: 'sha-1'}, data);
+    return crypto.webkitSubtle.digest({name: 'sha-1'}, data);
 }).then(function(result) {
     digest = result;
     shouldBe("bytesToHexString(new Uint8Array(digest))", "'2c7e7c384f7829694282b1e3a6216def8082d055'");
 
     // All SHA-1 can do is digest.
-    shouldThrow("crypto.subtle.generateKey('sha-1')");
+    shouldThrow("crypto.webkitSubtle.generateKey('sha-1')");
     finishJSTest();
 });
 </script>
@@ -1,4 +1,4 @@
-Test crypto.subtle.digest.
+Test crypto.webkitSubtle.digest.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
similarity index 80%
rename from LayoutTests/crypto/subtle/sha-224.html
rename to LayoutTests/crypto/webkitSubtle/sha-224.html
index 648d052..b44ec98 100644 (file)
@@ -9,26 +9,26 @@
 <div id="console"></div>
 
 <script>
-description("Test crypto.subtle.digest.");
+description("Test crypto.webkitSubtle.digest.");
 
 jsTestIsAsync = true;
 
 Promise.resolve(null).then(function() {
     debug("SHA224 of []");
-    return crypto.subtle.digest('sha-224', new Uint8Array([]));
+    return crypto.webkitSubtle.digest('sha-224', new Uint8Array([]));
 }).then(function(result) {
     digest = result;
     shouldBe("bytesToHexString(new Uint8Array(digest))", "'d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f'");
 
     debug("SHA224 of [0x0]")
-    return crypto.subtle.digest({name: 'sha-224'}, new Uint8Array([0]));
+    return crypto.webkitSubtle.digest({name: 'sha-224'}, new Uint8Array([0]));
 }).then(function(result) {
     digest = result;
     shouldBe("bytesToHexString(new Uint8Array(digest))", "'fff9292b4201617bdc4d3053fce02734166a683d7d858a7f5f59b073'");
 
     debug("SHA224 of [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]");
     var data = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
-    return crypto.subtle.digest({name: 'sha-224'}, data);
+    return crypto.webkitSubtle.digest({name: 'sha-224'}, data);
 }).then(function(result) {
     digest = result;
     shouldBe("bytesToHexString(new Uint8Array(digest))", "'767d0cdc11079ba8dca276df5c4b85507de67dce47eda4cd9196d312'");
@@ -1,4 +1,4 @@
-Test crypto.subtle.digest.
+Test crypto.webkitSubtle.digest.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
similarity index 80%
rename from LayoutTests/crypto/subtle/sha-256.html
rename to LayoutTests/crypto/webkitSubtle/sha-256.html
index 942abdd..0ea77c4 100644 (file)
@@ -9,26 +9,26 @@
 <div id="console"></div>
 
 <script>
-description("Test crypto.subtle.digest.");
+description("Test crypto.webkitSubtle.digest.");
 
 jsTestIsAsync = true;
 
 Promise.resolve(null).then(function() {
     debug("SHA256 of []");
-    return crypto.subtle.digest('sha-256', new Uint8Array([]));
+    return crypto.webkitSubtle.digest('sha-256', new Uint8Array([]));
 }).then(function(result) {
     digest = result;
     shouldBe("bytesToHexString(new Uint8Array(digest))", "'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'");
 
     debug("SHA256 of [0x0]")
-    return crypto.subtle.digest({name: 'sha-256'}, new Uint8Array([0]));
+    return crypto.webkitSubtle.digest({name: 'sha-256'}, new Uint8Array([0]));
 }).then(function(result) {
     digest = result;
     shouldBe("bytesToHexString(new Uint8Array(digest))", "'6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d'");
 
     debug("SHA256 of [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]");
     var data = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
-    return crypto.subtle.digest({name: 'sha-256'}, data);
+    return crypto.webkitSubtle.digest({name: 'sha-256'}, data);
 }).then(function(result) {
     digest = result;
     shouldBe("bytesToHexString(new Uint8Array(digest))", "'78a6273103d17c39a0b6126e226cec70e33337f4bc6a38067401b54a33e78ead'");
@@ -1,4 +1,4 @@
-Test crypto.subtle.digest.
+Test crypto.webkitSubtle.digest.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
similarity index 81%
rename from LayoutTests/crypto/subtle/sha-384.html
rename to LayoutTests/crypto/webkitSubtle/sha-384.html
index c8ba9ee..f7c168a 100644 (file)
@@ -9,26 +9,26 @@
 <div id="console"></div>
 
 <script>
-description("Test crypto.subtle.digest.");
+description("Test crypto.webkitSubtle.digest.");
 
 jsTestIsAsync = true;
 
 Promise.resolve(null).then(function() {
     debug("SHA384 of []");
-    return crypto.subtle.digest('sha-384', new Uint8Array([]));
+    return crypto.webkitSubtle.digest('sha-384', new Uint8Array([]));
 }).then(function(result) {
     digest = result;
     shouldBe("bytesToHexString(new Uint8Array(digest))", "'38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b'");
 
     debug("SHA384 of [0x0]")
-    return crypto.subtle.digest({name: 'sha-384'}, new Uint8Array([0]));
+    return crypto.webkitSubtle.digest({name: 'sha-384'}, new Uint8Array([0]));
 }).then(function(result) {
     digest = result;
     shouldBe("bytesToHexString(new Uint8Array(digest))", "'bec021b4f368e3069134e012c2b4307083d3a9bdd206e24e5f0d86e13d6636655933ec2b413465966817a9c208a11717'");
 
     debug("SHA384 of [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]");
     var data = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
-    return crypto.subtle.digest({name: 'sha-384'}, data);
+    return crypto.webkitSubtle.digest({name: 'sha-384'}, data);
 }).then(function(result) {
     digest = result;
     shouldBe("bytesToHexString(new Uint8Array(digest))", "'89bfcf569ae4af718510da78c67414109f5739bb5c40d51c9c8c50e2b2cee86f2f80c8b9d68f7c01201a0714572fe602'");
@@ -1,4 +1,4 @@
-Test crypto.subtle.digest.
+Test crypto.webkitSubtle.digest.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
similarity index 83%
rename from LayoutTests/crypto/subtle/sha-512.html
rename to LayoutTests/crypto/webkitSubtle/sha-512.html
index d61963c..58f7b27 100644 (file)
@@ -9,26 +9,26 @@
 <div id="console"></div>
 
 <script>
-description("Test crypto.subtle.digest.");
+description("Test crypto.webkitSubtle.digest.");
 
 jsTestIsAsync = true;
 
 Promise.resolve(null).then(function() {
     debug("SHA512 of []");
-    return crypto.subtle.digest('sha-512', new Uint8Array([]));
+    return crypto.webkitSubtle.digest('sha-512', new Uint8Array([]));
 }).then(function(result) {
     digest = result;
     shouldBe("bytesToHexString(new Uint8Array(digest))", "'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e'");
 
     debug("SHA512 of [0x0]")
-    return crypto.subtle.digest({name: 'sha-512'}, new Uint8Array([0]));
+    return crypto.webkitSubtle.digest({name: 'sha-512'}, new Uint8Array([0]));
 }).then(function(result) {
     digest = result;
     shouldBe("bytesToHexString(new Uint8Array(digest))", "'b8244d028981d693af7b456af8efa4cad63d282e19ff14942c246e50d9351d22704a802a71c3580b6370de4ceb293c324a8423342557d4e5c38438f0e36910ee'");
 
     debug("SHA512 of [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]");
     var data = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
-    return crypto.subtle.digest({name: 'sha-512'}, data);
+    return crypto.webkitSubtle.digest({name: 'sha-512'}, data);
 }).then(function(result) {
     digest = result;
     shouldBe("bytesToHexString(new Uint8Array(digest))", "'8ffaee0cccc162851faf051ae38667eefd423c0164c50055f8ade00afc3705e3cdeb9900004b0e426ca66ab63aa3b99b075273f44fd37c22a3555c6fd1f37ccb'");
@@ -14,9 +14,9 @@ description("Make sure that unwrap does not cause a crash.");
 
 jsTestIsAsync = true;
 
-crypto.subtle.generateKey({name: "AES-KW", length: 256}, false, ["wrapKey"]).then(function(wrappingKey) {
-    return crypto.subtle.generateKey({name: "HMAC", hash: {name: "SHA-256"}}, true, ["sign", "verify"]).then(function(aesKey) {
-        return crypto.subtle.wrapKey("raw", aesKey, wrappingKey, {name: "AES-KW"});
+crypto.webkitSubtle.generateKey({name: "AES-KW", length: 256}, false, ["wrapKey"]).then(function(wrappingKey) {
+    return crypto.webkitSubtle.generateKey({name: "HMAC", hash: {name: "SHA-256"}}, true, ["sign", "verify"]).then(function(aesKey) {
+        return crypto.webkitSubtle.wrapKey("raw", aesKey, wrappingKey, {name: "AES-KW"});
     });
 }).then(finishJSTest, finishJSTest); // OK if the browser does not crash.
 </script>
@@ -8,7 +8,7 @@ Importing RSA keys...
 Importing an AES key...
 Wrapping it...
 Unwrapping it...
-PASS crypto.subtle.unwrapKey("raw", wrappedKey, privateKey, wrapAlgorithm, "aes-cbc", extractable, ["encrypt", "decrypt"]) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.unwrapKey("raw", wrappedKey, privateKey, wrapAlgorithm, "aes-cbc", extractable, ["encrypt", "decrypt"]) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
 PASS successfullyParsed is true
 
 TEST COMPLETE
@@ -37,26 +37,26 @@ var extractable = true;
 var nonExtractable = false;
 
 debug("Importing RSA keys...");
-crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, ["wrapKey"]).then(function(result) {
+crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, ["wrapKey"]).then(function(result) {
     publicKey = result;
-    return crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, ["encrypt", "decrypt", "wrapKey"]);
+    return crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, ["encrypt", "decrypt", "wrapKey"]);
 }).then(function(result) {
     privateKey = result;
 
     debug("Importing an AES key...");
     aesKeyData = hexStringToUint8Array("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4");
-    return crypto.subtle.importKey("raw", aesKeyData, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])
+    return crypto.webkitSubtle.importKey("raw", aesKeyData, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])
 }).then(function(result) {
     aesKey = result;
 
     debug("Wrapping it...");
-    return crypto.subtle.wrapKey("raw", aesKey, publicKey, wrapAlgorithm);
+    return crypto.webkitSubtle.wrapKey("raw", aesKey, publicKey, wrapAlgorithm);
 }).then(function(result) {
     wrappedKey = result;
 
     debug("Unwrapping it...");
     // privateKey lacks unwrapKey usage.
-    shouldThrow('crypto.subtle.unwrapKey("raw", wrappedKey, privateKey, wrapAlgorithm, "aes-cbc", extractable, ["encrypt", "decrypt"])');
+    shouldThrow('crypto.webkitSubtle.unwrapKey("raw", wrappedKey, privateKey, wrapAlgorithm, "aes-cbc", extractable, ["encrypt", "decrypt"])');
 
     finishJSTest();
 });
@@ -7,7 +7,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 Importing an RSA key...
 Importing an AES key...
 Wrapping it...
-PASS crypto.subtle.wrapKey("raw", aesKey, publicKey, wrapAlgorithm) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.webkitSubtle.wrapKey("raw", aesKey, publicKey, wrapAlgorithm) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
 PASS successfullyParsed is true
 
 TEST COMPLETE
@@ -25,18 +25,18 @@ var extractable = true;
 var nonExtractable = false;
 
 debug("Importing an RSA key...");
-crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, ["encrypt", "decrypt", "unwrapKey"]).then(function(result) {
+crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, ["encrypt", "decrypt", "unwrapKey"]).then(function(result) {
     publicKey = result;
 
     debug("Importing an AES key...");
     aesKeyData = hexStringToUint8Array("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4");
-    return crypto.subtle.importKey("raw", aesKeyData, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])
+    return crypto.webkitSubtle.importKey("raw", aesKeyData, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])
 }).then(function(result) {
     aesKey = result;
 
     debug("Wrapping it...");
     // publicKey lacks wrapKey usage.
-    shouldThrow('crypto.subtle.wrapKey("raw", aesKey, publicKey, wrapAlgorithm)');
+    shouldThrow('crypto.webkitSubtle.wrapKey("raw", aesKey, publicKey, wrapAlgorithm)');
     finishJSTest();
 });
 </script>
@@ -2,8 +2,8 @@
 <html>
 <head>
 <meta charset="utf-8">
-<script src="../../resources/js-test-pre.js"></script>
-<script src="../resources/common.js"></script>
+<script src="../../../resources/js-test-pre.js"></script>
+<script src="../../resources/common.js"></script>
 </head>
 <body>
 <script>
@@ -12,7 +12,7 @@ description("Test sending aes crypto keys via postMessage to a worker.");
 
 jsTestIsAsync = true;
 
-crypto.subtle.importKey("raw", asciiToUint8Array("16 bytes of key!"), {name: "aes-cbc", length: 128}, true, ["encrypt", "decrypt"]).then(function(localKey) {
+crypto.webkitSubtle.importKey("raw", asciiToUint8Array("16 bytes of key!"), {name: "aes-cbc", length: 128}, true, ["encrypt", "decrypt"]).then(function(localKey) {
     var worker = new Worker("resources/aes-postMessage-worker.js");
     worker.onmessage = function(evt) {
         if (!evt.data.result) {
@@ -31,6 +31,6 @@ crypto.subtle.importKey("raw", asciiToUint8Array("16 bytes of key!"), {name: "ae
     worker.postMessage(localKey);
 });
 </script>
-<script src="../../resources/js-test-post.js"></script>
+<script src="../../../resources/js-test-post.js"></script>
 </body>
 </html>
diff --git a/LayoutTests/crypto/workers/subtle/gc-worker-expected.txt b/LayoutTests/crypto/workers/subtle/gc-worker-expected.txt
new file mode 100644 (file)
index 0000000..0011a8c
--- /dev/null
@@ -0,0 +1,11 @@
+[Worker] Test that self.crypto.subtle wrapper preserves custom properties.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting worker: resources/gc-worker.js
+PASS [Worker] self.crypto.subtle.foo is "bar"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/crypto/workers/subtle/gc-worker.html b/LayoutTests/crypto/workers/subtle/gc-worker.html
new file mode 100644 (file)
index 0000000..fc3a2b5
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+    <script>
+        worker = startWorker('resources/gc-worker.js');
+    </script>
+    <script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
@@ -2,8 +2,8 @@
 <html>
 <head>
 <meta charset="utf-8">
-<script src="../../resources/js-test-pre.js"></script>
-<script src="../resources/common.js"></script>
+<script src="../../../resources/js-test-pre.js"></script>
+<script src="../../resources/common.js"></script>
 </head>
 <body>
 <script>
@@ -12,7 +12,7 @@ description("Test sending hmac crypto keys via postMessage to a worker.");
 
 jsTestIsAsync = true;
 
-crypto.subtle.importKey("raw", asciiToUint8Array("16 bytes of key!"), {name: 'hmac', hash: {name: 'sha-1'}}, true, ['sign', 'verify']).then(function(localKey) {
+crypto.webkitSubtle.importKey("raw", asciiToUint8Array("16 bytes of key!"), {name: 'hmac', hash: {name: 'sha-1'}}, true, ['sign', 'verify']).then(function(localKey) {
     var worker = new Worker("resources/hmac-postMessage-worker.js");
     worker.onmessage = function(evt) {
         if (!evt.data.result) {
@@ -32,6 +32,6 @@ crypto.subtle.importKey("raw", asciiToUint8Array("16 bytes of key!"), {name: 'hm
     worker.postMessage(localKey);
 });
 </script>
-<script src="../../resources/js-test-post.js"></script>
+<script src="../../../resources/js-test-post.js"></script>
 </body>
 </html>
@@ -2,8 +2,8 @@
 <html>
 <head>
 <meta charset="utf-8">
-<script src="../../resources/js-test-pre.js"></script>
-<script src="../resources/common.js"></script>
+<script src="../../../resources/js-test-pre.js"></script>
+<script src="../../resources/common.js"></script>
 </head>
 <body>
 <script>
@@ -72,13 +72,13 @@ worker.onmessage = function(evt) {
         finishJSTest();
 }
 
-crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), algorithmKeyGen, true, ['encrypt']).then(function(localPublicKey) {
+crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), algorithmKeyGen, true, ['encrypt']).then(function(localPublicKey) {
     worker.postMessage({ publicKey: localPublicKey });
 });
-crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), algorithmKeyGen, false, ['decrypt']).then(function(localPrivateKey) {
+crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), algorithmKeyGen, false, ['decrypt']).then(function(localPrivateKey) {
     worker.postMessage({ privateKey: localPrivateKey });
 });
 </script>
-<script src="../../resources/js-test-post.js"></script>
+<script src="../../../resources/js-test-post.js"></script>
 </body>
 </html>
@@ -2,8 +2,8 @@
 <html>
 <head>
 <meta charset="utf-8">
-<script src="../../resources/js-test-pre.js"></script>
-<script src="../resources/common.js"></script>
+<script src="../../../resources/js-test-pre.js"></script>
+<script src="../../resources/common.js"></script>
 </head>
 <body>
 <script>
@@ -38,10 +38,10 @@ var keyData = asciiToUint8Array("16 bytes of key!");
 var aesKeyGenParams = {name: "aes-cbc", length: 128};
 var usages = ["encrypt", "decrypt"]
 for (i = 0; i < 10; i++)
-    crypto.subtle.importKey(keyFormat, keyData, aesKeyGenParams, true, usages).then(function(localKey) {
+    crypto.webkitSubtle.importKey(keyFormat, keyData, aesKeyGenParams, true, usages).then(function(localKey) {
         worker.postMessage(localKey);
     });
 </script>
-<script src="../../resources/js-test-post.js"></script>
+<script src="../../../resources/js-test-post.js"></script>
 </body>
 </html>
diff --git a/LayoutTests/crypto/workers/subtle/resources/gc-worker.js b/LayoutTests/crypto/workers/subtle/resources/gc-worker.js
new file mode 100644 (file)
index 0000000..fff86ac
--- /dev/null
@@ -0,0 +1,26 @@
+importScripts('../../../../resources/js-test-pre.js');
+
+description("Test that self.crypto.subtle wrapper preserves custom properties.");
+jsTestIsAsync = true;
+
+function startTest()
+{
+    self.crypto.subtle.foo = "bar";
+    gc();
+    setTimeout(continueTest, 10);
+}
+
+function continueTest()
+{
+    gc();
+    setTimeout(finishTest, 10);
+}
+
+function finishTest()
+{
+    gc();
+    shouldBe('self.crypto.subtle.foo', '"bar"');
+    finishJSTest();
+}
+
+startTest();
@@ -2,8 +2,8 @@
 <html>
 <head>
 <meta charset="utf-8">
-<script src="../../resources/js-test-pre.js"></script>
-<script src="../resources/common.js"></script>
+<script src="../../../resources/js-test-pre.js"></script>
+<script src="../../resources/common.js"></script>
 </head>
 <body>
 <script>
@@ -72,13 +72,13 @@ worker.onmessage = function(evt) {
         finishJSTest();
 }
 
-crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), algorithmKeyGen, true, ['encrypt']).then(function(localPublicKey) {
+crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(publicKeyJSON)), algorithmKeyGen, true, ['encrypt']).then(function(localPublicKey) {
     worker.postMessage({ publicKey: localPublicKey });
 });
-crypto.subtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), algorithmKeyGen, false, ['decrypt']).then(function(localPrivateKey) {
+crypto.webkitSubtle.importKey("jwk", asciiToUint8Array(JSON.stringify(privateKeyJSON)), algorithmKeyGen, false, ['decrypt']).then(function(localPrivateKey) {
     worker.postMessage({ privateKey: localPrivateKey });
 });
 </script>
-<script src="../../resources/js-test-post.js"></script>
+<script src="../../../resources/js-test-post.js"></script>
 </body>
 </html>
index 037880c..af78bb3 100644 (file)
@@ -1,3 +1,14 @@
+2016-10-06  Jiewen Tan  <jiewen_tan@apple.com>
+
+        Add a dummy SubtleCrypto interface
+        https://bugs.webkit.org/show_bug.cgi?id=162992
+        <rdar://problem/28643573>
+
+        Reviewed by Brent Fulgham.
+
+        * WebCryptoAPI/digest/test_digest-expected.txt:
+        * WebCryptoAPI/idlharness-expected.txt:
+
 2016-10-06  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed, drop bad tests that were included by mistake in r206874.
index 0b45fc1..5b9b29a 100644 (file)
@@ -1,84 +1,84 @@
 encrypt Tests for digest method
 
 
-FAIL SHA-1 with empty source data undefined is not an object (evaluating 'subtle.digest')
-FAIL sha-1 with empty source data undefined is not an object (evaluating 'subtle.digest')
-FAIL Sha-1 with empty source data undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-1 with empty source data and altered buffer after call undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-256 with empty source data undefined is not an object (evaluating 'subtle.digest')
-FAIL sha-256 with empty source data undefined is not an object (evaluating 'subtle.digest')
-FAIL Sha-256 with empty source data undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-256 with empty source data and altered buffer after call undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-384 with empty source data undefined is not an object (evaluating 'subtle.digest')
-FAIL sha-384 with empty source data undefined is not an object (evaluating 'subtle.digest')
-FAIL Sha-384 with empty source data undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-384 with empty source data and altered buffer after call undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-512 with empty source data undefined is not an object (evaluating 'subtle.digest')
-FAIL sha-512 with empty source data undefined is not an object (evaluating 'subtle.digest')
-FAIL Sha-512 with empty source data undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-512 with empty source data and altered buffer after call undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-1 with short source data undefined is not an object (evaluating 'subtle.digest')
-FAIL sha-1 with short source data undefined is not an object (evaluating 'subtle.digest')
-FAIL Sha-1 with short source data undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-1 with short source data and altered buffer after call undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-256 with short source data undefined is not an object (evaluating 'subtle.digest')
-FAIL sha-256 with short source data undefined is not an object (evaluating 'subtle.digest')
-FAIL Sha-256 with short source data undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-256 with short source data and altered buffer after call undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-384 with short source data undefined is not an object (evaluating 'subtle.digest')
-FAIL sha-384 with short source data undefined is not an object (evaluating 'subtle.digest')
-FAIL Sha-384 with short source data undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-384 with short source data and altered buffer after call undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-512 with short source data undefined is not an object (evaluating 'subtle.digest')
-FAIL sha-512 with short source data undefined is not an object (evaluating 'subtle.digest')
-FAIL Sha-512 with short source data undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-512 with short source data and altered buffer after call undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-1 with medium source data undefined is not an object (evaluating 'subtle.digest')
-FAIL sha-1 with medium source data undefined is not an object (evaluating 'subtle.digest')
-FAIL Sha-1 with medium source data undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-1 with medium source data and altered buffer after call undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-256 with medium source data undefined is not an object (evaluating 'subtle.digest')
-FAIL sha-256 with medium source data undefined is not an object (evaluating 'subtle.digest')
-FAIL Sha-256 with medium source data undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-256 with medium source data and altered buffer after call undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-384 with medium source data undefined is not an object (evaluating 'subtle.digest')
-FAIL sha-384 with medium source data undefined is not an object (evaluating 'subtle.digest')
-FAIL Sha-384 with medium source data undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-384 with medium source data and altered buffer after call undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-512 with medium source data undefined is not an object (evaluating 'subtle.digest')
-FAIL sha-512 with medium source data undefined is not an object (evaluating 'subtle.digest')
-FAIL Sha-512 with medium source data undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-512 with medium source data and altered buffer after call undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-1 with long source data undefined is not an object (evaluating 'subtle.digest')
-FAIL sha-1 with long source data undefined is not an object (evaluating 'subtle.digest')
-FAIL Sha-1 with long source data undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-1 with long source data and altered buffer after call undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-256 with long source data undefined is not an object (evaluating 'subtle.digest')
-FAIL sha-256 with long source data undefined is not an object (evaluating 'subtle.digest')
-FAIL Sha-256 with long source data undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-256 with long source data and altered buffer after call undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-384 with long source data undefined is not an object (evaluating 'subtle.digest')
-FAIL sha-384 with long source data undefined is not an object (evaluating 'subtle.digest')
-FAIL Sha-384 with long source data undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-384 with long source data and altered buffer after call undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-512 with long source data undefined is not an object (evaluating 'subtle.digest')
-FAIL sha-512 with long source data undefined is not an object (evaluating 'subtle.digest')
-FAIL Sha-512 with long source data undefined is not an object (evaluating 'subtle.digest')
-FAIL SHA-512 with long source data and altered buffer after call undefined is not an object (evaluating 'subtle.digest')
-FAIL AES-GCM with empty undefined is not an object (evaluating 'subtle.digest')
-FAIL RSA-OAEP with empty undefined is not an object (evaluating 'subtle.digest')
-FAIL PBKDF2 with empty undefined is not an object (evaluating 'subtle.digest')
-FAIL AES-KW with empty undefined is not an object (evaluating 'subtle.digest')
-FAIL AES-GCM with short undefined is not an object (evaluating 'subtle.digest')
-FAIL RSA-OAEP with short undefined is not an object (evaluating 'subtle.digest')
-FAIL PBKDF2 with short undefined is not an object (evaluating 'subtle.digest')
-FAIL AES-KW with short undefined is not an object (evaluating 'subtle.digest')
-FAIL AES-GCM with medium undefined is not an object (evaluating 'subtle.digest')
-FAIL RSA-OAEP with medium undefined is not an object (evaluating 'subtle.digest')
-FAIL PBKDF2 with medium undefined is not an object (evaluating 'subtle.digest')
-FAIL AES-KW with medium undefined is not an object (evaluating 'subtle.digest')
-FAIL AES-GCM with long undefined is not an object (evaluating 'subtle.digest')
-FAIL RSA-OAEP with long undefined is not an object (evaluating 'subtle.digest')
-FAIL PBKDF2 with long undefined is not an object (evaluating 'subtle.digest')
-FAIL AES-KW with long undefined is not an object (evaluating 'subtle.digest')
+FAIL SHA-1 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL sha-1 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL Sha-1 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL SHA-1 with empty source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
+FAIL SHA-256 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL sha-256 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL Sha-256 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL SHA-256 with empty source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
+FAIL SHA-384 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL sha-384 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL Sha-384 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL SHA-384 with empty source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
+FAIL SHA-512 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL sha-512 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL Sha-512 with empty source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL SHA-512 with empty source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
+FAIL SHA-1 with short source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL sha-1 with short source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL Sha-1 with short source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL SHA-1 with short source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
+FAIL SHA-256 with short source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL sha-256 with short source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL Sha-256 with short source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL SHA-256 with short source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
+FAIL SHA-384 with short source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL sha-384 with short source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL Sha-384 with short source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL SHA-384 with short source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
+FAIL SHA-512 with short source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL sha-512 with short source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL Sha-512 with short source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL SHA-512 with short source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
+FAIL SHA-1 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL sha-1 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL Sha-1 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL SHA-1 with medium source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
+FAIL SHA-256 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL sha-256 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL Sha-256 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL SHA-256 with medium source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
+FAIL SHA-384 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL sha-384 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL Sha-384 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL SHA-384 with medium source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
+FAIL SHA-512 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL sha-512 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL Sha-512 with medium source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL SHA-512 with medium source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
+FAIL SHA-1 with long source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL sha-1 with long source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL Sha-1 with long source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL SHA-1 with long source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
+FAIL SHA-256 with long source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL sha-256 with long source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL Sha-256 with long source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL SHA-256 with long source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
+FAIL SHA-384 with long source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL sha-384 with long source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL Sha-384 with long source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL SHA-384 with long source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
+FAIL SHA-512 with long source data subtle.digest is not a function. (In 'subtle.digest({name: upCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL sha-512 with long source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL Sha-512 with long source data subtle.digest is not a function. (In 'subtle.digest({name: mixedCase}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL SHA-512 with long source data and altered buffer after call subtle.digest is not a function. (In 'subtle.digest({name: upCase}, copiedBuffer)', 'subtle.digest' is undefined)
+FAIL AES-GCM with empty subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL RSA-OAEP with empty subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL PBKDF2 with empty subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL AES-KW with empty subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL AES-GCM with short subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL RSA-OAEP with short subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL PBKDF2 with short subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL AES-KW with short subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL AES-GCM with medium subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL RSA-OAEP with medium subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL PBKDF2 with medium subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL AES-KW with medium subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL AES-GCM with long subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL RSA-OAEP with long subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL PBKDF2 with long subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
+FAIL AES-KW with long subtle.digest is not a function. (In 'subtle.digest({name: badName}, sourceData[size])', 'subtle.digest' is undefined)
 
index d1479ab..b4d0f9b 100644 (file)
@@ -8,11 +8,11 @@ PASS Crypto interface object length
 PASS Crypto interface object name 
 PASS Crypto interface: existence and properties of interface prototype object 
 PASS Crypto interface: existence and properties of interface prototype object's "constructor" property 
-FAIL Crypto interface: attribute subtle assert_true: The prototype object must have a property "subtle" expected true got false
+PASS Crypto interface: attribute subtle 
 PASS Crypto interface: operation getRandomValues(ArrayBufferView) 
 PASS Crypto must be primary interface of crypto 
 PASS Stringification of crypto 
-FAIL Crypto interface: crypto must inherit property "subtle" with the proper type (0) assert_inherits: property "subtle" not found in prototype chain
+PASS Crypto interface: crypto must inherit property "subtle" with the proper type (0) 
 PASS Crypto interface: crypto must inherit property "getRandomValues" with the proper type (1) 
 PASS Crypto interface: calling getRandomValues(ArrayBufferView) on crypto with too few arguments must throw TypeError 
 PASS CryptoKey interface: existence and properties of interface object 
@@ -41,30 +41,30 @@ FAIL SubtleCrypto interface: operation importKey(KeyFormat,[object Object],[obje
 FAIL SubtleCrypto interface: operation exportKey(KeyFormat,CryptoKey) assert_own_property: self does not have own property "SubtleCrypto" expected property "SubtleCrypto" missing
 FAIL SubtleCrypto interface: operation wrapKey(KeyFormat,CryptoKey,CryptoKey,AlgorithmIdentifier) assert_own_property: self does not have own property "SubtleCrypto" expected property "SubtleCrypto" missing
 FAIL SubtleCrypto interface: operation unwrapKey(KeyFormat,BufferSource,CryptoKey,AlgorithmIdentifier,AlgorithmIdentifier,boolean,[object Object]) assert_own_property: self does not have own property "SubtleCrypto" expected property "SubtleCrypto" missing
-FAIL SubtleCrypto must be primary interface of crypto.subtle assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL Stringification of crypto.subtle assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: crypto.subtle must inherit property "encrypt" with the proper type (0) assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: calling encrypt(AlgorithmIdentifier,CryptoKey,BufferSource) on crypto.subtle with too few arguments must throw TypeError assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: crypto.subtle must inherit property "decrypt" with the proper type (1) assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: calling decrypt(AlgorithmIdentifier,CryptoKey,BufferSource) on crypto.subtle with too few arguments must throw TypeError assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: crypto.subtle must inherit property "sign" with the proper type (2) assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: calling sign(AlgorithmIdentifier,CryptoKey,BufferSource) on crypto.subtle with too few arguments must throw TypeError assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: crypto.subtle must inherit property "verify" with the proper type (3) assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: calling verify(AlgorithmIdentifier,CryptoKey,BufferSource,BufferSource) on crypto.subtle with too few arguments must throw TypeError assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: crypto.subtle must inherit property "digest" with the proper type (4) assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: calling digest(AlgorithmIdentifier,BufferSource) on crypto.subtle with too few arguments must throw TypeError assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: crypto.subtle must inherit property "generateKey" with the proper type (5) assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: calling generateKey(AlgorithmIdentifier,boolean,[object Object]) on crypto.subtle with too few arguments must throw TypeError assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: crypto.subtle must inherit property "deriveKey" with the proper type (6) assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: calling deriveKey(AlgorithmIdentifier,CryptoKey,AlgorithmIdentifier,boolean,[object Object]) on crypto.subtle with too few arguments must throw TypeError assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: crypto.subtle must inherit property "deriveBits" with the proper type (7) assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: calling deriveBits(AlgorithmIdentifier,CryptoKey,unsigned long) on crypto.subtle with too few arguments must throw TypeError assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: crypto.subtle must inherit property "importKey" with the proper type (8) assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: calling importKey(KeyFormat,[object Object],[object Object],AlgorithmIdentifier,boolean,[object Object]) on crypto.subtle with too few arguments must throw TypeError assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: crypto.subtle must inherit property "exportKey" with the proper type (9) assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: calling exportKey(KeyFormat,CryptoKey) on crypto.subtle with too few arguments must throw TypeError assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: crypto.subtle must inherit property "wrapKey" with the proper type (10) assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: calling wrapKey(KeyFormat,CryptoKey,CryptoKey,AlgorithmIdentifier) on crypto.subtle with too few arguments must throw TypeError assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: crypto.subtle must inherit property "unwrapKey" with the proper type (11) assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL SubtleCrypto interface: calling unwrapKey(KeyFormat,BufferSource,CryptoKey,AlgorithmIdentifier,AlgorithmIdentifier,boolean,[object Object]) on crypto.subtle with too few arguments must throw TypeError assert_equals: wrong typeof object expected "object" but got "undefined"
+FAIL SubtleCrypto must be primary interface of crypto.subtle assert_own_property: self does not have own property "SubtleCrypto" expected property "SubtleCrypto" missing
+PASS Stringification of crypto.subtle 
+FAIL SubtleCrypto interface: crypto.subtle must inherit property "encrypt" with the proper type (0) assert_inherits: property "encrypt" not found in prototype chain
+FAIL SubtleCrypto interface: calling encrypt(AlgorithmIdentifier,CryptoKey,BufferSource) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "encrypt" not found in prototype chain
+FAIL SubtleCrypto interface: crypto.subtle must inherit property "decrypt" with the proper type (1) assert_inherits: property "decrypt" not found in prototype chain
+FAIL SubtleCrypto interface: calling decrypt(AlgorithmIdentifier,CryptoKey,BufferSource) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "decrypt" not found in prototype chain
+FAIL SubtleCrypto interface: crypto.subtle must inherit property "sign" with the proper type (2) assert_inherits: property "sign" not found in prototype chain
+FAIL SubtleCrypto interface: calling sign(AlgorithmIdentifier,CryptoKey,BufferSource) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "sign" not found in prototype chain
+FAIL SubtleCrypto interface: crypto.subtle must inherit property "verify" with the proper type (3) assert_inherits: property "verify" not found in prototype chain
+FAIL SubtleCrypto interface: calling verify(AlgorithmIdentifier,CryptoKey,BufferSource,BufferSource) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "verify" not found in prototype chain
+FAIL SubtleCrypto interface: crypto.subtle must inherit property "digest" with the proper type (4) assert_inherits: property "digest" not found in prototype chain
+FAIL SubtleCrypto interface: calling digest(AlgorithmIdentifier,BufferSource) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "digest" not found in prototype chain
+FAIL SubtleCrypto interface: crypto.subtle must inherit property "generateKey" with the proper type (5) assert_inherits: property "generateKey" not found in prototype chain
+FAIL SubtleCrypto interface: calling generateKey(AlgorithmIdentifier,boolean,[object Object]) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "generateKey" not found in prototype chain
+FAIL SubtleCrypto interface: crypto.subtle must inherit property "deriveKey" with the proper type (6) assert_inherits: property "deriveKey" not found in prototype chain
+FAIL SubtleCrypto interface: calling deriveKey(AlgorithmIdentifier,CryptoKey,AlgorithmIdentifier,boolean,[object Object]) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "deriveKey" not found in prototype chain
+FAIL SubtleCrypto interface: crypto.subtle must inherit property "deriveBits" with the proper type (7) assert_inherits: property "deriveBits" not found in prototype chain
+FAIL SubtleCrypto interface: calling deriveBits(AlgorithmIdentifier,CryptoKey,unsigned long) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "deriveBits" not found in prototype chain
+FAIL SubtleCrypto interface: crypto.subtle must inherit property "importKey" with the proper type (8) assert_inherits: property "importKey" not found in prototype chain
+FAIL SubtleCrypto interface: calling importKey(KeyFormat,[object Object],[object Object],AlgorithmIdentifier,boolean,[object Object]) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "importKey" not found in prototype chain
+FAIL SubtleCrypto interface: crypto.subtle must inherit property "exportKey" with the proper type (9) assert_inherits: property "exportKey" not found in prototype chain
+FAIL SubtleCrypto interface: calling exportKey(KeyFormat,CryptoKey) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "exportKey" not found in prototype chain
+FAIL SubtleCrypto interface: crypto.subtle must inherit property "wrapKey" with the proper type (10) assert_inherits: property "wrapKey" not found in prototype chain
+FAIL SubtleCrypto interface: calling wrapKey(KeyFormat,CryptoKey,CryptoKey,AlgorithmIdentifier) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "wrapKey" not found in prototype chain
+FAIL SubtleCrypto interface: crypto.subtle must inherit property "unwrapKey" with the proper type (11) assert_inherits: property "unwrapKey" not found in prototype chain
+FAIL SubtleCrypto interface: calling unwrapKey(KeyFormat,BufferSource,CryptoKey,AlgorithmIdentifier,AlgorithmIdentifier,boolean,[object Object]) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "unwrapKey" not found in prototype chain
 
index 7ccc82d..79bcab7 100644 (file)
@@ -375,7 +375,7 @@ storage/indexeddb/unprefix-workers.html [ Skip ]
 http/tests/security/cross-origin-worker-indexeddb-allowed.html [ Skip ]
 http/tests/security/cross-origin-worker-indexeddb.html [ Skip ]
 
-webkit.org/b/87661 crypto/subtle/rsa-indexeddb.html [ Skip ]
+webkit.org/b/87661 crypto/webkitSubtle/rsa-indexeddb.html [ Skip ]
 storage/indexeddb/database-odd-names.html [ Skip ]
 
 # EFL port has not supported selection gap painting since r200412
@@ -1957,17 +1957,17 @@ webkit.org/b/119782 fast/forms/search-styled.html [ Failure ]
 # and their tests are whitelisted
 webkit.org/b/133122 crypto/subtle [ Skip ]
 webkit.org/b/133122 crypto/webkitSubtle [ Skip ]
-webkit.org/b/133319 crypto/subtle/sha-1.html [ Pass ]
-webkit.org/b/133319 crypto/subtle/sha-224.html [ Pass ]
-webkit.org/b/133319 crypto/subtle/sha-256.html [ Pass ]
-webkit.org/b/133319 crypto/subtle/sha-384.html [ Pass ]
-webkit.org/b/133319 crypto/subtle/sha-512.html [ Pass ]
-webkit.org/b/133320 crypto/subtle/hmac-check-algorithm.html [ Pass ]
-webkit.org/b/133320 crypto/subtle/hmac-export-key.html [ Pass ]
-webkit.org/b/133320 crypto/subtle/hmac-generate-key.html [ Pass ]
-webkit.org/b/133320 crypto/subtle/hmac-import-jwk.html [ Pass ]
-webkit.org/b/133320 crypto/subtle/hmac-sign-verify-empty-key.html [ Pass ]
-webkit.org/b/133320 crypto/subtle/hmac-sign-verify.html [ Pass ]
+webkit.org/b/133319 crypto/webkitSubtle/sha-1.html [ Pass ]
+webkit.org/b/133319 crypto/webkitSubtle/sha-224.html [ Pass ]
+webkit.org/b/133319 crypto/webkitSubtle/sha-256.html [ Pass ]
+webkit.org/b/133319 crypto/webkitSubtle/sha-384.html [ Pass ]
+webkit.org/b/133319 crypto/webkitSubtle/sha-512.html [ Pass ]
+webkit.org/b/133320 crypto/webkitSubtle/hmac-check-algorithm.html [ Pass ]
+webkit.org/b/133320 crypto/webkitSubtle/hmac-export-key.html [ Pass ]
+webkit.org/b/133320 crypto/webkitSubtle/hmac-generate-key.html [ Pass ]
+webkit.org/b/133320 crypto/webkitSubtle/hmac-import-jwk.html [ Pass ]
+webkit.org/b/133320 crypto/webkitSubtle/hmac-sign-verify-empty-key.html [ Pass ]
+webkit.org/b/133320 crypto/webkitSubtle/hmac-sign-verify.html [ Pass ]
 
 # Missing EFL's accessibility functions
 webkit.org/b/111984 accessibility/aria-hidden-updates-alldescendants.html [ Failure ]
index 41ead28..78872e5 100644 (file)
@@ -377,17 +377,17 @@ Bug(GTK) editing/secure-input [ Failure ]
 # and their tests are whitelisted
 webkit.org/b/133122 crypto/subtle [ Skip ]
 webkit.org/b/133122 crypto/webkitSubtle [ Skip ]
-webkit.org/b/133319 crypto/subtle/sha-1.html [ Pass ]
-webkit.org/b/133319 crypto/subtle/sha-224.html [ Pass ]
-webkit.org/b/133319 crypto/subtle/sha-256.html [ Pass ]
-webkit.org/b/133319 crypto/subtle/sha-384.html [ Pass ]
-webkit.org/b/133319 crypto/subtle/sha-512.html [ Pass ]
-webkit.org/b/133320 crypto/subtle/hmac-check-algorithm.html [ Pass ]
-webkit.org/b/133320 crypto/subtle/hmac-export-key.html [ Pass ]
-webkit.org/b/133320 crypto/subtle/hmac-generate-key.html [ Pass ]
-webkit.org/b/133320 crypto/subtle/hmac-import-jwk.html [ Pass ]
-webkit.org/b/133320 crypto/subtle/hmac-sign-verify-empty-key.html [ Pass ]
-webkit.org/b/133320 crypto/subtle/hmac-sign-verify.html [ Pass ]
+webkit.org/b/133319 crypto/webkitSubtle/sha-1.html [ Pass ]
+webkit.org/b/133319 crypto/webkitSubtle/sha-224.html [ Pass ]
+webkit.org/b/133319 crypto/webkitSubtle/sha-256.html [ Pass ]
+webkit.org/b/133319 crypto/webkitSubtle/sha-384.html [ Pass ]
+webkit.org/b/133319 crypto/webkitSubtle/sha-512.html [ Pass ]
+webkit.org/b/133320 crypto/webkitSubtle/hmac-check-algorithm.html [ Pass ]
+webkit.org/b/133320 crypto/webkitSubtle/hmac-export-key.html [ Pass ]
+webkit.org/b/133320 crypto/webkitSubtle/hmac-generate-key.html [ Pass ]
+webkit.org/b/133320 crypto/webkitSubtle/hmac-import-jwk.html [ Pass ]
+webkit.org/b/133320 crypto/webkitSubtle/hmac-sign-verify-empty-key.html [ Pass ]
+webkit.org/b/133320 crypto/webkitSubtle/hmac-sign-verify.html [ Pass ]
 
 # GTK does not implement setAutomaticLinkDetectionEnabled
 editing/inserting/typing-space-to-trigger-smart-link.html [ Skip ]
@@ -2261,7 +2261,7 @@ webkit.org/b/107825 media/audio-delete-while-step-button-clicked.html [ Failure
 webkit.org/b/107825 media/nodesFromRect-shadowContent.html [ Failure ]
 webkit.org/b/107825 media/video-controls-fullscreen-volume.html [ Failure ]
 
-webkit.org/b/107194 crypto/subtle/rsa-indexeddb.html [ Skip ]
+webkit.org/b/107194 crypto/webkitSubtle/rsa-indexeddb.html [ Skip ]
 
 # Test marked in TestExpectations as failing on non-retina displays, passing on GTK port
 webkit.org/b/129113 fast/multicol/newmulticol/clipping.html [ Pass ]
index 2cf950b..b2bb9ac 100644 (file)
@@ -996,10 +996,10 @@ animations/trigger-container-scroll-empty.html [ Failure ]
 storage/indexeddb
 imported/w3c/IndexedDB-private-browsing
 imported/w3c/web-platform-tests/IndexedDB
-crypto/subtle/rsa-indexeddb-non-exportable-private.html
-crypto/subtle/rsa-indexeddb-non-exportable.html
-crypto/subtle/rsa-indexeddb-private.html
-crypto/subtle/rsa-indexeddb.html
+crypto/webkitSubtle/rsa-indexeddb-non-exportable-private.html
+crypto/webkitSubtle/rsa-indexeddb-non-exportable.html
+crypto/webkitSubtle/rsa-indexeddb-private.html
+crypto/webkitSubtle/rsa-indexeddb.html
 fast/history/page-cache-indexed-closed-db.html
 fast/history/page-cache-indexed-opened-db.html
 
index 9c7c905..8b75b7d 100644 (file)
@@ -257,10 +257,10 @@ http/tests/security/cross-origin-indexeddb.html [ Skip ]
 http/tests/security/cross-origin-worker-indexeddb-allowed.html [ Skip ]
 http/tests/security/cross-origin-worker-indexeddb.html [ Skip ]
 http/tests/security/no-indexeddb-from-sandbox.html [ Skip ]
-crypto/subtle/rsa-indexeddb-non-exportable-private.html [ Skip ]
-crypto/subtle/rsa-indexeddb-non-exportable.html [ Skip ]
-crypto/subtle/rsa-indexeddb-private.html [ Skip ]
-crypto/subtle/rsa-indexeddb.html [ Skip ]
+crypto/webkitSubtle/rsa-indexeddb-non-exportable-private.html [ Skip ]
+crypto/webkitSubtle/rsa-indexeddb-non-exportable.html [ Skip ]
+crypto/webkitSubtle/rsa-indexeddb-private.html [ Skip ]
+crypto/webkitSubtle/rsa-indexeddb.html [ Skip ]
 fast/history/page-cache-indexed-closed-db.html [ Skip ]
 fast/history/page-cache-indexed-opened-db.html [ Skip ]
 
index 59f89ac..1c47cf7 100644 (file)
@@ -327,6 +327,7 @@ set(WebCore_NON_SVG_IDL_FILES
 
     crypto/CryptoKey.idl
     crypto/CryptoKeyPair.idl
+    crypto/SubtleCrypto.idl
     crypto/WebKitSubtleCrypto.idl
 
     css/CSSCharsetRule.idl
index e07e9fb..ea7b591 100644 (file)
@@ -1,3 +1,99 @@
+2016-10-06  Jiewen Tan  <jiewen_tan@apple.com>
+
+        Add a dummy SubtleCrypto interface
+        https://bugs.webkit.org/show_bug.cgi?id=162992
+        <rdar://problem/28643573>
+
+        Reviewed by Brent Fulgham.
+
+        Add a dummy SubtleCrypto interface and rename KeyPair to CryptoKeyPair.
+
+        Tests: crypto/subtle/gc-2.html
+               crypto/subtle/gc-3.html
+               crypto/subtle/gc.html
+               crypto/webkitSubtle/aes-cbc-192-encrypt-decrypt.html
+               crypto/webkitSubtle/aes-cbc-256-encrypt-decrypt.html
+               crypto/webkitSubtle/aes-cbc-encrypt-decrypt-with-padding.html
+               crypto/webkitSubtle/aes-cbc-encrypt-decrypt.html
+               crypto/webkitSubtle/aes-cbc-generate-key.html
+               crypto/webkitSubtle/aes-cbc-import-jwk.html
+               crypto/webkitSubtle/aes-cbc-invalid-length.html
+               crypto/webkitSubtle/aes-cbc-unwrap-failure.html
+               crypto/webkitSubtle/aes-cbc-unwrap-rsa.html
+               crypto/webkitSubtle/aes-cbc-wrap-rsa-non-extractable.html
+               crypto/webkitSubtle/aes-cbc-wrap-rsa.html
+               crypto/webkitSubtle/aes-cbc-wrong-key-class.html
+               crypto/webkitSubtle/aes-export-key.html
+               crypto/webkitSubtle/aes-kw-key-manipulation.html
+               crypto/webkitSubtle/aes-kw-wrap-unwrap-aes.html
+               crypto/webkitSubtle/aes-postMessage.html
+               crypto/webkitSubtle/argument-conversion.html
+               crypto/webkitSubtle/array-buffer-view-offset.html
+               crypto/webkitSubtle/crypto-key-algorithm-gc.html
+               crypto/webkitSubtle/crypto-key-usages-gc.html
+               crypto/webkitSubtle/hmac-check-algorithm.html
+               crypto/webkitSubtle/hmac-export-key.html
+               crypto/webkitSubtle/hmac-generate-key.html
+               crypto/webkitSubtle/hmac-import-jwk.html
+               crypto/webkitSubtle/hmac-postMessage.html
+               crypto/webkitSubtle/hmac-sign-verify-empty-key.html
+               crypto/webkitSubtle/hmac-sign-verify.html
+               crypto/webkitSubtle/import-jwk.html
+               crypto/webkitSubtle/jwk-export-use-values.html
+               crypto/webkitSubtle/jwk-import-use-values.html
+               crypto/webkitSubtle/rsa-export-generated-keys.html
+               crypto/webkitSubtle/rsa-export-key.html
+               crypto/webkitSubtle/rsa-export-private-key.html
+               crypto/webkitSubtle/rsa-indexeddb-non-exportable-private.html
+               crypto/webkitSubtle/rsa-indexeddb-non-exportable.html
+               crypto/webkitSubtle/rsa-indexeddb-private.html
+               crypto/webkitSubtle/rsa-indexeddb.html
+               crypto/webkitSubtle/rsa-oaep-generate-non-extractable-key.html
+               crypto/webkitSubtle/rsa-oaep-key-manipulation.html
+               crypto/webkitSubtle/rsa-oaep-plaintext-length.html
+               crypto/webkitSubtle/rsa-oaep-wrap-unwrap-aes.html
+               crypto/webkitSubtle/rsa-postMessage.html
+               crypto/webkitSubtle/rsaes-pkcs1-v1_5-decrypt.html
+               crypto/webkitSubtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes.html
+               crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html
+               crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key.html
+               crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk-small-key.html
+               crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk.html
+               crypto/webkitSubtle/rsassa-pkcs1-v1_5-sign-verify.html
+               crypto/webkitSubtle/sha-1.html
+               crypto/webkitSubtle/sha-224.html
+               crypto/webkitSubtle/sha-256.html
+               crypto/webkitSubtle/sha-384.html
+               crypto/webkitSubtle/sha-512.html
+               crypto/webkitSubtle/unimplemented-unwrap-crash.html
+               crypto/webkitSubtle/unwrapKey-check-usage.html
+               crypto/webkitSubtle/wrapKey-check-usage.html
+               crypto/workers/subtle/aes-postMessage-worker.html
+               crypto/workers/subtle/gc-worker.html
+               crypto/workers/subtle/hmac-postMessage-worker.html
+               crypto/workers/subtle/hrsa-postMessage-worker.html
+               crypto/workers/subtle/multiple-postMessage-worker.html
+               crypto/workers/subtle/rsa-postMessage-worker.html
+
+        * CMakeLists.txt:
+        * DerivedSources.cpp:
+        * DerivedSources.make:
+        * PlatformEfl.cmake:
+        * PlatformGTK.cmake:
+        * PlatformMac.cmake:
+        * WebCore.xcodeproj/project.pbxproj:
+        * crypto/CryptoKeyPair.idl:
+        * crypto/SubtleCrypto.cpp:
+        (WebCore::SubtleCrypto::SubtleCrypto):
+        * crypto/SubtleCrypto.h:
+        (WebCore::SubtleCrypto::create):
+        * crypto/SubtleCrypto.idl: Added.
+        * page/Crypto.cpp:
+        (WebCore::Crypto::Crypto):
+        (WebCore::Crypto::subtle):
+        * page/Crypto.h:
+        * page/Crypto.idl:
+
 2016-10-06  Anders Carlsson  <andersca@apple.com>
 
         Crash when ApplePaySession.completeMerchantValidation is not passed a dictionary
index b75c557..bfbd690 100644 (file)
 #include "JSStyleMedia.cpp"
 #include "JSStyleSheet.cpp"
 #include "JSStyleSheetList.cpp"
+#include "JSSubtleCrypto.cpp"
 #include "JSText.cpp"
 #include "JSTextEvent.cpp"
 #include "JSTextMetrics.cpp"
index e59d31a..3d1d4d1 100644 (file)
@@ -238,6 +238,7 @@ JS_BINDING_IDLS = \
     $(WebCore)/animation/WebAnimation.idl \
     $(WebCore)/crypto/CryptoKey.idl \
     $(WebCore)/crypto/CryptoKeyPair.idl \
+    $(WebCore)/crypto/SubtleCrypto.idl \
     $(WebCore)/crypto/WebKitSubtleCrypto.idl \
     $(WebCore)/css/CSSCharsetRule.idl \
     $(WebCore)/css/CSSFontFaceLoadEvent.idl \
index 7e99a49..a56ee47 100644 (file)
@@ -407,6 +407,7 @@ if (ENABLE_SUBTLE_CRYPTO)
         crypto/CryptoAlgorithmRegistry.cpp
         crypto/CryptoKey.cpp
         crypto/CryptoKeyPair.cpp
+        crypto/SubtleCrypto.cpp
         crypto/WebKitSubtleCrypto.cpp
 
         crypto/algorithms/CryptoAlgorithmAES_CBC.cpp
index ad27e56..9125390 100644 (file)
@@ -400,6 +400,7 @@ if (ENABLE_SUBTLE_CRYPTO)
         crypto/CryptoAlgorithmRegistry.cpp
         crypto/CryptoKey.cpp
         crypto/CryptoKeyPair.cpp
+        crypto/SubtleCrypto.cpp
         crypto/WebKitSubtleCrypto.cpp
 
         crypto/algorithms/CryptoAlgorithmAES_CBC.cpp
index b7079b7..1ee6eef 100644 (file)
@@ -180,6 +180,7 @@ list(APPEND WebCore_SOURCES
     crypto/CryptoAlgorithmRegistry.cpp
     crypto/CryptoKey.cpp
     crypto/CryptoKeyPair.cpp
+    crypto/SubtleCrypto.cpp
     crypto/WebKitSubtleCrypto.cpp
 
     crypto/algorithms/CryptoAlgorithmAES_CBC.cpp
index c11c8c6..b49eef4 100644 (file)
                5709E8CF1D413D9A003244AC /* WebKitSubtleCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 5709E8CB1D413CE3003244AC /* WebKitSubtleCrypto.h */; };
                570A99DA1D417408004EC630 /* JSWebKitSubtleCrypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FF8F62180745D800132674 /* JSWebKitSubtleCrypto.cpp */; };
                570A99DB1D41A2F3004EC630 /* JSWebKitSubtleCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = E1FF8F63180745D800132674 /* JSWebKitSubtleCrypto.h */; };
+               571F21891DA57C54005C9EFD /* JSSubtleCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 571F21881DA57C54005C9EFD /* JSSubtleCrypto.h */; };
+               571F218B1DA57C7B005C9EFD /* JSSubtleCrypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 571F218A1DA57C7A005C9EFD /* JSSubtleCrypto.cpp */; };
                572A7F211C6E5719009C6149 /* SimulatedClick.h in Headers */ = {isa = PBXBuildFile; fileRef = 572A7F201C6E5719009C6149 /* SimulatedClick.h */; };
                572A7F231C6E5A66009C6149 /* SimulatedClick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 572A7F221C6E5A66009C6149 /* SimulatedClick.cpp */; };
+               5778BD821DA4806C009E3009 /* SubtleCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 5778BD811DA4802C009E3009 /* SubtleCrypto.h */; };
+               5778BD841DA4817B009E3009 /* SubtleCrypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5778BD831DA4817B009E3009 /* SubtleCrypto.cpp */; };
                57EF5E601D20C83900171E60 /* TextCodecReplacement.h in Headers */ = {isa = PBXBuildFile; fileRef = 57EF5E5F1D20C83900171E60 /* TextCodecReplacement.h */; };
                57EF5E621D20D28700171E60 /* TextCodecReplacement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57EF5E611D20D28700171E60 /* TextCodecReplacement.cpp */; };
                580371611A66F00A00BAF519 /* ClipRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5803715F1A66F00A00BAF519 /* ClipRect.cpp */; };
                5709E8CA1D413CE3003244AC /* WebKitSubtleCrypto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitSubtleCrypto.cpp; sourceTree = "<group>"; };
                5709E8CB1D413CE3003244AC /* WebKitSubtleCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitSubtleCrypto.h; sourceTree = "<group>"; };
                5709E8CC1D413CE3003244AC /* WebKitSubtleCrypto.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitSubtleCrypto.idl; sourceTree = "<group>"; };
+               571F21881DA57C54005C9EFD /* JSSubtleCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSubtleCrypto.h; sourceTree = "<group>"; };
+               571F218A1DA57C7A005C9EFD /* JSSubtleCrypto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSubtleCrypto.cpp; sourceTree = "<group>"; };
                572A7F201C6E5719009C6149 /* SimulatedClick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimulatedClick.h; sourceTree = "<group>"; };
                572A7F221C6E5A66009C6149 /* SimulatedClick.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimulatedClick.cpp; sourceTree = "<group>"; };
                574D42791D594FF6002CF50E /* GlobalCrypto.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GlobalCrypto.idl; sourceTree = "<group>"; };
+               5778BD801DA4733E009E3009 /* SubtleCrypto.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SubtleCrypto.idl; sourceTree = "<group>"; };
+               5778BD811DA4802C009E3009 /* SubtleCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubtleCrypto.h; sourceTree = "<group>"; };
+               5778BD831DA4817B009E3009 /* SubtleCrypto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubtleCrypto.cpp; sourceTree = "<group>"; };
                57EF5E5F1D20C83900171E60 /* TextCodecReplacement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCodecReplacement.h; sourceTree = "<group>"; };
                57EF5E611D20D28700171E60 /* TextCodecReplacement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextCodecReplacement.cpp; sourceTree = "<group>"; };
                5803715F1A66F00A00BAF519 /* ClipRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClipRect.cpp; sourceTree = "<group>"; };
                                E19727151820549E00592D51 /* CryptoKeyType.h */,
                                E172AF6F180F289500FBADB9 /* CryptoKeyUsage.h */,
                                E18DF33418AAF12C00773E59 /* SerializedCryptoKeyWrap.h */,
+                               5778BD811DA4802C009E3009 /* SubtleCrypto.h */,
+                               5778BD831DA4817B009E3009 /* SubtleCrypto.cpp */,
+                               5778BD801DA4733E009E3009 /* SubtleCrypto.idl */,
                                5709E8CA1D413CE3003244AC /* WebKitSubtleCrypto.cpp */,
                                5709E8CB1D413CE3003244AC /* WebKitSubtleCrypto.h */,
                                5709E8CC1D413CE3003244AC /* WebKitSubtleCrypto.idl */,
                                E157A8DF1817331C009F821D /* JSCryptoKey.h */,
                                E1F80B8B183172B5007885C3 /* JSCryptoKeyPair.cpp */,
                                E1F80B8C183172B5007885C3 /* JSCryptoKeyPair.h */,
+                               571F218A1DA57C7A005C9EFD /* JSSubtleCrypto.cpp */,
+                               571F21881DA57C54005C9EFD /* JSSubtleCrypto.h */,
                                E1FF8F62180745D800132674 /* JSWebKitSubtleCrypto.cpp */,
                                E1FF8F63180745D800132674 /* JSWebKitSubtleCrypto.h */,
                        );
                                84730D891248F0B300D3A9C9 /* FESpecularLighting.h in Headers */,
                                416E6FE81BBD12DF000A6023 /* FetchInternalsBuiltins.h in Headers */,
                                41AD753A1CEF6BD100A31486 /* FetchOptions.h in Headers */,
+                               5778BD821DA4806C009E3009 /* SubtleCrypto.h in Headers */,
                                84730D8B1248F0B300D3A9C9 /* FETile.h in Headers */,
                                84730D8D1248F0B300D3A9C9 /* FETurbulence.h in Headers */,
                                FD31609512B026F700C1A359 /* FFTConvolver.h in Headers */,
                                E446143C0CD689CC00FADA75 /* JSHTMLSourceElement.h in Headers */,
                                9752D38E1413104B003305BD /* JSHTMLSpanElement.h in Headers */,
                                A80E7B0E0A19D606007FB8C5 /* JSHTMLStyleElement.h in Headers */,
+                               571F21891DA57C54005C9EFD /* JSSubtleCrypto.h in Headers */,
                                BCA169A30BFD55B40019CA76 /* JSHTMLTableCaptionElement.h in Headers */,
                                BC06EDE40BFD6D0D00856E9D /* JSHTMLTableCellElement.h in Headers */,
                                BC06ED9E0BFD660600856E9D /* JSHTMLTableColElement.h in Headers */,
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               571F218B1DA57C7B005C9EFD /* JSSubtleCrypto.cpp in Sources */,
                                41E1B1D00FF5986900576B3B /* AbstractWorker.cpp in Sources */,
                                37F57AB91A50726900876F98 /* AccessibilityARIAGrid.cpp in Sources */,
                                37F57ABA1A50726F00876F98 /* AccessibilityARIAGridCell.cpp in Sources */,
                                442ABCD617D9262F00D30715 /* SynchronousLoaderClientCFNet.cpp in Sources */,
                                26FAE4CE1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp in Sources */,
                                E45390AE0EAFF4B5003695C8 /* SystemMemoryIOS.cpp in Sources */,
+                               5778BD841DA4817B009E3009 /* SubtleCrypto.cpp in Sources */,
                                CDA07FBD18E0A16A004699FA /* SystemSleepListener.cpp in Sources */,
                                CDA07FC118E0A22B004699FA /* SystemSleepListenerMac.mm in Sources */,
                                5D5975B419635F1100D00878 /* SystemVersion.mm in Sources */,
index 1df4fba..3ae466c 100644 (file)
@@ -26,7 +26,6 @@
 [
     Conditional=SUBTLE_CRYPTO,
     ImplementationLacksVTable,
-    InterfaceName=KeyPair,
     JSCustomMarkFunction,
     NoInterfaceObject
 ] interface CryptoKeyPair {
diff --git a/Source/WebCore/crypto/SubtleCrypto.cpp b/Source/WebCore/crypto/SubtleCrypto.cpp
new file mode 100644 (file)
index 0000000..6eddcc7
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SubtleCrypto.h"
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+namespace WebCore {
+
+SubtleCrypto::SubtleCrypto(ScriptExecutionContext& context)
+    : ContextDestructionObserver(&context)
+{
+}
+
+}
+
+#endif
diff --git a/Source/WebCore/crypto/SubtleCrypto.h b/Source/WebCore/crypto/SubtleCrypto.h
new file mode 100644 (file)
index 0000000..47ed8d6
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "ContextDestructionObserver.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+namespace WebCore {
+
+class SubtleCrypto : public ContextDestructionObserver, public RefCounted<SubtleCrypto> {
+public:
+    static Ref<SubtleCrypto> create(ScriptExecutionContext& context) { return adoptRef(*new SubtleCrypto(context)); }
+
+private:
+    SubtleCrypto(ScriptExecutionContext&);
+};
+
+}
+
+#endif
diff --git a/Source/WebCore/crypto/SubtleCrypto.idl b/Source/WebCore/crypto/SubtleCrypto.idl
new file mode 100644 (file)
index 0000000..7c4d0af
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+* Copyright (C) 2016 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+* THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+[
+    Conditional=SUBTLE_CRYPTO,
+    Exposed=(Window,Worker),
+    GenerateIsReachable=ImplScriptExecutionContext,
+    NoInterfaceObject,
+] interface SubtleCrypto {
+};
index b6e540e..25a6d92 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "Document.h"
 #include "ExceptionCode.h"
+#include "SubtleCrypto.h"
 #include "WebKitSubtleCrypto.h"
 #include <runtime/ArrayBufferView.h>
 #include <wtf/CryptographicallyRandomNumber.h>
@@ -41,6 +42,9 @@ namespace WebCore {
 
 Crypto::Crypto(ScriptExecutionContext& context)
     : ContextDestructionObserver(&context)
+#if ENABLE(SUBTLE_CRYPTO)
+    , m_subtle(SubtleCrypto::create(context))
+#endif
 {
 }
 
@@ -62,6 +66,11 @@ void Crypto::getRandomValues(ArrayBufferView* array, ExceptionCode& ec)
 }
 
 #if ENABLE(SUBTLE_CRYPTO)
+SubtleCrypto& Crypto::subtle()
+{
+    return m_subtle;
+}
+
 WebKitSubtleCrypto* Crypto::webkitSubtle(ExceptionCode& ec)
 {
     if (!isMainThread()) {
index 764fea7..d64ae4b 100644 (file)
@@ -45,6 +45,7 @@ typedef int ExceptionCode;
 
 class Document;
 class WebKitSubtleCrypto;
+class SubtleCrypto;
 
 class Crypto : public ContextDestructionObserver, public RefCounted<Crypto> {
 public:
@@ -54,6 +55,9 @@ public:
     void getRandomValues(JSC::ArrayBufferView*, ExceptionCode&);
 
 #if ENABLE(SUBTLE_CRYPTO)
+    SubtleCrypto& subtle();
+
+    // Will be deprecated.
     WebKitSubtleCrypto* webkitSubtle(ExceptionCode&);
 #endif
 
@@ -61,6 +65,9 @@ private:
     Crypto(ScriptExecutionContext&);
 
 #if ENABLE(SUBTLE_CRYPTO)
+    Ref<SubtleCrypto> m_subtle;
+
+    // Will be deprecated.
     RefPtr<WebKitSubtleCrypto> m_webkitSubtle;
 #endif
 };
index 74ada0e..0d33596 100644 (file)
@@ -31,7 +31,9 @@
     Exposed=(Window,Worker),
     GenerateIsReachable=ImplScriptExecutionContext,
 ] interface Crypto {
+    [Conditional=SUBTLE_CRYPTO] readonly attribute SubtleCrypto subtle;
     [Custom, MayThrowLegacyException] ArrayBufferView getRandomValues(ArrayBufferView array);
 
+    // Will be deprecated.
     [Conditional=SUBTLE_CRYPTO, GetterMayThrowLegacyException] readonly attribute WebKitSubtleCrypto webkitSubtle;
 };