Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp |
| index 75998cd4faef55a876d90911f864e7accb3e9d9e..4db502835405957098b1f8af1d432fadf7c10e3a 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp |
| +++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp |
| @@ -166,11 +166,8 @@ void installAccessorInternal(v8::Isolate* isolate, v8::Local<ObjectOrTemplate> i |
| } |
| } |
| -void installConstantInternal(v8::Isolate* isolate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, const V8DOMConfiguration::ConstantConfiguration& constant) |
| +v8::Local<v8::Primitive> valueForConstant(v8::Isolate* isolate, const V8DOMConfiguration::ConstantConfiguration& constant) |
| { |
| - v8::Local<v8::String> constantName = v8AtomicString(isolate, constant.name); |
| - v8::PropertyAttribute attributes = |
| - static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); |
| v8::Local<v8::Primitive> value; |
| switch (constant.type) { |
| case V8DOMConfiguration::ConstantTypeShort: |
| @@ -188,10 +185,26 @@ void installConstantInternal(v8::Isolate* isolate, v8::Local<v8::FunctionTemplat |
| default: |
| NOTREACHED(); |
| } |
| + return value; |
| +} |
| + |
| +void installConstantInternal(v8::Isolate* isolate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, const V8DOMConfiguration::ConstantConfiguration& constant) |
| +{ |
| + v8::Local<v8::String> constantName = v8AtomicString(isolate, constant.name); |
| + v8::PropertyAttribute attributes = |
| + static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); |
| + v8::Local<v8::Primitive> value = valueForConstant(isolate, constant); |
| interfaceTemplate->Set(constantName, value, attributes); |
| prototypeTemplate->Set(constantName, value, attributes); |
| } |
| +void installConstantInternal(v8::Isolate* isolate, v8::Local<v8::Object> prototype, const V8DOMConfiguration::ConstantConfiguration& constant, const DOMWrapperWorld& world) |
|
haraken
2016/06/13 01:12:59
Why do you need to pass DOMWrapperWorld? It's unus
iclelland
2016/06/15 14:08:40
Not needed. removed. (Replaced with WrapperTypeInf
|
| +{ |
| + v8::Local<v8::Name> name = v8AtomicString(isolate, constant.name); |
| + v8::Local<v8::Primitive> value = valueForConstant(isolate, constant); |
| + v8CallOrCrash(prototype->DefineOwnProperty(isolate->GetCurrentContext(), name, value)); |
|
haraken
2016/06/13 01:12:59
Per the spec, constant must be defined on both pro
iclelland
2016/06/15 12:12:04
I'm adding them now on the object returned from co
Yuki
2016/06/15 12:32:11
Yes, the function object returned by constructorFo
iclelland
2016/06/15 14:08:41
I see, thanks. I'm not sure how to write a proper
|
| +} |
| + |
| template<class Configuration> |
| void installMethodInternal(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Local<v8::Signature> signature, const Configuration& method, const DOMWrapperWorld& world) |
| { |
| @@ -298,6 +311,11 @@ void V8DOMConfiguration::installConstant(v8::Isolate* isolate, v8::Local<v8::Fun |
| installConstantInternal(isolate, interfaceTemplate, prototypeTemplate, constant); |
| } |
| +void V8DOMConfiguration::installConstant(v8::Isolate* isolate, const DOMWrapperWorld& world, v8::Local<v8::Object> prototype, const ConstantConfiguration& constant) |
| +{ |
| + installConstantInternal(isolate, prototype, constant, world); |
| +} |
| + |
| void V8DOMConfiguration::installConstantWithGetter(v8::Isolate* isolate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, const char* name, v8::AccessorNameGetterCallback getter) |
| { |
| v8::Local<v8::String> constantName = v8AtomicString(isolate, name); |