michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/licenses/publicdomain/ michael@0: */ michael@0: michael@0: var gTestfile = 'this-for-function-expression-recursion.js'; michael@0: var BUGNUMBER = 611276; michael@0: var summary = "JSOP_CALLEE should push undefined, not null, for this"; michael@0: michael@0: print(BUGNUMBER + ": " + summary); michael@0: michael@0: /************** michael@0: * BEGIN TEST * michael@0: **************/ michael@0: michael@0: // Calling a named function expression (not function statement) uses the michael@0: // JSOP_CALLEE opcode. This opcode pushes its own |this|, distinct from the michael@0: // normal call path; verify that that |this| value is properly |undefined|. michael@0: michael@0: var calleeThisFun = michael@0: function calleeThisFun(recurring) michael@0: { michael@0: if (recurring) michael@0: return this; michael@0: return calleeThisFun(true); michael@0: }; michael@0: assertEq(calleeThisFun(false), this); michael@0: michael@0: var calleeThisStrictFun = michael@0: function calleeThisStrictFun(recurring) michael@0: { michael@0: "use strict"; michael@0: if (recurring) michael@0: return this; michael@0: return calleeThisStrictFun(true); michael@0: }; michael@0: assertEq(calleeThisStrictFun(false), undefined); michael@0: michael@0: /******************************************************************************/ michael@0: michael@0: if (typeof reportCompare === "function") michael@0: reportCompare(true, true); michael@0: michael@0: print("All tests passed!");