-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
timers: fix arbitrary object clearImmediate errors
Fix errors that are caused by invoking clearImmediate with arbitrary objects. fixes: #37806 PR-URL: #37824 Fixes: #37806 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
- Loading branch information
Showing
4 changed files
with
23 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const child_process = require('child_process'); | ||
const assert = require('assert'); | ||
|
||
// Regression test for https://github.com/nodejs/node/issues/37806: | ||
const proc = child_process.spawn(process.execPath, ['-i']); | ||
proc.on('error', common.mustNotCall()); | ||
proc.on('exit', common.mustCall((code) => { | ||
assert.strictEqual(code, 0); | ||
})); | ||
proc.stdin.write('clearImmediate({});\n.exit\n'); |
8 changes: 8 additions & 0 deletions
8
test/parallel/test-timers-clear-object-does-not-throw-error.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
'use strict'; | ||
require('../common'); | ||
|
||
// This test makes sure clearing timers with | ||
// objects doesn't throw | ||
clearImmediate({}); | ||
clearTimeout({}); | ||
clearInterval({}); |