tor-browser

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

options-style-abrupt-throws.js (1554B)


      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  Return abrupt completion from GetOption style
      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. If options is undefined, then
     16    a. Let options be ObjectCreate(null).
     17  5. Else
     18    a. Let options be ? ToObject(options).
     19  ...
     20  8. Let matcher be ? GetOption(options, "localeMatcher", "string", « "lookup", "best fit" », "best fit").
     21  ...
     22  11. Let style be ? GetOption(options, "style", "string", « "narrow", "short", "long" », "long").
     23  ...
     24  13. Let type be ? GetOption(options, "type", "string", « "language", "region", "script", "currency", "weekday", "month", "quarter", "dayPeriod", "dateTimeField" », "language").
     25  ...
     26  15. Let fallback be ? GetOption(options, "fallback", "string", « "code", "none" », "code").
     27  ...
     28 
     29  GetOption ( options, property, type, values, fallback )
     30 
     31  1. Let value be ? Get(options, property).
     32  ...
     33 features: [Intl.DisplayNames]
     34 locale: [en]
     35 ---*/
     36 
     37 var options = {};
     38 Object.defineProperty(options, 'style', {
     39  get() { throw new Test262Error(); },
     40 });
     41 
     42 assert.throws(Test262Error, () => {
     43  new Intl.DisplayNames('en', options);
     44 });
     45 
     46 reportCompare(0, 0);