Skip to content

Commit a865b9c

Browse files
srujzscommit-bot@chromium.org
authored andcommitted
Change Future lists to use dynamic
Bug: #39627 Lists in a future should be typed with dynamic since they come from JS interop. Change-Id: I93d4da16eb27c3af23820a170cfad7cc5c3b4472 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128368 Reviewed-by: Sigmund Cherem <[email protected]> Commit-Queue: Srujan Gaddam <[email protected]>
1 parent 4071889 commit a865b9c

File tree

3 files changed

+46
-50
lines changed

3 files changed

+46
-50
lines changed

sdk/lib/html/dart2js/html_dart2js.dart

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,8 +1192,8 @@ class BackgroundFetchManager extends Interceptor {
11921192
promiseToFuture<BackgroundFetchRegistration>(
11931193
JS("", "#.get(#)", this, id));
11941194

1195-
Future<List<String>> getIds() =>
1196-
promiseToFuture<List<String>>(JS("", "#.getIds()", this));
1195+
Future<List<dynamic>> getIds() =>
1196+
promiseToFuture<List<dynamic>>(JS("", "#.getIds()", this));
11971197
}
11981198
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
11991199
// for details. All rights reserved. Use of this source code is governed by a
@@ -1299,9 +1299,8 @@ class BarcodeDetector extends Interceptor {
12991299
static BarcodeDetector _create_1() =>
13001300
JS('BarcodeDetector', 'new BarcodeDetector()');
13011301

1302-
Future<List<DetectedBarcode>> detect(/*ImageBitmapSource*/ image) =>
1303-
promiseToFuture<List<DetectedBarcode>>(
1304-
JS("", "#.detect(#)", this, image));
1302+
Future<List<dynamic>> detect(/*ImageBitmapSource*/ image) =>
1303+
promiseToFuture<List<dynamic>>(JS("", "#.detect(#)", this, image));
13051304
}
13061305
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
13071306
// for details. All rights reserved. Use of this source code is governed by a
@@ -2811,12 +2810,12 @@ class Clients extends Interceptor {
28112810

28122811
Future get(String id) => promiseToFuture(JS("", "#.get(#)", this, id));
28132812

2814-
Future<List<Client>> matchAll([Map options]) {
2813+
Future<List<dynamic>> matchAll([Map options]) {
28152814
var options_dict = null;
28162815
if (options != null) {
28172816
options_dict = convertDartToNative_Dictionary(options);
28182817
}
2819-
return promiseToFuture<List<Client>>(
2818+
return promiseToFuture<List<dynamic>>(
28202819
JS("", "#.matchAll(#)", this, options_dict));
28212820
}
28222821

@@ -15197,8 +15196,8 @@ class FaceDetector extends Interceptor {
1519715196
JS('FaceDetector', 'new FaceDetector(#)', faceDetectorOptions);
1519815197
static FaceDetector _create_2() => JS('FaceDetector', 'new FaceDetector()');
1519915198

15200-
Future<List<DetectedFace>> detect(/*ImageBitmapSource*/ image) =>
15201-
promiseToFuture<List<DetectedFace>>(JS("", "#.detect(#)", this, image));
15199+
Future<List<dynamic>> detect(/*ImageBitmapSource*/ image) =>
15200+
promiseToFuture<List<dynamic>>(JS("", "#.detect(#)", this, image));
1520215201
}
1520315202
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1520415203
// for details. All rights reserved. Use of this source code is governed by a
@@ -23666,8 +23665,8 @@ class PaymentInstruments extends Interceptor {
2366623665
Future has(String instrumentKey) =>
2366723666
promiseToFuture(JS("", "#.has(#)", this, instrumentKey));
2366823667

23669-
Future<List<String>> keys() =>
23670-
promiseToFuture<List<String>>(JS("", "#.keys()", this));
23668+
Future<List<dynamic>> keys() =>
23669+
promiseToFuture<List<dynamic>>(JS("", "#.keys()", this));
2367123670

2367223671
Future set(String instrumentKey, Map details) {
2367323672
var details_dict = convertDartToNative_Dictionary(details);
@@ -26437,9 +26436,8 @@ class ServiceWorkerContainer extends EventTarget {
2643726436
promiseToFuture<ServiceWorkerRegistration>(
2643826437
JS("", "#.getRegistration(#)", this, documentURL));
2643926438

26440-
Future<List<ServiceWorkerRegistration>> getRegistrations() =>
26441-
promiseToFuture<List<ServiceWorkerRegistration>>(
26442-
JS("", "#.getRegistrations()", this));
26439+
Future<List<dynamic>> getRegistrations() =>
26440+
promiseToFuture<List<dynamic>>(JS("", "#.getRegistrations()", this));
2644326441

2644426442
Future<ServiceWorkerRegistration> register(String url, [Map options]) {
2644526443
var options_dict = null;
@@ -26529,12 +26527,12 @@ class ServiceWorkerRegistration extends EventTarget {
2652926527

2653026528
final ServiceWorker waiting;
2653126529

26532-
Future<List<Notification>> getNotifications([Map filter]) {
26530+
Future<List<dynamic>> getNotifications([Map filter]) {
2653326531
var filter_dict = null;
2653426532
if (filter != null) {
2653526533
filter_dict = convertDartToNative_Dictionary(filter);
2653626534
}
26537-
return promiseToFuture<List<Notification>>(
26535+
return promiseToFuture<List<dynamic>>(
2653826536
JS("", "#.getNotifications(#)", this, filter_dict));
2653926537
}
2654026538

@@ -27887,8 +27885,8 @@ class SyncManager extends Interceptor {
2788727885
throw new UnsupportedError("Not supported");
2788827886
}
2788927887

27890-
Future<List<String>> getTags() =>
27891-
promiseToFuture<List<String>>(JS("", "#.getTags()", this));
27888+
Future<List<dynamic>> getTags() =>
27889+
promiseToFuture<List<dynamic>>(JS("", "#.getTags()", this));
2789227890

2789327891
Future register(String tag) =>
2789427892
promiseToFuture(JS("", "#.register(#)", this, tag));
@@ -28390,8 +28388,8 @@ class TextDetector extends Interceptor {
2839028388
}
2839128389
static TextDetector _create_1() => JS('TextDetector', 'new TextDetector()');
2839228390

28393-
Future<List<DetectedText>> detect(/*ImageBitmapSource*/ image) =>
28394-
promiseToFuture<List<DetectedText>>(JS("", "#.detect(#)", this, image));
28391+
Future<List<dynamic>> detect(/*ImageBitmapSource*/ image) =>
28392+
promiseToFuture<List<dynamic>>(JS("", "#.detect(#)", this, image));
2839528393
}
2839628394
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2839728395
// for details. All rights reserved. Use of this source code is governed by a

sdk_nnbd/lib/html/dart2js/html_dart2js.dart

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,8 +1191,8 @@ class BackgroundFetchManager extends Interceptor {
11911191
promiseToFuture<BackgroundFetchRegistration>(
11921192
JS("", "#.get(#)", this, id));
11931193

1194-
Future<List<String>> getIds() =>
1195-
promiseToFuture<List<String>>(JS("", "#.getIds()", this));
1194+
Future<List<dynamic>> getIds() =>
1195+
promiseToFuture<List<dynamic>>(JS("", "#.getIds()", this));
11961196
}
11971197
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
11981198
// for details. All rights reserved. Use of this source code is governed by a
@@ -1298,9 +1298,8 @@ class BarcodeDetector extends Interceptor {
12981298
static BarcodeDetector _create_1() =>
12991299
JS('BarcodeDetector', 'new BarcodeDetector()');
13001300

1301-
Future<List<DetectedBarcode>> detect(/*ImageBitmapSource*/ image) =>
1302-
promiseToFuture<List<DetectedBarcode>>(
1303-
JS("", "#.detect(#)", this, image));
1301+
Future<List<dynamic>> detect(/*ImageBitmapSource*/ image) =>
1302+
promiseToFuture<List<dynamic>>(JS("", "#.detect(#)", this, image));
13041303
}
13051304
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
13061305
// for details. All rights reserved. Use of this source code is governed by a
@@ -2810,12 +2809,12 @@ class Clients extends Interceptor {
28102809

28112810
Future get(String id) => promiseToFuture(JS("", "#.get(#)", this, id));
28122811

2813-
Future<List<Client>> matchAll([Map options]) {
2812+
Future<List<dynamic>> matchAll([Map options]) {
28142813
var options_dict = null;
28152814
if (options != null) {
28162815
options_dict = convertDartToNative_Dictionary(options);
28172816
}
2818-
return promiseToFuture<List<Client>>(
2817+
return promiseToFuture<List<dynamic>>(
28192818
JS("", "#.matchAll(#)", this, options_dict));
28202819
}
28212820

@@ -15196,8 +15195,8 @@ class FaceDetector extends Interceptor {
1519615195
JS('FaceDetector', 'new FaceDetector(#)', faceDetectorOptions);
1519715196
static FaceDetector _create_2() => JS('FaceDetector', 'new FaceDetector()');
1519815197

15199-
Future<List<DetectedFace>> detect(/*ImageBitmapSource*/ image) =>
15200-
promiseToFuture<List<DetectedFace>>(JS("", "#.detect(#)", this, image));
15198+
Future<List<dynamic>> detect(/*ImageBitmapSource*/ image) =>
15199+
promiseToFuture<List<dynamic>>(JS("", "#.detect(#)", this, image));
1520115200
}
1520215201
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1520315202
// for details. All rights reserved. Use of this source code is governed by a
@@ -23665,8 +23664,8 @@ class PaymentInstruments extends Interceptor {
2366523664
Future has(String instrumentKey) =>
2366623665
promiseToFuture(JS("", "#.has(#)", this, instrumentKey));
2366723666

23668-
Future<List<String>> keys() =>
23669-
promiseToFuture<List<String>>(JS("", "#.keys()", this));
23667+
Future<List<dynamic>> keys() =>
23668+
promiseToFuture<List<dynamic>>(JS("", "#.keys()", this));
2367023669

2367123670
Future set(String instrumentKey, Map details) {
2367223671
var details_dict = convertDartToNative_Dictionary(details);
@@ -26436,9 +26435,8 @@ class ServiceWorkerContainer extends EventTarget {
2643626435
promiseToFuture<ServiceWorkerRegistration>(
2643726436
JS("", "#.getRegistration(#)", this, documentURL));
2643826437

26439-
Future<List<ServiceWorkerRegistration>> getRegistrations() =>
26440-
promiseToFuture<List<ServiceWorkerRegistration>>(
26441-
JS("", "#.getRegistrations()", this));
26438+
Future<List<dynamic>> getRegistrations() =>
26439+
promiseToFuture<List<dynamic>>(JS("", "#.getRegistrations()", this));
2644226440

2644326441
Future<ServiceWorkerRegistration> register(String url, [Map options]) {
2644426442
var options_dict = null;
@@ -26528,12 +26526,12 @@ class ServiceWorkerRegistration extends EventTarget {
2652826526

2652926527
final ServiceWorker waiting;
2653026528

26531-
Future<List<Notification>> getNotifications([Map filter]) {
26529+
Future<List<dynamic>> getNotifications([Map filter]) {
2653226530
var filter_dict = null;
2653326531
if (filter != null) {
2653426532
filter_dict = convertDartToNative_Dictionary(filter);
2653526533
}
26536-
return promiseToFuture<List<Notification>>(
26534+
return promiseToFuture<List<dynamic>>(
2653726535
JS("", "#.getNotifications(#)", this, filter_dict));
2653826536
}
2653926537

@@ -27886,8 +27884,8 @@ class SyncManager extends Interceptor {
2788627884
throw new UnsupportedError("Not supported");
2788727885
}
2788827886

27889-
Future<List<String>> getTags() =>
27890-
promiseToFuture<List<String>>(JS("", "#.getTags()", this));
27887+
Future<List<dynamic>> getTags() =>
27888+
promiseToFuture<List<dynamic>>(JS("", "#.getTags()", this));
2789127889

2789227890
Future register(String tag) =>
2789327891
promiseToFuture(JS("", "#.register(#)", this, tag));
@@ -28389,8 +28387,8 @@ class TextDetector extends Interceptor {
2838928387
}
2839028388
static TextDetector _create_1() => JS('TextDetector', 'new TextDetector()');
2839128389

28392-
Future<List<DetectedText>> detect(/*ImageBitmapSource*/ image) =>
28393-
promiseToFuture<List<DetectedText>>(JS("", "#.detect(#)", this, image));
28390+
Future<List<dynamic>> detect(/*ImageBitmapSource*/ image) =>
28391+
promiseToFuture<List<dynamic>>(JS("", "#.detect(#)", this, image));
2839428392
}
2839528393
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2839628394
// for details. All rights reserved. Use of this source code is governed by a

tools/dom/scripts/systemhtml.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ def _DartType(self, type_name):
926926
"type": "FontFace"
927927
},
928928
"FontFaceSet.load": {
929-
"type": "List<FontFace>"
929+
"type": "List<dynamic>"
930930
},
931931
"OffscreenCanvas.load": {
932932
"type": "Blob"
@@ -938,13 +938,13 @@ def _DartType(self, type_name):
938938
"type": "BackgroundFetchRegistration"
939939
},
940940
"BackgroundFetchManager.getIds": {
941-
"type": "List<String>"
941+
"type": "List<dynamic>"
942942
},
943943
"BackgroundFetchRegistration.abort": {
944944
"type": "bool"
945945
},
946946
"SyncManager.getTags": {
947-
"type": "List<String>"
947+
"type": "List<dynamic>"
948948
},
949949
"BudgetService.getCost": {
950950
"type": "double"
@@ -995,7 +995,7 @@ def _DartType(self, type_name):
995995
"type": "MediaStream"
996996
},
997997
"ServiceWorkerRegistration.getNotifications": {
998-
"type": "List<Notification>"
998+
"type": "List<dynamic>"
999999
},
10001000
"PaymentInstruments.delete": {
10011001
"type": "bool"
@@ -1004,7 +1004,7 @@ def _DartType(self, type_name):
10041004
"type": "dictionary"
10051005
},
10061006
"PaymentInstruments.keys": {
1007-
"type": "List<String>"
1007+
"type": "List<dynamic>"
10081008
},
10091009
"PaymentInstrumentshas.": {
10101010
"type": "bool"
@@ -1074,7 +1074,7 @@ def _DartType(self, type_name):
10741074
"type": "int"
10751075
},
10761076
"Clients.matchAll": {
1077-
"type": "List<Client>"
1077+
"type": "List<dynamic>"
10781078
},
10791079
"Clients.openWindow": {
10801080
"type": "WindowClient"
@@ -1089,7 +1089,7 @@ def _DartType(self, type_name):
10891089
"type": "ServiceWorkerRegistration"
10901090
},
10911091
"ServiceWorkerContainer.getRegistrations": {
1092-
"type": "List<ServiceWorkerRegistration>"
1092+
"type": "List<dynamic>"
10931093
},
10941094
"ServiceWorkerGlobalScope.fetch": {
10951095
"type": "Response"
@@ -1104,13 +1104,13 @@ def _DartType(self, type_name):
11041104
"type": "WindowClient"
11051105
},
11061106
"BarcodeDetector.detect": {
1107-
"type": "List<DetectedBarcode>"
1107+
"type": "List<dynamic>"
11081108
},
11091109
"FaceDetector.detect": {
1110-
"type": "List<DetectedFace>"
1110+
"type": "List<dynamic>"
11111111
},
11121112
"TextDetector.detect": {
1113-
"type": "List<DetectedText>"
1113+
"type": "List<dynamic>"
11141114
},
11151115
"BaseAudioContext.decodeAudioData": {
11161116
"type": "AudioBuffer"

0 commit comments

Comments
 (0)