Attempt to fix bug 681138 by making the test loading not race against snapshotting

This commit is contained in:
Ehsan Akhgari 2013-03-05 09:32:51 -05:00
parent f2d9014b85
commit 872145695a

View File

@ -47,9 +47,12 @@ function doSnapShot(iframe) {
callbackTestCanvas(iframe);
};
function remotePageLoaded() {
function remotePageLoaded(callback) {
var iframe = this;
setTimeout(function(){doSnapShot(iframe);}, 0)
setTimeout(function(){
doSnapShot(iframe);
callback();
}, 0);
};
const MAX_ITERATIONS = 1000;
@ -71,8 +74,11 @@ function createIframe(url,next) {
}
return;
}
iframe.remotePageLoaded();
if (next) setTimeout(function(){createIframe(next,null);}, 0)
iframe.remotePageLoaded(function() {
if (next) {
setTimeout(function(){createIframe(next,null);}, 0)
}
});
}
iframe.addEventListener("load", iframeLoadCompleted, false);
window.document.body.appendChild(iframe);