[dart:js] Use Array.isArray
Bug: b/411647888
Change-Id: I501808ab48798e99531114017ad3497d1f0ab2c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423067
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
diff --git a/sdk/lib/_internal/js_dev_runtime/patch/js_patch.dart b/sdk/lib/_internal/js_dev_runtime/patch/js_patch.dart
index 31ff5e6..43376e5 100644
--- a/sdk/lib/_internal/js_dev_runtime/patch/js_patch.dart
+++ b/sdk/lib/_internal/js_dev_runtime/patch/js_patch.dart
@@ -440,7 +440,7 @@
if (JS<bool>('!', 'typeof # == "function"', o)) {
return JsFunction._fromJs(o);
}
- if (JS<bool>('!', '# instanceof Array', o)) {
+ if (JS<bool>('!', 'Array.isArray(#)', o)) {
return JsArray._fromJs(o);
}
return JsObject._fromJs(o);
diff --git a/sdk/lib/_internal/js_runtime/lib/js_patch.dart b/sdk/lib/_internal/js_runtime/lib/js_patch.dart
index b1a138a..c2111a4 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_patch.dart
@@ -548,7 +548,7 @@
(o) => JsFunction._fromJs(o),
);
}
- if (JS('bool', '# instanceof Array', o)) {
+ if (JS('bool', 'Array.isArray(#)', o)) {
return _getDartProxy(
o,
_DART_OBJECT_PROPERTY_NAME,