| Index: Source/modules/crypto/SubtleCrypto.cpp
|
| diff --git a/Source/modules/crypto/SubtleCrypto.cpp b/Source/modules/crypto/SubtleCrypto.cpp
|
| index 8c4018e6e48ddd3b58c296ef61d08b71a2dd0675..4f00316f9ad93706be7e49db077cf7e23b9e0c4d 100644
|
| --- a/Source/modules/crypto/SubtleCrypto.cpp
|
| +++ b/Source/modules/crypto/SubtleCrypto.cpp
|
| @@ -49,30 +49,30 @@ namespace WebCore {
|
|
|
| namespace {
|
|
|
| -ScriptPromise startCryptoOperation(const Dictionary& rawAlgorithm, Key* key, AlgorithmOperation operationType, ArrayBufferView* signature, ArrayBufferView* dataBuffer, ExceptionState& es)
|
| +ScriptPromise startCryptoOperation(const Dictionary& rawAlgorithm, Key* key, AlgorithmOperation operationType, ArrayBufferView* signature, ArrayBufferView* dataBuffer, ExceptionState& exceptionState)
|
| {
|
| bool requiresKey = operationType != Digest;
|
|
|
| // Seems like the generated bindings should take care of these however it
|
| // currently doesn't. See also http://crbugh.com/264520
|
| if (requiresKey && !key) {
|
| - es.throwTypeError("Invalid key argument");
|
| + exceptionState.throwTypeError("Invalid key argument");
|
| return ScriptPromise();
|
| }
|
| if (operationType == Verify && !signature) {
|
| - es.throwTypeError("Invalid signature argument");
|
| + exceptionState.throwTypeError("Invalid signature argument");
|
| return ScriptPromise();
|
| }
|
| if (!dataBuffer) {
|
| - es.throwTypeError("Invalid dataBuffer argument");
|
| + exceptionState.throwTypeError("Invalid dataBuffer argument");
|
| return ScriptPromise();
|
| }
|
|
|
| blink::WebCryptoAlgorithm algorithm;
|
| - if (!normalizeAlgorithm(rawAlgorithm, operationType, algorithm, es))
|
| + if (!normalizeAlgorithm(rawAlgorithm, operationType, algorithm, exceptionState))
|
| return ScriptPromise();
|
|
|
| - if (requiresKey && !key->canBeUsedForAlgorithm(algorithm, operationType, es))
|
| + if (requiresKey && !key->canBeUsedForAlgorithm(algorithm, operationType, exceptionState))
|
| return ScriptPromise();
|
|
|
| const unsigned char* data = static_cast<const unsigned char*>(dataBuffer->baseAddress());
|
| @@ -112,39 +112,39 @@ SubtleCrypto::SubtleCrypto()
|
| ScriptWrappable::init(this);
|
| }
|
|
|
| -ScriptPromise SubtleCrypto::encrypt(const Dictionary& rawAlgorithm, Key* key, ArrayBufferView* data, ExceptionState& es)
|
| +ScriptPromise SubtleCrypto::encrypt(const Dictionary& rawAlgorithm, Key* key, ArrayBufferView* data, ExceptionState& exceptionState)
|
| {
|
| - return startCryptoOperation(rawAlgorithm, key, Encrypt, 0, data, es);
|
| + return startCryptoOperation(rawAlgorithm, key, Encrypt, 0, data, exceptionState);
|
| }
|
|
|
| -ScriptPromise SubtleCrypto::decrypt(const Dictionary& rawAlgorithm, Key* key, ArrayBufferView* data, ExceptionState& es)
|
| +ScriptPromise SubtleCrypto::decrypt(const Dictionary& rawAlgorithm, Key* key, ArrayBufferView* data, ExceptionState& exceptionState)
|
| {
|
| - return startCryptoOperation(rawAlgorithm, key, Decrypt, 0, data, es);
|
| + return startCryptoOperation(rawAlgorithm, key, Decrypt, 0, data, exceptionState);
|
| }
|
|
|
| -ScriptPromise SubtleCrypto::sign(const Dictionary& rawAlgorithm, Key* key, ArrayBufferView* data, ExceptionState& es)
|
| +ScriptPromise SubtleCrypto::sign(const Dictionary& rawAlgorithm, Key* key, ArrayBufferView* data, ExceptionState& exceptionState)
|
| {
|
| - return startCryptoOperation(rawAlgorithm, key, Sign, 0, data, es);
|
| + return startCryptoOperation(rawAlgorithm, key, Sign, 0, data, exceptionState);
|
| }
|
|
|
| -ScriptPromise SubtleCrypto::verifySignature(const Dictionary& rawAlgorithm, Key* key, ArrayBufferView* signature, ArrayBufferView* data, ExceptionState& es)
|
| +ScriptPromise SubtleCrypto::verifySignature(const Dictionary& rawAlgorithm, Key* key, ArrayBufferView* signature, ArrayBufferView* data, ExceptionState& exceptionState)
|
| {
|
| - return startCryptoOperation(rawAlgorithm, key, Verify, signature, data, es);
|
| + return startCryptoOperation(rawAlgorithm, key, Verify, signature, data, exceptionState);
|
| }
|
|
|
| -ScriptPromise SubtleCrypto::digest(const Dictionary& rawAlgorithm, ArrayBufferView* data, ExceptionState& es)
|
| +ScriptPromise SubtleCrypto::digest(const Dictionary& rawAlgorithm, ArrayBufferView* data, ExceptionState& exceptionState)
|
| {
|
| - return startCryptoOperation(rawAlgorithm, 0, Digest, 0, data, es);
|
| + return startCryptoOperation(rawAlgorithm, 0, Digest, 0, data, exceptionState);
|
| }
|
|
|
| -ScriptPromise SubtleCrypto::generateKey(const Dictionary& rawAlgorithm, bool extractable, const Vector<String>& rawKeyUsages, ExceptionState& es)
|
| +ScriptPromise SubtleCrypto::generateKey(const Dictionary& rawAlgorithm, bool extractable, const Vector<String>& rawKeyUsages, ExceptionState& exceptionState)
|
| {
|
| blink::WebCryptoKeyUsageMask keyUsages;
|
| - if (!Key::parseUsageMask(rawKeyUsages, keyUsages, es))
|
| + if (!Key::parseUsageMask(rawKeyUsages, keyUsages, exceptionState))
|
| return ScriptPromise();
|
|
|
| blink::WebCryptoAlgorithm algorithm;
|
| - if (!normalizeAlgorithm(rawAlgorithm, GenerateKey, algorithm, es))
|
| + if (!normalizeAlgorithm(rawAlgorithm, GenerateKey, algorithm, exceptionState))
|
| return ScriptPromise();
|
|
|
| ScriptPromise promise = ScriptPromise::createPending();
|
| @@ -153,24 +153,24 @@ ScriptPromise SubtleCrypto::generateKey(const Dictionary& rawAlgorithm, bool ext
|
| return promise;
|
| }
|
|
|
| -ScriptPromise SubtleCrypto::importKey(const String& rawFormat, ArrayBufferView* keyData, const Dictionary& rawAlgorithm, bool extractable, const Vector<String>& rawKeyUsages, ExceptionState& es)
|
| +ScriptPromise SubtleCrypto::importKey(const String& rawFormat, ArrayBufferView* keyData, const Dictionary& rawAlgorithm, bool extractable, const Vector<String>& rawKeyUsages, ExceptionState& exceptionState)
|
| {
|
| blink::WebCryptoKeyFormat format;
|
| - if (!Key::parseFormat(rawFormat, format, es))
|
| + if (!Key::parseFormat(rawFormat, format, exceptionState))
|
| return ScriptPromise();
|
|
|
| if (!keyData) {
|
| - es.throwTypeError("Invalid keyData argument");
|
| + exceptionState.throwTypeError("Invalid keyData argument");
|
| return ScriptPromise();
|
| }
|
|
|
| blink::WebCryptoKeyUsageMask keyUsages;
|
| - if (!Key::parseUsageMask(rawKeyUsages, keyUsages, es))
|
| + if (!Key::parseUsageMask(rawKeyUsages, keyUsages, exceptionState))
|
| return ScriptPromise();
|
|
|
| // The algorithm is optional.
|
| blink::WebCryptoAlgorithm algorithm;
|
| - if (!rawAlgorithm.isUndefinedOrNull() && !normalizeAlgorithm(rawAlgorithm, ImportKey, algorithm, es))
|
| + if (!rawAlgorithm.isUndefinedOrNull() && !normalizeAlgorithm(rawAlgorithm, ImportKey, algorithm, exceptionState))
|
| return ScriptPromise();
|
|
|
| const unsigned char* keyDataBytes = static_cast<unsigned char*>(keyData->baseAddress());
|
| @@ -181,19 +181,19 @@ ScriptPromise SubtleCrypto::importKey(const String& rawFormat, ArrayBufferView*
|
| return promise;
|
| }
|
|
|
| -ScriptPromise SubtleCrypto::exportKey(const String& rawFormat, Key* key, ExceptionState& es)
|
| +ScriptPromise SubtleCrypto::exportKey(const String& rawFormat, Key* key, ExceptionState& exceptionState)
|
| {
|
| blink::WebCryptoKeyFormat format;
|
| - if (!Key::parseFormat(rawFormat, format, es))
|
| + if (!Key::parseFormat(rawFormat, format, exceptionState))
|
| return ScriptPromise();
|
|
|
| if (!key) {
|
| - es.throwTypeError("Invalid key argument");
|
| + exceptionState.throwTypeError("Invalid key argument");
|
| return ScriptPromise();
|
| }
|
|
|
| if (!key->extractable()) {
|
| - es.throwDOMException(NotSupportedError, "key is not extractable");
|
| + exceptionState.throwDOMException(NotSupportedError, "key is not extractable");
|
| return ScriptPromise();
|
| }
|
|
|
|
|