[dart2js][ddc] Remove __proto__ use from dart:_rti
Issue: https://github.com/dart-lang/sdk/issues/52372
Change-Id: I86c5545c7e4c7d6c3636a849e8d67066f8155662
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303443
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
diff --git a/sdk/lib/_internal/js_shared/lib/rti.dart b/sdk/lib/_internal/js_shared/lib/rti.dart
index 9c3a3d2..1b6f82b 100644
--- a/sdk/lib/_internal/js_shared/lib/rti.dart
+++ b/sdk/lib/_internal/js_shared/lib/rti.dart
@@ -861,7 +861,8 @@
// TODO(sra): Can this test be avoided, e.g. by putting $ti on the
// prototype of Closure/BoundClosure/StaticClosure classes?
var effectiveConstructor = _isClosure(instance)
- ? JS('', '#.__proto__.__proto__.constructor', instance)
+ ? JS('', 'Object.getPrototypeOf(Object.getPrototypeOf(#)).constructor',
+ instance)
: constructor;
rti = _Universe.findErasedType(
_theUniverse(), JS('String', '#.name', effectiveConstructor));