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

Side by Side Diff: Source/bindings/modules/v8/custom/V8SubtleCryptoCustom.cpp

Issue 660243003: v8::Handle should be replaced with v8::Local in Source/bindings/modules (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git/+/master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « Source/bindings/modules/v8/custom/V8SQLTransactionCustom.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "bindings/modules/v8/V8SubtleCrypto.h" 6 #include "bindings/modules/v8/V8SubtleCrypto.h"
7 7
8 #include "bindings/core/v8/Dictionary.h" 8 #include "bindings/core/v8/Dictionary.h"
9 #include "bindings/core/v8/custom/V8ArrayBufferCustom.h" 9 #include "bindings/core/v8/custom/V8ArrayBufferCustom.h"
10 #include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" 10 #include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h"
11 #include "bindings/modules/v8/V8CryptoKey.h" 11 #include "bindings/modules/v8/V8CryptoKey.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 //////////////////////////////////////////////////////////////////////////////// 15 ////////////////////////////////////////////////////////////////////////////////
16 // Overload resolution for verify() 16 // Overload resolution for verify()
17 // FIXME: needs support for union types http://crbug.com/240176 17 // FIXME: needs support for union types http://crbug.com/240176
18 //////////////////////////////////////////////////////////////////////////////// 18 ////////////////////////////////////////////////////////////////////////////////
19 19
20 // Promise verify(Dictionary algorithm, CryptoKey key, ArrayBuffer signature, Ar rayBuffer data); 20 // Promise verify(Dictionary algorithm, CryptoKey key, ArrayBuffer signature, Ar rayBuffer data);
21 void verify1Method(const v8::FunctionCallbackInfo<v8::Value>& info) 21 void verify1Method(const v8::FunctionCallbackInfo<v8::Value>& info)
22 { 22 {
23 SubtleCrypto* impl = V8SubtleCrypto::toImpl(info.Holder()); 23 SubtleCrypto* impl = V8SubtleCrypto::toImpl(info.Holder());
24 TONATIVE_VOID(Dictionary, algorithm, Dictionary(info[0], info.GetIsolate())) ; 24 TONATIVE_VOID(Dictionary, algorithm, Dictionary(info[0], info.GetIsolate())) ;
25 if (!algorithm.isUndefinedOrNull() && !algorithm.isObject()) { 25 if (!algorithm.isUndefinedOrNull() && !algorithm.isObject()) {
26 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute("ver ify", "SubtleCrypto", "parameter 1 ('algorithm') is not an object."), info.GetIs olate()); 26 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute("ver ify", "SubtleCrypto", "parameter 1 ('algorithm') is not an object."), info.GetIs olate());
27 return; 27 return;
28 } 28 }
29 TONATIVE_VOID(CryptoKey*, key, V8CryptoKey::toImplWithTypeCheck(info.GetIsol ate(), info[1])); 29 TONATIVE_VOID(CryptoKey*, key, V8CryptoKey::toImplWithTypeCheck(info.GetIsol ate(), info[1]));
30 TONATIVE_VOID(ArrayBuffer*, signature, info[2]->IsArrayBuffer() ? V8ArrayBuf fer::toImpl(v8::Handle<v8::ArrayBuffer>::Cast(info[2])) : 0); 30 TONATIVE_VOID(ArrayBuffer*, signature, info[2]->IsArrayBuffer() ? V8ArrayBuf fer::toImpl(v8::Local<v8::ArrayBuffer>::Cast(info[2])) : 0);
31 TONATIVE_VOID(ArrayBuffer*, data, info[3]->IsArrayBuffer() ? V8ArrayBuffer:: toImpl(v8::Handle<v8::ArrayBuffer>::Cast(info[3])) : 0); 31 TONATIVE_VOID(ArrayBuffer*, data, info[3]->IsArrayBuffer() ? V8ArrayBuffer:: toImpl(v8::Local<v8::ArrayBuffer>::Cast(info[3])) : 0);
32 v8SetReturnValue(info, impl->verifySignature(ScriptState::current(info.GetIs olate()), algorithm, key, signature, data).v8Value()); 32 v8SetReturnValue(info, impl->verifySignature(ScriptState::current(info.GetIs olate()), algorithm, key, signature, data).v8Value());
33 } 33 }
34 34
35 // Promise verify(Dictionary algorithm, CryptoKey key, ArrayBuffer signature, Ar rayBufferView data); 35 // Promise verify(Dictionary algorithm, CryptoKey key, ArrayBuffer signature, Ar rayBufferView data);
36 void verify2Method(const v8::FunctionCallbackInfo<v8::Value>& info) 36 void verify2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
37 { 37 {
38 SubtleCrypto* impl = V8SubtleCrypto::toImpl(info.Holder()); 38 SubtleCrypto* impl = V8SubtleCrypto::toImpl(info.Holder());
39 TONATIVE_VOID(Dictionary, algorithm, Dictionary(info[0], info.GetIsolate())) ; 39 TONATIVE_VOID(Dictionary, algorithm, Dictionary(info[0], info.GetIsolate())) ;
40 if (!algorithm.isUndefinedOrNull() && !algorithm.isObject()) { 40 if (!algorithm.isUndefinedOrNull() && !algorithm.isObject()) {
41 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute("ver ify", "SubtleCrypto", "parameter 1 ('algorithm') is not an object."), info.GetIs olate()); 41 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute("ver ify", "SubtleCrypto", "parameter 1 ('algorithm') is not an object."), info.GetIs olate());
42 return; 42 return;
43 } 43 }
44 TONATIVE_VOID(CryptoKey*, key, V8CryptoKey::toImplWithTypeCheck(info.GetIsol ate(), info[1])); 44 TONATIVE_VOID(CryptoKey*, key, V8CryptoKey::toImplWithTypeCheck(info.GetIsol ate(), info[1]));
45 TONATIVE_VOID(ArrayBuffer*, signature, info[2]->IsArrayBuffer() ? V8ArrayBuf fer::toImpl(v8::Handle<v8::ArrayBuffer>::Cast(info[2])) : 0); 45 TONATIVE_VOID(ArrayBuffer*, signature, info[2]->IsArrayBuffer() ? V8ArrayBuf fer::toImpl(v8::Local<v8::ArrayBuffer>::Cast(info[2])) : 0);
46 TONATIVE_VOID(ArrayBufferView*, data, info[3]->IsArrayBufferView() ? V8Array BufferView::toImpl(v8::Handle<v8::ArrayBufferView>::Cast(info[3])) : 0); 46 TONATIVE_VOID(ArrayBufferView*, data, info[3]->IsArrayBufferView() ? V8Array BufferView::toImpl(v8::Local<v8::ArrayBufferView>::Cast(info[3])) : 0);
47 v8SetReturnValue(info, impl->verifySignature(ScriptState::current(info.GetIs olate()), algorithm, key, signature, data).v8Value()); 47 v8SetReturnValue(info, impl->verifySignature(ScriptState::current(info.GetIs olate()), algorithm, key, signature, data).v8Value());
48 } 48 }
49 49
50 // Promise verify(Dictionary algorithm, CryptoKey key, ArrayBufferView signature , ArrayBuffer data); 50 // Promise verify(Dictionary algorithm, CryptoKey key, ArrayBufferView signature , ArrayBuffer data);
51 void verify3Method(const v8::FunctionCallbackInfo<v8::Value>& info) 51 void verify3Method(const v8::FunctionCallbackInfo<v8::Value>& info)
52 { 52 {
53 SubtleCrypto* impl = V8SubtleCrypto::toImpl(info.Holder()); 53 SubtleCrypto* impl = V8SubtleCrypto::toImpl(info.Holder());
54 TONATIVE_VOID(Dictionary, algorithm, Dictionary(info[0], info.GetIsolate())) ; 54 TONATIVE_VOID(Dictionary, algorithm, Dictionary(info[0], info.GetIsolate())) ;
55 if (!algorithm.isUndefinedOrNull() && !algorithm.isObject()) { 55 if (!algorithm.isUndefinedOrNull() && !algorithm.isObject()) {
56 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute("ver ify", "SubtleCrypto", "parameter 1 ('algorithm') is not an object."), info.GetIs olate()); 56 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute("ver ify", "SubtleCrypto", "parameter 1 ('algorithm') is not an object."), info.GetIs olate());
57 return; 57 return;
58 } 58 }
59 TONATIVE_VOID(CryptoKey*, key, V8CryptoKey::toImplWithTypeCheck(info.GetIsol ate(), info[1])); 59 TONATIVE_VOID(CryptoKey*, key, V8CryptoKey::toImplWithTypeCheck(info.GetIsol ate(), info[1]));
60 TONATIVE_VOID(ArrayBufferView*, signature, info[2]->IsArrayBufferView() ? V8 ArrayBufferView::toImpl(v8::Handle<v8::ArrayBufferView>::Cast(info[2])) : 0); 60 TONATIVE_VOID(ArrayBufferView*, signature, info[2]->IsArrayBufferView() ? V8 ArrayBufferView::toImpl(v8::Local<v8::ArrayBufferView>::Cast(info[2])) : 0);
61 TONATIVE_VOID(ArrayBuffer*, data, info[3]->IsArrayBuffer() ? V8ArrayBuffer:: toImpl(v8::Handle<v8::ArrayBuffer>::Cast(info[3])) : 0); 61 TONATIVE_VOID(ArrayBuffer*, data, info[3]->IsArrayBuffer() ? V8ArrayBuffer:: toImpl(v8::Local<v8::ArrayBuffer>::Cast(info[3])) : 0);
62 v8SetReturnValue(info, impl->verifySignature(ScriptState::current(info.GetIs olate()), algorithm, key, signature, data).v8Value()); 62 v8SetReturnValue(info, impl->verifySignature(ScriptState::current(info.GetIs olate()), algorithm, key, signature, data).v8Value());
63 } 63 }
64 64
65 // Promise verify(Dictionary algorithm, CryptoKey key, ArrayBufferView signature , ArrayBufferView data); 65 // Promise verify(Dictionary algorithm, CryptoKey key, ArrayBufferView signature , ArrayBufferView data);
66 void verify4Method(const v8::FunctionCallbackInfo<v8::Value>& info) 66 void verify4Method(const v8::FunctionCallbackInfo<v8::Value>& info)
67 { 67 {
68 SubtleCrypto* impl = V8SubtleCrypto::toImpl(info.Holder()); 68 SubtleCrypto* impl = V8SubtleCrypto::toImpl(info.Holder());
69 TONATIVE_VOID(Dictionary, algorithm, Dictionary(info[0], info.GetIsolate())) ; 69 TONATIVE_VOID(Dictionary, algorithm, Dictionary(info[0], info.GetIsolate())) ;
70 if (!algorithm.isUndefinedOrNull() && !algorithm.isObject()) { 70 if (!algorithm.isUndefinedOrNull() && !algorithm.isObject()) {
71 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute("ver ify", "SubtleCrypto", "parameter 1 ('algorithm') is not an object."), info.GetIs olate()); 71 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute("ver ify", "SubtleCrypto", "parameter 1 ('algorithm') is not an object."), info.GetIs olate());
72 return; 72 return;
73 } 73 }
74 TONATIVE_VOID(CryptoKey*, key, V8CryptoKey::toImplWithTypeCheck(info.GetIsol ate(), info[1])); 74 TONATIVE_VOID(CryptoKey*, key, V8CryptoKey::toImplWithTypeCheck(info.GetIsol ate(), info[1]));
75 TONATIVE_VOID(ArrayBufferView*, signature, info[2]->IsArrayBufferView() ? V8 ArrayBufferView::toImpl(v8::Handle<v8::ArrayBufferView>::Cast(info[2])) : 0); 75 TONATIVE_VOID(ArrayBufferView*, signature, info[2]->IsArrayBufferView() ? V8 ArrayBufferView::toImpl(v8::Local<v8::ArrayBufferView>::Cast(info[2])) : 0);
76 TONATIVE_VOID(ArrayBufferView*, data, info[3]->IsArrayBufferView() ? V8Array BufferView::toImpl(v8::Handle<v8::ArrayBufferView>::Cast(info[3])) : 0); 76 TONATIVE_VOID(ArrayBufferView*, data, info[3]->IsArrayBufferView() ? V8Array BufferView::toImpl(v8::Local<v8::ArrayBufferView>::Cast(info[3])) : 0);
77 v8SetReturnValue(info, impl->verifySignature(ScriptState::current(info.GetIs olate()), algorithm, key, signature, data).v8Value()); 77 v8SetReturnValue(info, impl->verifySignature(ScriptState::current(info.GetIs olate()), algorithm, key, signature, data).v8Value());
78 } 78 }
79 79
80 void V8SubtleCrypto::verifyMethodCustom(const v8::FunctionCallbackInfo<v8::Value >& info) 80 void V8SubtleCrypto::verifyMethodCustom(const v8::FunctionCallbackInfo<v8::Value >& info)
81 { 81 {
82 v8::Isolate* isolate = info.GetIsolate(); 82 v8::Isolate* isolate = info.GetIsolate();
83 ExceptionState exceptionState(ExceptionState::ExecutionContext, "verify", "S ubtleCrypto", info.Holder(), isolate); 83 ExceptionState exceptionState(ExceptionState::ExecutionContext, "verify", "S ubtleCrypto", info.Holder(), isolate);
84 // typedef (ArrayBuffer or ArrayBufferView) CryptoOperationData; 84 // typedef (ArrayBuffer or ArrayBufferView) CryptoOperationData;
85 // 85 //
86 // Promise verify(Dictionary algorithm, CryptoKey key, 86 // Promise verify(Dictionary algorithm, CryptoKey key,
(...skipping 30 matching lines...) Expand all
117 setArityTypeError(exceptionState, "[4]", info.Length()); 117 setArityTypeError(exceptionState, "[4]", info.Length());
118 exceptionState.throwIfNeeded(); 118 exceptionState.throwIfNeeded();
119 return; 119 return;
120 break; 120 break;
121 } 121 }
122 exceptionState.throwTypeError("No function was found that matched the signat ure provided."); 122 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
123 exceptionState.throwIfNeeded(); 123 exceptionState.throwIfNeeded();
124 } 124 }
125 125
126 } // namespace blink 126 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/modules/v8/custom/V8SQLTransactionCustom.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698