Bug 570624 - "ASSERTION: called nsGenericElement::SetText"; r=roc

--HG--
extra : rebase_source : 24d41a8eccef1c6d8b3adc6a04ca1a20912263ef
This commit is contained in:
Ehsan Akhgari 2010-06-09 14:14:42 -04:00
parent f1bf233213
commit 8c018044af
3 changed files with 20 additions and 5 deletions

View File

@ -0,0 +1,15 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
function boom()
{
var xt = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", 'textbox');
document.body.appendChild(xt);
xt.setAttribute('disabled', "true");
xt.setAttribute('value', "foo");
}
</script>
</head>
<body onload="boom();">
</body>
</html>

View File

@ -38,4 +38,5 @@ load 455451-1.html
load 457537-1.html
load 457537-2.html
load 478219-1.xhtml
load 570624-1.html
load 498698-1.html

View File

@ -822,9 +822,8 @@ nsTextControlFrame::GetRootNodeAndInitializeEditor(nsIDOMElement **aRootElement)
{
NS_ENSURE_ARG_POINTER(aRootElement);
nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
NS_ASSERTION(txtCtrl, "Content not a text control element");
nsIEditor* editor = txtCtrl->GetTextEditor();
nsCOMPtr<nsIEditor> editor;
GetEditor(getter_AddRefs(editor));
if (!editor)
return NS_OK;
@ -1216,9 +1215,9 @@ nsTextControlFrame::AttributeChanged(PRInt32 aNameSpaceID,
const PRBool needEditor = nsGkAtoms::maxlength == aAttribute ||
nsGkAtoms::readonly == aAttribute ||
nsGkAtoms::disabled == aAttribute;
nsIEditor *editor = nsnull;
nsCOMPtr<nsIEditor> editor;
if (needEditor) {
editor = txtCtrl->GetTextEditor();
GetEditor(getter_AddRefs(editor));
}
if ((needEditor && !editor) || !selCon)
return nsBoxFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);;