tor-browser

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

options-value-emulates-undefined.js (927B)


      1 // |reftest| skip-if(!xulRuntime.shell||!this.hasOwnProperty('Intl'))
      2 // Any copyright is dedicated to the Public Domain.
      3 // http://creativecommons.org/licenses/publicdomain/
      4 
      5 //-----------------------------------------------------------------------------
      6 var BUGNUMBER = 843004;
      7 var summary =
      8  "Use of an object that emulates |undefined| as the sole option must " +
      9  "preclude imputing default values";
     10 
     11 print(BUGNUMBER + ": " + summary);
     12 
     13 /**************
     14 * BEGIN TEST *
     15 **************/
     16 
     17 var opt = createIsHTMLDDA();
     18 opt.toString = function() { return "long"; };
     19 
     20 var str = new Date(2013, 12 - 1, 14).toLocaleString("en-US", { weekday: opt });
     21 
     22 // Because "weekday" was present and not undefined (stringifying to "long"),
     23 // this must be a string like "Saturday" (in this implementation, that is).
     24 assertEq(str, "Saturday");
     25 
     26 if (typeof reportCompare === "function")
     27  reportCompare(true, true);
     28 
     29 print("Tests complete");