| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -272,6 +272,10 @@ exports.setInterval = function(callback, repeat) { | |||
| 272 | 272 | return timer; | |
| 273 | 273 | ||
| 274 | 274 | function wrapper() { | |
| 275 | + // If _repeat was overriden we are effectively canceled. Bail. | ||
| 276 | + if (typeof timer._repeat !== 'function') | ||
| 277 | + return; | ||
| 278 | + | ||
| 275 | 279 | timer._repeat(); | |
| 276 | 280 | ||
| 277 | 281 | // Do not re-arm unenroll'd or closed timers. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,7 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | 3 | const common = require('../common'); | |
| 4 | + const assert = require('assert'); | ||
| 4 | 5 | const timers = require('timers'); | |
| 5 | 6 | ||
| 6 | 7 | { | |
@@ -33,6 +34,19 @@ const timers = require('timers'); | |||
| 33 | 34 | }), 1).unref(); | |
| 34 | 35 | } | |
| 35 | 36 | ||
| 37 | + { | ||
| 38 | + const interval = setInterval(common.mustCall(() => { | ||
| 39 | + // This case is only necessary / valid prior to | ||
| 40 | + // c8c2544cd9c339cdde881fc9a7f0851971b94d72 | ||
| 41 | + // which is not on the v4.x branch. | ||
| 42 | + assert.strictEqual(typeof interval._repeat, 'function'); | ||
| 43 | + | ||
| 44 | + process.nextTick(common.mustCall(() => { | ||
| 45 | + interval._repeat = null; | ||
| 46 | + })); | ||
| 47 | + }), 1).unref(); | ||
| 48 | + } | ||
| 49 | + | ||
| 36 | 50 | // Use timers' intrinsic behavior to keep this open | |
| 37 | 51 | // exactly long enough for the problem to manifest. | |
| 38 | 52 | // | |
| Back | FazBrowse Home | New Git URL |
0 commit comments