tor-browser

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

invalid-callback.js (775B)


      1 // Copyright (c) 2023 Ecma International.  All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-map.groupby
      6 description: Map.groupBy called with non-callable throws TypeError
      7 info: |
      8  Map.groupBy ( items, callbackfn )
      9 
     10  ...
     11  GroupBy ( items, callbackfn, coercion )
     12 
     13  2. If IsCallable(callbackfn) is false, throw a TypeError exception.
     14  ...
     15 features: [array-grouping, Map]
     16 ---*/
     17 
     18 
     19 assert.throws(TypeError, function() {
     20  Map.groupBy([], null)
     21 }, "null callback throws TypeError");
     22 
     23 assert.throws(TypeError, function() {
     24  Map.groupBy([], undefined)
     25 }, "undefined callback throws TypeError");
     26 
     27 assert.throws(TypeError, function() {
     28  Map.groupBy([], {})
     29 }, "object callback throws TypeError");
     30 
     31 reportCompare(0, 0);