From ad353d440b593215a82c65ee58df72d849107c59 Mon Sep 17 00:00:00 2001 From: "vsm@google.com" Date: Mon, 10 Feb 2014 01:38:01 +0000 Subject: [PATCH] Fixes for 1750 roll TBR=jacobr@google.com Review URL: https://codereview.chromium.org//150783005 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32477 260f80e4-7a28-3924-810f-c04153c831b5 --- tests/html/html.status | 5 ++ tools/dom/idl/dart/dart.idl | 2 +- tools/dom/scripts/generator.py | 2 +- tools/dom/scripts/htmlrenamer.py | 4 +- tools/dom/scripts/systemnative.py | 51 +++++++++++++++---- .../html/dartium/cpp_callback_header.template | 16 +++--- 6 files changed, 58 insertions(+), 22 deletions(-) diff --git a/tests/html/html.status b/tests/html/html.status index 26672d00436..f44311f8e5c 100644 --- a/tests/html/html.status +++ b/tests/html/html.status @@ -5,6 +5,7 @@ event_test: Skip # Issue 1996 interactive_test: Skip # Must be run manually. dromaeo_smoke_test: Skip # Issue 14521, 8257 +custom/template_wrappers_test: Pass, Fail # Issue 16656 (Chrome 33 regression) [ $compiler == dart2js && $csp ] custom/js_custom_test: Fail # Issue 14643 @@ -35,6 +36,10 @@ xhr_test/json: Fail # Issue 13069 async_test: Fail # Background timers not implemented. keyboard_event_test: Fail # Issue 13902 isolates_test: Fail # Issue 13921 +node_test/iterating : RuntimeError # Issue 16657 (Chrome 33 regression) +indexeddb_5_test: RuntimeError # Issue 16657 Chrome 33 regression) +fileapi_test/fileEntry: RuntimeError # Issue 16657 (Chrome 33 regression) +audiocontext_test/functional: RuntimeError # Issue 16657 (Chrome 33 regression) [ $compiler == none && $runtime == drt && $system == windows ] worker_test/functional: Pass, Crash # Issue 9929. diff --git a/tools/dom/idl/dart/dart.idl b/tools/dom/idl/dart/dart.idl index 415b91482ec..b33973afb31 100644 --- a/tools/dom/idl/dart/dart.idl +++ b/tools/dom/idl/dart/dart.idl @@ -299,7 +299,7 @@ interface WebSocket { [Custom] void send(ArrayBufferView data); }; -[Supplemental] +[Supplemental, Constructor] interface XMLHttpRequest { [Custom] void send(); [Custom] void send(ArrayBuffer data); // FIXME: this should be eventually deprecated. diff --git a/tools/dom/scripts/generator.py b/tools/dom/scripts/generator.py index 570255be6b3..c6804a9a879 100644 --- a/tools/dom/scripts/generator.py +++ b/tools/dom/scripts/generator.py @@ -666,7 +666,7 @@ class IDLTypeInfo(object): cls = self.bindings_class() if 'Callback' in idl_node.ext_attrs: - return '%s', 'RefPtr<%s>' % self.native_type(), cls, 'create' + return '%s.release()', 'OwnPtr<%s>' % self.native_type(), cls, 'create' if self.custom_to_native(): type = 'RefPtr<%s>' % self.native_type() diff --git a/tools/dom/scripts/htmlrenamer.py b/tools/dom/scripts/htmlrenamer.py index 077a3a1ede3..be8372a27d9 100644 --- a/tools/dom/scripts/htmlrenamer.py +++ b/tools/dom/scripts/htmlrenamer.py @@ -128,6 +128,7 @@ _removed_html_interfaces = [ 'WebKitCSSMixFunctionValue', 'WebKitCSSTransformValue', 'WebKitMediaSource', + 'WebKitNotification', 'WebKitSourceBuffer', 'WebKitSourceBufferList', 'WorkerLocation', # Workers @@ -603,6 +604,7 @@ removed_html_members = monitored.Set('htmlrenamer.removed_html_members', [ '=Event.returnValue', # Only suppress on Event, allow for BeforeUnloadEvnt. 'Event.srcElement', 'EventSource.URL', + 'FontFace.ready', 'FontFaceSet.load', 'FontFaceSet.ready', 'HTMLAnchorElement.charset', @@ -813,7 +815,7 @@ class HtmlRenamer(object): if self.ShouldSuppressMember(interface, member, member_prefix): return None - if 'CheckSecurityForNode' in member_node.ext_attrs: + if 'CheckSecurity' in member_node.ext_attrs: return None name = self._FindMatch(interface, member, member_prefix, diff --git a/tools/dom/scripts/systemnative.py b/tools/dom/scripts/systemnative.py index d1c9c3f0ba6..36f73cc1951 100644 --- a/tools/dom/scripts/systemnative.py +++ b/tools/dom/scripts/systemnative.py @@ -39,6 +39,7 @@ _cpp_callback_map = { ('DOMWindow', 'clearTimeout'): 'DOMWindowTimers', ('DOMWindow', 'clearInterval'): 'DOMWindowTimers', ('DOMWindow', 'createImageBitmap'): 'ImageBitmapFactories', + ('Element', 'animate'): 'ElementAnimation', ('HTMLInputElement', 'webkitEntries'): 'HTMLInputElementFileSystem', ('HTMLVideoElement', 'getVideoPlaybackQuality'): 'HTMLVideoElementMediaSource', ('Navigator', 'doNotTrack'): 'NavigatorDoNotTrack', @@ -199,6 +200,7 @@ class DartiumBackend(HtmlDartGenerator): class_name = 'Dart%s' % self._interface.id for operation in self._interface.operations: function_name = operation.id + return_type = self.SecureOutputType(operation.type.id) parameters = [] arguments = [] if operation.ext_attrs.get('CallWith') == 'ThisValue': @@ -212,20 +214,28 @@ class DartiumBackend(HtmlDartGenerator): conversion_includes.extend(argument_type_info.conversion_includes()) # FIXME(vsm): Handle ThisValue attribute. + if (return_type == 'void'): + ret = '' + else: + ret = ' return 0;\n' + if operation.ext_attrs.get('CallWith') == 'ThisValue': cpp_header_handlers_emitter.Emit( '\n' - ' virtual bool $FUNCTION($PARAMETERS) {\n' + ' virtual $RETURN_TYPE $FUNCTION($PARAMETERS) {\n' ' DART_UNIMPLEMENTED();\n' - ' return false;\n' + '$RET' ' }\n', + RETURN_TYPE=return_type, + RET=ret, FUNCTION=function_name, PARAMETERS=', '.join(parameters)) continue cpp_header_handlers_emitter.Emit( '\n' - ' virtual bool $FUNCTION($PARAMETERS);\n', + ' virtual $RETURN_TYPE $FUNCTION($PARAMETERS);\n', + RETURN_TYPE=return_type, FUNCTION=function_name, PARAMETERS=', '.join(parameters)) @@ -236,17 +246,26 @@ class DartiumBackend(HtmlDartGenerator): arguments_declaration = 'Dart_Handle arguments[] = { %s }' % ', '.join(arguments) if not len(arguments): arguments_declaration = 'Dart_Handle* arguments = 0' + if (return_type == 'void'): + ret1 = 'return' + ret2 = '' + else: + ret1 = 'return 0' + ret2 = ' return' cpp_impl_handlers_emitter.Emit( '\n' - 'bool $CLASS_NAME::$FUNCTION($PARAMETERS)\n' + '$RETURN_TYPE $CLASS_NAME::$FUNCTION($PARAMETERS)\n' '{\n' ' if (!m_callback.isIsolateAlive())\n' - ' return false;\n' + ' $RET1;\n' ' DartIsolateScope scope(m_callback.isolate());\n' ' DartApiScope apiScope;\n' ' $ARGUMENTS_DECLARATION;\n' - ' return m_callback.handleEvent($ARGUMENT_COUNT, arguments);\n' + ' $RET2 m_callback.handleEvent($ARGUMENT_COUNT, arguments);\n' '}\n', + RETURN_TYPE=return_type, + RET1=ret1, + RET2=ret2, CLASS_NAME=class_name, FUNCTION=function_name, PARAMETERS=', '.join(parameters), @@ -508,6 +527,8 @@ class DartiumBackend(HtmlDartGenerator): 'PureInterface' in ext_attrs or 'CPPPureInterface' in ext_attrs or 'SpecialWrapFor' in ext_attrs or + ('Custom' in ext_attrs and ext_attrs['Custom'] == 'Wrap') or + ('Custom' in ext_attrs and ext_attrs['Custom'] == 'ToV8') or self._interface_type_info.custom_to_dart()): to_dart_emitter.Emit( ' static Dart_Handle createWrapper(DartDOMData* domData, NativeType* value);\n') @@ -586,6 +607,8 @@ class DartiumBackend(HtmlDartGenerator): webcore_function_name = self._ToWebKitName(attr.id) function_expression = self._GenerateWebCoreFunctionExpression(webcore_function_name, attr) + raises = ('RaisesException' in attr.ext_attrs and + attr.ext_attrs['RaisesException'] != 'Setter') self._GenerateNativeCallback( cpp_callback_name, True, @@ -594,7 +617,7 @@ class DartiumBackend(HtmlDartGenerator): [], attr.type.id, attr.type.nullable, - 'GetterRaisesException' in attr.ext_attrs or 'RaisesException' in attr.ext_attrs, + raises, auto_scope_setup) def _AddSetter(self, attr, html_name): @@ -611,12 +634,18 @@ class DartiumBackend(HtmlDartGenerator): if 'Reflect' in attr.ext_attrs: webcore_function_name = self._TypeInfo(attr.type.id).webcore_setter_name() else: + if 'ImplementedAs' in attr.ext_attrs: + attr_name = attr.ext_attrs['ImplementedAs'] + else: + attr_name = attr.id webcore_function_name = re.sub(r'^(xml|css|(?=[A-Z])|\w)', lambda s: s.group(1).upper(), - attr.id) + attr_name) webcore_function_name = 'set%s' % webcore_function_name function_expression = self._GenerateWebCoreFunctionExpression(webcore_function_name, attr) + raises = ('RaisesException' in attr.ext_attrs and + attr.ext_attrs['RaisesException'] != 'Getter') self._GenerateNativeCallback( cpp_callback_name, True, @@ -625,7 +654,7 @@ class DartiumBackend(HtmlDartGenerator): [attr], 'void', False, - 'SetterRaisesException' in attr.ext_attrs, + raises, auto_scope_setup, generate_custom_element_scope_if_needed=True) @@ -1082,7 +1111,7 @@ class DartiumBackend(HtmlDartGenerator): # In this case, the getter is mapped to a static method. if (not function_expression.startswith('receiver->') and not function_expression.startswith(interface_name + '::')): - if interface_name == 'DOMWindow' or interface_name == 'Navigator' or interface_name == 'WorkerGlobalScope': + if interface_name in ['DOMWindow', 'Element', 'Navigator', 'WorkerGlobalScope']: cpp_arguments.insert(0, 'receiver') else: cpp_arguments.append('receiver') @@ -1104,7 +1133,7 @@ class DartiumBackend(HtmlDartGenerator): ' $NATIVE_TYPE result = $FUNCTION_CALL;\n' ' if (isNull)\n' ' return;\n', - NATIVE_TYPE=return_type_info.native_type(), + NATIVE_TYPE=return_type_info.parameter_type(), FUNCTION_CALL=function_call) value_expression = 'result' else: diff --git a/tools/dom/templates/html/dartium/cpp_callback_header.template b/tools/dom/templates/html/dartium/cpp_callback_header.template index 001207fe902..2a245c41536 100644 --- a/tools/dom/templates/html/dartium/cpp_callback_header.template +++ b/tools/dom/templates/html/dartium/cpp_callback_header.template @@ -16,31 +16,31 @@ namespace WebCore { class Dart$(INTERFACE) : public $(INTERFACE), public ActiveDOMCallback { public: - typedef $(INTERFACE) NativeType; + typedef Dart$(INTERFACE) NativeType; - static PassRefPtr create(Dart_Handle object, Dart_Handle& exception) + static PassOwnPtr create(Dart_Handle object, Dart_Handle& exception) { - return adoptRef(new Dart$(INTERFACE)(object, exception, DartUtilities::scriptExecutionContext())); + return adoptPtr(new Dart$(INTERFACE)(object, exception, DartUtilities::scriptExecutionContext())); } - static PassRefPtr createWithNullCheck(Dart_Handle object, Dart_Handle& exception) + static PassOwnPtr createWithNullCheck(Dart_Handle object, Dart_Handle& exception) { if (Dart_IsNull(object)) - return 0; + return PassOwnPtr(); return create(object, exception); } - static PassRefPtr create(Dart_NativeArguments args, int idx, Dart_Handle& exception) + static PassOwnPtr create(Dart_NativeArguments args, int idx, Dart_Handle& exception) { Dart_Handle object = Dart_GetNativeArgument(args, idx); return create(object, exception); } - static PassRefPtr createWithNullCheck(Dart_NativeArguments args, int idx, Dart_Handle& exception) + static PassOwnPtr createWithNullCheck(Dart_NativeArguments args, int idx, Dart_Handle& exception) { Dart_Handle object = Dart_GetNativeArgument(args, idx); if (Dart_IsNull(object)) - return 0; + return PassOwnPtr(); return create(object, exception); }