1. 02 Jan, 2014 1 commit
    • weinig@apple.com's avatar
      Update Promises to the https://github.com/domenic/promises-unwrapping spec · 349af4e4
      weinig@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=120954
      
      Reviewed by Filip Pizlo.
      
      Source/JavaScriptCore: 
      
      Update Promises to the revised spec. Notable changes:
      - JSPromiseResolver is gone.
      - TaskContext has been renamed Microtask and now has a virtual run() function.
      - Instead of using custom InternalFunction subclasses, JSFunctions are used
        with PrivateName properties for internal slots.
      
      * CMakeLists.txt:
      * DerivedSources.make:
      * GNUmakefile.list.am:
      * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
      * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * interpreter/CallFrame.h:
      (JSC::ExecState::promiseConstructorTable):
      * runtime/CommonIdentifiers.cpp:
      (JSC::CommonIdentifiers::CommonIdentifiers):
      * runtime/CommonIdentifiers.h:
      * runtime/JSGlobalObject.cpp:
      (JSC::JSGlobalObject::reset):
      (JSC::JSGlobalObject::visitChildren):
      (JSC::JSGlobalObject::queueMicrotask):
      * runtime/JSGlobalObject.h:
      (JSC::JSGlobalObject::promiseConstructor):
      (JSC::JSGlobalObject::promisePrototype):
      (JSC::JSGlobalObject::promiseStructure):
      * runtime/JSPromise.cpp:
      (JSC::JSPromise::create):
      (JSC::JSPromise::JSPromise):
      (JSC::JSPromise::finishCreation):
      (JSC::JSPromise::visitChildren):
      (JSC::JSPromise::reject):
      (JSC::JSPromise::resolve):
      (JSC::JSPromise::appendResolveReaction):
      (JSC::JSPromise::appendRejectReaction):
      (JSC::triggerPromiseReactions):
      * runtime/JSPromise.h:
      (JSC::JSPromise::status):
      (JSC::JSPromise::result):
      (JSC::JSPromise::constructor):
      * runtime/JSPromiseCallback.cpp: Removed.
      * runtime/JSPromiseCallback.h: Removed.
      * runtime/JSPromiseConstructor.cpp:
      (JSC::constructPromise):
      (JSC::JSPromiseConstructor::getCallData):
      (JSC::JSPromiseConstructorFuncCast):
      (JSC::JSPromiseConstructorFuncResolve):
      (JSC::JSPromiseConstructorFuncReject):
      * runtime/JSPromiseConstructor.h:
      * runtime/JSPromiseDeferred.cpp: Added.
      (JSC::JSPromiseDeferred::create):
      (JSC::JSPromiseDeferred::JSPromiseDeferred):
      (JSC::JSPromiseDeferred::finishCreation):
      (JSC::JSPromiseDeferred::visitChildren):
      (JSC::createJSPromiseDeferredFromConstructor):
      (JSC::updateDeferredFromPotentialThenable):
      * runtime/JSPromiseDeferred.h: Added.
      (JSC::JSPromiseDeferred::createStructure):
      (JSC::JSPromiseDeferred::promise):
      (JSC::JSPromiseDeferred::resolve):
      (JSC::JSPromiseDeferred::reject):
      * runtime/JSPromiseFunctions.cpp: Added.
      (JSC::deferredConstructionFunction):
      (JSC::createDeferredConstructionFunction):
      (JSC::identifyFunction):
      (JSC::createIdentifyFunction):
      (JSC::promiseAllCountdownFunction):
      (JSC::createPromiseAllCountdownFunction):
      (JSC::promiseResolutionHandlerFunction):
      (JSC::createPromiseResolutionHandlerFunction):
      (JSC::rejectPromiseFunction):
      (JSC::createRejectPromiseFunction):
      (JSC::resolvePromiseFunction):
      (JSC::createResolvePromiseFunction):
      (JSC::throwerFunction):
      (JSC::createThrowerFunction):
      * runtime/JSPromiseFunctions.h: Added.
      * runtime/JSPromisePrototype.cpp:
      (JSC::JSPromisePrototypeFuncThen):
      (JSC::JSPromisePrototypeFuncCatch):
      * runtime/JSPromiseReaction.cpp: Added.
      (JSC::createExecutePromiseReactionMicroTask):
      (JSC::ExecutePromiseReactionMicroTask::run):
      (JSC::JSPromiseReaction::create):
      (JSC::JSPromiseReaction::JSPromiseReaction):
      (JSC::JSPromiseReaction::finishCreation):
      (JSC::JSPromiseReaction::visitChildren):
      * runtime/JSPromiseReaction.h: Added.
      (JSC::JSPromiseReaction::createStructure):
      (JSC::JSPromiseReaction::deferred):
      (JSC::JSPromiseReaction::handler):
      * runtime/JSPromiseResolver.cpp: Removed.
      * runtime/JSPromiseResolver.h: Removed.
      * runtime/JSPromiseResolverConstructor.cpp: Removed.
      * runtime/JSPromiseResolverConstructor.h: Removed.
      * runtime/JSPromiseResolverPrototype.cpp: Removed.
      * runtime/JSPromiseResolverPrototype.h: Removed.
      * runtime/Microtask.h: Added.
      * runtime/VM.cpp:
      (JSC::VM::VM):
      (JSC::VM::~VM):
      * runtime/VM.h:
      
      Source/WebCore: 
      
      * ForwardingHeaders/runtime/JSPromiseDeferred.h: Added.
      * ForwardingHeaders/runtime/JSPromiseResolver.h: Removed.
      * bindings/js/JSDOMGlobalObjectTask.cpp:
      (WebCore::JSGlobalObjectTask::JSGlobalObjectTask):
      * bindings/js/JSDOMGlobalObjectTask.h:
      * bindings/js/JSDOMPromise.cpp:
      (WebCore::DeferredWrapper::DeferredWrapper):
      (WebCore::DeferredWrapper::promise):
      (WebCore::DeferredWrapper::resolve):
      (WebCore::DeferredWrapper::reject):
      * bindings/js/JSDOMPromise.h:
      (WebCore::DeferredWrapper::resolve):
      (WebCore::DeferredWrapper::reject):
      (WebCore::DeferredWrapper::resolve<String>):
      (WebCore::DeferredWrapper::resolve<bool>):
      (WebCore::char>>):
      (WebCore::DeferredWrapper::reject<String>):
      * bindings/js/JSDOMWindowBase.cpp:
      (WebCore::JSDOMWindowBase::queueTaskToEventLoop):
      * bindings/js/JSDOMWindowBase.h:
      * bindings/js/JSSubtleCryptoCustom.cpp:
      (WebCore::JSSubtleCrypto::encrypt):
      (WebCore::JSSubtleCrypto::decrypt):
      (WebCore::JSSubtleCrypto::sign):
      (WebCore::JSSubtleCrypto::verify):
      (WebCore::JSSubtleCrypto::digest):
      (WebCore::JSSubtleCrypto::generateKey):
      (WebCore::JSSubtleCrypto::importKey):
      (WebCore::JSSubtleCrypto::exportKey):
      (WebCore::JSSubtleCrypto::wrapKey):
      (WebCore::JSSubtleCrypto::unwrapKey):
      * bindings/js/JSWorkerGlobalScopeBase.cpp:
      (WebCore::JSWorkerGlobalScopeBase::queueTaskToEventLoop):
      * bindings/js/JSWorkerGlobalScopeBase.h:
      
      LayoutTests: 
      
      * crypto/subtle/argument-conversion.html:
      * crypto/subtle/resources/common.js:
      * crypto/subtle/sha-1.html:
      * crypto/subtle/sha-224.html:
      * crypto/subtle/sha-256.html:
      * crypto/subtle/sha-384.html:
      * crypto/subtle/sha-512.html:
      * js/dom/Promise-already-fulfilled-expected.txt: Removed.
      * js/dom/Promise-already-fulfilled.html: Removed.
      * js/dom/Promise-already-rejected.html:
      * js/dom/Promise-already-resolved.html:
      * js/dom/Promise-catch-expected.txt:
      * js/dom/Promise-catch-in-workers-expected.txt:
      * js/dom/Promise-catch.html:
      * js/dom/Promise-chain.html:
      * js/dom/Promise-exception-expected.txt:
      * js/dom/Promise-exception.html:
      * js/dom/Promise-expected.txt:
      * js/dom/Promise-fulfill-expected.txt: Removed.
      * js/dom/Promise-fulfill-in-workers-expected.txt: Removed.
      * js/dom/Promise-fulfill-in-workers.html: Removed.
      * js/dom/Promise-fulfill.html: Removed.
      * js/dom/Promise-init-callback-receiver-expected.txt: Added.
      * js/dom/Promise-init-callback-receiver.html: Added.
      * js/dom/Promise-init-expected.txt:
      * js/dom/Promise-init-in-workers-expected.txt:
      * js/dom/Promise-init.html:
      * js/dom/Promise-onFulfilled-deep-expected.txt: Added.
      * js/dom/Promise-onFulfilled-deep.html: Added.
      * js/dom/Promise-onRejected-deep-expected.txt: Added.
      * js/dom/Promise-onRejected-deep.html: Added.
      * js/dom/Promise-reject.html:
      * js/dom/Promise-resolve-chain.html:
      * js/dom/Promise-resolve-expected.txt:
      * js/dom/Promise-resolve-in-workers-expected.txt:
      * js/dom/Promise-resolve-state-expected.txt: Added.
      * js/dom/Promise-resolve-state-in-workers-expected.txt: Added.
      * js/dom/Promise-resolve-state-in-workers.html: Added.
      * js/dom/Promise-resolve-state.html: Added.
      * js/dom/Promise-resolve-with-itself-expected.txt: Added.
      * js/dom/Promise-resolve-with-itself.html: Added.
      * js/dom/Promise-resolve-with-then-exception.html:
      * js/dom/Promise-resolve-with-then-fulfill-expected.txt:
      * js/dom/Promise-resolve-with-then-fulfill.html:
      * js/dom/Promise-resolve-with-then-reject-expected.txt:
      * js/dom/Promise-resolve-with-then-reject.html:
      * js/dom/Promise-resolve.html:
      * js/dom/Promise-simple-expected.txt:
      * js/dom/Promise-simple-fulfill-expected.txt: Removed.
      * js/dom/Promise-simple-fulfill-inside-callback-expected.txt: Removed.
      * js/dom/Promise-simple-fulfill-inside-callback.html: Removed.
      * js/dom/Promise-simple-fulfill.html: Removed.
      * js/dom/Promise-simple-in-workers-expected.txt:
      * js/dom/Promise-simple-resolve-expected.txt: Added.
      * js/dom/Promise-simple-resolve.html: Added.
      * js/dom/Promise-simple.html:
      * js/dom/Promise-static-all-expected.txt: Added.
      * js/dom/Promise-static-all.html: Added.
      * js/dom/Promise-static-cast-expected.txt: Added.
      * js/dom/Promise-static-cast.html: Added.
      * js/dom/Promise-static-fulfill-expected.txt: Removed.
      * js/dom/Promise-static-fulfill.html: Removed.
      * js/dom/Promise-static-race-expected.txt: Added.
      * js/dom/Promise-static-race.html: Added.
      * js/dom/Promise-static-resolve.html:
      * js/dom/Promise-then-callback-receiver-expected.txt: Added.
      * js/dom/Promise-then-callback-receiver.html: Added.
      * js/dom/Promise-then-expected.txt:
      * js/dom/Promise-then-in-workers-expected.txt:
      * js/dom/Promise-then-without-callbacks.html:
      * js/dom/Promise-then.html:
      * js/dom/Promise-types-expected.txt:
      * js/dom/Promise-types.html:
      * js/dom/Promise.html:
      * js/resources/Promise-catch-in-workers.js:
      * js/resources/Promise-fulfill-in-workers.js: Removed.
      * js/resources/Promise-init-in-workers.js:
      * js/resources/Promise-reject-in-workers.js:
      * js/resources/Promise-resolve-in-workers.js:
      * js/resources/Promise-resolve-state-in-workers.js: Added.
      * js/resources/Promise-simple-in-workers.js:
      * js/resources/Promise-then-in-workers.js:
      * js/resources/Promise-then-without-callbacks-in-workers.js:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161241 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      349af4e4
  2. 16 Nov, 2013 1 commit
    • ap@apple.com's avatar
      WebCrypto no longer uses sequences of ArrayBuffers · b651c9a6
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124451
      
      Reviewed by Sam Weinig.
      
      Source/WebCore: 
      
      Covered by existing tests.
      
      Changed all operations to take single CryptoOperationData objects.
      
      * bindings/js/JSCryptoOperationData.cpp:
      * bindings/js/JSCryptoOperationData.h:
      * bindings/js/JSSubtleCryptoCustom.cpp:
      (WebCore::JSSubtleCrypto::encrypt):
      (WebCore::JSSubtleCrypto::decrypt):
      (WebCore::JSSubtleCrypto::sign):
      (WebCore::JSSubtleCrypto::verify):
      (WebCore::JSSubtleCrypto::digest):
      * crypto/CryptoAlgorithm.cpp:
      (WebCore::CryptoAlgorithm::encrypt):
      (WebCore::CryptoAlgorithm::decrypt):
      (WebCore::CryptoAlgorithm::sign):
      (WebCore::CryptoAlgorithm::verify):
      (WebCore::CryptoAlgorithm::digest):
      * crypto/CryptoAlgorithm.h:
      * crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
      (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
      (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
      * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
      * crypto/algorithms/CryptoAlgorithmHMAC.h:
      * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
      * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
      (WebCore::CryptoAlgorithmSHA1::digest):
      * crypto/algorithms/CryptoAlgorithmSHA1.h:
      * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
      (WebCore::CryptoAlgorithmSHA224::digest):
      * crypto/algorithms/CryptoAlgorithmSHA224.h:
      * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
      (WebCore::CryptoAlgorithmSHA256::digest):
      * crypto/algorithms/CryptoAlgorithmSHA256.h:
      * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
      (WebCore::CryptoAlgorithmSHA384::digest):
      * crypto/algorithms/CryptoAlgorithmSHA384.h:
      * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
      (WebCore::CryptoAlgorithmSHA512::digest):
      * crypto/algorithms/CryptoAlgorithmSHA512.h:
      * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
      (WebCore::transformAES_CBC):
      (WebCore::CryptoAlgorithmAES_CBC::encrypt):
      (WebCore::CryptoAlgorithmAES_CBC::decrypt):
      * crypto/mac/CryptoAlgorithmHMACMac.cpp:
      (WebCore::calculateSignature):
      (WebCore::CryptoAlgorithmHMAC::sign):
      (WebCore::CryptoAlgorithmHMAC::verify):
      * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h:
      
      LayoutTests: 
      
      Updated tests accordingly.
      
      * crypto/subtle/aes-cbc-192-encrypt-decrypt.html:
      * crypto/subtle/aes-cbc-256-encrypt-decrypt.html:
      * crypto/subtle/aes-cbc-encrypt-decrypt-expected.txt:
      * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding.html:
      * crypto/subtle/aes-cbc-encrypt-decrypt.html:
      * crypto/subtle/aes-cbc-import-jwk.html:
      * crypto/subtle/aes-cbc-wrong-key-class-expected.txt:
      * crypto/subtle/aes-cbc-wrong-key-class.html:
      * crypto/subtle/argument-conversion-expected.txt:
      * crypto/subtle/argument-conversion.html:
      * crypto/subtle/hmac-import-jwk.html:
      * crypto/subtle/hmac-sign-verify-empty-key.html:
      * crypto/subtle/hmac-sign-verify.html:
      * crypto/subtle/rsassa-pkcs1-v1_5-sign-verify.html:
      * crypto/subtle/sha-1-expected.txt:
      * crypto/subtle/sha-1.html:
      * crypto/subtle/sha-224-expected.txt:
      * crypto/subtle/sha-224.html:
      * crypto/subtle/sha-256-expected.txt:
      * crypto/subtle/sha-256.html:
      * crypto/subtle/sha-384-expected.txt:
      * crypto/subtle/sha-384.html:
      * crypto/subtle/sha-512-expected.txt:
      * crypto/subtle/sha-512.html:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159379 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b651c9a6
  3. 14 Nov, 2013 1 commit
    • ap@apple.com's avatar
      Update WebCrypto tests · df32d58c
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124388
      
      Reviewed by Anders Carlsson.
      
      Updated tests for newer common.js. Changed some tests from just dumping results
      to comparing them to known expected ones. Fixed a syntax error in
      aes-cbc-invalid-length.html, so it now actually runs.
      
      * crypto/subtle/resources/common.js: Update to a new version from Blink, because
      it's much nicer than the old one, and it's good to be compatible at test level.
      Moved crypto.subtle definition from webkitSubtle here to avoid repeating it in all
      tests. Added a quick and dirty Promise.all implementation.
      
      * crypto/subtle/aes-cbc-192-encrypt-decrypt-expected.txt:
      * crypto/subtle/aes-cbc-192-encrypt-decrypt.html:
      * crypto/subtle/aes-cbc-256-encrypt-decrypt-expected.txt:
      * crypto/subtle/aes-cbc-256-encrypt-decrypt.html:
      * crypto/subtle/aes-cbc-encrypt-decrypt-expected.txt:
      * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding-expected.txt:
      * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding.html:
      * crypto/subtle/aes-cbc-encrypt-decrypt.html:
      * crypto/subtle/aes-cbc-generate-key.html:
      * crypto/subtle/aes-cbc-import-jwk-expected.txt:
      * crypto/subtle/aes-cbc-import-jwk.html:
      * crypto/subtle/aes-cbc-invalid-length-expected.txt:
      * crypto/subtle/aes-cbc-invalid-length.html:
      * crypto/subtle/aes-cbc-wrong-key-class.html:
      * crypto/subtle/aes-export-key-expected.txt:
      * crypto/subtle/aes-export-key.html:
      * crypto/subtle/argument-conversion-expected.txt:
      * crypto/subtle/argument-conversion.html:
      * crypto/subtle/hmac-export-key-expected.txt:
      * crypto/subtle/hmac-export-key.html:
      * crypto/subtle/hmac-generate-key.html:
      * crypto/subtle/hmac-import-jwk-expected.txt:
      * crypto/subtle/hmac-import-jwk.html:
      * crypto/subtle/hmac-sign-verify-empty-key-expected.txt:
      * crypto/subtle/hmac-sign-verify-empty-key.html:
      * crypto/subtle/hmac-sign-verify-expected.txt:
      * crypto/subtle/hmac-sign-verify.html:
      * crypto/subtle/import-jwk-expected.txt:
      * crypto/subtle/import-jwk.html:
      * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt:
      * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html:
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt:
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html:
      * crypto/subtle/rsassa-pkcs1-v1_5-sign-verify-expected.txt:
      * crypto/subtle/rsassa-pkcs1-v1_5-sign-verify.html:
      * crypto/subtle/sha-1-expected.txt:
      * crypto/subtle/sha-1.html:
      * crypto/subtle/sha-224-expected.txt:
      * crypto/subtle/sha-224.html:
      * crypto/subtle/sha-256-expected.txt:
      * crypto/subtle/sha-256.html:
      * crypto/subtle/sha-384-expected.txt:
      * crypto/subtle/sha-384.html:
      * crypto/subtle/sha-512-expected.txt:
      * crypto/subtle/sha-512.html:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159327 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      df32d58c
  4. 31 Oct, 2013 2 commits
    • ap@apple.com's avatar
      Enable WebCrypto on Mac · 13a73330
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=123587
      
      Reviewed by Anders Carlsson.
      
      Source/JavaScriptCore:
      
      * Configurations/FeatureDefines.xcconfig: Do it.
      
      Source/WebCore:
      
      * Configurations/FeatureDefines.xcconfig: Enable it.
      
      * bindings/js/JSCryptoAlgorithmDictionary.cpp: Build fix.
      
      * crypto/CryptoAlgorithmRegistry.cpp: (WebCore::CryptoAlgorithmRegistry::getIdentifierForName):
      Special case empty keys to avoid upsetting HashMap.
      
      * crypto/algorithms/CryptoAlgorithmSHA1.cpp: (WebCore::CryptoAlgorithmSHA1::create):
      Build fix. Can't use make_unique, because constructor is private.
      
      Source/WebKit/mac:
      
      * Configurations/FeatureDefines.xcconfig: Do it.
      
      Source/WebKit2:
      
      * Configurations/FeatureDefines.xcconfig: Do it.
      
      LayoutTests:
      
      * TestExpectations:
      * platform/efl/TestExpectations:
      * platform/gtk/TestExpectations:
      * platform/win/TestExpectations:
      * platform/wincairo/TestExpectations:
      Only skipping on specific platforms now.
      
      * crypto: Added.
      * crypto/crypto-gc-expected.txt: Copied from LayoutTests/security/crypto-gc-expected.txt.
      * crypto/crypto-gc.html: Copied from LayoutTests/security/crypto-gc.html.
      * crypto/crypto-random-values-expected.txt: Copied from LayoutTests/security/crypto-random-values-expected.txt.
      * crypto/crypto-random-values-limits-expected.txt: Copied from LayoutTests/security/crypto-random-values-limits-expected.txt.
      * crypto/crypto-random-values-limits.html: Copied from LayoutTests/security/crypto-random-values-limits.html.
      * crypto/crypto-random-values-types-expected.txt: Copied from LayoutTests/security/crypto-random-values-types-expected.txt.
      * crypto/crypto-random-values-types.html: Copied from LayoutTests/security/crypto-random-values-types.html.
      * crypto/crypto-random-values.html: Copied from LayoutTests/security/crypto-random-values.html.
      * crypto/subtle: Added.
      * crypto/subtle/argument-conversion-expected.txt: Copied from LayoutTests/security/crypto-subtle-arguments-expected.txt.
      * crypto/subtle/argument-conversion.html: Copied from LayoutTests/security/crypto-subtle-arguments.html.
      * crypto/subtle/gc-2-expected.txt: Copied from LayoutTests/security/crypto-subtle-gc-2-expected.txt.
      * crypto/subtle/gc-2.html: Copied from LayoutTests/security/crypto-subtle-gc-2.html.
      * crypto/subtle/gc-3-expected.txt: Copied from LayoutTests/security/crypto-subtle-gc-3-expected.txt.
      * crypto/subtle/gc-3.html: Copied from LayoutTests/security/crypto-subtle-gc-3.html.
      * crypto/subtle/gc-expected.txt: Copied from LayoutTests/security/crypto-subtle-gc-expected.txt.
      * crypto/subtle/gc.html: Copied from LayoutTests/security/crypto-subtle-gc.html.
      * crypto/subtle/resources: Added.
      * crypto/subtle/resources/common.js: Copied from LayoutTests/security/resources/common.js.
      * crypto/subtle/sha-1-expected.txt: Copied from LayoutTests/security/crypto-subtle-sha1-expected.txt.
      * crypto/subtle/sha-1.html: Copied from LayoutTests/security/crypto-subtle-sha1.html.
      * security/crypto-gc-expected.txt: Removed.
      * security/crypto-gc.html: Removed.
      * security/crypto-random-values-expected.txt: Removed.
      * security/crypto-random-values-limits-expected.txt: Removed.
      * security/crypto-random-values-limits.html: Removed.
      * security/crypto-random-values-types-expected.txt: Removed.
      * security/crypto-random-values-types.html: Removed.
      * security/crypto-random-values.html: Removed.
      * security/crypto-subtle-arguments-expected.txt: Removed.
      * security/crypto-subtle-arguments.html: Removed.
      * security/crypto-subtle-gc-2-expected.txt: Removed.
      * security/crypto-subtle-gc-2.html: Removed.
      * security/crypto-subtle-gc-3-expected.txt: Removed.
      * security/crypto-subtle-gc-3.html: Removed.
      * security/crypto-subtle-gc-expected.txt: Removed.
      * security/crypto-subtle-gc.html: Removed.
      * security/crypto-subtle-sha1-expected.txt: Removed.
      * security/crypto-subtle-sha1.html: Removed.
      * security/resources/common.js: Removed.
      Moved tests from security/ to crypto/.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158396 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      13a73330
    • ap@apple.com's avatar
      [WebCrypto] Add SHA-1 · d23ff7fa
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=123582
      
      Reviewed by Anders Carlsson.
      
      Source/WebCore: 
      
      Tests: security/crypto-subtle-arguments.html
             security/crypto-subtle-sha1.html
      
      * WebCore.xcodeproj/project.pbxproj: Added new files.
      
      * bindings/js/JSSubtleCryptoCustom.cpp:
      (WebCore::createAlgorithmFromJSValue):
      (WebCore::sequenceOfCryptoOperationDataFromJSValue):
      (WebCore::JSSubtleCrypto::digest):
      * crypto/SubtleCrypto.idl:
      Added bindings for crypto.digest.
      
      * crypto/algorithms: Added.
      * crypto/algorithms/CryptoAlgorithmSHA1.cpp: Added.
      * crypto/algorithms/CryptoAlgorithmSHA1.h: Added.
      * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
      (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): Register SHA-1.
      
      * crypto/mac/CryptoAlgorithmSHA1Mac.cpp: Added.
      (WebCore::CryptoAlgorithmSHA1::digest): Performs the work synchronously, because
      otherwise we'd have to copy the data first, which is crazy for something as simple
      as hashing. We can change to a dispatch queue later if we find that it's actually
      better to copy and do the work asynchronously.
      
      LayoutTests: 
      
      * security/resources/common.js: Added from Blink.
      (importTestKeys):
      (asciiToArrayBuffer):
      (printRejectedResult):
      (printAcceptedResult):
      (failAndFinishJSTest):
      
      * security/crypto-subtle-arguments-expected.txt: Added.
      * security/crypto-subtle-arguments.html: Added.
      Added tests for how bindings treat crazy arguments. Heavily based on a test from Blink.
      
      * security/crypto-subtle-sha1-expected.txt: Added.
      * security/crypto-subtle-sha1.html: Added.
      Test that SHA-1 works.
      
      * TestExpectations: Skip these tests everywhere for now.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158387 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      d23ff7fa