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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user