Bug 1216945 - Uninitialised value use in nsXULWindow::SizeShellTo. r=bzbarsky.

This commit is contained in:
Julian Seward 2015-10-26 18:27:42 +01:00
parent 4b5bb1380b
commit 03a524fde7

View File

@ -1025,9 +1025,12 @@ void nsXULWindow::OnChromeLoaded()
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
docShellAsItem->GetTreeOwner(getter_AddRefs(treeOwner));
if (treeOwner) {
int32_t width, height;
cv->GetContentSize(&width, &height);
treeOwner->SizeShellTo(docShellAsItem, width, height);
// GetContentSize can fail, so initialise |width| and |height| to be
// on the safe side.
int32_t width = 0, height = 0;
if (NS_SUCCEEDED(cv->GetContentSize(&width, &height))) {
treeOwner->SizeShellTo(docShellAsItem, width, height);
}
}
}
}