11cb0ef41Sopenharmony_ci// Flags: --expose-internals --no-warnings 21cb0ef41Sopenharmony_ci'use strict'; 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ciconst common = require('../common'); 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ciconst { on, EventEmitter } = require('events'); 71cb0ef41Sopenharmony_ciconst { 81cb0ef41Sopenharmony_ci NodeEventTarget, 91cb0ef41Sopenharmony_ci} = require('internal/event_target'); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciasync function basic() { 121cb0ef41Sopenharmony_ci const ee = new EventEmitter(); 131cb0ef41Sopenharmony_ci process.nextTick(() => { 141cb0ef41Sopenharmony_ci ee.emit('foo', 'bar'); 151cb0ef41Sopenharmony_ci // 'bar' is a spurious event, we are testing 161cb0ef41Sopenharmony_ci // that it does not show up in the iterable 171cb0ef41Sopenharmony_ci ee.emit('bar', 24); 181cb0ef41Sopenharmony_ci ee.emit('foo', 42); 191cb0ef41Sopenharmony_ci }); 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_ci const iterable = on(ee, 'foo'); 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ci const expected = [['bar'], [42]]; 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ci for await (const event of iterable) { 261cb0ef41Sopenharmony_ci const current = expected.shift(); 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_ci assert.deepStrictEqual(current, event); 291cb0ef41Sopenharmony_ci 301cb0ef41Sopenharmony_ci if (expected.length === 0) { 311cb0ef41Sopenharmony_ci break; 321cb0ef41Sopenharmony_ci } 331cb0ef41Sopenharmony_ci } 341cb0ef41Sopenharmony_ci assert.strictEqual(ee.listenerCount('foo'), 0); 351cb0ef41Sopenharmony_ci assert.strictEqual(ee.listenerCount('error'), 0); 361cb0ef41Sopenharmony_ci} 371cb0ef41Sopenharmony_ci 381cb0ef41Sopenharmony_ciasync function invalidArgType() { 391cb0ef41Sopenharmony_ci assert.throws(() => on({}, 'foo'), common.expectsError({ 401cb0ef41Sopenharmony_ci code: 'ERR_INVALID_ARG_TYPE', 411cb0ef41Sopenharmony_ci name: 'TypeError', 421cb0ef41Sopenharmony_ci })); 431cb0ef41Sopenharmony_ci} 441cb0ef41Sopenharmony_ci 451cb0ef41Sopenharmony_ciasync function error() { 461cb0ef41Sopenharmony_ci const ee = new EventEmitter(); 471cb0ef41Sopenharmony_ci const _err = new Error('kaboom'); 481cb0ef41Sopenharmony_ci process.nextTick(() => { 491cb0ef41Sopenharmony_ci ee.emit('error', _err); 501cb0ef41Sopenharmony_ci }); 511cb0ef41Sopenharmony_ci 521cb0ef41Sopenharmony_ci const iterable = on(ee, 'foo'); 531cb0ef41Sopenharmony_ci let looped = false; 541cb0ef41Sopenharmony_ci let thrown = false; 551cb0ef41Sopenharmony_ci 561cb0ef41Sopenharmony_ci try { 571cb0ef41Sopenharmony_ci // eslint-disable-next-line no-unused-vars 581cb0ef41Sopenharmony_ci for await (const event of iterable) { 591cb0ef41Sopenharmony_ci looped = true; 601cb0ef41Sopenharmony_ci } 611cb0ef41Sopenharmony_ci } catch (err) { 621cb0ef41Sopenharmony_ci thrown = true; 631cb0ef41Sopenharmony_ci assert.strictEqual(err, _err); 641cb0ef41Sopenharmony_ci } 651cb0ef41Sopenharmony_ci assert.strictEqual(thrown, true); 661cb0ef41Sopenharmony_ci assert.strictEqual(looped, false); 671cb0ef41Sopenharmony_ci} 681cb0ef41Sopenharmony_ci 691cb0ef41Sopenharmony_ciasync function errorDelayed() { 701cb0ef41Sopenharmony_ci const ee = new EventEmitter(); 711cb0ef41Sopenharmony_ci const _err = new Error('kaboom'); 721cb0ef41Sopenharmony_ci process.nextTick(() => { 731cb0ef41Sopenharmony_ci ee.emit('foo', 42); 741cb0ef41Sopenharmony_ci ee.emit('error', _err); 751cb0ef41Sopenharmony_ci }); 761cb0ef41Sopenharmony_ci 771cb0ef41Sopenharmony_ci const iterable = on(ee, 'foo'); 781cb0ef41Sopenharmony_ci const expected = [[42]]; 791cb0ef41Sopenharmony_ci let thrown = false; 801cb0ef41Sopenharmony_ci 811cb0ef41Sopenharmony_ci try { 821cb0ef41Sopenharmony_ci for await (const event of iterable) { 831cb0ef41Sopenharmony_ci const current = expected.shift(); 841cb0ef41Sopenharmony_ci assert.deepStrictEqual(current, event); 851cb0ef41Sopenharmony_ci } 861cb0ef41Sopenharmony_ci } catch (err) { 871cb0ef41Sopenharmony_ci thrown = true; 881cb0ef41Sopenharmony_ci assert.strictEqual(err, _err); 891cb0ef41Sopenharmony_ci } 901cb0ef41Sopenharmony_ci assert.strictEqual(thrown, true); 911cb0ef41Sopenharmony_ci assert.strictEqual(ee.listenerCount('foo'), 0); 921cb0ef41Sopenharmony_ci assert.strictEqual(ee.listenerCount('error'), 0); 931cb0ef41Sopenharmony_ci} 941cb0ef41Sopenharmony_ci 951cb0ef41Sopenharmony_ciasync function throwInLoop() { 961cb0ef41Sopenharmony_ci const ee = new EventEmitter(); 971cb0ef41Sopenharmony_ci const _err = new Error('kaboom'); 981cb0ef41Sopenharmony_ci 991cb0ef41Sopenharmony_ci process.nextTick(() => { 1001cb0ef41Sopenharmony_ci ee.emit('foo', 42); 1011cb0ef41Sopenharmony_ci }); 1021cb0ef41Sopenharmony_ci 1031cb0ef41Sopenharmony_ci try { 1041cb0ef41Sopenharmony_ci for await (const event of on(ee, 'foo')) { 1051cb0ef41Sopenharmony_ci assert.deepStrictEqual(event, [42]); 1061cb0ef41Sopenharmony_ci throw _err; 1071cb0ef41Sopenharmony_ci } 1081cb0ef41Sopenharmony_ci } catch (err) { 1091cb0ef41Sopenharmony_ci assert.strictEqual(err, _err); 1101cb0ef41Sopenharmony_ci } 1111cb0ef41Sopenharmony_ci 1121cb0ef41Sopenharmony_ci assert.strictEqual(ee.listenerCount('foo'), 0); 1131cb0ef41Sopenharmony_ci assert.strictEqual(ee.listenerCount('error'), 0); 1141cb0ef41Sopenharmony_ci} 1151cb0ef41Sopenharmony_ci 1161cb0ef41Sopenharmony_ciasync function next() { 1171cb0ef41Sopenharmony_ci const ee = new EventEmitter(); 1181cb0ef41Sopenharmony_ci const iterable = on(ee, 'foo'); 1191cb0ef41Sopenharmony_ci 1201cb0ef41Sopenharmony_ci process.nextTick(function() { 1211cb0ef41Sopenharmony_ci ee.emit('foo', 'bar'); 1221cb0ef41Sopenharmony_ci ee.emit('foo', 42); 1231cb0ef41Sopenharmony_ci iterable.return(); 1241cb0ef41Sopenharmony_ci }); 1251cb0ef41Sopenharmony_ci 1261cb0ef41Sopenharmony_ci const results = await Promise.all([ 1271cb0ef41Sopenharmony_ci iterable.next(), 1281cb0ef41Sopenharmony_ci iterable.next(), 1291cb0ef41Sopenharmony_ci iterable.next(), 1301cb0ef41Sopenharmony_ci ]); 1311cb0ef41Sopenharmony_ci 1321cb0ef41Sopenharmony_ci assert.deepStrictEqual(results, [{ 1331cb0ef41Sopenharmony_ci value: ['bar'], 1341cb0ef41Sopenharmony_ci done: false, 1351cb0ef41Sopenharmony_ci }, { 1361cb0ef41Sopenharmony_ci value: [42], 1371cb0ef41Sopenharmony_ci done: false, 1381cb0ef41Sopenharmony_ci }, { 1391cb0ef41Sopenharmony_ci value: undefined, 1401cb0ef41Sopenharmony_ci done: true, 1411cb0ef41Sopenharmony_ci }]); 1421cb0ef41Sopenharmony_ci 1431cb0ef41Sopenharmony_ci assert.deepStrictEqual(await iterable.next(), { 1441cb0ef41Sopenharmony_ci value: undefined, 1451cb0ef41Sopenharmony_ci done: true, 1461cb0ef41Sopenharmony_ci }); 1471cb0ef41Sopenharmony_ci} 1481cb0ef41Sopenharmony_ci 1491cb0ef41Sopenharmony_ciasync function nextError() { 1501cb0ef41Sopenharmony_ci const ee = new EventEmitter(); 1511cb0ef41Sopenharmony_ci const iterable = on(ee, 'foo'); 1521cb0ef41Sopenharmony_ci const _err = new Error('kaboom'); 1531cb0ef41Sopenharmony_ci process.nextTick(function() { 1541cb0ef41Sopenharmony_ci ee.emit('error', _err); 1551cb0ef41Sopenharmony_ci }); 1561cb0ef41Sopenharmony_ci const results = await Promise.allSettled([ 1571cb0ef41Sopenharmony_ci iterable.next(), 1581cb0ef41Sopenharmony_ci iterable.next(), 1591cb0ef41Sopenharmony_ci iterable.next(), 1601cb0ef41Sopenharmony_ci ]); 1611cb0ef41Sopenharmony_ci assert.deepStrictEqual(results, [{ 1621cb0ef41Sopenharmony_ci status: 'rejected', 1631cb0ef41Sopenharmony_ci reason: _err, 1641cb0ef41Sopenharmony_ci }, { 1651cb0ef41Sopenharmony_ci status: 'fulfilled', 1661cb0ef41Sopenharmony_ci value: { 1671cb0ef41Sopenharmony_ci value: undefined, 1681cb0ef41Sopenharmony_ci done: true, 1691cb0ef41Sopenharmony_ci }, 1701cb0ef41Sopenharmony_ci }, { 1711cb0ef41Sopenharmony_ci status: 'fulfilled', 1721cb0ef41Sopenharmony_ci value: { 1731cb0ef41Sopenharmony_ci value: undefined, 1741cb0ef41Sopenharmony_ci done: true, 1751cb0ef41Sopenharmony_ci }, 1761cb0ef41Sopenharmony_ci }]); 1771cb0ef41Sopenharmony_ci assert.strictEqual(ee.listeners('error').length, 0); 1781cb0ef41Sopenharmony_ci} 1791cb0ef41Sopenharmony_ci 1801cb0ef41Sopenharmony_ciasync function iterableThrow() { 1811cb0ef41Sopenharmony_ci const ee = new EventEmitter(); 1821cb0ef41Sopenharmony_ci const iterable = on(ee, 'foo'); 1831cb0ef41Sopenharmony_ci 1841cb0ef41Sopenharmony_ci process.nextTick(() => { 1851cb0ef41Sopenharmony_ci ee.emit('foo', 'bar'); 1861cb0ef41Sopenharmony_ci ee.emit('foo', 42); // lost in the queue 1871cb0ef41Sopenharmony_ci iterable.throw(_err); 1881cb0ef41Sopenharmony_ci }); 1891cb0ef41Sopenharmony_ci 1901cb0ef41Sopenharmony_ci const _err = new Error('kaboom'); 1911cb0ef41Sopenharmony_ci let thrown = false; 1921cb0ef41Sopenharmony_ci 1931cb0ef41Sopenharmony_ci assert.throws(() => { 1941cb0ef41Sopenharmony_ci // No argument 1951cb0ef41Sopenharmony_ci iterable.throw(); 1961cb0ef41Sopenharmony_ci }, { 1971cb0ef41Sopenharmony_ci message: 'The "EventEmitter.AsyncIterator" property must be' + 1981cb0ef41Sopenharmony_ci ' an instance of Error. Received undefined', 1991cb0ef41Sopenharmony_ci name: 'TypeError', 2001cb0ef41Sopenharmony_ci }); 2011cb0ef41Sopenharmony_ci 2021cb0ef41Sopenharmony_ci const expected = [['bar'], [42]]; 2031cb0ef41Sopenharmony_ci 2041cb0ef41Sopenharmony_ci try { 2051cb0ef41Sopenharmony_ci for await (const event of iterable) { 2061cb0ef41Sopenharmony_ci assert.deepStrictEqual(event, expected.shift()); 2071cb0ef41Sopenharmony_ci } 2081cb0ef41Sopenharmony_ci } catch (err) { 2091cb0ef41Sopenharmony_ci thrown = true; 2101cb0ef41Sopenharmony_ci assert.strictEqual(err, _err); 2111cb0ef41Sopenharmony_ci } 2121cb0ef41Sopenharmony_ci assert.strictEqual(thrown, true); 2131cb0ef41Sopenharmony_ci assert.strictEqual(expected.length, 0); 2141cb0ef41Sopenharmony_ci assert.strictEqual(ee.listenerCount('foo'), 0); 2151cb0ef41Sopenharmony_ci assert.strictEqual(ee.listenerCount('error'), 0); 2161cb0ef41Sopenharmony_ci} 2171cb0ef41Sopenharmony_ci 2181cb0ef41Sopenharmony_ciasync function eventTarget() { 2191cb0ef41Sopenharmony_ci const et = new EventTarget(); 2201cb0ef41Sopenharmony_ci const tick = () => et.dispatchEvent(new Event('tick')); 2211cb0ef41Sopenharmony_ci const interval = setInterval(tick, 0); 2221cb0ef41Sopenharmony_ci let count = 0; 2231cb0ef41Sopenharmony_ci for await (const [ event ] of on(et, 'tick')) { 2241cb0ef41Sopenharmony_ci count++; 2251cb0ef41Sopenharmony_ci assert.strictEqual(event.type, 'tick'); 2261cb0ef41Sopenharmony_ci if (count >= 5) { 2271cb0ef41Sopenharmony_ci break; 2281cb0ef41Sopenharmony_ci } 2291cb0ef41Sopenharmony_ci } 2301cb0ef41Sopenharmony_ci assert.strictEqual(count, 5); 2311cb0ef41Sopenharmony_ci clearInterval(interval); 2321cb0ef41Sopenharmony_ci} 2331cb0ef41Sopenharmony_ci 2341cb0ef41Sopenharmony_ciasync function errorListenerCount() { 2351cb0ef41Sopenharmony_ci const et = new EventEmitter(); 2361cb0ef41Sopenharmony_ci on(et, 'foo'); 2371cb0ef41Sopenharmony_ci assert.strictEqual(et.listenerCount('error'), 1); 2381cb0ef41Sopenharmony_ci} 2391cb0ef41Sopenharmony_ci 2401cb0ef41Sopenharmony_ciasync function nodeEventTarget() { 2411cb0ef41Sopenharmony_ci const et = new NodeEventTarget(); 2421cb0ef41Sopenharmony_ci const tick = () => et.dispatchEvent(new Event('tick')); 2431cb0ef41Sopenharmony_ci const interval = setInterval(tick, 0); 2441cb0ef41Sopenharmony_ci let count = 0; 2451cb0ef41Sopenharmony_ci for await (const [ event] of on(et, 'tick')) { 2461cb0ef41Sopenharmony_ci count++; 2471cb0ef41Sopenharmony_ci assert.strictEqual(event.type, 'tick'); 2481cb0ef41Sopenharmony_ci if (count >= 5) { 2491cb0ef41Sopenharmony_ci break; 2501cb0ef41Sopenharmony_ci } 2511cb0ef41Sopenharmony_ci } 2521cb0ef41Sopenharmony_ci assert.strictEqual(count, 5); 2531cb0ef41Sopenharmony_ci clearInterval(interval); 2541cb0ef41Sopenharmony_ci} 2551cb0ef41Sopenharmony_ci 2561cb0ef41Sopenharmony_ciasync function abortableOnBefore() { 2571cb0ef41Sopenharmony_ci const ee = new EventEmitter(); 2581cb0ef41Sopenharmony_ci const abortedSignal = AbortSignal.abort(); 2591cb0ef41Sopenharmony_ci [1, {}, null, false, 'hi'].forEach((signal) => { 2601cb0ef41Sopenharmony_ci assert.throws(() => on(ee, 'foo', { signal }), { 2611cb0ef41Sopenharmony_ci code: 'ERR_INVALID_ARG_TYPE', 2621cb0ef41Sopenharmony_ci }); 2631cb0ef41Sopenharmony_ci }); 2641cb0ef41Sopenharmony_ci assert.throws(() => on(ee, 'foo', { signal: abortedSignal }), { 2651cb0ef41Sopenharmony_ci name: 'AbortError', 2661cb0ef41Sopenharmony_ci }); 2671cb0ef41Sopenharmony_ci} 2681cb0ef41Sopenharmony_ci 2691cb0ef41Sopenharmony_ciasync function eventTargetAbortableOnBefore() { 2701cb0ef41Sopenharmony_ci const et = new EventTarget(); 2711cb0ef41Sopenharmony_ci const abortedSignal = AbortSignal.abort(); 2721cb0ef41Sopenharmony_ci [1, {}, null, false, 'hi'].forEach((signal) => { 2731cb0ef41Sopenharmony_ci assert.throws(() => on(et, 'foo', { signal }), { 2741cb0ef41Sopenharmony_ci code: 'ERR_INVALID_ARG_TYPE', 2751cb0ef41Sopenharmony_ci }); 2761cb0ef41Sopenharmony_ci }); 2771cb0ef41Sopenharmony_ci assert.throws(() => on(et, 'foo', { signal: abortedSignal }), { 2781cb0ef41Sopenharmony_ci name: 'AbortError', 2791cb0ef41Sopenharmony_ci }); 2801cb0ef41Sopenharmony_ci} 2811cb0ef41Sopenharmony_ci 2821cb0ef41Sopenharmony_ciasync function abortableOnAfter() { 2831cb0ef41Sopenharmony_ci const ee = new EventEmitter(); 2841cb0ef41Sopenharmony_ci const ac = new AbortController(); 2851cb0ef41Sopenharmony_ci 2861cb0ef41Sopenharmony_ci const i = setInterval(() => ee.emit('foo', 'foo'), 10); 2871cb0ef41Sopenharmony_ci 2881cb0ef41Sopenharmony_ci async function foo() { 2891cb0ef41Sopenharmony_ci for await (const f of on(ee, 'foo', { signal: ac.signal })) { 2901cb0ef41Sopenharmony_ci assert.strictEqual(f, 'foo'); 2911cb0ef41Sopenharmony_ci } 2921cb0ef41Sopenharmony_ci } 2931cb0ef41Sopenharmony_ci 2941cb0ef41Sopenharmony_ci foo().catch(common.mustCall((error) => { 2951cb0ef41Sopenharmony_ci assert.strictEqual(error.name, 'AbortError'); 2961cb0ef41Sopenharmony_ci })).finally(() => { 2971cb0ef41Sopenharmony_ci clearInterval(i); 2981cb0ef41Sopenharmony_ci }); 2991cb0ef41Sopenharmony_ci 3001cb0ef41Sopenharmony_ci process.nextTick(() => ac.abort()); 3011cb0ef41Sopenharmony_ci} 3021cb0ef41Sopenharmony_ci 3031cb0ef41Sopenharmony_ciasync function eventTargetAbortableOnAfter() { 3041cb0ef41Sopenharmony_ci const et = new EventTarget(); 3051cb0ef41Sopenharmony_ci const ac = new AbortController(); 3061cb0ef41Sopenharmony_ci 3071cb0ef41Sopenharmony_ci const i = setInterval(() => et.dispatchEvent(new Event('foo')), 10); 3081cb0ef41Sopenharmony_ci 3091cb0ef41Sopenharmony_ci async function foo() { 3101cb0ef41Sopenharmony_ci for await (const f of on(et, 'foo', { signal: ac.signal })) { 3111cb0ef41Sopenharmony_ci assert(f); 3121cb0ef41Sopenharmony_ci } 3131cb0ef41Sopenharmony_ci } 3141cb0ef41Sopenharmony_ci 3151cb0ef41Sopenharmony_ci foo().catch(common.mustCall((error) => { 3161cb0ef41Sopenharmony_ci assert.strictEqual(error.name, 'AbortError'); 3171cb0ef41Sopenharmony_ci })).finally(() => { 3181cb0ef41Sopenharmony_ci clearInterval(i); 3191cb0ef41Sopenharmony_ci }); 3201cb0ef41Sopenharmony_ci 3211cb0ef41Sopenharmony_ci process.nextTick(() => ac.abort()); 3221cb0ef41Sopenharmony_ci} 3231cb0ef41Sopenharmony_ci 3241cb0ef41Sopenharmony_ciasync function eventTargetAbortableOnAfter2() { 3251cb0ef41Sopenharmony_ci const et = new EventTarget(); 3261cb0ef41Sopenharmony_ci const ac = new AbortController(); 3271cb0ef41Sopenharmony_ci 3281cb0ef41Sopenharmony_ci const i = setInterval(() => et.dispatchEvent(new Event('foo')), 10); 3291cb0ef41Sopenharmony_ci 3301cb0ef41Sopenharmony_ci async function foo() { 3311cb0ef41Sopenharmony_ci for await (const f of on(et, 'foo', { signal: ac.signal })) { 3321cb0ef41Sopenharmony_ci assert(f); 3331cb0ef41Sopenharmony_ci // Cancel after a single event has been triggered. 3341cb0ef41Sopenharmony_ci ac.abort(); 3351cb0ef41Sopenharmony_ci } 3361cb0ef41Sopenharmony_ci } 3371cb0ef41Sopenharmony_ci 3381cb0ef41Sopenharmony_ci foo().catch(common.mustCall((error) => { 3391cb0ef41Sopenharmony_ci assert.strictEqual(error.name, 'AbortError'); 3401cb0ef41Sopenharmony_ci })).finally(() => { 3411cb0ef41Sopenharmony_ci clearInterval(i); 3421cb0ef41Sopenharmony_ci }); 3431cb0ef41Sopenharmony_ci} 3441cb0ef41Sopenharmony_ci 3451cb0ef41Sopenharmony_ciasync function abortableOnAfterDone() { 3461cb0ef41Sopenharmony_ci const ee = new EventEmitter(); 3471cb0ef41Sopenharmony_ci const ac = new AbortController(); 3481cb0ef41Sopenharmony_ci 3491cb0ef41Sopenharmony_ci const i = setInterval(() => ee.emit('foo', 'foo'), 1); 3501cb0ef41Sopenharmony_ci let count = 0; 3511cb0ef41Sopenharmony_ci 3521cb0ef41Sopenharmony_ci async function foo() { 3531cb0ef41Sopenharmony_ci for await (const f of on(ee, 'foo', { signal: ac.signal })) { 3541cb0ef41Sopenharmony_ci assert.strictEqual(f[0], 'foo'); 3551cb0ef41Sopenharmony_ci if (++count === 5) 3561cb0ef41Sopenharmony_ci break; 3571cb0ef41Sopenharmony_ci } 3581cb0ef41Sopenharmony_ci ac.abort(); // No error will occur 3591cb0ef41Sopenharmony_ci } 3601cb0ef41Sopenharmony_ci 3611cb0ef41Sopenharmony_ci foo().finally(() => { 3621cb0ef41Sopenharmony_ci clearInterval(i); 3631cb0ef41Sopenharmony_ci }); 3641cb0ef41Sopenharmony_ci} 3651cb0ef41Sopenharmony_ci 3661cb0ef41Sopenharmony_ciasync function run() { 3671cb0ef41Sopenharmony_ci const funcs = [ 3681cb0ef41Sopenharmony_ci basic, 3691cb0ef41Sopenharmony_ci invalidArgType, 3701cb0ef41Sopenharmony_ci error, 3711cb0ef41Sopenharmony_ci errorDelayed, 3721cb0ef41Sopenharmony_ci throwInLoop, 3731cb0ef41Sopenharmony_ci next, 3741cb0ef41Sopenharmony_ci nextError, 3751cb0ef41Sopenharmony_ci iterableThrow, 3761cb0ef41Sopenharmony_ci eventTarget, 3771cb0ef41Sopenharmony_ci errorListenerCount, 3781cb0ef41Sopenharmony_ci nodeEventTarget, 3791cb0ef41Sopenharmony_ci abortableOnBefore, 3801cb0ef41Sopenharmony_ci abortableOnAfter, 3811cb0ef41Sopenharmony_ci eventTargetAbortableOnBefore, 3821cb0ef41Sopenharmony_ci eventTargetAbortableOnAfter, 3831cb0ef41Sopenharmony_ci eventTargetAbortableOnAfter2, 3841cb0ef41Sopenharmony_ci abortableOnAfterDone, 3851cb0ef41Sopenharmony_ci ]; 3861cb0ef41Sopenharmony_ci 3871cb0ef41Sopenharmony_ci for (const fn of funcs) { 3881cb0ef41Sopenharmony_ci await fn(); 3891cb0ef41Sopenharmony_ci } 3901cb0ef41Sopenharmony_ci} 3911cb0ef41Sopenharmony_ci 3921cb0ef41Sopenharmony_cirun().then(common.mustCall()); 393