Handle null values in clearTimeout
This commit is contained in:
parent
fa7dcbec8b
commit
7a48fd8455
@ -209,9 +209,11 @@ exports.setTimeout = function (callback, after) {
|
||||
|
||||
|
||||
exports.clearTimeout = function (timer) {
|
||||
timer.callback = timer._onTimeout = null;
|
||||
exports.unenroll(timer);
|
||||
if (timer instanceof Timer) timer.stop(); // for after === 0
|
||||
if (timer) {
|
||||
timer.callback = timer._onTimeout = null;
|
||||
exports.unenroll(timer);
|
||||
if (timer instanceof Timer) timer.stop(); // for after === 0
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -8,6 +8,10 @@ var WINDOW = 200; // why is does this need to be so big?
|
||||
var interval_count = 0;
|
||||
var setTimeout_called = false;
|
||||
|
||||
// check that these don't blow up.
|
||||
clearTimeout(null);
|
||||
clearInterval(null);
|
||||
|
||||
assert.equal(true, setTimeout instanceof Function);
|
||||
var starttime = new Date;
|
||||
setTimeout(function () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user