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

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

Issue 2321073002: binding: Let indexed interceptor falls through to named interceptor. (Closed)
Patch Set: Updated global-interface-listing expectations. Created 4 years, 3 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/V8TestObject.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
index 178a144cb67aa65452417efa3cffc93b74a09fde..4f2af441da2054f4730cb395e2b0ad80e6897fee 100644
--- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
@@ -10958,157 +10958,165 @@ static void iteratorMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in
TestObjectV8Internal::iteratorMethod(info);
}
-static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
+static void namedPropertyGetter(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
+ ScriptState* scriptState = ScriptState::forReceiverObject(info);
+
TestObject* impl = V8TestObject::toImpl(info.Holder());
- ScriptState* scriptState = ScriptState::current(info.GetIsolate());
- ScriptValue result = impl->item(scriptState, index);
+ ScriptValue result = impl->anonymousNamedGetter(scriptState, name);
if (result.isEmpty())
return;
v8SetReturnValue(info, result.v8Value());
}
-void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
+void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
- TestObjectV8Internal::indexedPropertyGetter(index, info);
+ if (!name->IsString())
+ return;
+ const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
+
+ TestObjectV8Internal::namedPropertyGetter(propertyName, info);
}
-static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
+static void namedPropertySetter(const AtomicString& name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
+ ScriptState* scriptState = ScriptState::forReceiverObject(info);
+
TestObject* impl = V8TestObject::toImpl(info.Holder());
V8StringResource<> propertyValue = v8Value;
if (!propertyValue.prepare())
return;
- ScriptState* scriptState = ScriptState::current(info.GetIsolate());
- bool result = impl->setItem(scriptState, index, propertyValue);
+
+ bool result = impl->anonymousNamedSetter(scriptState, name, propertyValue);
if (!result)
return;
v8SetReturnValue(info, v8Value);
}
-void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
+void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
- TestObjectV8Internal::indexedPropertySetter(index, v8Value, info);
+ if (!name->IsString())
+ return;
+ const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
+
+ TestObjectV8Internal::namedPropertySetter(propertyName, v8Value, info);
}
-static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
+static void namedPropertyDeleter(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
{
+ ScriptState* scriptState = ScriptState::forReceiverObject(info);
+
TestObject* impl = V8TestObject::toImpl(info.Holder());
- ExceptionState exceptionState(ExceptionState::IndexedDeletionContext, "TestObject", info.Holder(), info.GetIsolate());
- ScriptState* scriptState = ScriptState::current(info.GetIsolate());
- DeleteResult result = impl->anonymousIndexedDeleter(scriptState, index, exceptionState);
- if (exceptionState.hadException())
+
+ DeleteResult result = impl->anonymousNamedDeleter(scriptState, name);
+ if (result == DeleteUnknownProperty)
return;
- if (result != DeleteUnknownProperty)
- return v8SetReturnValueBool(info, result == DeleteSuccess);
+ v8SetReturnValue(info, result == DeleteSuccess);
}
-void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
+void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
{
- TestObjectV8Internal::indexedPropertyDeleter(index, info);
+ if (!name->IsString())
+ return;
+ const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
+
+ TestObjectV8Internal::namedPropertyDeleter(propertyName, info);
}
-static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
+static void namedPropertyQuery(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Integer>& info)
{
- auto nameString = name.As<v8::String>();
+ const CString& nameInUtf8 = name.utf8();
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterContext, "TestObject", nameInUtf8.data());
+ ScriptState* scriptState = ScriptState::forReceiverObject(info);
+
TestObject* impl = V8TestObject::toImpl(info.Holder());
- AtomicString propertyName = toCoreAtomicString(nameString);
- ScriptState* scriptState = ScriptState::current(info.GetIsolate());
- ScriptValue result = impl->anonymousNamedGetter(scriptState, propertyName);
- if (result.isEmpty())
+
+ bool result = impl->namedPropertyQuery(scriptState, name, exceptionState);
+ if (!result)
return;
- v8SetReturnValue(info, result.v8Value());
+ v8SetReturnValueInt(info, v8::None);
}
-void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
+void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
{
if (!name->IsString())
return;
- TestObjectV8Internal::namedPropertyGetter(name, info);
+ const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
+
+ TestObjectV8Internal::namedPropertyQuery(propertyName, info);
}
-static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
+static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info)
{
- auto nameString = name.As<v8::String>();
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::EnumerationContext, "TestObject");
+
TestObject* impl = V8TestObject::toImpl(info.Holder());
- V8StringResource<> propertyName(nameString);
- if (!propertyName.prepare())
- return;
- V8StringResource<> propertyValue = v8Value;
- if (!propertyValue.prepare())
- return;
- ScriptState* scriptState = ScriptState::current(info.GetIsolate());
- bool result = impl->anonymousNamedSetter(scriptState, propertyName, propertyValue);
- if (!result)
+
+ Vector<String> names;
+ impl->namedPropertyEnumerator(names, exceptionState);
+ if (exceptionState.hadException())
return;
- v8SetReturnValue(info, v8Value);
+ v8SetReturnValue(info, toV8(names, info.Holder(), info.GetIsolate()).As<v8::Array>());
}
-void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
+void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info)
{
- if (!name->IsString())
- return;
- TestObjectV8Internal::namedPropertySetter(name, v8Value, info);
+ TestObjectV8Internal::namedPropertyEnumerator(info);
}
-static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
+static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestObject* impl = V8TestObject::toImpl(info.Holder());
- AtomicString propertyName = toCoreAtomicString(name.As<v8::String>());
- v8::String::Utf8Value namedProperty(name);
- ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestObject", info.Holder(), info.GetIsolate());
- ScriptState* scriptState = ScriptState::current(info.GetIsolate());
- bool result = impl->namedPropertyQuery(scriptState, propertyName, exceptionState);
- if (exceptionState.hadException())
- return;
- if (!result)
+
+ ScriptState* scriptState = ScriptState::forReceiverObject(info);
+ ScriptValue result = impl->item(scriptState, index);
+ if (result.isEmpty())
return;
- v8SetReturnValueInt(info, v8::None);
+ v8SetReturnValue(info, result.v8Value());
}
-void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
+void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
{
- if (!name->IsString())
- return;
- TestObjectV8Internal::namedPropertyQuery(name, info);
+ TestObjectV8Internal::indexedPropertyGetter(index, info);
}
-static void namedPropertyDeleter(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
+static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestObject* impl = V8TestObject::toImpl(info.Holder());
- AtomicString propertyName = toCoreAtomicString(name.As<v8::String>());
- ScriptState* scriptState = ScriptState::current(info.GetIsolate());
- DeleteResult result = impl->anonymousNamedDeleter(scriptState, propertyName);
- if (result != DeleteUnknownProperty)
- return v8SetReturnValueBool(info, result == DeleteSuccess);
+ V8StringResource<> propertyValue = v8Value;
+ if (!propertyValue.prepare())
+ return;
+
+ ScriptState* scriptState = ScriptState::forReceiverObject(info);
+ bool result = impl->setItem(scriptState, index, propertyValue);
+ if (!result)
+ return;
+ v8SetReturnValue(info, v8Value);
}
-void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
+void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
- if (!name->IsString())
- return;
- TestObjectV8Internal::namedPropertyDeleter(name, info);
+ TestObjectV8Internal::indexedPropertySetter(index, v8Value, info);
}
-static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info)
+static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
{
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedDeletionContext, "TestObject");
+
TestObject* impl = V8TestObject::toImpl(info.Holder());
- Vector<String> names;
- ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestObject", info.Holder(), info.GetIsolate());
- impl->namedPropertyEnumerator(names, exceptionState);
+
+ ScriptState* scriptState = ScriptState::forReceiverObject(info);
+ DeleteResult result = impl->anonymousIndexedDeleter(scriptState, index, exceptionState);
if (exceptionState.hadException())
return;
- v8::Local<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size());
- for (size_t i = 0; i < names.size(); ++i) {
- if (!v8CallBoolean(v8names->CreateDataProperty(info.GetIsolate()->GetCurrentContext(), i, v8String(info.GetIsolate(), names[i]))))
- return;
- }
- v8SetReturnValue(info, v8names);
+ if (result == DeleteUnknownProperty)
+ return;
+ v8SetReturnValue(info, result == DeleteSuccess);
}
-void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info)
+void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
{
- TestObjectV8Internal::namedPropertyEnumerator(info);
+ TestObjectV8Internal::indexedPropertyDeleter(index, info);
}
} // namespace TestObjectV8Internal

Powered by Google App Engine
This is Rietveld 408576698