Fixed a number of dart:html P1 issues.
- Fixed HTML API's with callback typedef to correctly convert Dart function to JS function.
- Expose HttpStatus from dart:html
- Expose DomName ondblclick and dblclickEvent for Angular analyzer.
- Fixed removeAll should be Iterable<Object> to match Set's removeAll not Iterable<E>.
- Fixed a number of DataTransferItem, Entry, FileEntry and DiretoryEntry returning NativeJavaScriptObject needed type registered in DDC.
- Added ability to allow local file access from Chrome browser added -local in ddb.
R=vsm@google.com
Fixes #30278
Fixes #35484
Fixes #34318
Fixes #35510
Change-Id: Ide8c04716c54045e837781d489562f27b694b109
Reviewed-on: https://dart-review.googlesource.com/c/89340
Commit-Queue: Terry Lucas <terry@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 166c567..6cdf406 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,21 @@
[35576]: https://github.com/dart-lang/sdk/issues/35576
+* Fixed a number of 'dart:html' P1 bugs:
+
+ * Fixed HTML API's with callback typedef to correctly convert Dart function to JS function.
+ * HttpStatus constants exposed in dart:html
+ * Expose DomName ondblclick and dblclickEvent for Angular analyzer.
+ * Fixed removeAll on classes Set should be Iterable<Object> to match Set's removeAll not Iterable<E>.
+ * Fixed a number of DataTransferItem, Entry, FileEntry and DiretoryEntry returning NativeJavaScriptObject needed type registered in DDC.
+ This fixes handling drag/drop of files/directories.
+ * Added ability to allow local file access from Chrome browser in ddb.
+
+[30278]: https://github.com/dart-lang/sdk/issues/30278
+[34318]: https://github.com/dart-lang/sdk/issues/34318
+[35484]: https://github.com/dart-lang/sdk/issues/35484
+[35510]: https://github.com/dart-lang/sdk/issues/35510
+
### Dart VM
### Tool Changes
diff --git a/pkg/dev_compiler/tool/ddb b/pkg/dev_compiler/tool/ddb
index 98f39aa..3e045cc 100755
--- a/pkg/dev_compiler/tool/ddb
+++ b/pkg/dev_compiler/tool/ddb
@@ -176,7 +176,9 @@
var tmp = path.join(Directory.systemTemp.path, 'ddc');
result = Process.runSync(chromeBinary,
- ['--auto-open-devtools-for-tabs', '--user-data-dir=$tmp', htmlFile]);
+ ['--auto-open-devtools-for-tabs',
+ '--allow-file-access-from-files',
+ '--user-data-dir=$tmp', htmlFile]);
} else if (node) {
var nodePath = '$sdkJsPath:$libRoot';
var runjs = '''
diff --git a/sdk/lib/_http/http.dart b/sdk/lib/_http/http.dart
index 393045f..f1e72be 100644
--- a/sdk/lib/_http/http.dart
+++ b/sdk/lib/_http/http.dart
@@ -16,7 +16,7 @@
UnmodifiableMapView;
import 'dart:convert';
import 'dart:developer' hide log;
-import 'dart:_internal' show Since;
+import 'dart:_internal' show Since, HttpStatus;
import 'dart:math';
import 'dart:io';
import 'dart:typed_data';
@@ -32,184 +32,6 @@
part 'websocket_impl.dart';
/**
- * HTTP status codes.
- */
-abstract class HttpStatus {
- static const int continue_ = 100;
- static const int switchingProtocols = 101;
- @Since("2.1")
- static const int processing = 102;
- static const int ok = 200;
- static const int created = 201;
- static const int accepted = 202;
- static const int nonAuthoritativeInformation = 203;
- static const int noContent = 204;
- static const int resetContent = 205;
- static const int partialContent = 206;
- @Since("2.1")
- static const int multiStatus = 207;
- @Since("2.1")
- static const int alreadyReported = 208;
- @Since("2.1")
- static const int imUsed = 226;
- static const int multipleChoices = 300;
- static const int movedPermanently = 301;
- static const int found = 302;
- static const int movedTemporarily = 302; // Common alias for found.
- static const int seeOther = 303;
- static const int notModified = 304;
- static const int useProxy = 305;
- static const int temporaryRedirect = 307;
- @Since("2.1")
- static const int permanentRedirect = 308;
- static const int badRequest = 400;
- static const int unauthorized = 401;
- static const int paymentRequired = 402;
- static const int forbidden = 403;
- static const int notFound = 404;
- static const int methodNotAllowed = 405;
- static const int notAcceptable = 406;
- static const int proxyAuthenticationRequired = 407;
- static const int requestTimeout = 408;
- static const int conflict = 409;
- static const int gone = 410;
- static const int lengthRequired = 411;
- static const int preconditionFailed = 412;
- static const int requestEntityTooLarge = 413;
- static const int requestUriTooLong = 414;
- static const int unsupportedMediaType = 415;
- static const int requestedRangeNotSatisfiable = 416;
- static const int expectationFailed = 417;
- @Since("2.1")
- static const int misdirectedRequest = 421;
- @Since("2.1")
- static const int unprocessableEntity = 422;
- @Since("2.1")
- static const int locked = 423;
- @Since("2.1")
- static const int failedDependency = 424;
- static const int upgradeRequired = 426;
- @Since("2.1")
- static const int preconditionRequired = 428;
- @Since("2.1")
- static const int tooManyRequests = 429;
- @Since("2.1")
- static const int requestHeaderFieldsTooLarge = 431;
- @Since("2.1")
- static const int connectionClosedWithoutResponse = 444;
- @Since("2.1")
- static const int unavailableForLegalReasons = 451;
- @Since("2.1")
- static const int clientClosedRequest = 499;
- static const int internalServerError = 500;
- static const int notImplemented = 501;
- static const int badGateway = 502;
- static const int serviceUnavailable = 503;
- static const int gatewayTimeout = 504;
- static const int httpVersionNotSupported = 505;
- @Since("2.1")
- static const int variantAlsoNegotiates = 506;
- @Since("2.1")
- static const int insufficientStorage = 507;
- @Since("2.1")
- static const int loopDetected = 508;
- @Since("2.1")
- static const int notExtended = 510;
- @Since("2.1")
- static const int networkAuthenticationRequired = 511;
- // Client generated status code.
- static const int networkConnectTimeoutError = 599;
-
- @Deprecated("Use continue_ instead")
- static const int CONTINUE = continue_;
- @Deprecated("Use switchingProtocols instead")
- static const int SWITCHING_PROTOCOLS = switchingProtocols;
- @Deprecated("Use ok instead")
- static const int OK = ok;
- @Deprecated("Use created instead")
- static const int CREATED = created;
- @Deprecated("Use accepted instead")
- static const int ACCEPTED = accepted;
- @Deprecated("Use nonAuthoritativeInformation instead")
- static const int NON_AUTHORITATIVE_INFORMATION = nonAuthoritativeInformation;
- @Deprecated("Use noContent instead")
- static const int NO_CONTENT = noContent;
- @Deprecated("Use resetContent instead")
- static const int RESET_CONTENT = resetContent;
- @Deprecated("Use partialContent instead")
- static const int PARTIAL_CONTENT = partialContent;
- @Deprecated("Use multipleChoices instead")
- static const int MULTIPLE_CHOICES = multipleChoices;
- @Deprecated("Use movedPermanently instead")
- static const int MOVED_PERMANENTLY = movedPermanently;
- @Deprecated("Use found instead")
- static const int FOUND = found;
- @Deprecated("Use movedTemporarily instead")
- static const int MOVED_TEMPORARILY = movedTemporarily;
- @Deprecated("Use seeOther instead")
- static const int SEE_OTHER = seeOther;
- @Deprecated("Use notModified instead")
- static const int NOT_MODIFIED = notModified;
- @Deprecated("Use useProxy instead")
- static const int USE_PROXY = useProxy;
- @Deprecated("Use temporaryRedirect instead")
- static const int TEMPORARY_REDIRECT = temporaryRedirect;
- @Deprecated("Use badRequest instead")
- static const int BAD_REQUEST = badRequest;
- @Deprecated("Use unauthorized instead")
- static const int UNAUTHORIZED = unauthorized;
- @Deprecated("Use paymentRequired instead")
- static const int PAYMENT_REQUIRED = paymentRequired;
- @Deprecated("Use forbidden instead")
- static const int FORBIDDEN = forbidden;
- @Deprecated("Use notFound instead")
- static const int NOT_FOUND = notFound;
- @Deprecated("Use methodNotAllowed instead")
- static const int METHOD_NOT_ALLOWED = methodNotAllowed;
- @Deprecated("Use notAcceptable instead")
- static const int NOT_ACCEPTABLE = notAcceptable;
- @Deprecated("Use proxyAuthenticationRequired instead")
- static const int PROXY_AUTHENTICATION_REQUIRED = proxyAuthenticationRequired;
- @Deprecated("Use requestTimeout instead")
- static const int REQUEST_TIMEOUT = requestTimeout;
- @Deprecated("Use conflict instead")
- static const int CONFLICT = conflict;
- @Deprecated("Use gone instead")
- static const int GONE = gone;
- @Deprecated("Use lengthRequired instead")
- static const int LENGTH_REQUIRED = lengthRequired;
- @Deprecated("Use preconditionFailed instead")
- static const int PRECONDITION_FAILED = preconditionFailed;
- @Deprecated("Use requestEntityTooLarge instead")
- static const int REQUEST_ENTITY_TOO_LARGE = requestEntityTooLarge;
- @Deprecated("Use requestUriTooLong instead")
- static const int REQUEST_URI_TOO_LONG = requestUriTooLong;
- @Deprecated("Use unsupportedMediaType instead")
- static const int UNSUPPORTED_MEDIA_TYPE = unsupportedMediaType;
- @Deprecated("Use requestedRangeNotSatisfiable instead")
- static const int REQUESTED_RANGE_NOT_SATISFIABLE =
- requestedRangeNotSatisfiable;
- @Deprecated("Use expectationFailed instead")
- static const int EXPECTATION_FAILED = expectationFailed;
- @Deprecated("Use upgradeRequired instead")
- static const int UPGRADE_REQUIRED = upgradeRequired;
- @Deprecated("Use internalServerError instead")
- static const int INTERNAL_SERVER_ERROR = internalServerError;
- @Deprecated("Use notImplemented instead")
- static const int NOT_IMPLEMENTED = notImplemented;
- @Deprecated("Use badGateway instead")
- static const int BAD_GATEWAY = badGateway;
- @Deprecated("Use serviceUnavailable instead")
- static const int SERVICE_UNAVAILABLE = serviceUnavailable;
- @Deprecated("Use gatewayTimeout instead")
- static const int GATEWAY_TIMEOUT = gatewayTimeout;
- @Deprecated("Use httpVersionNotSupported instead")
- static const int HTTP_VERSION_NOT_SUPPORTED = httpVersionNotSupported;
- @Deprecated("Use networkConnectTimeoutError instead")
- static const int NETWORK_CONNECT_TIMEOUT_ERROR = networkConnectTimeoutError;
-}
-
-/**
* A server that delivers content, such as web pages, using the HTTP protocol.
*
* The HttpServer is a [Stream] that provides [HttpRequest] objects. Each
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index d5d6287..b7b158c 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -67,6 +67,7 @@
setDispatchProperty;
export 'dart:math' show Rectangle, Point;
+export 'dart:_internal' show HttpStatus;
/**
* Top-level container for a web page, which is usually a browser tab or window.
@@ -1967,8 +1968,6 @@
@Returns('CanvasRenderingContext2D|RenderingContext|RenderingContext2|Null')
Object _getContext_2(contextId) native;
- void toBlob(BlobCallback callback, String type, [Object arguments]) native;
-
@JSName('toDataURL')
String _toDataUrl(String type, [arguments_OR_quality]) native;
@@ -2062,6 +2061,17 @@
*/
String toDataUrl([String type = 'image/png', num quality]) =>
_toDataUrl(type, quality);
+
+ @JSName('toBlob')
+ void _toBlob(BlobCallback callback, String type, [Object arguments]) native;
+
+ Future<Blob> toBlob(String type, [Object arguments]) {
+ var completer = new Completer<Blob>();
+ _toBlob((value) {
+ completer.complete(value);
+ }, type, arguments);
+ return completer.future;
+ }
}
// 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
@@ -8553,12 +8563,25 @@
void setDragImage(Element image, int x, int y) native;
}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("DataTransferItem")
class DataTransferItem extends Interceptor {
+ Entry getAsEntry() {
+ Entry entry = _webkitGetAsEntry();
+
+ if (entry.isFile)
+ applyExtension('FileEntry', entry);
+ else if (entry.isDirectory)
+ applyExtension('DirectoryEntry', entry);
+ else
+ applyExtension('Entry', entry);
+
+ return entry;
+ }
+
// To suppress missing implicit constructor warnings.
factory DataTransferItem._() {
throw new UnsupportedError("Not supported");
@@ -8573,7 +8596,7 @@
@JSName('webkitGetAsEntry')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- Entry getAsEntry() native;
+ Entry _webkitGetAsEntry() native;
}
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -9155,8 +9178,15 @@
Future<List<Entry>> readEntries() {
var completer = new Completer<List<Entry>>();
- _readEntries((value) {
- completer.complete(new List<Entry>.from(value));
+ _readEntries((values) {
+ values.forEach((value) {
+ applyExtension('Entry', value);
+ Entry entry = value as Entry;
+ if (entry.isFile)
+ applyExtension('FileEntry', entry);
+ else if (entry.isDirectory) applyExtension('DirectoryEntry', entry);
+ });
+ completer.complete(new List<Entry>.from(values));
}, (error) {
completer.completeError(error);
});
@@ -9573,6 +9603,7 @@
Stream<ClipboardEvent> get onCut => Element.cutEvent.forTarget(this);
/// Stream of `doubleclick` events handled by this [Document].
+ @DomName('Document.ondblclick')
Stream<Event> get onDoubleClick => Element.doubleClickEvent.forTarget(this);
/// Stream of `drag` events handled by this [Document].
@@ -11357,6 +11388,7 @@
ElementStream<ClipboardEvent> get onCut;
/// Stream of `doubleclick` events handled by this [Element].
+ @DomName('Element.ondblclick')
ElementStream<Event> get onDoubleClick;
/**
@@ -11721,6 +11753,7 @@
Element.cutEvent._forElementList(this);
/// Stream of `doubleclick` events handled by this [Element].
+ @DomName('Element.ondblclick')
ElementStream<Event> get onDoubleClick =>
Element.doubleClickEvent._forElementList(this);
@@ -12310,6 +12343,30 @@
ElementList<T> querySelectorAll<T extends Element>(String selectors) =>
new _FrozenElementList<T>._wrap(_querySelectorAll(selectors));
+ @JSName('setApplyScroll')
+ void _setApplyScroll(ScrollStateCallback scrollStateCallback,
+ String nativeScrollBehavior) native;
+
+ Future<ScrollState> setApplyScroll(String nativeScrollBehavior) {
+ var completer = new Completer<ScrollState>();
+ _setApplyScroll((value) {
+ completer.complete(value);
+ }, nativeScrollBehavior);
+ return completer.future;
+ }
+
+ @JSName('setDistributeScroll')
+ void _setDistributeScroll(ScrollStateCallback scrollStateCallback,
+ String nativeScrollBehavior) native;
+
+ Future<ScrollState> setDistributeScroll(String nativeScrollBehavior) {
+ var completer = new Completer<ScrollState>();
+ _setDistributeScroll((value) {
+ completer.complete(value);
+ }, nativeScrollBehavior);
+ return completer.future;
+ }
+
/**
* The set of CSS classes applied to this element.
*
@@ -13275,6 +13332,7 @@
*
* See [EventStreamProvider] for usage information.
*/
+ @DomName('Element.dblclickEvent')
static const EventStreamProvider<Event> doubleClickEvent =
const EventStreamProvider<Event>('dblclick');
@@ -14025,16 +14083,10 @@
@JSName('scrollTo')
void _scrollTo_3(num x, y) native;
- void setApplyScroll(ScrollStateCallback scrollStateCallback,
- String nativeScrollBehavior) native;
-
void setAttribute(String name, String value) native;
void setAttributeNS(String namespaceURI, String name, String value) native;
- void setDistributeScroll(ScrollStateCallback scrollStateCallback,
- String nativeScrollBehavior) native;
-
void setPointerCapture(int pointerId) native;
@JSName('webkitRequestFullscreen')
@@ -14140,6 +14192,7 @@
ElementStream<ClipboardEvent> get onCut => cutEvent.forElement(this);
/// Stream of `doubleclick` events handled by this [Element].
+ @DomName('Element.ondblclick')
ElementStream<Event> get onDoubleClick => doubleClickEvent.forElement(this);
/**
@@ -14549,6 +14602,7 @@
Future<Entry> getParent() {
var completer = new Completer<Entry>();
_getParent((value) {
+ applyExtension('Entry', value);
completer.complete(value);
}, (error) {
completer.completeError(error);
@@ -16090,47 +16144,53 @@
void _getCurrentPosition(_PositionCallback successCallback,
[_PositionErrorCallback errorCallback, Map options]) {
if (options != null) {
- var options_1 = convertDartToNative_Dictionary(options);
- _getCurrentPosition_1(successCallback, errorCallback, options_1);
+ var successCallback_1 = convertDartClosureToJS(successCallback, 1);
+ var options_2 = convertDartToNative_Dictionary(options);
+ _getCurrentPosition_1(successCallback_1, errorCallback, options_2);
return;
}
if (errorCallback != null) {
- _getCurrentPosition_2(successCallback, errorCallback);
+ var successCallback_1 = convertDartClosureToJS(successCallback, 1);
+ _getCurrentPosition_2(successCallback_1, errorCallback);
return;
}
- _getCurrentPosition_3(successCallback);
+ var successCallback_1 = convertDartClosureToJS(successCallback, 1);
+ _getCurrentPosition_3(successCallback_1);
return;
}
@JSName('getCurrentPosition')
- void _getCurrentPosition_1(_PositionCallback successCallback,
- _PositionErrorCallback errorCallback, options) native;
+ void _getCurrentPosition_1(
+ successCallback, _PositionErrorCallback errorCallback, options) native;
@JSName('getCurrentPosition')
- void _getCurrentPosition_2(_PositionCallback successCallback,
- _PositionErrorCallback errorCallback) native;
+ void _getCurrentPosition_2(
+ successCallback, _PositionErrorCallback errorCallback) native;
@JSName('getCurrentPosition')
- void _getCurrentPosition_3(_PositionCallback successCallback) native;
+ void _getCurrentPosition_3(successCallback) native;
int _watchPosition(_PositionCallback successCallback,
[_PositionErrorCallback errorCallback, Map options]) {
if (options != null) {
- var options_1 = convertDartToNative_Dictionary(options);
- return _watchPosition_1(successCallback, errorCallback, options_1);
+ var successCallback_1 = convertDartClosureToJS(successCallback, 1);
+ var options_2 = convertDartToNative_Dictionary(options);
+ return _watchPosition_1(successCallback_1, errorCallback, options_2);
}
if (errorCallback != null) {
- return _watchPosition_2(successCallback, errorCallback);
+ var successCallback_1 = convertDartClosureToJS(successCallback, 1);
+ return _watchPosition_2(successCallback_1, errorCallback);
}
- return _watchPosition_3(successCallback);
+ var successCallback_1 = convertDartClosureToJS(successCallback, 1);
+ return _watchPosition_3(successCallback_1);
}
@JSName('watchPosition')
- int _watchPosition_1(_PositionCallback successCallback,
- _PositionErrorCallback errorCallback, options) native;
+ int _watchPosition_1(
+ successCallback, _PositionErrorCallback errorCallback, options) native;
@JSName('watchPosition')
- int _watchPosition_2(_PositionCallback successCallback,
- _PositionErrorCallback errorCallback) native;
+ int _watchPosition_2(successCallback, _PositionErrorCallback errorCallback)
+ native;
@JSName('watchPosition')
- int _watchPosition_3(_PositionCallback successCallback) native;
+ int _watchPosition_3(successCallback) native;
}
/**
@@ -16201,6 +16261,7 @@
static const EventStreamProvider<MouseEvent> contextMenuEvent =
const EventStreamProvider<MouseEvent>('contextmenu');
+ @DomName('GlobalEventHandlers.dblclickEvent')
static const EventStreamProvider<Event> doubleClickEvent =
const EventStreamProvider<Event>('dblclick');
@@ -16365,6 +16426,7 @@
Stream<MouseEvent> get onContextMenu => contextMenuEvent.forTarget(this);
+ @DomName('GlobalEventHandlers.ondblclick')
Stream<Event> get onDoubleClick => doubleClickEvent.forTarget(this);
Stream<MouseEvent> get onDrag => dragEvent.forTarget(this);
@@ -18781,10 +18843,12 @@
factory IntersectionObserver(IntersectionObserverCallback callback,
[Map options]) {
if (options != null) {
- var options_1 = convertDartToNative_Dictionary(options);
- return IntersectionObserver._create_1(callback, options_1);
+ var callback_1 = convertDartClosureToJS(callback, 2);
+ var options_2 = convertDartToNative_Dictionary(options);
+ return IntersectionObserver._create_1(callback_1, options_2);
}
- return IntersectionObserver._create_2(callback);
+ var callback_1 = convertDartClosureToJS(callback, 2);
+ return IntersectionObserver._create_2(callback_1);
}
static IntersectionObserver _create_1(callback, options) => JS(
'IntersectionObserver',
@@ -23883,7 +23947,8 @@
}
factory PerformanceObserver(PerformanceObserverCallback callback) {
- return PerformanceObserver._create_1(callback);
+ var callback_1 = convertDartClosureToJS(callback, 2);
+ return PerformanceObserver._create_1(callback_1);
}
static PerformanceObserver _create_1(callback) =>
JS('PerformanceObserver', 'new PerformanceObserver(#)', callback);
@@ -25024,7 +25089,8 @@
}
factory ReportingObserver(ReportingObserverCallback callback) {
- return ReportingObserver._create_1(callback);
+ var callback_1 = convertDartClosureToJS(callback, 2);
+ return ReportingObserver._create_1(callback_1);
}
static ReportingObserver _create_1(callback) =>
JS('ReportingObserver', 'new ReportingObserver(#)', callback);
@@ -25060,7 +25126,8 @@
}
factory ResizeObserver(ResizeObserverCallback callback) {
- return ResizeObserver._create_1(callback);
+ var callback_1 = convertDartClosureToJS(callback, 2);
+ return ResizeObserver._create_1(callback_1);
}
static ResizeObserver _create_1(callback) =>
JS('ResizeObserver', 'new ResizeObserver(#)', callback);
@@ -31257,16 +31324,18 @@
int requestIdleCallback(IdleRequestCallback callback, [Map options]) {
if (options != null) {
- var options_1 = convertDartToNative_Dictionary(options);
- return _requestIdleCallback_1(callback, options_1);
+ var callback_1 = convertDartClosureToJS(callback, 1);
+ var options_2 = convertDartToNative_Dictionary(options);
+ return _requestIdleCallback_1(callback_1, options_2);
}
- return _requestIdleCallback_2(callback);
+ var callback_1 = convertDartClosureToJS(callback, 1);
+ return _requestIdleCallback_2(callback_1);
}
@JSName('requestIdleCallback')
- int _requestIdleCallback_1(IdleRequestCallback callback, options) native;
+ int _requestIdleCallback_1(callback, options) native;
@JSName('requestIdleCallback')
- int _requestIdleCallback_2(IdleRequestCallback callback) native;
+ int _requestIdleCallback_2(callback) native;
/**
* Resizes this window by an offset.
@@ -31295,7 +31364,7 @@
*
* ## Other resources
*
- * * [Window scroll](https://developer.mozilla.org/en-US/docs/Web/API/Window/scroll)
+ * * [Window.scroll](https://developer.mozilla.org/en-US/docs/Web/API/Window/scroll)
* from MDN.
*/
void scroll([options_OR_x, y, Map scrollOptions]) {
@@ -31332,7 +31401,7 @@
*
* ## Other resources
*
- * * [Window scroll](https://developer.mozilla.org/en-US/docs/Web/API/Window/scroll)
+ * * [Window.scroll](https://developer.mozilla.org/en-US/docs/Web/API/Window/scroll)
* from MDN.
*/
void _scroll_1() native;
@@ -31344,7 +31413,7 @@
*
* ## Other resources
*
- * * [Window scroll](https://developer.mozilla.org/en-US/docs/Web/API/Window/scroll)
+ * * [Window.scroll](https://developer.mozilla.org/en-US/docs/Web/API/Window/scroll)
* from MDN.
*/
void _scroll_2(options) native;
@@ -31356,7 +31425,7 @@
*
* ## Other resources
*
- * * [Window scroll](https://developer.mozilla.org/en-US/docs/Web/API/Window/scroll)
+ * * [Window.scroll](https://developer.mozilla.org/en-US/docs/Web/API/Window/scroll)
* from MDN.
*/
void _scroll_3(num x, num y) native;
@@ -31368,7 +31437,7 @@
*
* ## Other resources
*
- * * [Window scroll](https://developer.mozilla.org/en-US/docs/Web/API/Window/scroll)
+ * * [Window.scroll](https://developer.mozilla.org/en-US/docs/Web/API/Window/scroll)
* from MDN.
*/
void _scroll_4(int x, int y) native;
@@ -31380,7 +31449,7 @@
*
* ## Other resources
*
- * * [Window scroll](https://developer.mozilla.org/en-US/docs/Web/API/Window/scroll)
+ * * [Window.scroll](https://developer.mozilla.org/en-US/docs/Web/API/Window/scroll)
* from MDN.
*/
void _scroll_5(int x, int y, scrollOptions) native;
@@ -31390,7 +31459,7 @@
*
* ## Other resources
*
- * * [Window scrollBy](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollBy)
+ * * [Window.scrollBy](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollBy)
* from MDN.
*/
void scrollBy([options_OR_x, y, Map scrollOptions]) {
@@ -31425,7 +31494,7 @@
*
* ## Other resources
*
- * * [Window scrollBy](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollBy)
+ * * [Window.scrollBy](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollBy)
* from MDN.
*/
void _scrollBy_1() native;
@@ -31435,7 +31504,7 @@
*
* ## Other resources
*
- * * [Window scrollBy](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollBy)
+ * * [Window.scrollBy](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollBy)
* from MDN.
*/
void _scrollBy_2(options) native;
@@ -31445,7 +31514,7 @@
*
* ## Other resources
*
- * * [Window scrollBy](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollBy)
+ * * [Window.scrollBy](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollBy)
* from MDN.
*/
void _scrollBy_3(num x, num y) native;
@@ -31455,7 +31524,7 @@
*
* ## Other resources
*
- * * [Window scrollBy](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollBy)
+ * * [Window.scrollBy](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollBy)
* from MDN.
*/
void _scrollBy_4(int x, int y) native;
@@ -31465,7 +31534,7 @@
*
* ## Other resources
*
- * * [Window scrollBy](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollBy)
+ * * [Window.scrollBy](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollBy)
* from MDN.
*/
void _scrollBy_5(int x, int y, scrollOptions) native;
@@ -31477,7 +31546,7 @@
*
* ## Other resources
*
- * * [Window scrollTo](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo)
+ * * [Window.scrollTo](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo)
* from MDN.
*/
void scrollTo([options_OR_x, y, Map scrollOptions]) {
@@ -31514,7 +31583,7 @@
*
* ## Other resources
*
- * * [Window scrollTo](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo)
+ * * [Window.scrollTo](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo)
* from MDN.
*/
void _scrollTo_1() native;
@@ -31526,7 +31595,7 @@
*
* ## Other resources
*
- * * [Window scrollTo](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo)
+ * * [Window.scrollTo](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo)
* from MDN.
*/
void _scrollTo_2(options) native;
@@ -31538,7 +31607,7 @@
*
* ## Other resources
*
- * * [Window scrollTo](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo)
+ * * [Window.scrollTo](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo)
* from MDN.
*/
void _scrollTo_3(num x, num y) native;
@@ -31550,7 +31619,7 @@
*
* ## Other resources
*
- * * [Window scrollTo](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo)
+ * * [Window.scrollTo](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo)
* from MDN.
*/
void _scrollTo_4(int x, int y) native;
@@ -31562,7 +31631,7 @@
*
* ## Other resources
*
- * * [Window scrollTo](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo)
+ * * [Window.scrollTo](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo)
* from MDN.
*/
void _scrollTo_5(int x, int y, scrollOptions) native;
@@ -31686,6 +31755,7 @@
Element.contextMenuEvent.forTarget(this);
/// Stream of `doubleclick` events handled by this [Window].
+ @DomName('Window.ondblclick')
Stream<Event> get onDoubleClick => Element.doubleClickEvent.forTarget(this);
/// Stream of `devicemotion` events handled by this [Window].
@@ -35076,9 +35146,9 @@
}
}
- static void _removeAll(Element _element, Iterable<String> iterable) {
+ static void _removeAll(Element _element, Iterable<Object> iterable) {
DomTokenList list = _classListOf(_element);
- for (var value in iterable) {
+ for (String value in iterable) {
_classListRemove(list, value);
}
}
diff --git a/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart b/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
index 7dd739d..50962df 100644
--- a/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
+++ b/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
@@ -82,6 +82,7 @@
import 'dart:_js_helper' show Creates, Returns, JSName, Native;
import 'dart:_foreign_helper' show JS;
import 'dart:_interceptors' show Interceptor, JSExtendableArray;
+import 'dart:_js_helper' show convertDartClosureToJS;
// 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
// BSD-style license that can be found in the LICENSE file.
@@ -1039,7 +1040,8 @@
}
factory Observer(ObserverCallback callback) {
- return Observer._create_1(callback);
+ var callback_1 = convertDartClosureToJS(callback, 1);
+ return Observer._create_1(callback_1);
}
static Observer _create_1(callback) =>
JS('Observer', 'new IDBObserver(#)', callback);
diff --git a/sdk/lib/internal/internal.dart b/sdk/lib/internal/internal.dart
index f5ae6a1..11ee996 100644
--- a/sdk/lib/internal/internal.dart
+++ b/sdk/lib/internal/internal.dart
@@ -202,3 +202,181 @@
final String version;
const Since(this.version);
}
+
+/**
+ * HTTP status codes. Exported in dart:io and dart:html.
+ */
+abstract class HttpStatus {
+ static const int continue_ = 100;
+ static const int switchingProtocols = 101;
+ @Since("2.1")
+ static const int processing = 102;
+ static const int ok = 200;
+ static const int created = 201;
+ static const int accepted = 202;
+ static const int nonAuthoritativeInformation = 203;
+ static const int noContent = 204;
+ static const int resetContent = 205;
+ static const int partialContent = 206;
+ @Since("2.1")
+ static const int multiStatus = 207;
+ @Since("2.1")
+ static const int alreadyReported = 208;
+ @Since("2.1")
+ static const int imUsed = 226;
+ static const int multipleChoices = 300;
+ static const int movedPermanently = 301;
+ static const int found = 302;
+ static const int movedTemporarily = 302; // Common alias for found.
+ static const int seeOther = 303;
+ static const int notModified = 304;
+ static const int useProxy = 305;
+ static const int temporaryRedirect = 307;
+ @Since("2.1")
+ static const int permanentRedirect = 308;
+ static const int badRequest = 400;
+ static const int unauthorized = 401;
+ static const int paymentRequired = 402;
+ static const int forbidden = 403;
+ static const int notFound = 404;
+ static const int methodNotAllowed = 405;
+ static const int notAcceptable = 406;
+ static const int proxyAuthenticationRequired = 407;
+ static const int requestTimeout = 408;
+ static const int conflict = 409;
+ static const int gone = 410;
+ static const int lengthRequired = 411;
+ static const int preconditionFailed = 412;
+ static const int requestEntityTooLarge = 413;
+ static const int requestUriTooLong = 414;
+ static const int unsupportedMediaType = 415;
+ static const int requestedRangeNotSatisfiable = 416;
+ static const int expectationFailed = 417;
+ @Since("2.1")
+ static const int misdirectedRequest = 421;
+ @Since("2.1")
+ static const int unprocessableEntity = 422;
+ @Since("2.1")
+ static const int locked = 423;
+ @Since("2.1")
+ static const int failedDependency = 424;
+ static const int upgradeRequired = 426;
+ @Since("2.1")
+ static const int preconditionRequired = 428;
+ @Since("2.1")
+ static const int tooManyRequests = 429;
+ @Since("2.1")
+ static const int requestHeaderFieldsTooLarge = 431;
+ @Since("2.1")
+ static const int connectionClosedWithoutResponse = 444;
+ @Since("2.1")
+ static const int unavailableForLegalReasons = 451;
+ @Since("2.1")
+ static const int clientClosedRequest = 499;
+ static const int internalServerError = 500;
+ static const int notImplemented = 501;
+ static const int badGateway = 502;
+ static const int serviceUnavailable = 503;
+ static const int gatewayTimeout = 504;
+ static const int httpVersionNotSupported = 505;
+ @Since("2.1")
+ static const int variantAlsoNegotiates = 506;
+ @Since("2.1")
+ static const int insufficientStorage = 507;
+ @Since("2.1")
+ static const int loopDetected = 508;
+ @Since("2.1")
+ static const int notExtended = 510;
+ @Since("2.1")
+ static const int networkAuthenticationRequired = 511;
+ // Client generated status code.
+ static const int networkConnectTimeoutError = 599;
+
+ @Deprecated("Use continue_ instead")
+ static const int CONTINUE = continue_;
+ @Deprecated("Use switchingProtocols instead")
+ static const int SWITCHING_PROTOCOLS = switchingProtocols;
+ @Deprecated("Use ok instead")
+ static const int OK = ok;
+ @Deprecated("Use created instead")
+ static const int CREATED = created;
+ @Deprecated("Use accepted instead")
+ static const int ACCEPTED = accepted;
+ @Deprecated("Use nonAuthoritativeInformation instead")
+ static const int NON_AUTHORITATIVE_INFORMATION = nonAuthoritativeInformation;
+ @Deprecated("Use noContent instead")
+ static const int NO_CONTENT = noContent;
+ @Deprecated("Use resetContent instead")
+ static const int RESET_CONTENT = resetContent;
+ @Deprecated("Use partialContent instead")
+ static const int PARTIAL_CONTENT = partialContent;
+ @Deprecated("Use multipleChoices instead")
+ static const int MULTIPLE_CHOICES = multipleChoices;
+ @Deprecated("Use movedPermanently instead")
+ static const int MOVED_PERMANENTLY = movedPermanently;
+ @Deprecated("Use found instead")
+ static const int FOUND = found;
+ @Deprecated("Use movedTemporarily instead")
+ static const int MOVED_TEMPORARILY = movedTemporarily;
+ @Deprecated("Use seeOther instead")
+ static const int SEE_OTHER = seeOther;
+ @Deprecated("Use notModified instead")
+ static const int NOT_MODIFIED = notModified;
+ @Deprecated("Use useProxy instead")
+ static const int USE_PROXY = useProxy;
+ @Deprecated("Use temporaryRedirect instead")
+ static const int TEMPORARY_REDIRECT = temporaryRedirect;
+ @Deprecated("Use badRequest instead")
+ static const int BAD_REQUEST = badRequest;
+ @Deprecated("Use unauthorized instead")
+ static const int UNAUTHORIZED = unauthorized;
+ @Deprecated("Use paymentRequired instead")
+ static const int PAYMENT_REQUIRED = paymentRequired;
+ @Deprecated("Use forbidden instead")
+ static const int FORBIDDEN = forbidden;
+ @Deprecated("Use notFound instead")
+ static const int NOT_FOUND = notFound;
+ @Deprecated("Use methodNotAllowed instead")
+ static const int METHOD_NOT_ALLOWED = methodNotAllowed;
+ @Deprecated("Use notAcceptable instead")
+ static const int NOT_ACCEPTABLE = notAcceptable;
+ @Deprecated("Use proxyAuthenticationRequired instead")
+ static const int PROXY_AUTHENTICATION_REQUIRED = proxyAuthenticationRequired;
+ @Deprecated("Use requestTimeout instead")
+ static const int REQUEST_TIMEOUT = requestTimeout;
+ @Deprecated("Use conflict instead")
+ static const int CONFLICT = conflict;
+ @Deprecated("Use gone instead")
+ static const int GONE = gone;
+ @Deprecated("Use lengthRequired instead")
+ static const int LENGTH_REQUIRED = lengthRequired;
+ @Deprecated("Use preconditionFailed instead")
+ static const int PRECONDITION_FAILED = preconditionFailed;
+ @Deprecated("Use requestEntityTooLarge instead")
+ static const int REQUEST_ENTITY_TOO_LARGE = requestEntityTooLarge;
+ @Deprecated("Use requestUriTooLong instead")
+ static const int REQUEST_URI_TOO_LONG = requestUriTooLong;
+ @Deprecated("Use unsupportedMediaType instead")
+ static const int UNSUPPORTED_MEDIA_TYPE = unsupportedMediaType;
+ @Deprecated("Use requestedRangeNotSatisfiable instead")
+ static const int REQUESTED_RANGE_NOT_SATISFIABLE =
+ requestedRangeNotSatisfiable;
+ @Deprecated("Use expectationFailed instead")
+ static const int EXPECTATION_FAILED = expectationFailed;
+ @Deprecated("Use upgradeRequired instead")
+ static const int UPGRADE_REQUIRED = upgradeRequired;
+ @Deprecated("Use internalServerError instead")
+ static const int INTERNAL_SERVER_ERROR = internalServerError;
+ @Deprecated("Use notImplemented instead")
+ static const int NOT_IMPLEMENTED = notImplemented;
+ @Deprecated("Use badGateway instead")
+ static const int BAD_GATEWAY = badGateway;
+ @Deprecated("Use serviceUnavailable instead")
+ static const int SERVICE_UNAVAILABLE = serviceUnavailable;
+ @Deprecated("Use gatewayTimeout instead")
+ static const int GATEWAY_TIMEOUT = gatewayTimeout;
+ @Deprecated("Use httpVersionNotSupported instead")
+ static const int HTTP_VERSION_NOT_SUPPORTED = httpVersionNotSupported;
+ @Deprecated("Use networkConnectTimeoutError instead")
+ static const int NETWORK_CONNECT_TIMEOUT_ERROR = networkConnectTimeoutError;
+}
diff --git a/sdk/lib/io/io.dart b/sdk/lib/io/io.dart
index 6131c0e..c640c5b 100644
--- a/sdk/lib/io/io.dart
+++ b/sdk/lib/io/io.dart
@@ -196,6 +196,7 @@
import 'dart:typed_data';
export 'dart:_http';
+export 'dart:_internal' show HttpStatus;
part 'bytes_builder.dart';
part 'common.dart';
diff --git a/sdk/lib/svg/dart2js/svg_dart2js.dart b/sdk/lib/svg/dart2js/svg_dart2js.dart
index fdd5a68..7966fd7 100644
--- a/sdk/lib/svg/dart2js/svg_dart2js.dart
+++ b/sdk/lib/svg/dart2js/svg_dart2js.dart
@@ -3021,6 +3021,7 @@
static const EventStreamProvider<MouseEvent> contextMenuEvent =
const EventStreamProvider<MouseEvent>('contextmenu');
+ @DomName('SVGElement.dblclickEvent')
static const EventStreamProvider<Event> doubleClickEvent =
const EventStreamProvider<Event>('dblclick');
@@ -3215,6 +3216,7 @@
ElementStream<MouseEvent> get onContextMenu =>
contextMenuEvent.forElement(this);
+ @DomName('SVGElement.ondblclick')
ElementStream<Event> get onDoubleClick => doubleClickEvent.forElement(this);
ElementStream<MouseEvent> get onDrag => dragEvent.forElement(this);
diff --git a/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart b/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart
index cce7a93..0f703f9 100644
--- a/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart
+++ b/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart
@@ -80,6 +80,7 @@
final String version;
+ @JSName('changeVersion')
/**
* Atomically update the database version to [newVersion], asynchronously
* running [callback] on the [SqlTransaction] representing this
@@ -94,15 +95,52 @@
*
* * [Database.changeVersion](http://www.w3.org/TR/webdatabase/#dom-database-changeversion) from W3C.
*/
- void changeVersion(String oldVersion, String newVersion,
+ void _changeVersion(String oldVersion, String newVersion,
[SqlTransactionCallback callback,
SqlTransactionErrorCallback errorCallback,
VoidCallback successCallback]) native;
- void readTransaction(SqlTransactionCallback callback,
+ @JSName('changeVersion')
+ /**
+ * Atomically update the database version to [newVersion], asynchronously
+ * running [callback] on the [SqlTransaction] representing this
+ * [changeVersion] transaction.
+ *
+ * If [callback] runs successfully, then [successCallback] is called.
+ * Otherwise, [errorCallback] is called.
+ *
+ * [oldVersion] should match the database's current [version] exactly.
+ *
+ * See also:
+ *
+ * * [Database.changeVersion](http://www.w3.org/TR/webdatabase/#dom-database-changeversion) from W3C.
+ */
+ Future<SqlTransaction> changeVersion(String oldVersion, String newVersion) {
+ var completer = new Completer<SqlTransaction>();
+ _changeVersion(oldVersion, newVersion, (value) {
+ completer.complete(value);
+ }, (error) {
+ completer.completeError(error);
+ });
+ return completer.future;
+ }
+
+ @JSName('readTransaction')
+ void _readTransaction(SqlTransactionCallback callback,
[SqlTransactionErrorCallback errorCallback,
VoidCallback successCallback]) native;
+ @JSName('readTransaction')
+ Future<SqlTransaction> readTransaction() {
+ var completer = new Completer<SqlTransaction>();
+ _readTransaction((value) {
+ completer.complete(value);
+ }, (error) {
+ completer.completeError(error);
+ });
+ return completer.future;
+ }
+
void transaction(SqlTransactionCallback callback,
[SqlTransactionErrorCallback errorCallback,
VoidCallback successCallback]) native;
diff --git a/tests/lib_2/html/css_selector_test.dart b/tests/lib_2/html/css_selector_test.dart
new file mode 100644
index 0000000..5fcbd9e
--- /dev/null
+++ b/tests/lib_2/html/css_selector_test.dart
@@ -0,0 +1,49 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:html';
+
+import 'package:unittest/unittest.dart';
+import 'package:unittest/html_individual_config.dart';
+import 'utils.dart';
+
+main() {
+ useHtmlIndividualConfiguration();
+
+ final String htmlPayload = "<div>"
+ "<div>"
+ "<p class='a'>"
+ "<span>Test #1</span>"
+ "</p>"
+ "</div>"
+ "<div>"
+ "<p class='b'>"
+ "<span>Test #2</span>"
+ "</p>"
+ "</div>"
+ "</div>";
+
+ final elements =
+ new Element.html(htmlPayload, treeSanitizer: new NullTreeSanitizer());
+ document.body.nodes.add(elements);
+
+ var para = document.body.querySelector('p') as ParagraphElement;
+ para.classes.removeAll(['a', 'b']);
+
+ para = document.body.querySelector('p') as ParagraphElement;
+ expect(para.outerHtml, '<p class=""><span>Test #1</span></p>');
+
+ para = document.body.querySelector('p') as ParagraphElement;
+ para.classes.addAll(['c']);
+
+ para = document.body.querySelector('p') as ParagraphElement;
+ expect(para.outerHtml, '<p class="c"><span>Test #1</span></p>');
+
+ var allPara = document.body.querySelectorAll('p');
+ allPara.classes.removeAll(['b', 'c']);
+
+ var checkAllPara = document.body.querySelectorAll('p');
+ expect(checkAllPara[0].outerHtml, '<p class=""><span>Test #1</span></p>');
+ expect(checkAllPara[1].outerHtml, '<p class=""><span>Test #2</span></p>');
+}
diff --git a/tests/lib_2/html/http_test.dart b/tests/lib_2/html/http_test.dart
new file mode 100644
index 0000000..905f4d5
--- /dev/null
+++ b/tests/lib_2/html/http_test.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:html';
+
+import 'package:expect/minitest.dart';
+
+bool testSwitch(int currentValue) {
+ switch (currentValue) {
+ case HttpStatus.continue_:
+ return true;
+ case HttpStatus.ok:
+ return true;
+ case HttpStatus.NETWORK_CONNECT_TIMEOUT_ERROR:
+ return true;
+ }
+
+ return false;
+}
+
+main() {
+ expect(testSwitch(HttpStatus.continue_), isTrue);
+ expect(testSwitch(HttpStatus.CONTINUE), isTrue);
+
+ expect(testSwitch(HttpStatus.ok), isTrue);
+ expect(testSwitch(HttpStatus.OK), isTrue);
+
+ expect(testSwitch(HttpStatus.networkConnectTimeoutError), isTrue);
+ expect(testSwitch(HttpStatus.NETWORK_CONNECT_TIMEOUT_ERROR), isTrue);
+
+ expect(testSwitch(-20100), isFalse);
+}
diff --git a/tools/dom/dom.json b/tools/dom/dom.json
index a63e560..7dbf7aa 100644
--- a/tools/dom/dom.json
+++ b/tools/dom/dom.json
@@ -8033,6 +8033,9 @@
},
"createWriter": {},
"file": {},
+ "fileBlob": {
+ "support_level": "untriaged"
+ },
"filesystem": {
"support_level": "untriaged"
},
@@ -31541,4 +31544,4 @@
},
"support_level": "nonstandard"
}
-}
+}
\ No newline at end of file
diff --git a/tools/dom/scripts/dartmetadata.py b/tools/dom/scripts/dartmetadata.py
index 39736b1..cb81c49 100644
--- a/tools/dom/scripts/dartmetadata.py
+++ b/tools/dom/scripts/dartmetadata.py
@@ -741,14 +741,15 @@
def _GetCommonAnnotations(self, interface, member_name=None,
source_member_name=None):
+ annotations = []
if member_name:
key = '%s.%s' % (interface.id, member_name)
dom_name = '%s.%s' % (interface.javascript_binding_name, member_name)
+ # DomName annotation is needed for dblclick ACX plugin analyzer.
+ if member_name == 'dblclickEvent' or member_name == 'ondblclick':
+ annotations.append("@DomName('" + dom_name + "')")
else:
key = interface.id
- dom_name = interface.javascript_binding_name
-
- annotations = []
if key in _annotations:
annotations.extend(_annotations[key])
diff --git a/tools/dom/scripts/generator.py b/tools/dom/scripts/generator.py
index 952c629..81ce640 100644
--- a/tools/dom/scripts/generator.py
+++ b/tools/dom/scripts/generator.py
@@ -873,6 +873,8 @@
'dynamic', 'dynamic')
dart2js_conversions = monitored.Dict('generator.dart2js_conversions', {
+ # Used to convert Dart function to a JS callback typedef (old style).
+ 'Callback set': Conversion('convertDartClosureToJS', 'dynamic', 'dynamic'),
'Date get':
Conversion('convertNativeToDart_DateTime', 'dynamic', 'DateTime'),
'Date set':
diff --git a/tools/dom/scripts/htmldartgenerator.py b/tools/dom/scripts/htmldartgenerator.py
index 64e9f93..7f7574c6 100644
--- a/tools/dom/scripts/htmldartgenerator.py
+++ b/tools/dom/scripts/htmldartgenerator.py
@@ -323,7 +323,6 @@
info.operations[0],
info.name,
'call:')
-
if not method_name:
if info.name == 'item':
# FIXME: item should be renamed to operator[], not removed.
@@ -905,24 +904,37 @@
def _TypeInfo(self, type_name):
return self._type_registry.TypeInfo(type_name)
+ def _CallbackConvert(self, argType, info):
+ if self._database.HasInterface(argType):
+ interface = self._database.GetInterface(argType)
+ if "Callback" in interface.ext_attrs:
+ return interface.ext_attrs['Callback']
+ return None
+
def _ConvertArgumentTypes(self, stmts_emitter, arguments, argument_count, info):
temp_version = [0]
converted_arguments = []
target_parameters = []
calling_parameters = []
for position, arg in enumerate(arguments[:argument_count]):
- conversion = self._InputConversion(arg.type.id, info.declared_name)
+ callBackInfo = self._CallbackConvert(arg.type.id, info) # Returns callback arity (# of parameters)
+ if callBackInfo is None:
+ conversion = self._InputConversion(arg.type.id, info.declared_name)
+ else:
+ conversion = self._InputConversion('Callback', info.declared_name)
+
param_name = arguments[position].id
if conversion:
temp_version[0] += 1
temp_name = '%s_%s' % (param_name, temp_version[0])
temp_type = conversion.output_type
stmts_emitter.Emit(
- '$(INDENT)$TYPE $NAME = $CONVERT($ARG);\n',
+ '$(INDENT)$TYPE $NAME = $CONVERT($ARG);\n' if callBackInfo is None else '$(INDENT)$TYPE $NAME = $CONVERT($ARG, $ARITY);\n',
TYPE=TypeOrVar(temp_type),
NAME=temp_name,
CONVERT=conversion.function_name,
- ARG=info.param_infos[position].name)
+ ARG=info.param_infos[position].name,
+ ARITY=callBackInfo)
converted_arguments.append(temp_name)
param_type = temp_type
verified_type = temp_type # verified by assignment in checked mode.
diff --git a/tools/dom/scripts/htmlrenamer.py b/tools/dom/scripts/htmlrenamer.py
index 06bd04b..eade5b6 100644
--- a/tools/dom/scripts/htmlrenamer.py
+++ b/tools/dom/scripts/htmlrenamer.py
@@ -188,6 +188,8 @@
convert_to_future_members = monitored.Set(
'htmlrenamer.converted_to_future_members', [
+ 'Database.changeVersion',
+ 'Database.readTransaction',
'DataTransferItem.getAsString',
'DirectoryEntry.getDirectory',
'DirectoryEntry.getFile',
@@ -222,6 +224,9 @@
'Entry': {
'getMetadata': [
'applyExtension(\'Metadata\', value);',
+ ],
+ 'getParent': [
+ 'applyExtension(\'Entry\', value);',
]
},
'FileEntry': {
@@ -296,6 +301,7 @@
'CompositionEvent.initCompositionEvent',
'CustomEvent.detail',
'CustomEvent.initCustomEvent',
+ 'DataTransferItem.webkitGetAsEntry',
'DeviceOrientationEvent.initDeviceOrientationEvent',
'DirectoryEntry.createReader',
'DirectoryReader.readEntries',
@@ -495,19 +501,27 @@
# Members from the standard dom that exist in the dart:html library with
# identical functionality but with cleaner names.
renamed_html_members = monitored.Dict('htmlrenamer.renamed_html_members', {
- 'ConsoleBase.assert': 'assertCondition', 'CSSKeyframesRule.insertRule':
- 'appendRule', 'DirectoryEntry.getDirectory': '_getDirectory',
- 'DirectoryEntry.getFile': '_getFile', 'Document.createCDATASection':
- 'createCDataSection', 'Document.defaultView': 'window', 'Window.CSS': 'css',
+ 'ConsoleBase.assert': 'assertCondition',
+ 'CSSKeyframesRule.insertRule': 'appendRule',
+ 'DirectoryEntry.getDirectory': '_getDirectory',
+ 'DirectoryEntry.getFile': '_getFile',
+ 'Document.createCDATASection': 'createCDataSection',
+ 'Document.defaultView': 'window',
+ 'Window.CSS': 'css',
'Window.webkitNotifications': 'notifications',
'Window.webkitRequestFileSystem': '_requestFileSystem',
'Window.webkitResolveLocalFileSystemURL': 'resolveLocalFileSystemUrl',
- 'Navigator.webkitGetUserMedia': '_getUserMedia', 'Node.appendChild':
- 'append', 'Node.cloneNode': 'clone', 'Node.nextSibling': 'nextNode',
- 'Node.parentElement': 'parent', 'Node.previousSibling': 'previousNode',
- 'Node.textContent': 'text', 'SVGElement.className': '_svgClassName',
- 'SVGStopElement.offset': 'gradientOffset', 'URL.createObjectURL':
- 'createObjectUrl', 'URL.revokeObjectURL': 'revokeObjectUrl',
+ 'Navigator.webkitGetUserMedia': '_getUserMedia',
+ 'Node.appendChild': 'append',
+ 'Node.cloneNode': 'clone',
+ 'Node.nextSibling': 'nextNode',
+ 'Node.parentElement': 'parent',
+ 'Node.previousSibling': 'previousNode',
+ 'Node.textContent': 'text',
+ 'SVGElement.className': '_svgClassName',
+ 'SVGStopElement.offset': 'gradientOffset',
+ 'URL.createObjectURL': 'createObjectUrl',
+ 'URL.revokeObjectURL': 'revokeObjectUrl',
#'WorkerContext.webkitRequestFileSystem': '_requestFileSystem',
#'WorkerContext.webkitRequestFileSystemSync': '_requestFileSystemSync',
@@ -600,6 +614,7 @@
'AudioContext.decodeAudioData',
'AudioBufferSourceNode.looping', # TODO(vsm): Use deprecated IDL annotation
'CSSStyleDeclaration.getPropertyCSSValue',
+ 'HTMLCanvasElement.toBlob',
'CanvasRenderingContext2D.clearShadow',
'CanvasRenderingContext2D.drawImageFromRect',
'CanvasRenderingContext2D.setAlpha',
@@ -727,8 +742,10 @@
'Element.prepend',
'Element.removeAttributeNode',
'Element.set:outerHTML',
+ 'Element.setApplyScroll',
'Element.setAttributeNode',
'Element.setAttributeNodeNS',
+ 'Element.setDistributeScroll',
'Element.webkitCreateShadowRoot',
'Element.webkitMatchesSelector',
'Element.webkitPseudo',
diff --git a/tools/dom/scripts/idlnode.py b/tools/dom/scripts/idlnode.py
index b2e06d2..6149474 100644
--- a/tools/dom/scripts/idlnode.py
+++ b/tools/dom/scripts/idlnode.py
@@ -404,7 +404,7 @@
for annotation in callback_function.annotations:
callback = callback_function.annotations[annotation]
cb_interface = IDLInterface(None, callback.name)
- cb_interface.ext_attrs['Callback'] = None
+ cb_interface.ext_attrs['Callback'] = len(callback.arguments)
op = IDLOperation(None, cb_interface.id, "handleEvent")
op.type = IDLType(callback.idl_type)
op.type = resolveTypedef(op.type)
diff --git a/tools/dom/src/dart2js_CssClassSet.dart b/tools/dom/src/dart2js_CssClassSet.dart
index c3394aa..098d28f 100644
--- a/tools/dom/src/dart2js_CssClassSet.dart
+++ b/tools/dom/src/dart2js_CssClassSet.dart
@@ -193,9 +193,9 @@
}
}
- static void _removeAll(Element _element, Iterable<String> iterable) {
+ static void _removeAll(Element _element, Iterable<Object> iterable) {
DomTokenList list = _classListOf(_element);
- for (var value in iterable) {
+ for (String value in iterable) {
_classListRemove(list, value);
}
}
diff --git a/tools/dom/templates/html/dart2js/html_dart2js.darttemplate b/tools/dom/templates/html/dart2js/html_dart2js.darttemplate
index 436df0a..2a30e63 100644
--- a/tools/dom/templates/html/dart2js/html_dart2js.darttemplate
+++ b/tools/dom/templates/html/dart2js/html_dart2js.darttemplate
@@ -53,6 +53,7 @@
import 'dart:_foreign_helper' show JS, JS_INTERCEPTOR_CONSTANT;
export 'dart:math' show Rectangle, Point;
+export 'dart:_internal' show HttpStatus;
$!GENERATED_DART_FILES
diff --git a/tools/dom/templates/html/dart2js/indexed_db_dart2js.darttemplate b/tools/dom/templates/html/dart2js/indexed_db_dart2js.darttemplate
index 706bc06..29bc8c5 100644
--- a/tools/dom/templates/html/dart2js/indexed_db_dart2js.darttemplate
+++ b/tools/dom/templates/html/dart2js/indexed_db_dart2js.darttemplate
@@ -91,6 +91,8 @@
import 'dart:_foreign_helper' show JS;
import 'dart:_interceptors' show Interceptor, JSExtendableArray;
+import 'dart:_js_helper' show convertDartClosureToJS;
+
$!GENERATED_DART_FILES
class _KeyRangeFactoryProvider {
diff --git a/tools/dom/templates/html/impl/impl_DataTransferItem.darttemplate b/tools/dom/templates/html/impl/impl_DataTransferItem.darttemplate
new file mode 100644
index 0000000..8294cc1
--- /dev/null
+++ b/tools/dom/templates/html/impl/impl_DataTransferItem.darttemplate
@@ -0,0 +1,23 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+part of $LIBRARYNAME;
+
+$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
+
+ Entry getAsEntry() {
+ Entry entry = _webkitGetAsEntry();
+
+ if (entry.isFile)
+ applyExtension('FileEntry', entry);
+ else if (entry.isDirectory)
+ applyExtension('DirectoryEntry', entry);
+ else
+ applyExtension('Entry', entry);
+
+ return entry;
+ }
+
+$!MEMBERS
+}
diff --git a/tools/dom/templates/html/impl/impl_DirectoryReader.darttemplate b/tools/dom/templates/html/impl/impl_DirectoryReader.darttemplate
index 53bc0ef..06eba12 100644
--- a/tools/dom/templates/html/impl/impl_DirectoryReader.darttemplate
+++ b/tools/dom/templates/html/impl/impl_DirectoryReader.darttemplate
@@ -9,8 +9,16 @@
Future<List<Entry>> readEntries() {
var completer = new Completer<List<Entry>>();
- _readEntries((value) {
- completer.complete(new List<Entry>.from(value));
+ _readEntries((values) {
+ values.forEach((value) {
+ applyExtension('Entry', value);
+ Entry entry = value as Entry;
+ if (entry.isFile)
+ applyExtension('FileEntry', entry);
+ else if (entry.isDirectory)
+ applyExtension('DirectoryEntry', entry);
+ });
+ completer.complete(new List<Entry>.from(values));
}, (error) {
completer.completeError(error);
});
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index 35bd16f..0ff97f6 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -599,6 +599,28 @@
ElementList<T> querySelectorAll<T extends Element>(String selectors) =>
new _FrozenElementList<T>._wrap(_querySelectorAll(selectors));
+ @JSName('setApplyScroll')
+ void _setApplyScroll(ScrollStateCallback scrollStateCallback, String nativeScrollBehavior) native;
+
+ Future<ScrollState> setApplyScroll(String nativeScrollBehavior) {
+ var completer = new Completer<ScrollState>();
+ _setApplyScroll((value) {
+ completer.complete(value);
+ }, nativeScrollBehavior);
+ return completer.future;
+ }
+
+ @JSName('setDistributeScroll')
+ void _setDistributeScroll(ScrollStateCallback scrollStateCallback, String nativeScrollBehavior) native;
+
+ Future<ScrollState> setDistributeScroll(String nativeScrollBehavior) {
+ var completer = new Completer<ScrollState>();
+ _setDistributeScroll((value) {
+ completer.complete(value);
+ }, nativeScrollBehavior);
+ return completer.future;
+ }
+
/**
* The set of CSS classes applied to this element.
*
diff --git a/tools/dom/templates/html/impl/impl_HTMLCanvasElement.darttemplate b/tools/dom/templates/html/impl/impl_HTMLCanvasElement.darttemplate
index bfde34a..c935546 100644
--- a/tools/dom/templates/html/impl/impl_HTMLCanvasElement.darttemplate
+++ b/tools/dom/templates/html/impl/impl_HTMLCanvasElement.darttemplate
@@ -82,4 +82,15 @@
*/
String toDataUrl([String type = 'image/png', num quality]) =>
_toDataUrl(type, quality);
+
+ @JSName('toBlob')
+ void _toBlob(BlobCallback callback, String type, [Object arguments]) native;
+
+ Future<Blob> toBlob(String type, [Object arguments]) {
+ var completer = new Completer<Blob>();
+ _toBlob((value) {
+ completer.complete(value);
+ }, type, arguments);
+ return completer.future;
+ }
}