Bug 455451. Don't notify from inside frame construction. r+sr=jst

This commit is contained in:
Boris Zbarsky 2008-09-25 16:35:46 -04:00
parent 33105ca61f
commit c1fe6ebd6e
4 changed files with 24 additions and 6 deletions

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function boom()
{
window.addEventListener("DOMCharacterDataModified", function(){}, false);
document.body.appendChild(document.createElement("isindex"));
}
</script>
</head>
<body onload="boom();"></body>
</html>

View File

@ -22,3 +22,4 @@ load 393656-1.xhtml
load 393656-2.xhtml
load 404118-1.html
load 404123-1.html
load 455451-1.html

View File

@ -110,8 +110,8 @@ nsIsIndexFrame::Destroy()
// REVIEW: We don't need to override BuildDisplayList, nsAreaFrame will honour
// our visibility setting
NS_IMETHODIMP
nsIsIndexFrame::UpdatePromptLabel()
nsresult
nsIsIndexFrame::UpdatePromptLabel(PRBool aNotify)
{
if (!mTextContent) return NS_ERROR_UNEXPECTED;
@ -133,7 +133,7 @@ nsIsIndexFrame::UpdatePromptLabel()
"IsIndexPrompt", prompt);
}
mTextContent->SetText(prompt, PR_TRUE);
mTextContent->SetText(prompt, aNotify);
return NS_OK;
}
@ -203,7 +203,7 @@ nsIsIndexFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
return NS_ERROR_OUT_OF_MEMORY;
// set the value of the text node and add it to the child list
UpdatePromptLabel();
UpdatePromptLabel(PR_FALSE);
if (!aElements.AppendElement(mTextContent))
return NS_ERROR_OUT_OF_MEMORY;
@ -283,7 +283,7 @@ nsIsIndexFrame::AttributeChanged(PRInt32 aNameSpaceID,
{
nsresult rv = NS_OK;
if (nsGkAtoms::prompt == aAttribute) {
rv = UpdatePromptLabel();
rv = UpdatePromptLabel(PR_TRUE);
} else {
rv = nsAreaFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
}

View File

@ -117,7 +117,7 @@ protected:
nsCOMPtr<nsIContent> mPostHr;
private:
NS_IMETHOD UpdatePromptLabel();
nsresult UpdatePromptLabel(PRBool aNotify);
nsresult GetInputFrame(nsIFormControlFrame** oFrame);
void GetInputValue(nsString& oString);
void SetInputValue(const nsString& aString);