Go back to creating an inconsistent DOM and add a null-check elsewhere, because

the little mind of the focus code is blown by having no documentElement,
apparently. Bug 341730, r+sr=sicking, a=beltzner


git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@203221 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2006-07-20 03:20:49 +00:00
parent e65f8a086f
commit 56319bb6db
2 changed files with 11 additions and 12 deletions

View File

@@ -4928,17 +4928,15 @@ nsDocument::Destroy()
mIsGoingAway = PR_TRUE;
DestroyLinkMap();
for (PRInt32 indx = 0; indx < count; ++indx) {
nsIContent* content = mChildren.ChildAt(indx);
if (content == mRootContent) {
// Null out mRootContent first; this is similar to what RemoveChildAt()
// does.
mRootContent = nsnull;
}
// XXXbz what about document observer notifications? We really need to get
// rid of this Destroy() method!
content->UnbindFromTree();
// XXXbz what we _should_ do here is to clear mChildren and null out
// mRootContent. If we did this (or at least the latter), we could remove
// the silly null-checks in nsHTMLDocument::MatchLinks. Unfortunately,
// doing that introduces several problems:
// 1) Focus issues (see bug 341730). The fix for bug 303260 may fix these.
// 2) Crashes in OnPageHide if it fires after Destroy. See bug 303260
// comments 9 and 10.
// So we're just creating an inconsistent DOM for now and hoping. :(
mChildren.ChildAt(indx)->UnbindFromTree();
}
// Propagate the out-of-band notification to each PresShell's anonymous

View File

@@ -1732,8 +1732,9 @@ nsHTMLDocument::MatchLinks(nsIContent *aContent, PRInt32 aNamespaceID,
nsIAtom* aAtom, const nsAString& aData)
{
nsINodeInfo *ni = aContent->GetNodeInfo();
nsIDocument *doc = aContent->GetDocument();
if (ni) {
if (ni && doc) {
NS_ASSERTION(aContent->IsInDoc(),
"This method should never be called on content nodes that "
"are not in a document!");