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

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

Issue 1381543005: [cross-context] create new function prototypes in the context of the function (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: removing unused code Created 5 years, 2 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
« no previous file with comments | « src/objects.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
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 Realm.shared.caller_1(f_1); \ 63 Realm.shared.caller_1(f_1); \
64 "; 64 ";
65 65
66 Realm.eval(realms[1], script); 66 Realm.eval(realms[1], script);
67 assertSame(null, Realm.shared.result_0); 67 assertSame(null, Realm.shared.result_0);
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
74
75 // test that do not pollute / leak a function prototype v8/4217
76 var realmIndex = Realm.create();
77 var otherObject = Realm.eval(realmIndex, "Object");
78
79 var f = Realm.eval(realmIndex, "function f(){}; f");
80 f.prototype = null;
81
82 var o = new f();
83 var proto = Object.getPrototypeOf(o);
84 assertFalse(proto === Object.prototype);
85 assertTrue(proto === otherObject.prototype);
86
87 o = Realm.eval(realmIndex, "new f()");
88 proto = Object.getPrototypeOf(o);
89 assertFalse(proto === Object.prototype);
90 assertTrue(proto === otherObject.prototype);
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698