Fixed callbacks typedef to be List instead of a generic typed List.
Fixed getLegacyStats - shouldn't have a JSName annotation. Fixes #33891 R=sigmund@google.com Change-Id: Ie9761ad4f3c69fc875cdb1f0d096f48d1528671b Reviewed-on: https://dart-review.googlesource.com/66400 Reviewed-by: Sigmund Cherem <sigmund@google.com> Commit-Queue: Terry Lucas <terry@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
eb4b4d3699
commit
7b77fa217b
@@ -14504,7 +14504,7 @@ class EmbedElement extends HtmlElement {
|
||||
|
||||
// WARNING: Do not edit - generated code.
|
||||
|
||||
typedef void _EntriesCallback(List<Entry> entries);
|
||||
typedef void _EntriesCallback(List entries);
|
||||
// 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.
|
||||
@@ -18843,7 +18843,7 @@ class IntersectionObserver extends Interceptor {
|
||||
// WARNING: Do not edit - generated code.
|
||||
|
||||
typedef void IntersectionObserverCallback(
|
||||
List<IntersectionObserverEntry> entries, IntersectionObserver observer);
|
||||
List entries, IntersectionObserver observer);
|
||||
// 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.
|
||||
@@ -21179,8 +21179,7 @@ class MouseEvent extends UIEvent {
|
||||
|
||||
// WARNING: Do not edit - generated code.
|
||||
|
||||
typedef void MutationCallback(
|
||||
List<MutationRecord> mutations, MutationObserver observer);
|
||||
typedef void MutationCallback(List mutations, MutationObserver observer);
|
||||
// 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.
|
||||
@@ -25106,7 +25105,7 @@ class ReportingObserver extends Interceptor {
|
||||
// WARNING: Do not edit - generated code.
|
||||
|
||||
typedef void ReportingObserverCallback(
|
||||
List<_Report> reports, ReportingObserver observer);
|
||||
List reports, ReportingObserver observer);
|
||||
// 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.
|
||||
@@ -25481,7 +25480,6 @@ class RtcPeerConnection extends EventTarget {
|
||||
* Temporarily exposes _getStats and old getStats as getLegacyStats until Chrome fully supports
|
||||
* new getStats API.
|
||||
*/
|
||||
@JSName('getStats')
|
||||
Future<RtcStatsResponse> getLegacyStats([MediaStreamTrack selector]) {
|
||||
var completer = new Completer<RtcStatsResponse>();
|
||||
_getStats((value) {
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
library callback_list_test;
|
||||
|
||||
import 'dart:html';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:unittest/unittest.dart';
|
||||
import 'package:unittest/html_config.dart';
|
||||
|
||||
var callbackDone = false;
|
||||
bool isCallbackDone() => callbackDone;
|
||||
|
||||
Future waitUntilCallbackDone(bool test()) async {
|
||||
var completer = new Completer();
|
||||
check() {
|
||||
if (test()) {
|
||||
completer.complete();
|
||||
} else {
|
||||
new Timer(Duration.zero, check);
|
||||
}
|
||||
}
|
||||
|
||||
check();
|
||||
return completer.future;
|
||||
}
|
||||
|
||||
void main() async {
|
||||
useHtmlConfiguration();
|
||||
window.navigator.persistentStorage.requestQuota(1024 * 1024, _quotaHandler);
|
||||
|
||||
await waitUntilCallbackDone(isCallbackDone);
|
||||
expect(true, isCallbackDone());
|
||||
}
|
||||
|
||||
Future _quotaHandler(int byteCount) async {
|
||||
FileSystem filesystem =
|
||||
await window.requestFileSystem(1024 * 1024, persistent: true);
|
||||
DirectoryEntry dir = await filesystem.root;
|
||||
DirectoryReader dirReader = dir.createReader();
|
||||
await dirReader.readEntries();
|
||||
List<Entry> secondEntries = await dirReader.readEntries();
|
||||
callbackDone = true;
|
||||
}
|
||||
@@ -87,7 +87,6 @@ html/no_linked_scripts_htmltest: Timeout, Pass # Issue 32262
|
||||
html/worker_test/functional: RuntimeError # Issue 32261
|
||||
|
||||
[ $compiler == dart2js && $runtime == chrome && $strong ]
|
||||
html/fileapi_directory_reader_test: RuntimeError
|
||||
html/interactive_media_test: RuntimeError
|
||||
|
||||
[ $compiler == dart2js && $runtime == chromeOnAndroid ]
|
||||
@@ -117,6 +116,7 @@ html/audioelement_test: RuntimeError
|
||||
html/b_element_test: RuntimeError
|
||||
html/blob_constructor_test: RuntimeError
|
||||
html/cache_test: RuntimeError
|
||||
html/callback_list_test: RuntimeError
|
||||
html/callbacks_test: RuntimeError
|
||||
html/canvas_pixel_array_type_alias_test: RuntimeError
|
||||
html/canvas_test: RuntimeError
|
||||
|
||||
@@ -137,6 +137,15 @@ _js_custom_constructors = monitored.Set('systemhtml._js_custom_constructors', [
|
||||
# constructor creation.
|
||||
_static_classes = set(['Url'])
|
||||
|
||||
# Callback typedefs with generic List (List<nnn>) convert to List
|
||||
_callback_list_generics_mapping = monitored.Set('systemhtml._callback_list_generics_mapping', [
|
||||
'List<Entry>',
|
||||
'List<IntersectionObserverEntry>',
|
||||
'List<MutationRecord>',
|
||||
'List<_Report>',
|
||||
])
|
||||
|
||||
|
||||
# Information for generating element constructors.
|
||||
#
|
||||
# TODO(sra): maybe remove all the argument complexity and use cascades.
|
||||
@@ -524,10 +533,19 @@ class HtmlDartInterfaceGenerator(object):
|
||||
annotations = self._metadata.GetFormattedMetadata(self._library_name,
|
||||
self._interface)
|
||||
|
||||
params = info.ParametersAsDeclaration(self._DartType);
|
||||
|
||||
types = params.split()
|
||||
if len(types) > 0:
|
||||
mapType = types[0] in _callback_list_generics_mapping
|
||||
if mapType is True:
|
||||
types[0] = 'List'
|
||||
params = " ".join(types)
|
||||
|
||||
code.Emit('$(ANNOTATIONS)typedef void $NAME($PARAMS);\n',
|
||||
ANNOTATIONS=annotations,
|
||||
NAME=typedef_name,
|
||||
PARAMS=info.ParametersAsDeclaration(self._DartType))
|
||||
PARAMS=params)
|
||||
self._backend.GenerateCallback(info)
|
||||
|
||||
def GenerateInterface(self):
|
||||
|
||||
@@ -54,7 +54,6 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
||||
* Temporarily exposes _getStats and old getStats as getLegacyStats until Chrome fully supports
|
||||
* new getStats API.
|
||||
*/
|
||||
@JSName('getStats')
|
||||
Future<RtcStatsResponse> getLegacyStats([MediaStreamTrack selector]) {
|
||||
var completer = new Completer<RtcStatsResponse>();
|
||||
_getStats((value) {
|
||||
|
||||
Reference in New Issue
Block a user