Chromium Code Reviews| Index: Source/web/WebScriptBindings.cpp |
| diff --git a/Source/web/WebScriptBindings.cpp b/Source/web/WebScriptBindings.cpp |
| index 4377db6edd6a1f95dea7034983fa8f1a24557854..0d18876a232f0d5f0f70b3447fcc8ae89318131c 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,21 @@ 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); |
| + v8::TryCatch block; |
|
pneubeck (no reviews)
2014/05/29 12:52:56
ignore this line, I will remove it once I have acc
|
| + if (!algorithmDictionary.isUndefinedOrNull() && !algorithmDictionary.isObject()) |
| + return WebCryptoAlgorithm(); |
| + WebCryptoAlgorithm algorithm; |
| + WebCore::AlgorithmError error; |
| + if (!WebCore::normalizeAlgorithm(algorithmDictionary, operation, algorithm, &error)) { |
| + *exceptionCode = toExceptionCode(error.errorType); |
| + *errorDetails = error.errorDetails; |
| + return WebCryptoAlgorithm(); |
| + } |
| + |
| + return algorithm; |
| +} |
| + |
| } // namespace blink |