| Index: Source/web/WebScriptBindings.cpp
|
| diff --git a/Source/web/WebScriptBindings.cpp b/Source/web/WebScriptBindings.cpp
|
| index 4377db6edd6a1f95dea7034983fa8f1a24557854..1452ed22126fa6b707be7a6ae39cbc0a49ced4f3 100644
|
| --- a/Source/web/WebScriptBindings.cpp
|
| +++ b/Source/web/WebScriptBindings.cpp
|
| @@ -31,8 +31,14 @@
|
| #include "config.h"
|
| #include "public/web/WebScriptBindings.h"
|
|
|
| +#include "bindings/v8/Dictionary.h"
|
| #include "bindings/v8/V8Binding.h"
|
| +#include "modules/crypto/CryptoResultImpl.h"
|
| +#include "modules/crypto/NormalizeAlgorithm.h"
|
| +#include "platform/CryptoResult.h"
|
| +#include "public/platform/WebCryptoAlgorithm.h"
|
| #include "public/platform/WebString.h"
|
| +#include <v8.h>
|
|
|
| using namespace WebCore;
|
|
|
| @@ -48,4 +54,20 @@ WebString WebScriptBindings::toWebString(v8::Handle<v8::String> v8String)
|
| return v8StringToWebCoreString<String>(v8String, Externalize);
|
| }
|
|
|
| +WebCryptoAlgorithm WebScriptBindings::normalizeCryptoAlgorithm(v8::Handle<v8::Object> algorithmObject, AlgorithmOperation operation, int* exceptionCode, WebString* errorDetails, v8::Isolate* isolate)
|
| +{
|
| + Dictionary algorithmDictionary = Dictionary(algorithmObject, isolate);
|
| + if (!algorithmDictionary.isUndefinedOrNull() && !algorithmDictionary.isObject())
|
| + return WebCryptoAlgorithm();
|
| + WebCryptoAlgorithm algorithm;
|
| + AlgorithmError error;
|
| + if (!normalizeAlgorithm(algorithmDictionary, operation, algorithm, &error)) {
|
| + *exceptionCode = webCryptoErrorToExceptionCode(error.errorType);
|
| + *errorDetails = error.errorDetails;
|
| + return WebCryptoAlgorithm();
|
| + }
|
| +
|
| + return algorithm;
|
| +}
|
| +
|
| } // namespace blink
|
|
|