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/tests/results/core/V8TestDictionaryDerived.cpp

Issue 724733002: Support for [Clamp] and [EnforceRange] to IDL dictionary. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 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 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6 6
7 #include "config.h" 7 #include "config.h"
8 #include "V8TestDictionaryDerivedImplementedAs.h" 8 #include "V8TestDictionaryDerivedImplementedAs.h"
9 9
10 #include "bindings/core/v8/Dictionary.h"
11 #include "bindings/core/v8/ExceptionState.h" 10 #include "bindings/core/v8/ExceptionState.h"
12 #include "bindings/core/v8/V8TestDictionary.h" 11 #include "bindings/core/v8/V8TestDictionary.h"
13 12
14 namespace blink { 13 namespace blink {
15 14
16 void V8TestDictionaryDerivedImplementedAs::toImpl(v8::Isolate* isolate, v8::Hand le<v8::Value> v8Value, TestDictionaryDerivedImplementedAs& impl, ExceptionState& exceptionState) 15 void V8TestDictionaryDerivedImplementedAs::toImpl(v8::Isolate* isolate, v8::Hand le<v8::Value> v8Value, TestDictionaryDerivedImplementedAs& impl, ExceptionState& exceptionState)
17 { 16 {
18 if (isUndefinedOrNull(v8Value)) 17 if (isUndefinedOrNull(v8Value))
19 return; 18 return;
20 if (!v8Value->IsObject()) { 19 if (!v8Value->IsObject()) {
21 exceptionState.throwTypeError("cannot convert to dictionary."); 20 exceptionState.throwTypeError("cannot convert to dictionary.");
22 return; 21 return;
23 } 22 }
24 23
25 V8TestDictionary::toImpl(isolate, v8Value, impl, exceptionState); 24 V8TestDictionary::toImpl(isolate, v8Value, impl, exceptionState);
26 if (exceptionState.hadException()) 25 if (exceptionState.hadException())
27 return; 26 return;
28 27
29 // FIXME: Do not use Dictionary and DictionaryHelper 28 v8::Local<v8::Object> v8Object = v8Value->ToObject(isolate);
30 // https://crbug.com/321462
31 Dictionary dictionary(v8Value, isolate);
32 // FIXME: Remove this v8::TryCatch once the code is switched from
33 // Dictionary/DictionaryHelper to something that uses ExceptionState.
34 v8::TryCatch block; 29 v8::TryCatch block;
35 String derivedStringMember; 30 v8::Local<v8::Value> derivedStringMemberValue = v8Object->Get(v8String(isola te, "derivedStringMember"));
36 if (DictionaryHelper::getWithUndefinedOrNullCheck(dictionary, "derivedString Member", derivedStringMember)) { 31 if (!derivedStringMemberValue.IsEmpty() && !isUndefinedOrNull(derivedStringM emberValue)) {
32 TOSTRING_VOID(V8StringResource<>, derivedStringMember, derivedStringMemb erValue);
37 impl.setDerivedStringMember(derivedStringMember); 33 impl.setDerivedStringMember(derivedStringMember);
38 } else if (block.HasCaught()) { 34 } else if (block.HasCaught()) {
39 exceptionState.rethrowV8Exception(block.Exception()); 35 exceptionState.rethrowV8Exception(block.Exception());
40 return; 36 return;
41 } 37 }
42 38
43 String derivedStringMemberWithDefault; 39 v8::Local<v8::Value> derivedStringMemberWithDefaultValue = v8Object->Get(v8S tring(isolate, "derivedStringMemberWithDefault"));
44 if (DictionaryHelper::getWithUndefinedOrNullCheck(dictionary, "derivedString MemberWithDefault", derivedStringMemberWithDefault)) { 40 if (!derivedStringMemberWithDefaultValue.IsEmpty() && !isUndefinedOrNull(der ivedStringMemberWithDefaultValue)) {
41 TOSTRING_VOID(V8StringResource<>, derivedStringMemberWithDefault, derive dStringMemberWithDefaultValue);
45 impl.setDerivedStringMemberWithDefault(derivedStringMemberWithDefault); 42 impl.setDerivedStringMemberWithDefault(derivedStringMemberWithDefault);
46 } else if (block.HasCaught()) { 43 } else if (block.HasCaught()) {
47 exceptionState.rethrowV8Exception(block.Exception()); 44 exceptionState.rethrowV8Exception(block.Exception());
48 return; 45 return;
49 } 46 }
50 47
51 } 48 }
52 49
53 v8::Handle<v8::Value> toV8(TestDictionaryDerivedImplementedAs& impl, v8::Handle< v8::Object> creationContext, v8::Isolate* isolate) 50 v8::Handle<v8::Value> toV8(TestDictionaryDerivedImplementedAs& impl, v8::Handle< v8::Object> creationContext, v8::Isolate* isolate)
54 { 51 {
(...skipping 11 matching lines...) Expand all
66 63
67 if (impl.hasDerivedStringMemberWithDefault()) { 64 if (impl.hasDerivedStringMemberWithDefault()) {
68 dictionary->Set(v8String(isolate, "derivedStringMemberWithDefault"), v8S tring(isolate, impl.derivedStringMemberWithDefault())); 65 dictionary->Set(v8String(isolate, "derivedStringMemberWithDefault"), v8S tring(isolate, impl.derivedStringMemberWithDefault()));
69 } else { 66 } else {
70 dictionary->Set(v8String(isolate, "derivedStringMemberWithDefault"), v8S tring(isolate, String("default string value"))); 67 dictionary->Set(v8String(isolate, "derivedStringMemberWithDefault"), v8S tring(isolate, String("default string value")));
71 } 68 }
72 69
73 } 70 }
74 71
75 } // namespace blink 72 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/core/V8TestDictionary.cpp ('k') | Source/core/testing/DictionaryTest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698