Index: Source/bindings/core/v8/V8Binding.cpp |
diff --git a/Source/bindings/core/v8/V8Binding.cpp b/Source/bindings/core/v8/V8Binding.cpp |
index b288a2950186d5b88766aa9ae4837cccb0b2bdc9..b9c554fbe7499b42b57e6d7ec6e07144fe618997 100644 |
--- a/Source/bindings/core/v8/V8Binding.cpp |
+++ b/Source/bindings/core/v8/V8Binding.cpp |
@@ -778,6 +778,25 @@ void crashIfV8IsDead() |
} |
} |
+bool isValidEnum(const String value, const char** validValues, size_t length, ExceptionState& exceptionState) |
+{ |
+ for (size_t i = 0; i < length; ++i) { |
+ if (value == validValues[i]) |
+ return true; |
+ } |
+ exceptionState.throwTypeError("The provided value '" + value + "' is not a valid enum value."); |
+ return false; |
+} |
+ |
+bool isValidEnum(const Vector<String>& values, const char** validValues, size_t length, ExceptionState& exceptionState) |
+{ |
+ for (auto value : values) { |
+ if (!isValidEnum(value, validValues, length, exceptionState)) |
+ return false; |
+ } |
+ return true; |
+} |
+ |
v8::Handle<v8::Function> getBoundFunction(v8::Handle<v8::Function> function) |
{ |
v8::Handle<v8::Value> boundFunction = function->GetBoundFunction(); |