tor-browser

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

available-locales-supported.js (933B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Intl'))
      2 
      3 if (typeof getAvailableLocalesOf === "undefined") {
      4  var getAvailableLocalesOf = SpecialPowers.Cu.getJSTestingFunctions().getAvailableLocalesOf;
      5 }
      6 
      7 function IsIntlService(c) {
      8  return typeof c === "function" &&
      9         c.hasOwnProperty("prototype") &&
     10         c.prototype.hasOwnProperty("resolvedOptions");
     11 }
     12 
     13 const intlConstructors = Object.getOwnPropertyNames(Intl).map(name => Intl[name]).filter(IsIntlService);
     14 
     15 // Test all Intl service constructors.
     16 for (let intlConstructor of intlConstructors) {
     17  // Retrieve all available locales of the given Intl service constructor.
     18  let available = getAvailableLocalesOf(intlConstructor.name);
     19 
     20  // All available locales must be reported as supported.
     21  let supported = intlConstructor.supportedLocalesOf(available);
     22  assertEqArray(supported, available);
     23 }
     24 
     25 if (typeof reportCompare === "function")
     26  reportCompare(true, true);