tor-browser

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

options-languagedisplay-abrupt-throws.js (1299B)


      1 // Copyright (C) 2021 the V8 project authors. 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: Return abrupt completion from GetOption fallback
      7 info: |
      8  Intl.DisplayNames ( locales , options )
      9 
     10  1. If NewTarget is undefined, throw a TypeError exception.
     11  2. Let displayNames be ? OrdinaryCreateFromConstructor(NewTarget, "%DisplayNamesPrototype%",
     12    « [[InitializedDisplayNames]], [[Locale]], [[Style]], [[Type]], [[Fallback]], [[Fields]] »).
     13  ...
     14  4. Let options be ? ToObject(options).
     15  ...
     16  12. Let type be ? GetOption(options, "type", "string", « "language", "region", "script", "currency" », undefined).
     17  13. If type is undefined, throw a TypeError exception.
     18  ...
     19  24. Let languageDisplay be ? GetOption(options, "languageDisplay", "string", « "dialect", "standard" », "dialect").
     20  ...
     21 
     22  GetOption ( options, property, type, values, fallback )
     23 
     24  1. Let value be ? Get(options, property).
     25  ...
     26 features: [Intl.DisplayNames-v2]
     27 locale: [en]
     28 ---*/
     29 
     30 var options = { type: 'language' };
     31 Object.defineProperty(options, 'languageDisplay', {
     32  get() { throw new Test262Error(); },
     33 });
     34 
     35 assert.throws(Test262Error, () => {
     36  new Intl.DisplayNames('en', options);
     37 });
     38 
     39 reportCompare(0, 0);