summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/saved-stacks/principals-03.js
blob: 006b4477cd678c9f38d05882627b17a4f9b9dfa1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// With arrows representing child-to-parent links, create a SavedFrame stack
// like this:
//
//     high.a -> low.b
//
// in `low`'s compartment and give `low` a reference to this stack. Assert the
// stack's youngest frame's properties doesn't leak information about `high.a`
// that `low` shouldn't have access to, and instead returns information about
// `low.b`.

var low = newGlobal({ principal: 0 });
var high = newGlobal({ principal: 0xfffff });

low.high = high;
high.low = low;

high.eval("function a() { return saveStack(0, low); }");
low.eval("function b() { return high.a(); }")

var stack = low.b();

assertEq(stack.functionDisplayName, "b");
assertEq(stack.parent, null);