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

Unified Diff: Source/bindings/tests/results/modules/V8TestInterfacePartial.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, 9 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
Index: Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp
diff --git a/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp b/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp
index ce85958b6117668f272894090421a464a8fa82f5..ec7de0f80a9d21077924420b5c45f4ee712f6ffa 100644
--- a/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp
+++ b/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp
@@ -233,9 +233,12 @@ static void partialVoidTestEnumModulesArgMethodMethod(const v8::FunctionCallback
arg = info[0];
if (!arg.prepare())
return;
- String string = arg;
- if (!(string == "EnumModulesValue1" || string == "EnumModulesValue2")) {
- V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("partialVoidTestEnumModulesArgMethod", "TestInterface", "parameter 1 ('" + string + "') is not a valid enum value."));
+ const char* validValues[] = {
+ "EnumModulesValue1",
+ "EnumModulesValue2",
+ };
+ if (!isValidEnum(arg, validValues, 2)) {
+ V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("partialVoidTestEnumModulesArgMethod", "TestInterface", "parameter 1 is not a valid enum value."));
return;
}
}

Powered by Google App Engine
This is Rietveld 408576698