cross-realm-global-prototype.js 688 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10
// 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 }");
11
%PrepareFunctionForOptimization(test);
12 13 14 15 16 17 18 19 20 21 22 23

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());