| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Flags: --allow-natives-syntax | 5 // Flags: --allow-natives-syntax --restricted-realms |
| 6 // Make sure we don't accidentally leak information about other objects. | 6 // Make sure we don't accidentally leak information about other objects. |
| 7 | 7 |
| 8 var realm = Realm.create(); | 8 var realm = Realm.create(); |
| 9 var test = Realm.eval(realm, | 9 var test = Realm.eval(realm, |
| 10 "() => { return Realm.global(0) instanceof Object }"); | 10 "() => { return Realm.global(0) instanceof Object }"); |
| 11 | 11 |
| 12 assertFalse(test()); | 12 assertFalse(test()); |
| 13 | 13 |
| 14 // Set the prototype of the current global object to the global object of the | 14 // Set the prototype of the current global object to the global object of the |
| 15 // other realm. | 15 // other realm. |
| 16 __proto__ = Realm.eval(realm, "this"); | 16 __proto__ = Realm.eval(realm, "this"); |
| 17 assertFalse(test()); | 17 assertFalse(test()); |
| 18 | 18 |
| 19 test(); | 19 test(); |
| 20 test(); | 20 test(); |
| 21 %OptimizeFunctionOnNextCall(test); | 21 %OptimizeFunctionOnNextCall(test); |
| 22 assertEquals(false, test()); | 22 assertEquals(false, test()); |
| OLD | NEW |