Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: test/mjsunit/cross-realm-filtering.js

Issue 261103002: filter out .caller from other worlds (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« src/api.cc ('K') | « src/isolate.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 var realms = [Realm.current(), Realm.create()];
6
7 function throw_in_current() { Realm.eval(Realm.current(), "throw Error()"); };
8
9 Realm.shared = {
10 throw_in_current: throw_in_current,
11 thrower_0: (function thrower_0() { Realm.shared.throw_in_current(); }),
12 thrower_1: Realm.eval(realms[1],
13 "(function thrower_1() { Realm.shared.throw_in_current(); })"),
14 };
15
16 var script =
17 "Error.prepareStackTrace = function(a, b) { return b; }; \
18 try { \
19 Realm.shared.thrower_0(); \
20 } catch (e) { \
21 Realm.shared.error_0 = e.stack; \
22 } \
23 try { \
24 Realm.shared.thrower_1(); \
25 } catch (e) { \
26 Realm.shared.error_1 = e.stack; \
27 }"
28
29 Realm.eval(realms[1], script);
30 assertSame(3, Realm.shared.error_0.length);
31 assertSame(4, Realm.shared.error_1.length);
32
33 assertTrue(Realm.shared.thrower_1 === Realm.shared.error_1[2].getFunction());
34 for (var i = 0; i < Realm.shared.error_0.length; i++) {
35 assertFalse(Realm.shared.thrower_0 === Realm.shared.error_0[i].getFunction());
36 }
37 for (var i = 0; i < Realm.shared.error_1.length; i++) {
38 assertFalse(Realm.shared.thrower_0 === Realm.shared.error_1[i].getFunction());
39 }
40
41 Realm.eval(realms[0], script);
42 assertSame(6, Realm.shared.error_0.length);
43 assertSame(5, Realm.shared.error_1.length);
44
45 assertTrue(Realm.shared.thrower_0 === Realm.shared.error_0[3].getFunction());
46 for (var i = 0; i < Realm.shared.error_0.length; i++) {
47 assertFalse(Realm.shared.thrower_1 === Realm.shared.error_0[i].getFunction());
48 }
49 for (var i = 0; i < Realm.shared.error_1.length; i++) {
50 assertFalse(Realm.shared.thrower_1 === Realm.shared.error_1[i].getFunction());
51 }
OLDNEW
« src/api.cc ('K') | « src/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698