Index: test/mjsunit/cross-realm-global-prototype.js |
diff --git a/test/mjsunit/cross-realm-global-prototype.js b/test/mjsunit/cross-realm-global-prototype.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..46e5a3a37fbc76472c072a3baeb8b51cc272e39e |
--- /dev/null |
+++ b/test/mjsunit/cross-realm-global-prototype.js |
@@ -0,0 +1,22 @@ |
+// Copyright 2015 the V8 project authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// Flags: --allow-natives-syntax |
+// Make sure we don't accidentally leak information about other objects. |
+ |
+var realm = Realm.create(); |
+var test = Realm.eval(realm, |
+ "() => { return Realm.global(0) instanceof Object }"); |
+ |
+assertFalse(test()); |
+ |
+// Set the prototype of the current global object to the global object of the |
+// other realm. |
+__proto__ = Realm.eval(realm, "this"); |
+assertFalse(test()); |
+ |
+test(); |
+test(); |
+%OptimizeFunctionOnNextCall(test); |
+assertEquals(false, test()); |