-
Notifications
You must be signed in to change notification settings - Fork 7.3k
setTimeout(fn) does not work as expected #593
Comments
Is this about |
i'm not sure what this was about. closing. |
I think you meant that when you omit the second param, the timeout never actually occurs, instead of it happening immediately like one might think. |
Yup @ER88 is right the function is never called and a error is never produced. |
Right, that's a bug. Reopening. |
Looks mostly ok to me.
|
|
we should match web browser semantics here. what is the web browser doing? |
I know in the latest version of Firefox, anything equal to or less than zero, the timeout just occurs immediately, same if you omit the second param all together |
@isaacs: What MAX_INT do you mean? Afaik, there is no MAX_INT nor Number.MAX_INT and maximal integer number is Math.pow(53)-1 (maximal UInt32 is another matter, of course). EDIT: The maximal possible Date is enough a limit, I think. In specs, it's year 9999, I think; in v8, it is very near to the maximal integer I mentioned above (in numbers of milliseconds from epoch). If an ending Date may be constructed, ok, if not, problem, |
Firefox 3.6.18
|
@ER88 Not immediately, at least not in 3.6.18. It runs on the next tick, a couple of milliseconds later. |
Follows browser behaviour by scheduling the callback on the next tick. Fixes nodejs#593.
Can someone review 8ad75f9? It's a standalone patch that implements the behaviour observed in FF 3.6. |
Hello.... this is related to #1877: Large timeouts for setTimeout stop propagation of event loops please see comments there. |
Landed on 7fc835a. Thanks! |
So... does this help/apply to
I see the limit to (2**31)-1 , so maybe? |
Yes, this ought to fix #1877 as well. I'll check it out to make sure. |
never get timeout.
The text was updated successfully, but these errors were encountered: