blob: 0685811f55b7f8efc88e04ffd5e173ed7d415258 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
'use strict';
// Flags: --expose-gc --harmony-weak-refs
const common = require('../common');
const assert = require('assert');
const g = new globalThis.FinalizationGroup(common.mustCallAtLeast(() => {
throw new Error('test');
}, 1));
g.register({}, 42);
setTimeout(() => {
globalThis.gc();
assert.throws(() => {
g.cleanupSome();
}, {
name: 'Error',
message: 'test',
});
// Give the callbacks scheduled by global.gc() time to run, as the underlying
// uv_async_t is unref’ed.
setTimeout(() => {}, 200);
}, 200);
process.on('uncaughtException', common.mustCall());
|