tor-browser

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

invalid-callback.js (788B)


      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-object.groupby
      6 description: Object.groupBy called with non-callable throws TypeError
      7 info: |
      8  Object.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]
     16 ---*/
     17 
     18 
     19 assert.throws(TypeError, function() {
     20  Object.groupBy([], null)
     21 }, "null callback throws TypeError");
     22 
     23 assert.throws(TypeError, function() {
     24  Object.groupBy([], undefined)
     25 }, "undefined callback throws TypeError");
     26 
     27 assert.throws(TypeError, function() {
     28  Object.groupBy([], {})
     29 }, "object callback throws TypeError");
     30 
     31 reportCompare(0, 0);