Skip to content
This repository has been archived by the owner on Dec 16, 2023. It is now read-only.

Commit

Permalink
Don't block forever on wait
Browse files Browse the repository at this point in the history
  • Loading branch information
assaf committed Dec 24, 2011
1 parent ee1bf5c commit 82baad8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/zombie/eventloop.coffee
Expand Up @@ -136,7 +136,7 @@ class EventLoop
wait: (window, duration, callback)->
if typeof duration == "function"
is_done = duration
done_at = Date.now() + 5000 # don't block forever
done_at = Infinity
else
unless duration && duration != 0
duration = @_browser.waitFor
Expand All @@ -152,6 +152,11 @@ class EventLoop
@_pause() if @_waiting.length == 0
process.nextTick ->
callback error, window
if terminate
clearTimeout(terminate)

# don't block forever
terminate = setTimeout(done, 5000)

# Duration is a function, proceed until function returns false.
waiting = =>
Expand Down

0 comments on commit 82baad8

Please sign in to comment.