Debian Codegraph @

js/src/tests/non262/Map/getOrInsertComputed/callbackfn-throws.js

raw
1 // |reftest| shell-option(--enable-upsert) skip-if(!Map.prototype.getOrInsertComputed)
2 // Copyright (C) 2024 Jonas Haukenes, Mathias Ness. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: proposal-upsert
7 description: Map.getOrInsertComputed throws when callbackfn throws
8 return if abrubt completion Call(callbackfn, key)
9
10 info: |
11 Map.prototype.getOrInsertComputed ( key , callbackfn )
12
13 ...
14
15 6. Let value be ? Call(callbackfn, key).
16 ...
17
18 ---*/
19
20 var map = new Map();
21
22 assertThrowsInstanceOf(function() {
23 map.getOrInsertComputed(1, function() {
24 throw new Error('throw in callback');
25 })
26 }, Error);
27
28 reportCompare(0, 0);