ConstructDocElementFrame can return null if the XBL hasn't loaded yet. Handle

that XBL loading later by changing how XBL triggers the frame construction and
making it possible to recreate the doc element hierarchy even if there is no
doc element frame.  Bug 366207, r=sicking, sr=roc
This commit is contained in:
bzbarsky@mit.edu
2007-01-13 03:32:31 +00:00
parent 9ae7ccb248
commit fe588b461a
2 changed files with 20 additions and 27 deletions

View File

@@ -7638,26 +7638,27 @@ nsCSSFrameConstructor::ReconstructDocElementHierarchyInternal()
// XXXbz So why can't we reuse ContentRemoved?
nsIFrame* docParentFrame = docElementFrame->GetParent();
NS_ASSERTION(docElementFrame->GetParent() == mDocElementContainingBlock,
"Unexpected doc element parent frame");
NS_ASSERTION(docParentFrame, "should have a parent frame");
if (docParentFrame) {
// Remove the old document element hieararchy
rv = state.mFrameManager->RemoveFrame(docParentFrame, nsnull,
docElementFrame);
if (NS_SUCCEEDED(rv)) {
// Create the new document element hierarchy
nsIFrame* newChild;
rv = ConstructDocElementFrame(state, rootContent,
docParentFrame, &newChild);
if (NS_SUCCEEDED(rv)) {
rv = state.mFrameManager->InsertFrames(docParentFrame, nsnull,
nsnull, newChild);
}
}
// Remove the old document element hieararchy
rv = state.mFrameManager->RemoveFrame(mDocElementContainingBlock,
nsnull, docElementFrame);
if (NS_FAILED(rv)) {
return rv;
}
}
// Create the new document element hierarchy
nsIFrame* newChild;
rv = ConstructDocElementFrame(state, rootContent,
mDocElementContainingBlock, &newChild);
// newChild could be null even if |rv| is success, thanks to XBL.
if (NS_SUCCEEDED(rv) && newChild) {
rv = state.mFrameManager->InsertFrames(mDocElementContainingBlock,
nsnull, nsnull, newChild);
}
}
}