Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Unified Diff: Source/bindings/v8/custom/V8SubtleCryptoCustom.cpp

Issue 331373002: Split bindings/v8/custom into core and modules. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/v8/custom/V8StyleSheetCustom.cpp ('k') | Source/bindings/v8/custom/V8TextCustom.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/custom/V8SubtleCryptoCustom.cpp
diff --git a/Source/bindings/v8/custom/V8SubtleCryptoCustom.cpp b/Source/bindings/v8/custom/V8SubtleCryptoCustom.cpp
deleted file mode 100644
index b40d0764a5e1931074308d57e3d48743ee4dfad7..0000000000000000000000000000000000000000
--- a/Source/bindings/v8/custom/V8SubtleCryptoCustom.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-#include "bindings/modules/v8/V8SubtleCrypto.h"
-
-#include "bindings/modules/v8/V8CryptoKey.h"
-#include "bindings/v8/Dictionary.h"
-#include "bindings/v8/custom/V8ArrayBufferCustom.h"
-#include "bindings/v8/custom/V8ArrayBufferViewCustom.h"
-
-namespace WebCore {
-
-////////////////////////////////////////////////////////////////////////////////
-// Overload resolution for verify()
-// FIXME: needs support for union types http://crbug.com/240176
-////////////////////////////////////////////////////////////////////////////////
-
-// Promise verify(Dictionary algorithm, CryptoKey key, ArrayBuffer signature, ArrayBuffer data);
-void verify1Method(const v8::FunctionCallbackInfo<v8::Value>& info)
-{
- SubtleCrypto* impl = V8SubtleCrypto::toNative(info.Holder());
- TONATIVE_VOID(Dictionary, algorithm, Dictionary(info[0], info.GetIsolate()));
- if (!algorithm.isUndefinedOrNull() && !algorithm.isObject()) {
- throwTypeError(ExceptionMessages::failedToExecute("verify", "SubtleCrypto", "parameter 1 ('algorithm') is not an object."), info.GetIsolate());
- return;
- }
- TONATIVE_VOID(CryptoKey*, key, V8CryptoKey::toNativeWithTypeCheck(info.GetIsolate(), info[1]));
- TONATIVE_VOID(ArrayBuffer*, signature, info[2]->IsArrayBuffer() ? V8ArrayBuffer::toNative(v8::Handle<v8::ArrayBuffer>::Cast(info[2])) : 0);
- TONATIVE_VOID(ArrayBuffer*, data, info[3]->IsArrayBuffer() ? V8ArrayBuffer::toNative(v8::Handle<v8::ArrayBuffer>::Cast(info[3])) : 0);
- v8SetReturnValue(info, impl->verifySignature(ScriptState::current(info.GetIsolate()), algorithm, key, signature, data).v8Value());
-}
-
-// Promise verify(Dictionary algorithm, CryptoKey key, ArrayBuffer signature, ArrayBufferView data);
-void verify2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
-{
- SubtleCrypto* impl = V8SubtleCrypto::toNative(info.Holder());
- TONATIVE_VOID(Dictionary, algorithm, Dictionary(info[0], info.GetIsolate()));
- if (!algorithm.isUndefinedOrNull() && !algorithm.isObject()) {
- throwTypeError(ExceptionMessages::failedToExecute("verify", "SubtleCrypto", "parameter 1 ('algorithm') is not an object."), info.GetIsolate());
- return;
- }
- TONATIVE_VOID(CryptoKey*, key, V8CryptoKey::toNativeWithTypeCheck(info.GetIsolate(), info[1]));
- TONATIVE_VOID(ArrayBuffer*, signature, info[2]->IsArrayBuffer() ? V8ArrayBuffer::toNative(v8::Handle<v8::ArrayBuffer>::Cast(info[2])) : 0);
- TONATIVE_VOID(ArrayBufferView*, data, info[3]->IsArrayBufferView() ? V8ArrayBufferView::toNative(v8::Handle<v8::ArrayBufferView>::Cast(info[3])) : 0);
- v8SetReturnValue(info, impl->verifySignature(ScriptState::current(info.GetIsolate()), algorithm, key, signature, data).v8Value());
-}
-
-// Promise verify(Dictionary algorithm, CryptoKey key, ArrayBufferView signature, ArrayBuffer data);
-void verify3Method(const v8::FunctionCallbackInfo<v8::Value>& info)
-{
- SubtleCrypto* impl = V8SubtleCrypto::toNative(info.Holder());
- TONATIVE_VOID(Dictionary, algorithm, Dictionary(info[0], info.GetIsolate()));
- if (!algorithm.isUndefinedOrNull() && !algorithm.isObject()) {
- throwTypeError(ExceptionMessages::failedToExecute("verify", "SubtleCrypto", "parameter 1 ('algorithm') is not an object."), info.GetIsolate());
- return;
- }
- TONATIVE_VOID(CryptoKey*, key, V8CryptoKey::toNativeWithTypeCheck(info.GetIsolate(), info[1]));
- TONATIVE_VOID(ArrayBufferView*, signature, info[2]->IsArrayBufferView() ? V8ArrayBufferView::toNative(v8::Handle<v8::ArrayBufferView>::Cast(info[2])) : 0);
- TONATIVE_VOID(ArrayBuffer*, data, info[3]->IsArrayBuffer() ? V8ArrayBuffer::toNative(v8::Handle<v8::ArrayBuffer>::Cast(info[3])) : 0);
- v8SetReturnValue(info, impl->verifySignature(ScriptState::current(info.GetIsolate()), algorithm, key, signature, data).v8Value());
-}
-
-// Promise verify(Dictionary algorithm, CryptoKey key, ArrayBufferView signature, ArrayBufferView data);
-void verify4Method(const v8::FunctionCallbackInfo<v8::Value>& info)
-{
- SubtleCrypto* impl = V8SubtleCrypto::toNative(info.Holder());
- TONATIVE_VOID(Dictionary, algorithm, Dictionary(info[0], info.GetIsolate()));
- if (!algorithm.isUndefinedOrNull() && !algorithm.isObject()) {
- throwTypeError(ExceptionMessages::failedToExecute("verify", "SubtleCrypto", "parameter 1 ('algorithm') is not an object."), info.GetIsolate());
- return;
- }
- TONATIVE_VOID(CryptoKey*, key, V8CryptoKey::toNativeWithTypeCheck(info.GetIsolate(), info[1]));
- TONATIVE_VOID(ArrayBufferView*, signature, info[2]->IsArrayBufferView() ? V8ArrayBufferView::toNative(v8::Handle<v8::ArrayBufferView>::Cast(info[2])) : 0);
- TONATIVE_VOID(ArrayBufferView*, data, info[3]->IsArrayBufferView() ? V8ArrayBufferView::toNative(v8::Handle<v8::ArrayBufferView>::Cast(info[3])) : 0);
- v8SetReturnValue(info, impl->verifySignature(ScriptState::current(info.GetIsolate()), algorithm, key, signature, data).v8Value());
-}
-
-void V8SubtleCrypto::verifyMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
-{
- v8::Isolate* isolate = info.GetIsolate();
- ExceptionState exceptionState(ExceptionState::ExecutionContext, "verify", "SubtleCrypto", info.Holder(), isolate);
- // typedef (ArrayBuffer or ArrayBufferView) CryptoOperationData;
- //
- // Promise verify(Dictionary algorithm, CryptoKey key,
- // CryptoOperationData signature,
- // CryptoOperationData data);
- switch (info.Length()) {
- case 4:
- // Promise verify(Dictionary algorithm, CryptoKey key, ArrayBuffer signature, ArrayBuffer data);
- if (V8ArrayBuffer::hasInstance(info[2], isolate)
- && V8ArrayBuffer::hasInstance(info[3], isolate)) {
- verify1Method(info);
- return;
- }
- // Promise verify(Dictionary algorithm, CryptoKey key, ArrayBuffer signature, ArrayBufferView data);
- if (V8ArrayBuffer::hasInstance(info[2], isolate)
- && V8ArrayBufferView::hasInstance(info[3], isolate)) {
- verify2Method(info);
- return;
- }
- // Promise verify(Dictionary algorithm, CryptoKey key, ArrayBufferView signature, ArrayBuffer data);
- if (V8ArrayBufferView::hasInstance(info[2], isolate)
- && V8ArrayBuffer::hasInstance(info[3], isolate)) {
- verify3Method(info);
- return;
- }
- // Promise verify(Dictionary algorithm, CryptoKey key, ArrayBufferView signature, ArrayBufferView data);
- if (V8ArrayBufferView::hasInstance(info[2], isolate)
- && V8ArrayBufferView::hasInstance(info[3], isolate)) {
- verify4Method(info);
- return;
- }
- break;
- default:
- throwArityTypeError(exceptionState, "[4]", info.Length());
- return;
- break;
- }
- exceptionState.throwTypeError("No function was found that matched the signature provided.");
- exceptionState.throwIfNeeded();
-}
-
-} // namespace WebCore
« no previous file with comments | « Source/bindings/v8/custom/V8StyleSheetCustom.cpp ('k') | Source/bindings/v8/custom/V8TextCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698