| Index: Source/modules/crypto/SubtleCrypto.cpp
|
| diff --git a/Source/modules/crypto/SubtleCrypto.cpp b/Source/modules/crypto/SubtleCrypto.cpp
|
| index 25cd59ffde696814ed670b6ec870586b53d4197e..7aa241fea572d7f0ef0f90435586cce4fbd9c9dc 100644
|
| --- a/Source/modules/crypto/SubtleCrypto.cpp
|
| +++ b/Source/modules/crypto/SubtleCrypto.cpp
|
| @@ -59,38 +59,6 @@ DOMArrayPiece::DOMArrayPiece(const BufferSource& bufferSource)
|
| initWithData(data, len);
|
| }
|
|
|
| -// Seems like the generated bindings should take care of these however it
|
| -// currently doesn't. See also http://crbug.com/264520
|
| -static bool ensureNotNull(const DOMArrayPiece& x, const char* paramName, CryptoResult* result)
|
| -{
|
| - if (x.isNull()) {
|
| - String message = String("Invalid ") + paramName + String(" argument");
|
| - result->completeWithError(WebCryptoErrorTypeType, WebString(message));
|
| - return false;
|
| - }
|
| - return true;
|
| -}
|
| -
|
| -static bool ensureNotNull(const ArrayBufferOrArrayBufferViewOrDictionary& dictionary, const char* paramName, CryptoResult* result)
|
| -{
|
| - if (dictionary.isNull()) {
|
| - String message = String("Invalid ") + paramName + String(" argument");
|
| - result->completeWithError(WebCryptoErrorTypeType, WebString(message));
|
| - return false;
|
| - }
|
| - return true;
|
| -}
|
| -
|
| -static bool ensureNotNull(CryptoKey* key, const char* paramName, CryptoResult* result)
|
| -{
|
| - if (!key) {
|
| - String message = String("Invalid ") + paramName + String(" argument");
|
| - result->completeWithError(WebCryptoErrorTypeType, WebString(message));
|
| - return false;
|
| - }
|
| - return true;
|
| -}
|
| -
|
| static bool parseAlgorithm(const AlgorithmIdentifier& raw, WebCryptoOperation op, WebCryptoAlgorithm& algorithm, CryptoResult* result)
|
| {
|
| AlgorithmError error;
|
| @@ -175,11 +143,6 @@ ScriptPromise SubtleCrypto::encrypt(ScriptState* scriptState, const AlgorithmIde
|
| if (!canAccessWebCrypto(scriptState, result.get()))
|
| return promise;
|
|
|
| - if (!ensureNotNull(key, "key", result.get()))
|
| - return promise;
|
| - if (!ensureNotNull(data, "dataBuffer", result.get()))
|
| - return promise;
|
| -
|
| WebCryptoAlgorithm algorithm;
|
| if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationEncrypt, algorithm, result.get()))
|
| return promise;
|
| @@ -199,11 +162,6 @@ ScriptPromise SubtleCrypto::decrypt(ScriptState* scriptState, const AlgorithmIde
|
| if (!canAccessWebCrypto(scriptState, result.get()))
|
| return promise;
|
|
|
| - if (!ensureNotNull(key, "key", result.get()))
|
| - return promise;
|
| - if (!ensureNotNull(data, "dataBuffer", result.get()))
|
| - return promise;
|
| -
|
| WebCryptoAlgorithm algorithm;
|
| if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationDecrypt, algorithm, result.get()))
|
| return promise;
|
| @@ -223,11 +181,6 @@ ScriptPromise SubtleCrypto::sign(ScriptState* scriptState, const AlgorithmIdenti
|
| if (!canAccessWebCrypto(scriptState, result.get()))
|
| return promise;
|
|
|
| - if (!ensureNotNull(key, "key", result.get()))
|
| - return promise;
|
| - if (!ensureNotNull(data, "dataBuffer", result.get()))
|
| - return promise;
|
| -
|
| WebCryptoAlgorithm algorithm;
|
| if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationSign, algorithm, result.get()))
|
| return promise;
|
| @@ -247,13 +200,6 @@ ScriptPromise SubtleCrypto::verifySignature(ScriptState* scriptState, const Algo
|
| if (!canAccessWebCrypto(scriptState, result.get()))
|
| return promise;
|
|
|
| - if (!ensureNotNull(key, "key", result.get()))
|
| - return promise;
|
| - if (!ensureNotNull(data, "dataBuffer", result.get()))
|
| - return promise;
|
| - if (!ensureNotNull(signature, "signature", result.get()))
|
| - return promise;
|
| -
|
| WebCryptoAlgorithm algorithm;
|
| if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationVerify, algorithm, result.get()))
|
| return promise;
|
| @@ -273,9 +219,6 @@ ScriptPromise SubtleCrypto::digest(ScriptState* scriptState, const AlgorithmIden
|
| if (!canAccessWebCrypto(scriptState, result.get()))
|
| return promise;
|
|
|
| - if (!ensureNotNull(data, "dataBuffer", result.get()))
|
| - return promise;
|
| -
|
| WebCryptoAlgorithm algorithm;
|
| if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationDigest, algorithm, result.get()))
|
| return promise;
|
| @@ -312,9 +255,6 @@ ScriptPromise SubtleCrypto::importKey(ScriptState* scriptState, const String& ra
|
| if (!canAccessWebCrypto(scriptState, result.get()))
|
| return promise;
|
|
|
| - if (!ensureNotNull(keyData, "keyData", result.get()))
|
| - return promise;
|
| -
|
| WebCryptoKeyFormat format;
|
| if (!CryptoKey::parseFormat(rawFormat, format, result.get()))
|
| return promise;
|
| @@ -365,9 +305,6 @@ ScriptPromise SubtleCrypto::exportKey(ScriptState* scriptState, const String& ra
|
| if (!canAccessWebCrypto(scriptState, result.get()))
|
| return promise;
|
|
|
| - if (!ensureNotNull(key, "key", result.get()))
|
| - return promise;
|
| -
|
| WebCryptoKeyFormat format;
|
| if (!CryptoKey::parseFormat(rawFormat, format, result.get()))
|
| return promise;
|
| @@ -389,12 +326,6 @@ ScriptPromise SubtleCrypto::wrapKey(ScriptState* scriptState, const String& rawF
|
| if (!canAccessWebCrypto(scriptState, result.get()))
|
| return promise;
|
|
|
| - if (!ensureNotNull(key, "key", result.get()))
|
| - return promise;
|
| -
|
| - if (!ensureNotNull(wrappingKey, "wrappingKey", result.get()))
|
| - return promise;
|
| -
|
| WebCryptoKeyFormat format;
|
| if (!CryptoKey::parseFormat(rawFormat, format, result.get()))
|
| return promise;
|
| @@ -423,11 +354,6 @@ ScriptPromise SubtleCrypto::unwrapKey(ScriptState* scriptState, const String& ra
|
| if (!canAccessWebCrypto(scriptState, result.get()))
|
| return promise;
|
|
|
| - if (!ensureNotNull(wrappedKey, "wrappedKey", result.get()))
|
| - return promise;
|
| - if (!ensureNotNull(unwrappingKey, "unwrappingKey", result.get()))
|
| - return promise;
|
| -
|
| WebCryptoKeyFormat format;
|
| if (!CryptoKey::parseFormat(rawFormat, format, result.get()))
|
| return promise;
|
| @@ -459,9 +385,6 @@ ScriptPromise SubtleCrypto::deriveBits(ScriptState* scriptState, const Algorithm
|
| if (!canAccessWebCrypto(scriptState, result.get()))
|
| return promise;
|
|
|
| - if (!ensureNotNull(baseKey, "baseKey", result.get()))
|
| - return promise;
|
| -
|
| WebCryptoAlgorithm algorithm;
|
| if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationDeriveBits, algorithm, result.get()))
|
| return promise;
|
| @@ -481,9 +404,6 @@ ScriptPromise SubtleCrypto::deriveKey(ScriptState* scriptState, const AlgorithmI
|
| if (!canAccessWebCrypto(scriptState, result.get()))
|
| return promise;
|
|
|
| - if (!ensureNotNull(baseKey, "baseKey", result.get()))
|
| - return promise;
|
| -
|
| WebCryptoKeyUsageMask keyUsages;
|
| if (!CryptoKey::parseUsageMask(rawKeyUsages, keyUsages, result.get()))
|
| return promise;
|
|
|