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

Side by Side Diff: Source/bindings/tests/results/core/V8TestDictionary.cpp

Issue 1047993002: bindings: Add validation for enum Sequence or Array (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
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 "V8TestDictionary.h" 8 #include "V8TestDictionary.h"
9 9
10 #include "bindings/core/v8/ExceptionState.h" 10 #include "bindings/core/v8/ExceptionState.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 if (block.HasCaught()) { 123 if (block.HasCaught()) {
124 exceptionState.rethrowV8Exception(block.Exception()); 124 exceptionState.rethrowV8Exception(block.Exception());
125 return; 125 return;
126 } 126 }
127 if (enumMemberValue.IsEmpty() || enumMemberValue->IsUndefined()) { 127 if (enumMemberValue.IsEmpty() || enumMemberValue->IsUndefined()) {
128 // Do nothing. 128 // Do nothing.
129 } else { 129 } else {
130 V8StringResource<> enumMember = enumMemberValue; 130 V8StringResource<> enumMember = enumMemberValue;
131 if (!enumMember.prepare(exceptionState)) 131 if (!enumMember.prepare(exceptionState))
132 return; 132 return;
133 String string = enumMember; 133 static const char* validValues[] = {
134 if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" | | string == "EnumValue3")) { 134 "",
135 exceptionState.throwTypeError("member enumMember ('" + string + "') is not a valid enum value."); 135 "EnumValue1",
136 "EnumValue2",
137 "EnumValue3",
138 };
139 if (!isValidEnum(enumMember, validValues, WTF_ARRAY_LENGTH(validValues)) ) {
140 exceptionState.throwTypeError("member enumMember ('" + toCoreString( isolate, enumMemberValue) + "') is not a valid enum value.");
haraken 2015/04/01 00:29:45 Can we just use enumMember (not toCoreString(enumM
bashi 2015/04/01 00:50:57 I don't think we want to do it because it requires
136 return; 141 return;
137 } 142 }
138 impl.setEnumMember(enumMember); 143 impl.setEnumMember(enumMember);
139 } 144 }
140 145
141 v8::Local<v8::Value> eventTargetMemberValue = v8Object->Get(v8String(isolate , "eventTargetMember")); 146 v8::Local<v8::Value> eventTargetMemberValue = v8Object->Get(v8String(isolate , "eventTargetMember"));
142 if (block.HasCaught()) { 147 if (block.HasCaught()) {
143 exceptionState.rethrowV8Exception(block.Exception()); 148 exceptionState.rethrowV8Exception(block.Exception());
144 return; 149 return;
145 } 150 }
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 } 595 }
591 596
592 TestDictionary NativeValueTraits<TestDictionary>::nativeValue(v8::Isolate* isola te, v8::Local<v8::Value> value, ExceptionState& exceptionState) 597 TestDictionary NativeValueTraits<TestDictionary>::nativeValue(v8::Isolate* isola te, v8::Local<v8::Value> value, ExceptionState& exceptionState)
593 { 598 {
594 TestDictionary impl; 599 TestDictionary impl;
595 V8TestDictionary::toImpl(isolate, value, impl, exceptionState); 600 V8TestDictionary::toImpl(isolate, value, impl, exceptionState);
596 return impl; 601 return impl;
597 } 602 }
598 603
599 } // namespace blink 604 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698