| Index: test/mjsunit/cross-realm-filtering.js
|
| diff --git a/test/mjsunit/cross-realm-filtering.js b/test/mjsunit/cross-realm-filtering.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..73d24dfac1e1d45a6bc6937e905df7d7bb584221
|
| --- /dev/null
|
| +++ b/test/mjsunit/cross-realm-filtering.js
|
| @@ -0,0 +1,51 @@
|
| +// Copyright 2014 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.
|
| +
|
| +var realms = [Realm.current(), Realm.create()];
|
| +
|
| +function throw_in_current() { Realm.eval(Realm.current(), "throw Error()"); };
|
| +
|
| +Realm.shared = {
|
| + throw_in_current: throw_in_current,
|
| + thrower_0: (function thrower_0() { Realm.shared.throw_in_current(); }),
|
| + thrower_1: Realm.eval(realms[1],
|
| + "(function thrower_1() { Realm.shared.throw_in_current(); })"),
|
| +};
|
| +
|
| +var script =
|
| +"Error.prepareStackTrace = function(a, b) { return b; }; \
|
| + try { \
|
| + Realm.shared.thrower_0(); \
|
| + } catch (e) { \
|
| + Realm.shared.error_0 = e.stack; \
|
| + } \
|
| + try { \
|
| + Realm.shared.thrower_1(); \
|
| + } catch (e) { \
|
| + Realm.shared.error_1 = e.stack; \
|
| + }"
|
| +
|
| +Realm.eval(realms[1], script);
|
| +assertSame(3, Realm.shared.error_0.length);
|
| +assertSame(4, Realm.shared.error_1.length);
|
| +
|
| +assertTrue(Realm.shared.thrower_1 === Realm.shared.error_1[2].getFunction());
|
| +for (var i = 0; i < Realm.shared.error_0.length; i++) {
|
| + assertFalse(Realm.shared.thrower_0 === Realm.shared.error_0[i].getFunction());
|
| +}
|
| +for (var i = 0; i < Realm.shared.error_1.length; i++) {
|
| + assertFalse(Realm.shared.thrower_0 === Realm.shared.error_1[i].getFunction());
|
| +}
|
| +
|
| +Realm.eval(realms[0], script);
|
| +assertSame(6, Realm.shared.error_0.length);
|
| +assertSame(5, Realm.shared.error_1.length);
|
| +
|
| +assertTrue(Realm.shared.thrower_0 === Realm.shared.error_0[3].getFunction());
|
| +for (var i = 0; i < Realm.shared.error_0.length; i++) {
|
| + assertFalse(Realm.shared.thrower_1 === Realm.shared.error_0[i].getFunction());
|
| +}
|
| +for (var i = 0; i < Realm.shared.error_1.length; i++) {
|
| + assertFalse(Realm.shared.thrower_1 === Realm.shared.error_1[i].getFunction());
|
| +}
|
|
|