@@ -6,19 +6,26 @@ import 'native_testing.dart';
66import 'dart:_js_helper' show setNativeSubclassDispatchRecord;
77import 'dart:_interceptors'
88 show
9- JSObject, // The interface, which may be re-exported by a
10- // js-interop library.
11- LegacyJavaScriptObject, // The interceptor abstract class.
12- PlainJavaScriptObject, // The interceptor concrete class.
13- UnknownJavaScriptObject, // The interceptor concrete class.
14- Interceptor;
9+ // The interface, which may be re-exported by a js-interop library.
10+ JSObject,
11+ // The interceptor base class for all non-Dart objects. @Native classes
12+ // should extend this class.
13+ JavaScriptObject,
14+ // The interceptor abstract class for non-Dart, non-@Native objects.
15+ LegacyJavaScriptObject,
16+ // The interceptor concrete sublass of LegacyJavaScriptObject for object
17+ // literals and objects with `null` prototype.
18+ PlainJavaScriptObject,
19+ // The interceptor concrete subclass of LegacyJavaScriptObject for
20+ // Objects with a prototype chain.
21+ UnknownJavaScriptObject;
1522
1623// Test for JavaScript objects from outside the Dart program. Although we only
1724// export the interface [JSObject] to user level code, this test makes sure we
1825// can distinguish plain JavaScript objects from ones with a complex prototype.
1926
2027@Native ('QQ' )
21- class Q {}
28+ class Q extends JavaScriptObject {}
2229
2330makeA () native ;
2431makeB () native ;
@@ -49,18 +56,18 @@ static_test() {
4956 Expect .isTrue (x is JSObject );
5057 Expect .isTrue (x is LegacyJavaScriptObject );
5158 Expect .isTrue (x is PlainJavaScriptObject );
52- Expect .isTrue (x is ! UnknownJavaScriptObject );
59+ Expect .isFalse (x is UnknownJavaScriptObject );
5360 Expect .equals (JSObject , x.runtimeType);
5461
5562 x = makeB ();
5663 Expect .isTrue (x is JSObject );
5764 Expect .isTrue (x is LegacyJavaScriptObject );
58- Expect .isTrue (x is ! PlainJavaScriptObject );
65+ Expect .isFalse (x is PlainJavaScriptObject );
5966 Expect .isTrue (x is UnknownJavaScriptObject );
6067 Expect .equals (JSObject , x.runtimeType);
6168
6269 x = makeQ ();
63- Expect .isFalse (x is JSObject );
70+ Expect .isTrue (x is JSObject );
6471 Expect .isFalse (x is LegacyJavaScriptObject );
6572 Expect .isFalse (x is PlainJavaScriptObject );
6673 Expect .isFalse (x is UnknownJavaScriptObject );
@@ -79,18 +86,18 @@ dynamic_test() {
7986 Expect .isTrue (isJSObject (x));
8087 Expect .isTrue (isLegacyJavaScriptObject (x));
8188 Expect .isTrue (isPlainJavaScriptObject (x));
82- Expect .isTrue ( ! isUnknownJavaScriptObject (x));
89+ Expect .isFalse ( isUnknownJavaScriptObject (x));
8390 Expect .equals (JSObject , x.runtimeType);
8491
8592 x = makeB ();
8693 Expect .isTrue (isJSObject (x));
8794 Expect .isTrue (isLegacyJavaScriptObject (x));
88- Expect .isTrue ( ! isPlainJavaScriptObject (x));
95+ Expect .isFalse ( isPlainJavaScriptObject (x));
8996 Expect .isTrue (isUnknownJavaScriptObject (x));
9097 Expect .equals (JSObject , x.runtimeType);
9198
9299 x = makeQ ();
93- Expect .isFalse (isJSObject (x));
100+ Expect .isTrue (isJSObject (x));
94101 Expect .isFalse (isLegacyJavaScriptObject (x));
95102 Expect .isFalse (isPlainJavaScriptObject (x));
96103 Expect .isFalse (isUnknownJavaScriptObject (x));
0 commit comments