Debian Codegraph @

js/src/jit-test/tests/saved-stacks/principals-03.js

raw
1 // With arrows representing child-to-parent links, create a SavedFrame stack
2 // like this:
3 //
4 // high.a -> low.b
5 //
6 // in `low`'s compartment and give `low` a reference to this stack. Assert the
7 // stack's youngest frame's properties doesn't leak information about `high.a`
8 // that `low` shouldn't have access to, and instead returns information about
9 // `low.b`.
10
11 var low = newGlobal({ principal: 0 });
12 var high = newGlobal({ principal: 0xfffff });
13
14 low.high = high;
15 high.low = low;
16
17 high.eval("function a() { return saveStack(0, low); }");
18 low.eval("function b() { return high.a(); }")
19
20 var stack = low.b();
21
22 assertEq(stack.functionDisplayName, "b");
23 assertEq(stack.parent, null);