Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 var r = Realm.create(); | |
| 6 var f = Realm.eval(r, "function f() { return this }; f()"); | |
| 7 | |
| 8 // Cross-origin property access throws | |
| 9 assertThrows(() => f.a, TypeError); | |
| 10 assertThrows(() => { 'use strict'; f.a = 1 }, TypeError); | |
| 11 | |
| 12 var r2 = Realm.createAllowCrossRealmAccess(); | |
| 13 var f2 = Realm.eval(r2, "function f() { return this }; f()"); | |
| 14 | |
| 15 // Same-origin property access doesn't throw | |
|
adamk
2016/05/19 19:23:20
Please also add a test that accessing properties o
Dan Ehrenberg
2016/05/27 13:51:40
A new test checks that f{,2} equals the output of
| |
| 16 assertEquals(undefined, f2.a); | |
| 17 f2.a = 1; | |
| 18 assertEquals(1, f2.a); | |
| OLD | NEW |