Chromium Code Reviews| Index: Source/bindings/tests/results/V8TestInterface.cpp |
| diff --git a/Source/bindings/tests/results/V8TestInterface.cpp b/Source/bindings/tests/results/V8TestInterface.cpp |
| index dfebb9591f2e498d74511fd65e5a82c64995e22e..86aa3e05ea6eeebae20822debb66c94e7cae3a93 100644 |
| --- a/Source/bindings/tests/results/V8TestInterface.cpp |
| +++ b/Source/bindings/tests/results/V8TestInterface.cpp |
| @@ -24,10 +24,12 @@ |
| #include "RuntimeEnabledFeatures.h" |
| #include "V8Node.h" |
| +#include "V8NodeList.h" |
| #include "V8TestObject.h" |
| #include "bindings/bindings/tests/idls/TestPartialInterface.h" |
| #include "bindings/v8/ScriptController.h" |
| #include "bindings/v8/V8Binding.h" |
| +#include "bindings/v8/V8Collection.h" |
| #include "bindings/v8/V8DOMConfiguration.h" |
| #include "bindings/v8/V8DOMWrapper.h" |
| #include "bindings/v8/V8ObjectConstructor.h" |
| @@ -519,6 +521,29 @@ v8::Handle<v8::Value> V8TestInterface::constructorCallback(const v8::Arguments& |
| return TestInterfaceV8Internal::constructor(args); |
| } |
| +v8::Handle<v8::Value> V8TestInterface::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) |
| +{ |
| + if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
| + return v8Undefined(); |
| + if (info.Holder()->HasRealNamedCallbackProperty(name)) |
| + return v8Undefined(); |
| + |
| + ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); |
| + TestInterface* collection = toNative(info.Holder()); |
| + AtomicString propertyName = toWebCoreAtomicString(name); |
| + RefPtr<Node> elementMember1; |
| + RefPtr<NodeList> elementMember2; |
| + collection->getItem(propertyName, elementMember1, elementMember2); |
| + if (!elementMember1 && !elementMember2) |
| + return v8Undefined(); |
| + if (elementMember1) |
| + return toV8Fast(elementMember1.release(), info, collection); |
| + if (elementMember2) |
| + return toV8Fast(elementMember2.release(), info, collection); |
| + ASSERT_NOT_REACHED(); |
|
haraken
2013/05/17 05:44:48
Can you write this like:
if (elementMember1)
|
| + return v8Undefined(); |
| +} |
| + |
| static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8::Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType currentWorldType) |
| { |
| desc->ReadOnlyPrototype(); |
| @@ -544,7 +569,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8: |
| } |
| #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| - desc->InstanceTemplate()->SetNamedPropertyHandler(0, V8TestInterface::namedPropertySetter, 0, 0, 0); |
| + desc->InstanceTemplate()->SetNamedPropertyHandler(V8TestInterface::namedPropertyGetter, V8TestInterface::namedPropertySetter, 0, 0, 0); |
| // Custom Signature 'supplementalMethod2' |
| const int supplementalMethod2Argc = 2; |