clearTimeout with invalid handle cause program runs longer
- Version: Tested on 6.0.0
- Platform: Tested on Windows & MacOS
- Subsystem: Timer
This program cost 20 seconds, but 10.5 seconds was expected:
var handle = setTimeout(function(){ clearTimeout(handle); handle = setTimeout( function() { }, 10000 ); setTimeout( function() { clearTimeout( handle ); }, 500 ); }, 10000);
But all below codes work as expected:
var handle = setTimeout(function(){ clearTimeout(handle); handle = setTimeout( function() { }, 10000 ); setTimeout( function() { clearTimeout( handle ); }, 500 ); }, 2000); // <-- different delay
var handle = setTimeout(function(){ //clearTimeout(handle); <-- comment this line. handle = setTimeout( function() { }, 10000 ); setTimeout( function() { clearTimeout( handle ); }, 500 ); }, 10000);
Does clearTimeout with a invalid handle causes this problem?