Bug 571428 - "ASSERTION: Can't be unbound without being bound originally"; r=roc

This commit is contained in:
Ehsan Akhgari 2010-06-11 12:24:28 -04:00
parent 3debe38b84
commit 28ae2c2781
4 changed files with 18 additions and 3 deletions

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<script>
function boom()
{
var i = document.getElementById("i");
i.setAttribute("type", "button");
i.removeAttribute("type");
}
</script>
</head>
<body onload="boom();"><input id="i"></body>
</html>

View File

@ -15,3 +15,4 @@ load 504183-1.html
load 515829-1.html
load 515829-2.html
load 570566-1.html
load 571428-1.html

View File

@ -571,6 +571,7 @@ nsHTMLInputElement::FreeData()
nsMemory::Free(mInputData.mValue);
mInputData.mValue = nsnull;
} else {
UnbindFromFrame(nsnull);
NS_IF_RELEASE(mInputData.mState);
}
}

View File

@ -1323,12 +1323,11 @@ nsTextEditorState::DestroyEditor()
void
nsTextEditorState::UnbindFromFrame(nsTextControlFrame* aFrame)
{
NS_ASSERTION(mBoundFrame, "Can't be unbound without being bound originally");
NS_ENSURE_TRUE(mBoundFrame, );
// If it was, however, it should be unbounded from the same frame.
NS_ASSERTION(aFrame == mBoundFrame, "Unbinding from the wrong frame");
NS_ENSURE_TRUE(aFrame == mBoundFrame, );
NS_ASSERTION(!aFrame || aFrame == mBoundFrame, "Unbinding from the wrong frame");
NS_ENSURE_TRUE(!aFrame || aFrame == mBoundFrame, );
// We need to start storing the value outside of the editor if we're not
// going to use it anymore, so retrieve it for now.