tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

strict-nested-assign-shadow-function-name.js (738B)


      1 /*
      2 * Any copyright is dedicated to the Public Domain.
      3 * http://creativecommons.org/licenses/publicdomain/
      4 */
      5 load(libdir + 'array-compare.js');
      6 
      7 var obj = {};
      8 
      9 function strictNestedAssignShadowFunctionName(p)
     10 {
     11  "use strict";
     12  function inner()
     13  {
     14    function p() { p = 1776; }
     15    p();
     16  }
     17  inner();
     18  return arguments;
     19 }
     20 
     21 var a1, a2, a3, a4, a5;
     22 for (var i = 0; i < 5; i++)
     23 {
     24  a1 = strictNestedAssignShadowFunctionName();
     25  a2 = strictNestedAssignShadowFunctionName(99);
     26  a3 = strictNestedAssignShadowFunctionName("");
     27  a4 = strictNestedAssignShadowFunctionName(obj);
     28 }
     29 
     30 assertEq(arraysEqual(a1, []), true);
     31 assertEq(arraysEqual(a2, [99]), true);
     32 assertEq(arraysEqual(a3, [""]), true);
     33 assertEq(arraysEqual(a4, [obj]), true);