| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9f1f215 commit e4d1042
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -275,11 +275,11 @@ ImmediateList.prototype.append = function(item) { | |||
| 275 | 275 | // Removes an item from the linked list, adjusting the pointers of adjacent | |
| 276 | 276 | // items and the linked list's head or tail pointers as necessary | |
| 277 | 277 | ImmediateList.prototype.remove = function(item) { | |
| 278 | - if (item._idleNext !== null) { | ||
| 278 | + if (item._idleNext) { | ||
| 279 | 279 | item._idleNext._idlePrev = item._idlePrev; | |
| 280 | 280 | } | |
| 281 | 281 | ||
| 282 | - if (item._idlePrev !== null) { | ||
| 282 | + if (item._idlePrev) { | ||
| 283 | 283 | item._idlePrev._idleNext = item._idleNext; | |
| 284 | 284 | } | |
| 285 | 285 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -283,7 +283,7 @@ function clearImmediate(immediate) { | |||
| 283 | 283 | toggleImmediateRef(false); | |
| 284 | 284 | immediate[kRefed] = null; | |
| 285 | 285 | ||
| 286 | - if (destroyHooksExist()) { | ||
| 286 | + if (destroyHooksExist() && immediate[async_id_symbol] !== undefined) { | ||
| 287 | 287 | emitDestroy(immediate[async_id_symbol]); | |
| 288 | 288 | } | |
| 289 | 289 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,12 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const child_process = require('child_process'); | ||
| 4 | + const assert = require('assert'); | ||
| 5 | + | ||
| 6 | + // Regression test for https://github.com/nodejs/node/issues/37806: | ||
| 7 | + const proc = child_process.spawn(process.execPath, ['-i']); | ||
| 8 | + proc.on('error', common.mustNotCall()); | ||
| 9 | + proc.on('exit', common.mustCall((code) => { | ||
| 10 | + assert.strictEqual(code, 0); | ||
| 11 | + })); | ||
| 12 | + proc.stdin.write('clearImmediate({});\n.exit\n'); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,8 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + require('../common'); | ||
| 3 | + | ||
| 4 | + // This test makes sure clearing timers with | ||
| 5 | + // objects doesn't throw | ||
| 6 | + clearImmediate({}); | ||
| 7 | + clearTimeout({}); | ||
| 8 | + clearInterval({}); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments