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

Unified Diff: Source/bindings/templates/interface.cpp

Issue 110023002: IDL compiler: [InitializedByEventConstructor] attribute any (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years 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: Source/bindings/templates/interface.cpp
diff --git a/Source/bindings/templates/interface.cpp b/Source/bindings/templates/interface.cpp
index 840c85466e3499cc31c812480fc032b6bbec9950..56adcc537d462189ea57d7ea5c49401f4762675b 100644
--- a/Source/bindings/templates/interface.cpp
+++ b/Source/bindings/templates/interface.cpp
@@ -169,6 +169,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()));
@@ -177,8 +180,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 %}
+ {# 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). #}
+ if (isolatedWorldForIsolate(info.GetIsolate())) {
+ {% for attribute in attributes if attribute.idl_type == 'any' %}
+ if (!{{attribute.name}}.IsEmpty())
+ event->{{attribute.set_serialized_script_value}}(SerializedScriptValue::createAndSwallowExceptions({{attribute.name}}, info.GetIsolate()));
+ {% 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);
@@ -267,7 +289,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 #}
« no previous file with comments | « Source/bindings/scripts/unstable/v8_interface.py ('k') | Source/bindings/tests/idls/TestInterfaceEventConstructor.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698