Chromium Code Reviews| Index: Source/bindings/core/v8/CustomElementConstructorBuilder.cpp |
| diff --git a/Source/bindings/core/v8/CustomElementConstructorBuilder.cpp b/Source/bindings/core/v8/CustomElementConstructorBuilder.cpp |
| index 5c57589d4347430d49734e7ef2356cb345bae8ad..9b96d81dd1a9bb40caada754fb32dd1a3f80a339 100644 |
| --- a/Source/bindings/core/v8/CustomElementConstructorBuilder.cpp |
| +++ b/Source/bindings/core/v8/CustomElementConstructorBuilder.cpp |
| @@ -186,6 +186,8 @@ bool CustomElementConstructorBuilder::createConstructor(Document* document, Cust |
| V8HiddenValue::setHiddenValue(isolate, m_constructor, V8HiddenValue::customElementType(isolate), v8Type); |
| v8::Local<v8::String> prototypeKey = v8String(isolate, "prototype"); |
| + v8::Local<v8::String> constructorKey = v8String(isolate, "constructor"); |
|
dominicc (has gone to gerrit)
2015/04/09 06:37:57
Move this down near to where it is used.
deepak.s
2015/04/15 06:44:53
Done.
|
| + |
| if (!v8CallBoolean(m_constructor->HasOwnProperty(context, prototypeKey))) |
| return false; |
| // This sets the property *value*; calling Set is safe because |
| @@ -198,9 +200,12 @@ bool CustomElementConstructorBuilder::createConstructor(Document* document, Cust |
| // property. |
| if (!v8CallBoolean(m_constructor->ForceSet(context, prototypeKey, m_prototype, v8::PropertyAttribute(v8::ReadOnly | v8::DontEnum | v8::DontDelete)))) |
| return false; |
| + // The generated constructor should inherit from constructor. |
| + if (!v8CallBoolean(m_constructor->SetPrototype(context, m_prototype->Get(constructorKey)))) |
|
dominicc (has gone to gerrit)
2015/04/09 06:37:57
FYI It looks like the bool SetPrototype is depreca
|
| + return false; |
| V8HiddenValue::setHiddenValue(isolate, m_prototype, V8HiddenValue::customElementIsInterfacePrototypeObject(isolate), v8::True(isolate)); |
| - if (!v8CallBoolean(m_prototype->ForceSet(context, v8String(isolate, "constructor"), m_constructor, v8::DontEnum))) |
| + if (!v8CallBoolean(m_prototype->ForceSet(context, constructorKey, m_constructor, v8::DontEnum))) |
| return false; |
| return true; |