diff --git a/lib/html/dart2js/html_dart2js.dart b/lib/html/dart2js/html_dart2js.dart index fd2f2b71771..38502c327c3 100644 --- a/lib/html/dart2js/html_dart2js.dart +++ b/lib/html/dart2js/html_dart2js.dart @@ -9561,19 +9561,9 @@ class _DOMTokenListImpl implements DOMTokenList native "*DOMTokenList" { abstract class DOMURL { factory DOMURL() => _DOMURLFactoryProvider.createDOMURL(); - - /** @domName DOMURL.createObjectURL */ - static final createObjectURL = _DOMURLImpl.createObjectURL; - - /** @domName DOMURL.revokeObjectURL */ - static final revokeObjectURL = _DOMURLImpl.revokeObjectURL; } class _DOMURLImpl implements DOMURL native "*DOMURL" { - - String createObjectURL(blob_OR_source_OR_stream) native; - - void revokeObjectURL(String url) native; } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -16425,18 +16415,6 @@ abstract class IDBKeyRange { /** @domName IDBKeyRange.upperOpen */ abstract bool get upperOpen; - - /** @domName IDBKeyRange.bound */ - static final bound = _IDBKeyRangeImpl.bound; - - /** @domName IDBKeyRange.lowerBound */ - static final lowerBound = _IDBKeyRangeImpl.lowerBound; - - /** @domName IDBKeyRange.only */ - static final only = _IDBKeyRangeImpl.only; - - /** @domName IDBKeyRange.upperBound */ - static final upperBound = _IDBKeyRangeImpl.upperBound; } class _IDBKeyRangeImpl implements IDBKeyRange native "*IDBKeyRange" { @@ -16450,53 +16428,6 @@ class _IDBKeyRangeImpl implements IDBKeyRange native "*IDBKeyRange" { Dynamic get _upper() native "return this.upper;"; final bool upperOpen; - - _IDBKeyRangeImpl bound(lower, upper, [lowerOpen, upperOpen]) { - if (?upperOpen) { - var lower_1 = _convertDartToNative_IDBKey(lower); - var upper_2 = _convertDartToNative_IDBKey(upper); - return _bound_1(lower_1, upper_2, lowerOpen, upperOpen); - } - if (?lowerOpen) { - var lower_3 = _convertDartToNative_IDBKey(lower); - var upper_4 = _convertDartToNative_IDBKey(upper); - return _bound_2(lower_3, upper_4, lowerOpen); - } - var lower_5 = _convertDartToNative_IDBKey(lower); - var upper_6 = _convertDartToNative_IDBKey(upper); - return _bound_3(lower_5, upper_6); - } - _IDBKeyRangeImpl _bound_1(lower, upper, bool lowerOpen, bool upperOpen) native "bound"; - _IDBKeyRangeImpl _bound_2(lower, upper, bool lowerOpen) native "bound"; - _IDBKeyRangeImpl _bound_3(lower, upper) native "bound"; - - _IDBKeyRangeImpl lowerBound(bound, [open]) { - if (?open) { - var bound_1 = _convertDartToNative_IDBKey(bound); - return _lowerBound_1(bound_1, open); - } - var bound_2 = _convertDartToNative_IDBKey(bound); - return _lowerBound_2(bound_2); - } - _IDBKeyRangeImpl _lowerBound_1(bound, bool open) native "lowerBound"; - _IDBKeyRangeImpl _lowerBound_2(bound) native "lowerBound"; - - _IDBKeyRangeImpl only(value) { - var value_1 = _convertDartToNative_IDBKey(value); - return _only_1(value_1); - } - _IDBKeyRangeImpl _only_1(value) native "only"; - - _IDBKeyRangeImpl upperBound(bound, [open]) { - if (?open) { - var bound_1 = _convertDartToNative_IDBKey(bound); - return _upperBound_1(bound_1, open); - } - var bound_2 = _convertDartToNative_IDBKey(bound); - return _upperBound_2(bound_2); - } - _IDBKeyRangeImpl _upperBound_1(bound, bool open) native "upperBound"; - _IDBKeyRangeImpl _upperBound_2(bound) native "upperBound"; } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -21517,9 +21448,6 @@ abstract class Notification implements EventTarget { /** @domName Notification.removeEventListener */ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]); - /** @domName Notification.requestPermission */ - static final requestPermission = _NotificationImpl.requestPermission; - /** @domName Notification.show */ void show(); } @@ -21592,8 +21520,6 @@ class _NotificationImpl extends _EventTargetImpl implements Notification native void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "removeEventListener"; - void requestPermission(NotificationPermissionCallback callback) native; - void show() native; } diff --git a/lib/html/dartium/html_dartium.dart b/lib/html/dartium/html_dartium.dart index 445e12df8c3..cd835f90f57 100644 --- a/lib/html/dartium/html_dartium.dart +++ b/lib/html/dartium/html_dartium.dart @@ -10499,12 +10499,6 @@ class _DOMTokenListImpl extends NativeFieldWrapperClass1 implements DOMTokenList abstract class DOMURL { factory DOMURL() => _DOMURLFactoryProvider.createDOMURL(); - - /** @domName DOMURL.createObjectURL */ - static final createObjectURL = _DOMURLImpl.createObjectURL; - - /** @domName DOMURL.revokeObjectURL */ - static final revokeObjectURL = _DOMURLImpl.revokeObjectURL; } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -17885,18 +17879,6 @@ abstract class IDBKeyRange { /** @domName IDBKeyRange.upperOpen */ abstract bool get upperOpen; - - /** @domName IDBKeyRange.bound */ - static final bound = _IDBKeyRangeImpl.bound; - - /** @domName IDBKeyRange.lowerBound */ - static final lowerBound = _IDBKeyRangeImpl.lowerBound; - - /** @domName IDBKeyRange.only */ - static final only = _IDBKeyRangeImpl.only; - - /** @domName IDBKeyRange.upperBound */ - static final upperBound = _IDBKeyRangeImpl.upperBound; } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -23488,9 +23470,6 @@ abstract class Notification implements EventTarget { /** @domName Notification.removeEventListener */ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]); - /** @domName Notification.requestPermission */ - static final requestPermission = _NotificationImpl.requestPermission; - /** @domName Notification.show */ void show(); } diff --git a/lib/html/scripts/systembase.py b/lib/html/scripts/systembase.py index 2b653fb9246..956038f4132 100644 --- a/lib/html/scripts/systembase.py +++ b/lib/html/scripts/systembase.py @@ -131,7 +131,10 @@ class BaseGenerator(object): for id in sorted(operationsById.keys()): operations = operationsById[id] info = AnalyzeOperation(interface, operations) - self.AddOperation(info) + if info.IsStatic(): + self.AddStaticOperation(info) + else: + self.AddOperation(info) def AddSecondaryMembers(self, interface): # With multiple inheritance, attributes and operations of non-first @@ -175,6 +178,9 @@ class BaseGenerator(object): def AddOperation(self, info): pass + def AddStaticOperation(self, info): + pass + def AddSecondaryAttribute(self, interface, attribute): pass diff --git a/lib/html/scripts/systemhtml.py b/lib/html/scripts/systemhtml.py index c53a284fb13..e1e4d4259d7 100644 --- a/lib/html/scripts/systemhtml.py +++ b/lib/html/scripts/systemhtml.py @@ -662,20 +662,16 @@ class HtmlDartInterfaceGenerator(BaseGenerator): DOMINTERFACE=info.overloads[0].doc_js_interface_name, DOMNAME=info.name) - if info.IsStatic(): - # FIXME: provide a type. - self._members_emitter.Emit('\n' - ' static final $NAME = $IMPL_CLASS_NAME.$NAME;\n', - IMPL_CLASS_NAME=self._backend.ImplementationClassName(), - NAME=html_name) - else: - self._members_emitter.Emit('\n' - ' $TYPE $NAME($PARAMS);\n', - TYPE=self._DartType(info.type_name), - NAME=html_name, - PARAMS=info.ParametersInterfaceDeclaration(self._DartType)) + self._members_emitter.Emit('\n' + ' $TYPE $NAME($PARAMS);\n', + TYPE=self._DartType(info.type_name), + NAME=html_name, + PARAMS=info.ParametersInterfaceDeclaration(self._DartType)) self._backend.AddOperation(info, html_name) + def AddStaticOperation(self, info): + self.AddOperation(info, True) + def AddSecondaryOperation(self, interface, info): self._backend.SecondaryContext(interface) self.AddOperation(info, True) @@ -1013,6 +1009,10 @@ class HtmlDart2JSClassGenerator(Dart2JSInterfaceGenerator): if self._HasCustomImplementation(info.name): return + # FIXME: support static operations. + if info.IsStatic(): + return + # Any conversions needed? if any(self._OperationRequiresConversions(op) for op in info.overloads): self._AddOperationWithConversions(info, html_name) diff --git a/tests/html/html.status b/tests/html/html.status index 91e220d9800..7c8ac8b6ea7 100644 --- a/tests/html/html.status +++ b/tests/html/html.status @@ -14,6 +14,7 @@ xhr_cross_origin_test: Skip # Issue 4502: Passes with --allow-external-pages. [ $compiler == none && ($runtime == drt || $runtime == dartium) ] request_animation_frame_test: Skip # drt hangs; requestAnimationFrame not implemented +url_test: Fail # createObjectURL not implemented. transferables_test: Fail # Under investigation by antonm [ $compiler == none && $runtime == drt && $system == windows] diff --git a/tests/html/url_test.dart b/tests/html/url_test.dart index f6527bbb71e..6cfc8158a32 100644 --- a/tests/html/url_test.dart +++ b/tests/html/url_test.dart @@ -36,7 +36,7 @@ main() { group('blob', () { test('createObjectUrl', () { var blob = createImageBlob(); - var url = DOMURL.createObjectURL(blob); + var url = window.createObjectUrl(blob); expect(url.length, greaterThan(0)); expect(url.startsWith('blob:')); @@ -52,11 +52,11 @@ main() { img.src = url; }); - test('revokeObjectURL', () { + test('revokeObjectUrl', () { var blob = createImageBlob(); - var url = DOMURL.createObjectURL(blob); + var url = window.createObjectUrl(blob); expect(url.startsWith('blob:')); - DOMURL.revokeObjectURL(url); + window.revokeObjectUrl(url); var img = new ImageElement(); // Image should fail to load since the URL was revoked.