tor-browser

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

remove-unicode-extensions.js (800B)


      1 // |reftest| skip-if(!this.hasOwnProperty("Intl"))
      2 
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 // Locale processing is supposed to internally remove any Unicode extension
      8 // sequences in the locale.  Test that various weird testcases invoking
      9 // algorithmic edge cases don't assert or throw exceptions.
     10 
     11 var weirdCases =
     12  [
     13   "en-x-u-foo",
     14   "en-a-bar-x-u-foo",
     15   "en-x-u-foo-a-bar",
     16   "en-a-bar-u-baz-x-u-foo",
     17  ];
     18 
     19 for (var locale of weirdCases)
     20  Intl.NumberFormat(locale).format(5);
     21 
     22 assertThrowsInstanceOf(() => Intl.NumberFormat("x-u-foo"), RangeError);
     23 
     24 if (typeof reportCompare === "function")
     25  reportCompare(true, true);