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:
@@ -1582,6 +1582,16 @@ SinkContext::DemoteContainer(const nsIParserNode& aNode)
|
||||
}
|
||||
}
|
||||
|
||||
// Suspend script processing while we move children around.
|
||||
// We don't want to re-evaluate scripts as a result of the move.
|
||||
nsCOMPtr<nsIScriptLoader> loader;
|
||||
if (mSink && mSink->mDocument) {
|
||||
mSink->mDocument->GetScriptLoader(getter_AddRefs(loader));
|
||||
if (loader) {
|
||||
loader->Suspend();
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// Move all of the demoted containers children to its parent
|
||||
PRInt32 i, count;
|
||||
@@ -1639,6 +1649,10 @@ SinkContext::DemoteContainer(const nsIParserNode& aNode)
|
||||
mStackPos--;
|
||||
}
|
||||
|
||||
if (loader) {
|
||||
loader->Resume();
|
||||
}
|
||||
|
||||
// Restore frames state after adding it to new parent
|
||||
if (frameManager && presContext && tempFrameState && frame) {
|
||||
presShell->GetPrimaryFrameFor(parent, &frame);
|
||||
|
||||
Reference in New Issue
Block a user