tor-browser

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

options-random-properties-unchecked.js (1848B)


      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  Random options are not checked or used, including case sensitive
      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  ...
     15  4. Let options be ? ToObject(options).
     16  ...
     17  7. Let matcher be ? GetOption(options, "localeMatcher", "string", « "lookup", "best fit" », "best fit").
     18  ...
     19  10. Let style be ? GetOption(options, "style", "string", « "narrow", "short", "long" », "long").
     20  ...
     21  12. Let type be ? GetOption(options, "type", "string", « "language", "region", "script", "currency" », undefined).
     22  13. If type is undefined, throw a TypeError exception.
     23  ...
     24  15. Let fallback be ? GetOption(options, "fallback", "string", « "code", "none" », "code").
     25  ...
     26 
     27  GetOption ( options, property, type, values, fallback )
     28 
     29  1. Let value be ? Get(options, property).
     30  ...
     31 features: [Intl.DisplayNames]
     32 locale: [en]
     33 ---*/
     34 
     35 var options = { type: 'language' };
     36 Object.defineProperty(options, 'fallBack', {
     37  get() { throw new Test262Error(); }
     38 });
     39 Object.defineProperty(options, 'localematcher', {
     40  get() { throw new Test262Error(); }
     41 });
     42 Object.defineProperty(options, 'locale-matcher', {
     43  get() { throw new Test262Error(); }
     44 });
     45 Object.defineProperty(options, 'Type', {
     46  get() { throw new Test262Error(); }
     47 });
     48 
     49 var obj = new Intl.DisplayNames('en', options);
     50 
     51 assert(obj instanceof Intl.DisplayNames);
     52 assert.sameValue(Object.getPrototypeOf(obj), Intl.DisplayNames.prototype);
     53 
     54 reportCompare(0, 0);