OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 var realms = [Realm.current(), Realm.create()]; | 5 var realms = [Realm.current(), Realm.create()]; |
6 | 6 |
7 // Check stack trace filtering across security contexts. | 7 // Check stack trace filtering across security contexts. |
8 var thrower_script = | 8 var thrower_script = |
9 "(function () { Realm.eval(Realm.current(), 'throw Error()') })"; | 9 "(function () { Realm.eval(Realm.current(), 'throw Error()') })"; |
10 Realm.shared = { | 10 Realm.shared = { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 assertSame(Realm.shared.caller_1, Realm.shared.result_1); | 68 assertSame(Realm.shared.caller_1, Realm.shared.result_1); |
69 | 69 |
70 Realm.eval(realms[0], script); | 70 Realm.eval(realms[0], script); |
71 assertSame(Realm.shared.caller_0, Realm.shared.result_0); | 71 assertSame(Realm.shared.caller_0, Realm.shared.result_0); |
72 assertSame(null, Realm.shared.result_1); | 72 assertSame(null, Realm.shared.result_1); |
73 | 73 |
74 | 74 |
75 // test that do not pollute / leak a function prototype v8/4217 | 75 // test that do not pollute / leak a function prototype v8/4217 |
76 var realmIndex = Realm.create(); | 76 var realmIndex = Realm.create(); |
77 var otherObject = Realm.eval(realmIndex, "Object"); | 77 var otherObject = Realm.eval(realmIndex, "Object"); |
| 78 var otherTypeError = Realm.eval(realmIndex, "TypeError"); |
78 | 79 |
79 var f = Realm.eval(realmIndex, "function f(){}; f"); | 80 var f = Realm.eval(realmIndex, "function f(){}; f"); |
80 f.prototype = null; | 81 f.prototype = null; |
81 | 82 |
82 var o = new f(); | 83 var o = new f(); |
83 var proto = Object.getPrototypeOf(o); | 84 var proto = Object.getPrototypeOf(o); |
84 assertFalse(proto === Object.prototype); | 85 assertFalse(proto === Object.prototype); |
85 assertTrue(proto === otherObject.prototype); | 86 assertTrue(proto === otherObject.prototype); |
86 | 87 |
87 o = Realm.eval(realmIndex, "new f()"); | 88 o = Realm.eval(realmIndex, "new f()"); |
88 proto = Object.getPrototypeOf(o); | 89 proto = Object.getPrototypeOf(o); |
89 assertFalse(proto === Object.prototype); | 90 assertFalse(proto === Object.prototype); |
90 assertTrue(proto === otherObject.prototype); | 91 assertTrue(proto === otherObject.prototype); |
OLD | NEW |