diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 3d1741b3ed4..0aec9892b10 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -6324,7 +6324,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsFrameConstructorState& aState, if (rootFrame) rootFrame = rootFrame->GetFirstChild(nsnull); nsCOMPtr rootBox(do_QueryInterface(rootFrame)); - NS_ASSERTION(rootBox, "unexpected null pointer"); + PRBool added = PR_FALSE; if (rootBox) { nsIFrame* popupSetFrame; rootBox->GetPopupSetFrame(&popupSetFrame); @@ -6332,13 +6332,25 @@ nsCSSFrameConstructor::ConstructXULFrame(nsFrameConstructorState& aState, if (popupSetFrame) { nsCOMPtr popupSet(do_QueryInterface(popupSetFrame)); NS_ASSERTION(popupSet, "unexpected null pointer"); - if (popupSet) + if (popupSet) { + added = PR_TRUE; popupSet->AddPopupFrame(newFrame); + } } } - // Add the placeholder frame to the flow - aFrameItems.AddChild(placeholderFrame); + if (added) { + // Add the placeholder frame to the flow + aFrameItems.AddChild(placeholderFrame); + } else { + // Didn't add the popup set frame... Need to clean up and + // just not construct a frame here. + aState.mFrameManager->UnregisterPlaceholderFrame(NS_STATIC_CAST(nsPlaceholderFrame*, placeholderFrame)); + newFrame->Destroy(aState.mPresContext); + placeholderFrame->Destroy(aState.mPresContext); + *aHaltProcessing = PR_TRUE; + return NS_OK; + } } else { #endif // Add the new frame to our list of frame items. Note that we