Index: Source/bindings/scripts/unstable/v8_attributes.py |
diff --git a/Source/bindings/scripts/unstable/v8_attributes.py b/Source/bindings/scripts/unstable/v8_attributes.py |
index 56b14963983a8b4deef7524fcc81d2b27460dde3..9967cbd82fe6a730cc7770841299042ec5e4c66d 100644 |
--- a/Source/bindings/scripts/unstable/v8_attributes.py |
+++ b/Source/bindings/scripts/unstable/v8_attributes.py |
@@ -140,22 +140,28 @@ def generate_getter(interface, attribute, contents): |
cpp_value = getter_expression(interface, attribute, contents) |
# Normally we can inline the function call into the return statement to |
# avoid the overhead of using a Ref<> temporary, but for some cases |
- # (nullable types, EventHandler, [CachedAttribute], or if there are |
- # exceptions), we need to use a local variable. |
+ # (nullable types, [RaisesException], [CachedAttribute], and EventHandler) |
+ # we need to use a local variable. |
# FIXME: check if compilers are smart enough to inline this, and if so, |
# always use a local variable (for readability and CG simplicity). |
- if (attribute.is_nullable or |
- idl_type == 'EventHandler' or |
- 'CachedAttribute' in extended_attributes or |
- contents['is_getter_raises_exception']): |
+ if idl_type == 'EventHandler': |
+ contents['cpp_value_original'] = cpp_value |
+ cpp_rvalue = cpp_value = 'jsValue' |
+ elif (attribute.is_nullable or |
+ contents['is_getter_raises_exception'] or |
+ 'CachedAttribute' in extended_attributes): |
contents['cpp_value_original'] = cpp_value |
- cpp_value = 'jsValue' |
+ cpp_rvalue = cpp_value = 'jsValue' |
+ if v8_types.is_interface_type(idl_type): |
+ cpp_rvalue += '.release()' |
+ else: |
+ cpp_rvalue = cpp_value |
if contents['is_keep_alive_for_gc']: |
v8_set_return_value_statement = 'v8SetReturnValue(info, wrapper)' |
includes.add('bindings/v8/V8HiddenPropertyName.h') |
else: |
- v8_set_return_value_statement = v8_types.v8_set_return_value(idl_type, cpp_value, extended_attributes=extended_attributes, script_wrappable='imp') |
+ v8_set_return_value_statement = v8_types.v8_set_return_value(idl_type, cpp_rvalue, extended_attributes=extended_attributes, script_wrappable='imp') |
contents.update({ |
'cpp_value': cpp_value, |