Chromium Code Reviews| Index: Source/bindings/templates/interface.cpp |
| diff --git a/Source/bindings/templates/interface.cpp b/Source/bindings/templates/interface.cpp |
| index 3faad33a7801e8dea19b585b65a4fe21c9876583..3efbac714de51233fcd607033ebf1bce4eb87a55 100644 |
| --- a/Source/bindings/templates/interface.cpp |
| +++ b/Source/bindings/templates/interface.cpp |
| @@ -163,6 +163,9 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) |
| } |
| V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, type, info[0]); |
| + {% for attribute in attributes if attribute.idl_type == 'any' %} |
| + v8::Local<v8::Value> {{attribute.name}}; |
| + {% endfor %} |
| {{cpp_class}}Init eventInit; |
| if (info.Length() >= 2) { |
| V8TRYCATCH_VOID(Dictionary, options, Dictionary(info[1], info.GetIsolate())); |
| @@ -171,8 +174,27 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| + {# Store attributes of type |any| on the wrapper to avoid leaking them |
| + between isolated worlds. #} |
| + {% for attribute in attributes if attribute.idl_type == 'any' %} |
| + options.get("{{attribute.name}}", {{attribute.name}}); |
| + if (!{{attribute.name}}.IsEmpty()) |
| + info.Holder()->SetHiddenValue(V8HiddenPropertyName::{{attribute.name}}(info.GetIsolate()), {{attribute.name}}); |
| + {% endfor %} |
| } |
| RefPtr<{{cpp_class}}> event = {{cpp_class}}::create(type, eventInit); |
| + {% if has_any_type_attributes %} |
|
haraken
2013/12/09 08:37:00
Nit: You're passing the result of
any(attribute
Nils Barth (inactive)
2013/12/09 09:55:01
In this case, no, because we need to add a special
|
| + {# If we're in an isolated world, create a SerializedScriptValue and store |
| + it in the event for later cloning if the property is accessed from |
| + another world. The main world case is handled lazily (in Custom code). #} |
|
haraken
2013/12/09 08:37:00
Custom => custom
Nils Barth (inactive)
2013/12/09 09:55:01
Done.
|
| + if (isolatedWorldForIsolate(info.GetIsolate())) { |
| + {% for attribute in attributes if attribute.idl_type == 'any' %} |
| + if (!{{attribute.name}}.IsEmpty()) |
| + event->{{attribute.set_serialized}}(SerializedScriptValue::createAndSwallowExceptions({{attribute.name}}, info.GetIsolate())); |
|
haraken
2013/12/09 08:37:00
set_serialized => set_serialized_script_value (sin
Nils Barth (inactive)
2013/12/09 09:55:01
Done.
|
| + {% endfor %} |
| + } |
| + |
| + {% endif %} |
| v8::Handle<v8::Object> wrapper = info.Holder(); |
| V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(event.release(), &{{v8_class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent); |
| v8SetReturnValue(info, wrapper); |
| @@ -261,7 +283,8 @@ bool initialize{{cpp_class}}({{cpp_class}}Init& eventInit, const Dictionary& opt |
| {% endif %} |
| {% for attribute in attributes |
| - if attribute.is_initialized_by_event_constructor %} |
| + if (attribute.is_initialized_by_event_constructor and |
| + not attribute.idl_type == 'any')%} |
| {# FIXME: implement [ImplementedAs] #} |
| {# FIXME: implement [DeprecateAs] #} |
| {# FIXME: special-case any #} |