Skip to content

Commit

Permalink
Patch for PhantomJS setTimout/setInterval issue
Browse files Browse the repository at this point in the history
Trying a patch suggested at the phantomjs github repo issues

ariya/phantomjs#10832
  • Loading branch information
SergioCrisostomo committed Feb 21, 2014
1 parent 13eecf7 commit 22c7812
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Specs/1.2/Core/Core.js
Expand Up @@ -83,12 +83,12 @@ describe('$chk', {
describe('$clear', {

'should clear timeouts': function(){
var timeout = setTimeout(function(){}, 100);
var timeout = setTimeout( function(){setTimeout(function(){}, 100); }),0);
expect($clear(timeout)).toBeNull();
},

'should clear intervals': function(){
var interval = setInterval(function(){}, 100);
var interval = setInterval(function(){setInterval(function(){}, 100);}, 0);
expect($clear(interval)).toBeNull();
}

Expand Down
12 changes: 6 additions & 6 deletions Specs/1.3client/Utilities/DOMReady.php
Expand Up @@ -196,7 +196,7 @@ function pollDoScroll(){
window.CANSCROLL = PASS
somethingHappened('TEST_ELEMENT.doScroll()', PASS)

if (!PASS) setTimeout(pollDoScroll, 10)
if (!PASS) setTimeout(function(){setTimeout(pollDoScroll, 10)}, 0)
}

function pollDoScroll_body(){
Expand All @@ -213,7 +213,7 @@ function pollDoScroll_body(){

somethingHappened('document.body.doScroll()', PASS)

if (!PASS) setTimeout(pollDoScroll_body, 10)
if (!PASS) setTimeout(function(){setTimeout(pollDoScroll_body, 10)},0)
}

var lastReadyState
Expand All @@ -222,7 +222,7 @@ function pollReadyState(){
if (!readyState) return
if (readyState == lastReadyState) return
somethingHappened('poll document.readyState', readyState)
if (readyState != 'complete' && readyState != 'loaded') setTimeout(pollReadyState, 10)
if (readyState != 'complete' && readyState != 'loaded') setTimeout(function(){setTimeout(pollReadyState, 10)}, 0)
lastReadyState = readyState
}

Expand All @@ -237,7 +237,7 @@ function pollBodyExists(){
PASS = false
}
somethingHappened('body Exists?', PASS? 'YES':'NO')
if (!window.ONLOAD) setTimeout(pollBodyExists, 10)
if (!window.ONLOAD) setTimeout(function(){setTimeout(pollBodyExists, 10)}, 0)
}

function pollAugmentBody(){
Expand All @@ -254,7 +254,7 @@ function pollAugmentBody(){
PASS = false
}
somethingHappened('can Augment Body?', PASS? 'YES':'NO')
if (!window.ONLOAD) setTimeout(pollAugmentBody, 10)
if (!window.ONLOAD) setTimeout(function(){setTimeout(pollAugmentBody, 10)}, 0)
}

// // // // // // // // // // // // // // // // // // // // //
Expand Down Expand Up @@ -342,7 +342,7 @@ function poll(){
})

if (hasDifferentResults) readyTestResults.push(results)
if (!window.ONLOAD) setTimeout(poll, 10)
if (!window.ONLOAD) setTimeout(function(){setTimeout(poll, 10)}, 0)
else report()
}

Expand Down

0 comments on commit 22c7812

Please sign in to comment.