js/src/tests/ecma_5/strict/this-for-function-expression-recursion.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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)
    22   {
    23     if (recurring)
    24       return this;
    25     return calleeThisFun(true);
    26   };
    27 assertEq(calleeThisFun(false), this);
    29 var calleeThisStrictFun =
    30   function calleeThisStrictFun(recurring)
    31   {
    32     "use strict";
    33     if (recurring)
    34       return this;
    35     return calleeThisStrictFun(true);
    36   };
    37 assertEq(calleeThisStrictFun(false), undefined);
    39 /******************************************************************************/
    41 if (typeof reportCompare === "function")
    42   reportCompare(true, true);
    44 print("All tests passed!");

mercurial