11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst timers = require('timers'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ci{ 71cb0ef41Sopenharmony_ci const interval = setInterval(common.mustCall(() => { 81cb0ef41Sopenharmony_ci clearTimeout(interval); 91cb0ef41Sopenharmony_ci }), 1).unref(); 101cb0ef41Sopenharmony_ci} 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_ci{ 131cb0ef41Sopenharmony_ci const interval = setInterval(common.mustCall(() => { 141cb0ef41Sopenharmony_ci interval.close(); 151cb0ef41Sopenharmony_ci }), 1).unref(); 161cb0ef41Sopenharmony_ci} 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ci{ 191cb0ef41Sopenharmony_ci const interval = setInterval(common.mustCall(() => { 201cb0ef41Sopenharmony_ci timers.unenroll(interval); 211cb0ef41Sopenharmony_ci }), 1).unref(); 221cb0ef41Sopenharmony_ci} 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_ci{ 251cb0ef41Sopenharmony_ci const interval = setInterval(common.mustCall(() => { 261cb0ef41Sopenharmony_ci interval._idleTimeout = -1; 271cb0ef41Sopenharmony_ci }), 1).unref(); 281cb0ef41Sopenharmony_ci} 291cb0ef41Sopenharmony_ci 301cb0ef41Sopenharmony_ci{ 311cb0ef41Sopenharmony_ci const interval = setInterval(common.mustCall(() => { 321cb0ef41Sopenharmony_ci interval._onTimeout = null; 331cb0ef41Sopenharmony_ci }), 1).unref(); 341cb0ef41Sopenharmony_ci} 351cb0ef41Sopenharmony_ci 361cb0ef41Sopenharmony_ci// Use timers' intrinsic behavior to keep this open 371cb0ef41Sopenharmony_ci// exactly long enough for the problem to manifest. 381cb0ef41Sopenharmony_ci// 391cb0ef41Sopenharmony_ci// See https://github.com/nodejs/node/issues/9561 401cb0ef41Sopenharmony_ci// 411cb0ef41Sopenharmony_ci// Since this is added after it will always fire later 421cb0ef41Sopenharmony_ci// than the previous timeouts, unrefed or not. 431cb0ef41Sopenharmony_ci// 441cb0ef41Sopenharmony_ci// Keep the event loop alive for one timeout and then 451cb0ef41Sopenharmony_ci// another. Any problems will occur when the second 461cb0ef41Sopenharmony_ci// should be called but before it is able to be. 471cb0ef41Sopenharmony_cisetTimeout(common.mustCall(() => { 481cb0ef41Sopenharmony_ci setTimeout(common.mustCall(), 1); 491cb0ef41Sopenharmony_ci}), 1); 50