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

Unified Diff: third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp

Issue 2777183004: Make pair iterators inherit from %IteratorPrototype%. (Closed)
Patch Set: Rebased patch with tests Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp
index 35e8fab2aa1c37a12400370ecf1c6aafa81fd3eb..186e3c453cb66dc4092396b5ec09e1500cd58ad7 100644
--- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp
@@ -1886,6 +1886,77 @@ static void partial2StaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Va
(partial2StaticVoidMethodMethodForPartialInterface)(info);
}
+static void keysMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestInterface", "keys");
+
+ TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
+
+ ScriptState* scriptState = ScriptState::forReceiverObject(info);
+
+ Iterator* result = impl->keysForBinding(scriptState, exceptionState);
+ if (exceptionState.hadException()) {
+ return;
+ }
+ v8SetReturnValue(info, result);
+}
+
+static void valuesMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestInterface", "values");
+
+ TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
+
+ ScriptState* scriptState = ScriptState::forReceiverObject(info);
+
+ Iterator* result = impl->valuesForBinding(scriptState, exceptionState);
+ if (exceptionState.hadException()) {
+ return;
+ }
+ v8SetReturnValue(info, result);
+}
+
+static void entriesMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestInterface", "entries");
+
+ TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
+
+ ScriptState* scriptState = ScriptState::forReceiverObject(info);
+
+ Iterator* result = impl->entriesForBinding(scriptState, exceptionState);
+ if (exceptionState.hadException()) {
+ return;
+ }
+ v8SetReturnValue(info, result);
+}
+
+static void forEachMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestInterface", "forEach");
+
+ TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
+
+ ScriptState* scriptState = ScriptState::forReceiverObject(info);
+
+ if (UNLIKELY(info.Length() < 1)) {
+ exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
+ return;
+ }
+
+ ScriptValue callback;
+ ScriptValue thisArg;
+ if (!(info[0]->IsObject() && v8::Local<v8::Object>::Cast(info[0])->IsCallable())) {
+ exceptionState.throwTypeError("The callback provided as parameter 1 is not a function.");
+
+ return;
+ }
+ callback = ScriptValue(ScriptState::current(info.GetIsolate()), info[0]);
+
+ thisArg = ScriptValue(ScriptState::current(info.GetIsolate()), info[1]);
+
+ impl->forEachForBinding(scriptState, ScriptValue(scriptState, info.Holder()), callback, thisArg, exceptionState);
+ if (exceptionState.hadException()) {
+ return;
+ }
+}
+
static void toJSONMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestInterface", "toJSON");
@@ -2674,6 +2745,22 @@ void V8TestInterface::partial2StaticVoidMethodMethodCallback(const v8::FunctionC
TestInterfaceImplementationV8Internal::partial2StaticVoidMethodMethod(info);
}
+void V8TestInterface::keysMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ TestInterfaceImplementationV8Internal::keysMethod(info);
+}
+
+void V8TestInterface::valuesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ TestInterfaceImplementationV8Internal::valuesMethod(info);
+}
+
+void V8TestInterface::entriesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ TestInterfaceImplementationV8Internal::entriesMethod(info);
+}
+
+void V8TestInterface::forEachMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ TestInterfaceImplementationV8Internal::forEachMethod(info);
+}
+
void V8TestInterface::toJSONMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestInterfaceImplementationV8Internal::toJSONMethod(info);
}
@@ -2799,6 +2886,10 @@ static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceMethods[] =
{"staticPromiseMethodPartialOverload", V8TestInterface::staticPromiseMethodPartialOverloadMethodCallback, 0, v8::None, V8DOMConfiguration::OnInterface, V8DOMConfiguration::DoNotCheckHolder, V8DOMConfiguration::DoNotCheckAccess, V8DOMConfiguration::AllWorlds},
{"partial2VoidMethod", V8TestInterface::partial2VoidMethodMethodCallback, 0, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess, V8DOMConfiguration::AllWorlds},
{"partial2StaticVoidMethod", V8TestInterface::partial2StaticVoidMethodMethodCallback, 0, v8::None, V8DOMConfiguration::OnInterface, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess, V8DOMConfiguration::AllWorlds},
+ {"keys", V8TestInterface::keysMethodCallback, 0, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess, V8DOMConfiguration::AllWorlds},
+ {"values", V8TestInterface::valuesMethodCallback, 0, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess, V8DOMConfiguration::AllWorlds},
+ {"entries", V8TestInterface::entriesMethodCallback, 0, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess, V8DOMConfiguration::AllWorlds},
+ {"forEach", V8TestInterface::forEachMethodCallback, 1, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess, V8DOMConfiguration::AllWorlds},
{"toJSON", V8TestInterface::toJSONMethodCallback, 0, static_cast<v8::PropertyAttribute>(v8::DontEnum), V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess, V8DOMConfiguration::AllWorlds},
{"toString", V8TestInterface::toStringMethodCallback, 0, static_cast<v8::PropertyAttribute>(v8::DontEnum), V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess, V8DOMConfiguration::AllWorlds},
};

Powered by Google App Engine
This is Rietveld 408576698