tor-browser

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

options-undefined.js (1140B)


      1 // Copyright 2018 Igalia, S.L. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-Intl.Segmenter.supportedLocalesOf
      6 description: Checks handling of an undefined options argument to the supportedLocalesOf function.
      7 info: |
      8    SupportedLocales ( availableLocales, requestedLocales, options )
      9 
     10    1. If options is not undefined, then
     11        b. Let matcher be ? GetOption(options, "localeMatcher", "string", «"lookup", "best fit"», "best fit").
     12 features: [Intl.Segmenter]
     13 ---*/
     14 
     15 assert.sameValue(typeof Intl.Segmenter.supportedLocalesOf, "function",
     16                 "Should support Intl.Segmenter.supportedLocalesOf.");
     17 
     18 Object.defineProperties(Object.prototype, {
     19  "localeMatcher": {
     20    get() { throw new Error("Should not call localeMatcher getter"); }
     21  }
     22 });
     23 
     24 assert.sameValue(Array.isArray(Intl.Segmenter.supportedLocalesOf()), true, "No arguments");
     25 assert.sameValue(Array.isArray(Intl.Segmenter.supportedLocalesOf([])), true, "One argument");
     26 assert.sameValue(Array.isArray(Intl.Segmenter.supportedLocalesOf([], undefined)), true, "Two arguments");
     27 
     28 reportCompare(0, 0);