Fix the ignoring of load events for previous documents check so that it also works for (most) cases of the assertion check. (Bug 477409) r=jruderman

This commit is contained in:
L. David Baron 2009-02-10 14:05:27 -08:00
parent a80ae7d9b5
commit fd2f36a3bd

View File

@ -59,6 +59,9 @@ const NS_XREAPPINFO_CONTRACTID =
const LOAD_FAILURE_TIMEOUT = 10000; // ms
// "<!--CLEAR-->"
const BLANK_URL_FOR_CLEARING = "data:text/html,%3C%21%2D%2DCLEAR%2D%2D%3E";
var gBrowser;
var gCanvas1, gCanvas2;
// gCurrentCanvas is non-null between InitCurrentCanvasWithSnapshot and the next
@ -542,7 +545,8 @@ function OnDocumentLoad(event)
// Ignore load events for subframes.
return;
if (gClearingForAssertionCheck) {
if (gClearingForAssertionCheck &&
gBrowser.contentDocument.location.href == BLANK_URL_FOR_CLEARING) {
DoAssertionCheck();
return;
}
@ -903,10 +907,10 @@ function LoadFailed()
function FinishTestItem()
{
// Replace document with about:blank in case there are
// Replace document with BLANK_URL_FOR_CLEARING in case there are
// assertions when unloading.
gClearingForAssertionCheck = true;
gBrowser.loadURI("about:blank");
gBrowser.loadURI(BLANK_URL_FOR_CLEARING);
}
function DoAssertionCheck()