Bug 417699, [@ nsXULTreeBuilder::SetTree], r+sr=sicking, a=mconnor

This commit is contained in:
Olli.Pettay@helsinki.fi 2008-02-18 14:52:19 -08:00
Родитель f972713d57
Коммит b1964ebca8
4 изменённых файлов: 14 добавлений и 10 удалений

Просмотреть файл

@ -2123,6 +2123,8 @@ nsGenericElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
if (HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)) {
document->ForgetLink(this);
}
document->ClearBoxObjectFor(this);
}
// Unset things in the reverse order from how we set them in BindToTree
@ -2889,6 +2891,7 @@ nsGenericElement::DestroyContent()
nsIDocument *document = GetOwnerDoc();
if (document) {
document->BindingManager()->ChangeDocumentFor(this, document, nsnull);
document->ClearBoxObjectFor(this);
}
PRUint32 i, count = mAttrsAndChildren.ChildCount();

Просмотреть файл

@ -1685,6 +1685,8 @@ nsXULContentBuilder::HasGeneratedContent(nsIRDFResource* aResource,
PRBool* aGenerated)
{
*aGenerated = PR_FALSE;
NS_ENSURE_TRUE(mRoot, NS_ERROR_NOT_INITIALIZED);
NS_ENSURE_STATE(mRootResult);
nsCOMPtr<nsIRDFResource> rootresource;
nsresult rv = mRootResult->GetResource(getter_AddRefs(rootresource));
@ -2037,9 +2039,7 @@ nsXULContentBuilder::CloseContainer(nsIContent* aElement)
nsresult
nsXULContentBuilder::RebuildAll()
{
NS_PRECONDITION(mRoot != nsnull, "not initialized");
if (! mRoot)
return NS_ERROR_NOT_INITIALIZED;
NS_ENSURE_TRUE(mRoot, NS_ERROR_NOT_INITIALIZED);
nsCOMPtr<nsIDocument> doc = mRoot->GetDocument();

Просмотреть файл

@ -310,7 +310,11 @@ NS_INTERFACE_MAP_END
NS_IMETHODIMP
nsXULTemplateBuilder::GetRoot(nsIDOMElement** aResult)
{
return CallQueryInterface(mRoot, aResult);
if (mRoot) {
return CallQueryInterface(mRoot, aResult);
}
*aResult = nsnull;
return NS_OK;
}
NS_IMETHODIMP
@ -407,7 +411,7 @@ nsXULTemplateBuilder::Refresh()
NS_IMETHODIMP
nsXULTemplateBuilder::Init(nsIContent* aElement)
{
NS_PRECONDITION(aElement, "null ptr");
NS_ENSURE_TRUE(aElement, NS_ERROR_NULL_POINTER);
mRoot = aElement;
nsCOMPtr<nsIDocument> doc = mRoot->GetDocument();

Просмотреть файл

@ -757,8 +757,6 @@ nsXULTreeBuilder::GetCellText(PRInt32 aRow, nsITreeColumn* aCol, nsAString& aRes
NS_IMETHODIMP
nsXULTreeBuilder::SetTree(nsITreeBoxObject* aTree)
{
NS_PRECONDITION(mRoot, "not initialized");
mBoxObject = aTree;
// If this is teardown time, then we're done.
@ -766,6 +764,7 @@ nsXULTreeBuilder::SetTree(nsITreeBoxObject* aTree)
Uninit(PR_FALSE);
return NS_OK;
}
NS_ENSURE_TRUE(mRoot, NS_ERROR_NOT_INITIALIZED);
// Is our root's principal trusted?
PRBool isTrusted = PR_FALSE;
@ -1339,9 +1338,7 @@ nsXULTreeBuilder::EnsureSortVariables()
nsresult
nsXULTreeBuilder::RebuildAll()
{
NS_PRECONDITION(mRoot != nsnull, "not initialized");
if (! mRoot)
return NS_ERROR_NOT_INITIALIZED;
NS_ENSURE_TRUE(mRoot, NS_ERROR_NOT_INITIALIZED);
nsCOMPtr<nsIDocument> doc = mRoot->GetDocument();