tor-browser

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

overriden-push.js (624B)


      1 // Copyright 2016 Mozilla Corporation. All rights reserved.
      2 // This code is governed by the license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-intl.getcanonicallocales
      6 description: Tests the getCanonicalLocales function for overridden Array.push().
      7 info: |
      8  8.2.1 Intl.getCanonicalLocales (locales)
      9  1. Let ll be ? CanonicalizeLocaleList(locales).
     10  2. Return CreateArrayFromList(ll).
     11 includes: [compareArray.js]
     12 ---*/
     13 
     14 Array.prototype.push = function() { throw 42; };
     15 
     16 // must not throw 42, might if push is used
     17 var arr = Intl.getCanonicalLocales(["en-US"]);
     18 
     19 assert.compareArray(arr, ["en-US"]);
     20 
     21 reportCompare(0, 0);