OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Flags: --harmony-proxies --harmony-reflect --allow-natives-syntax |
| 6 |
| 7 // Do not read out the prototype from a cross-realm object. |
| 8 var realm = Realm.create(); |
| 9 |
| 10 __proto__ = new Proxy({}, { getPrototypeOf() { assertUnreachable() } }); |
| 11 assertEquals(null, |
| 12 Realm.eval(realm, "1; Reflect.getPrototypeOf(Realm.global(0))")); |
| 13 |
| 14 assertFalse(Realm.eval(realm, "1; Realm.global(0) instanceof Object")); |
| 15 var test = Realm.eval(realm, "()=>{1.1; return Realm.global(0) instanceof Object
; }"); |
| 16 test(); |
| 17 test(); |
| 18 test(); |
| 19 %OptimizeFunctionOnNextCall(test); |
| 20 test(); |
| 21 |
| 22 __proto__ = new Proxy({}, { get(t, p, r) { print(p); assertUnreachable() } }); |
| 23 assertEquals(null, |
| 24 Realm.eval(realm, "2; Reflect.getPrototypeOf(Realm.global(0))")); |
| 25 assertFalse(Realm.eval(realm, "2; Realm.global(0) instanceof Object")); |
| 26 |
| 27 __proto__ = {}; |
| 28 assertEquals(null, |
| 29 Realm.eval(realm, "3; Reflect.getPrototypeOf(Realm.global(0))")); |
| 30 assertFalse(Realm.eval(realm, "3; Realm.global(0) instanceof Object")); |
| 31 |
| 32 __proto__.__proto__ = new Proxy({}, { |
| 33 getPrototypeOf() { assertUnreachable() } |
| 34 }); |
| 35 assertEquals(null, |
| 36 Realm.eval(realm, "4; Reflect.getPrototypeOf(Realm.global(0))")); |
| 37 assertFalse(Realm.eval(realm, "4; Realm.global(0) instanceof Object")); |
| 38 |
| 39 // 2-level proxy indirection |
| 40 __proto__ = new Proxy({}, |
| 41 new Proxy({}, { |
| 42 get() { assertUnreachable() } |
| 43 }) |
| 44 ); |
| 45 assertEquals(null, |
| 46 Realm.eval(realm, "5; Reflect.getPrototypeOf(Realm.global(0))")); |
| 47 assertFalse(Realm.eval(realm, "5; Realm.global(0) instanceof Object")); |
OLD | NEW |