Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / mozilla / strict / script-tests / this-for-function-expression-recursion.js
blobe17403374d4ea27cfaa1c4e770a27cc8fc08d0e1
1 /*
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/licenses/publicdomain/
4 */
6 var gTestfile = 'this-for-function-expression-recursion.js';
7 var BUGNUMBER = 611276;
8 var summary = "JSOP_CALLEE should push undefined, not null, for this";
10 print(BUGNUMBER + ": " + summary);
12 /**************
13 * BEGIN TEST *
14 **************/
16 // Calling a named function expression (not function statement) uses the
17 // JSOP_CALLEE opcode. This opcode pushes its own |this|, distinct from the
18 // normal call path; verify that that |this| value is properly |undefined|.
20 var calleeThisFun =
21 function calleeThisFun(recurring)
23 if (recurring)
24 return this;
25 return calleeThisFun(true);
27 assertEq(calleeThisFun(false), this);
29 var calleeThisStrictFun =
30 function calleeThisStrictFun(recurring)
32 "use strict";
33 if (recurring)
34 return this;
35 return calleeThisStrictFun(true);
37 assertEq(calleeThisStrictFun(false), undefined);
39 /******************************************************************************/
41 if (typeof reportCompare === "function")
42 reportCompare(true, true);
44 print("All tests passed!");
46 var successfullyParsed = true;