Bug 486848. Don't clobber |result| until we're done using it. r+sr=roc

This commit is contained in:
Boris Zbarsky 2009-04-05 23:53:40 -04:00
parent b815eff029
commit c5b13dc8d7
4 changed files with 43 additions and 2 deletions

View File

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<listbox id="listbox">
<listitem id="a">a</listitem>
<listitem>b</listitem>
<listitem id="c">c</listitem>
</listbox>
</window>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="boom();">
<script type="text/javascript">
function boom()
{
var c = document.getElementById("c");
var n = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "listitem");
n.textContent = "b";
c.parentNode.insertBefore(n, c);
}
</script>
<listbox id="listbox">
<listitem id="a">a</listitem>
<listitem id="c">c</listitem>
</listbox>
</window>

View File

@ -1132,3 +1132,4 @@ fails == 461512-1.html 461512-1-ref.html # Bug 461512
== 486052-2e.html 486052-2-ref.html
== 486052-2f.html 486052-2-ref.html
== 486052-2g.html 486052-2-ref.html
== 486848-1.xul 486848-1-ref.xul

View File

@ -1209,9 +1209,10 @@ nsListBoxBodyFrame::GetNextItemBox(nsIBox* aBox, PRInt32 aOffset,
nsIContent *nextContent = parentContent->GetChildAt(i + aOffset + 1);
nsPresContext* presContext = PresContext();
result = presContext->GetPresShell()->GetPrimaryFrameFor(nextContent);
nsIFrame* existingFrame =
presContext->GetPresShell()->GetPrimaryFrameFor(nextContent);
if (!result) {
if (!existingFrame) {
// Either append the new frame, or insert it after the current frame
PRBool isAppend = result != mLinkupFrame && mRowsToPrepend <= 0;
nsIFrame* prevFrame = isAppend ? nsnull : aBox;
@ -1225,6 +1226,8 @@ nsListBoxBodyFrame::GetNextItemBox(nsIBox* aBox, PRInt32 aOffset,
*aCreated = PR_TRUE;
} else
return GetNextItemBox(aBox, ++aOffset, aCreated);
} else {
result = existingFrame;
}
mLinkupFrame = nsnull;