From a8e56fa9fe34c77b08c55f111123190e8bf31517 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Tue, 25 Jan 2005 04:22:09 +0000 Subject: [PATCH] Make content state restoration flush out the content sink (but not content notifications!) before we try to generate the state key. Remove bogus assert. Bug 139568, r+sr=jst git-svn-id: svn://10.0.0.236/trunk@168284 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsContentUtils.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/mozilla/content/base/src/nsContentUtils.cpp b/mozilla/content/base/src/nsContentUtils.cpp index 084bfd15594..19470dc3f1f 100644 --- a/mozilla/content/base/src/nsContentUtils.cpp +++ b/mozilla/content/base/src/nsContentUtils.cpp @@ -1417,12 +1417,14 @@ nsContentUtils::GenerateStateKey(nsIContent* aContent, return NS_OK; } - nsCOMPtr htmlDocument(do_QueryInterface(aContent->GetDocument())); + nsCOMPtr htmlDocument(do_QueryInterface(aContent->GetCurrentDoc())); KeyAppendInt(partID, aKey); // first append a partID PRBool generatedUniqueKey = PR_FALSE; if (htmlDocument) { + // Flush our content model so it'll be up to date + aContent->GetCurrentDoc()->FlushPendingNotifications(Flush_Content); nsCOMPtr domHtmlDocument(do_QueryInterface(htmlDocument)); nsCOMPtr forms; domHtmlDocument->GetForms(getter_AddRefs(forms)); @@ -1503,16 +1505,9 @@ nsContentUtils::GenerateStateKey(nsIContent* aContent, // Hash by index of control in doc (we are not in a form) // These are important as they are unique, and type/name may not be. - // We don't refresh the form control list here (passing PR_TRUE - // for aFlush), although we really should. Forcing a flush - // causes a signficant pageload performance hit. See bug - // 166636. Doing this wrong means you will see the assertion - // below being hit. + // Note that we've already flushed content, so there's no + // reason to flush it again. index = htmlFormControls->IndexOf(aContent, PR_FALSE); - NS_ASSERTION(index > -1, - "nsFrameManager::GenerateStateKey didn't find content " - "by type! See bug 139568"); - if (index > -1) { KeyAppendInt(index, aKey); generatedUniqueKey = PR_TRUE;