tor-browser

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

locales-invalid-throws.js (1102B)


      1 // Copyright (C) 2019 Leo Balter. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-Intl.DisplayNames
      6 description: >
      7  Throws TypeError if locales is not undefined, a string, or an array-like object.
      8 info: |
      9  Intl.DisplayNames ([ locales [ , options ]])
     10 
     11  1. If NewTarget is undefined, throw a TypeError exception.
     12  2. Let displayNames be ? OrdinaryCreateFromConstructor(NewTarget, "%DisplayNamesPrototype%",
     13    « [[InitializedDisplayNames]], [[Locale]], [[Style]], [[Type]], [[Fallback]], [[Fields]] »).
     14  3. Let requestedLocales be ? CanonicalizeLocaleList(locales).
     15  ...
     16 
     17  CanonicalizeLocaleList ( locales )
     18 
     19  1. If locales is undefined, then
     20    a. Return a new empty List.
     21  2. Let seen be a new empty List.
     22  3. If Type(locales) is String, then
     23    a. Let O be CreateArrayFromList(« locales »).
     24  4. Else,
     25    a. Let O be ? ToObject(locales).
     26  5. Let len be ? ToLength(? Get(O, "length")).
     27 features: [Intl.DisplayNames]
     28 ---*/
     29 
     30 assert.throws(TypeError, () => {
     31  new Intl.DisplayNames(null);
     32 }, 'null');
     33 
     34 reportCompare(0, 0);