Make sure to call ScriptEvaluated when doing all evaluations, to call it

_after_ we've popped the JSContext from the stack, and to handle multiple
termination functions being posted from a single script evaluation.  Fixes
leaks when closing windows or tabs with still-loading documents.  Bug 295983,
r+sr=jst, a=asa


git-svn-id: svn://10.0.0.236/trunk@174364 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2005-06-09 15:42:19 +00:00
parent d599723a09
commit e01bd5e327
7 changed files with 152 additions and 44 deletions

View File

@@ -965,11 +965,16 @@ nsHTMLDocument::EndLoad()
// document.write("foo");
// location.href = "http://www.mozilla.org";
// document.write("bar");
scx->SetTerminationFunction(DocumentWriteTerminationFunc,
NS_STATIC_CAST(nsIDocument *, this));
return;
nsresult rv =
scx->SetTerminationFunction(DocumentWriteTerminationFunc,
NS_STATIC_CAST(nsIDocument *, this));
// If we fail to set the termination function, just go ahead
// and EndLoad now. The slight bugginess involved is better
// than leaking.
if (NS_SUCCEEDED(rv)) {
return;
}
}
}
}