Checking in vidur@netscape.com's fix for bug 81994 which caused scripts on webpages to be executed twice when calling DemoteContainer() in the html content sink. r=nisheeth@netscape.com, sr=jband@netscape.com, a=asa@mozilla.org

git-svn-id: svn://10.0.0.236/trunk@95899 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jst%netscape.com
2001-05-25 07:03:04 +00:00
parent 1f0f1e51a2
commit 855319209e
4 changed files with 50 additions and 2 deletions

View File

@@ -118,7 +118,7 @@ nsScriptLoadRequest::FireScriptEvaluated(nsresult aResult)
//////////////////////////////////////////////////////////////
nsScriptLoader::nsScriptLoader()
: mDocument(nsnull)
: mDocument(nsnull), mSuspendCount(0)
{
NS_INIT_ISUPPORTS();
}
@@ -261,7 +261,7 @@ nsScriptLoader::ProcessScriptElement(nsIDOMHTMLScriptElement *aElement,
// Check to see that the element is not in a container that
// suppresses script evaluation within it.
if (InNonScriptingContainer(aElement)) {
if (mSuspendCount || InNonScriptingContainer(aElement)) {
return FireErrorNotification(NS_ERROR_NOT_AVAILABLE, aElement, aObserver);
}
@@ -757,3 +757,20 @@ nsScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader,
return NS_OK;
}
NS_IMETHODIMP
nsScriptLoader::Suspend()
{
mSuspendCount++;
return NS_OK;
}
NS_IMETHODIMP
nsScriptLoader::Resume()
{
NS_ASSERTION((mSuspendCount > 0), "nsScriptLoader call to resume() unbalanced");
mSuspendCount--;
return NS_OK;
}