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

Side by Side Diff: third_party/WebKit/Source/bindings/modules/v8/serialization/V8ScriptValueSerializerForModulesTest.cpp

Issue 2509713002: binding: Makes Dictionary throw an exception (constructor). (Closed)
Patch Set: Addressed review comments. Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "bindings/modules/v8/serialization/V8ScriptValueSerializerForModules.h" 5 #include "bindings/modules/v8/serialization/V8ScriptValueSerializerForModules.h"
6 6
7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
8 #include "bindings/core/v8/ToV8.h" 8 #include "bindings/core/v8/ToV8.h"
9 #include "bindings/core/v8/V8ArrayBuffer.h" 9 #include "bindings/core/v8/V8ArrayBuffer.h"
10 #include "bindings/core/v8/V8BindingForTesting.h" 10 #include "bindings/core/v8/V8BindingForTesting.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 using CryptoKeyPair = std::pair<CryptoKey*, CryptoKey*>; 235 using CryptoKeyPair = std::pair<CryptoKey*, CryptoKey*>;
236 236
237 template <typename T> 237 template <typename T>
238 T convertCryptoResult(const ScriptValue&); 238 T convertCryptoResult(const ScriptValue&);
239 template <> 239 template <>
240 CryptoKey* convertCryptoResult<CryptoKey*>(const ScriptValue& value) { 240 CryptoKey* convertCryptoResult<CryptoKey*>(const ScriptValue& value) {
241 return V8CryptoKey::toImplWithTypeCheck(value.isolate(), value.v8Value()); 241 return V8CryptoKey::toImplWithTypeCheck(value.isolate(), value.v8Value());
242 } 242 }
243 template <> 243 template <>
244 CryptoKeyPair convertCryptoResult<CryptoKeyPair>(const ScriptValue& value) { 244 CryptoKeyPair convertCryptoResult<CryptoKeyPair>(const ScriptValue& value) {
245 Dictionary dictionary(value.isolate(), value.v8Value()); 245 NonThrowableExceptionState exceptionState;
246 Dictionary dictionary(value.isolate(), value.v8Value(), exceptionState);
246 v8::Local<v8::Value> privateKey, publicKey; 247 v8::Local<v8::Value> privateKey, publicKey;
247 EXPECT_TRUE(dictionary.get("publicKey", publicKey)); 248 EXPECT_TRUE(dictionary.get("publicKey", publicKey));
248 EXPECT_TRUE(dictionary.get("privateKey", privateKey)); 249 EXPECT_TRUE(dictionary.get("privateKey", privateKey));
249 return std::make_pair( 250 return std::make_pair(
250 V8CryptoKey::toImplWithTypeCheck(value.isolate(), publicKey), 251 V8CryptoKey::toImplWithTypeCheck(value.isolate(), publicKey),
251 V8CryptoKey::toImplWithTypeCheck(value.isolate(), privateKey)); 252 V8CryptoKey::toImplWithTypeCheck(value.isolate(), privateKey));
252 } 253 }
253 template <> 254 template <>
254 DOMException* convertCryptoResult<DOMException*>(const ScriptValue& value) { 255 DOMException* convertCryptoResult<DOMException*>(const ScriptValue& value) {
255 return V8DOMException::toImplWithTypeCheck(value.isolate(), value.v8Value()); 256 return V8DOMException::toImplWithTypeCheck(value.isolate(), value.v8Value());
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x65, 0x72, 0x73, 0x69, 961 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x65, 0x72, 0x73, 0x69,
961 0x73, 0x74, 0x65, 0x6e, 0x74, 0x2f 962 0x73, 0x74, 0x65, 0x6e, 0x74, 0x2f
962 963
963 })) 964 }))
964 .deserialize() 965 .deserialize()
965 ->IsNull()); 966 ->IsNull());
966 } 967 }
967 968
968 } // namespace 969 } // namespace
969 } // namespace blink 970 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698