Bug 489050. Make sure to not notify on our content once we've disconnected from the document. r=bent, sr=sicking, a=dveditz

git-svn-id: svn://10.0.0.236/trunk@257328 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2009-06-01 16:11:01 +00:00
parent e0d8ae73d8
commit 73deb4e727
3 changed files with 31 additions and 11 deletions

View File

@@ -168,6 +168,7 @@ nsXMLContentSink::Init(nsIDocument* aDoc,
NS_ENSURE_SUCCESS(rv, rv);
aDoc->AddObserver(this);
mIsDocumentObserver = PR_TRUE;
if (!mDocShell) {
mPrettyPrintXML = PR_FALSE;
@@ -248,6 +249,7 @@ nsXMLContentSink::MaybePrettyPrint()
// stop observing in order to avoid crashing when replacing content
mDocument->RemoveObserver(this);
mIsDocumentObserver = PR_FALSE;
// Reenable the CSSLoader so that the prettyprinting stylesheets can load
if (mCSSLoader) {
@@ -316,6 +318,7 @@ nsXMLContentSink::DidBuildModel()
if (mXSLTProcessor) {
// stop observing in order to avoid crashing when replacing content
mDocument->RemoveObserver(this);
mIsDocumentObserver = PR_FALSE;
// Check for xslt-param and xslt-param-namespace PIs
PRUint32 i;
@@ -374,6 +377,7 @@ nsXMLContentSink::DidBuildModel()
}
mDocument->RemoveObserver(this);
mIsDocumentObserver = PR_FALSE;
mDocument->EndLoad();
}
@@ -1455,6 +1459,7 @@ nsXMLContentSink::ReportError(const PRUnichar* aErrorText,
// stop observing in order to avoid crashing when removing content
mDocument->RemoveObserver(this);
mIsDocumentObserver = PR_FALSE;
// Clear the current content and
// prepare to set <parsererror> as the document root
@@ -1618,11 +1623,15 @@ nsXMLContentSink::FlushPendingNotifications(mozFlushType aType)
// Only flush tags if we're not doing the notification ourselves
// (since we aren't reentrant)
if (!mInNotification) {
if (aType >= Flush_ContentAndNotify) {
FlushTags();
}
else {
FlushText(PR_FALSE);
if (mIsDocumentObserver) {
// Only flush if we're still a document observer (so that our child
// counts should be correct).
if (aType >= Flush_ContentAndNotify) {
FlushTags();
}
else {
FlushText(PR_FALSE);
}
}
if (aType >= Flush_Layout) {
// Make sure that layout has started so that the reflow flush