tor-browser

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

Map-constructor-5.js (656B)


      1 // new Map(arr) throws if arr contains holes (or undefined values).
      2 
      3 load(libdir + "asserts.js");
      4 assertThrowsInstanceOf(function () { new Map([undefined]); }, TypeError);
      5 assertThrowsInstanceOf(function () { new Map([null]); }, TypeError);
      6 assertThrowsInstanceOf(function () { new Map([[0, 0], [1, 1], , [3, 3]]); }, TypeError);
      7 assertThrowsInstanceOf(function () { new Map([[0, 0], [1, 1], ,]); }, TypeError);
      8 
      9 // new Map(iterable) throws if iterable doesn't have array-like objects
     10 
     11 assertThrowsInstanceOf(function () { new Map([1, 2, 3]); }, TypeError);
     12 assertThrowsInstanceOf(function () {
     13 let s = new Set([1, 2, "abc"]);
     14 new Map(s);
     15 }, TypeError);