summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/extensions/function-caller-skips-eval-frames.js
blob: 77eb99108aa34db84c38f9a20f3017137a74e83a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/

function innermost() { return arguments.callee.caller; }
function nest() { return eval("innermost();"); }
function nest2() { return nest(); }

assertEq(nest2(), nest);

var innermost = function innermost() { return arguments.callee.caller.caller; };

assertEq(nest2(), nest2);

function nestTwice() { return eval("eval('innermost();');"); }
var nest = nestTwice;

assertEq(nest2(), nest2);

function innermostEval() { return eval("arguments.callee.caller"); }
var innermost = innermostEval;

assertEq(nest2(), nestTwice);

function innermostEvalTwice() { return eval('eval("arguments.callee.caller");'); }
var innermost = innermostEvalTwice;

assertEq(nest2(), nestTwice);

/******************************************************************************/

if (typeof reportCompare === "function")
  reportCompare(true, true);

print("Tests complete");