76193718d2
This is a reland of commit 2a669c571f.
External APIs when using dart:js_interop should only allow
primitives, JS types, and other static interop types. This
was previously checked in a more restrictive mode called
"strict mode" but is not checked everywhere where dart:js_interop
APIs exist.
Change-Id: I1a8d04071a519c4965b266eb2800bcc3c3bb8393
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325961
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
27 lines
638 B
Dart
27 lines
638 B
Dart
// Copyright (c) 2023, 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.
|
|
|
|
// Test that JS' Array type is interoperable using static interop.
|
|
|
|
@JS()
|
|
library js_array_test;
|
|
|
|
import 'dart:js_interop';
|
|
|
|
@JS()
|
|
external void eval(String code);
|
|
|
|
// dart:js_interop top-levels do return-type checks so if the call to these
|
|
// getters succeed, it's enough to know they can be interoperable.
|
|
|
|
@JS()
|
|
external JSObject get jsArray;
|
|
|
|
void main() {
|
|
eval('''
|
|
this.jsArray = Array();
|
|
''');
|
|
jsArray;
|
|
}
|