Bug 588929, don't throw when getting/setting visibility of *bars, r=jst, sr=mrbkap, a=blocking

--HG--
extra : rebase_source : 20b9ed1b8336b531460e221c167c7ad2e96c0e0b
This commit is contained in:
Olli Pettay 2010-08-25 17:00:16 +03:00
parent 78bdd52f91
commit 4e972e2cd0
2 changed files with 25 additions and 10 deletions

View File

@ -84,10 +84,10 @@ nsBarProp::SetWebBrowserChrome(nsIWebBrowserChrome* aBrowserChrome)
NS_IMETHODIMP
nsBarProp::GetVisibleByFlag(PRBool *aVisible, PRUint32 aChromeFlag)
{
NS_ENSURE_TRUE(mBrowserChrome, NS_ERROR_FAILURE);
*aVisible = PR_FALSE;
NS_ENSURE_TRUE(mBrowserChrome, NS_OK);
PRUint32 chromeFlags;
*aVisible = PR_FALSE;
NS_ENSURE_SUCCESS(mBrowserChrome->GetChromeFlags(&chromeFlags),
NS_ERROR_FAILURE);
@ -100,7 +100,7 @@ nsBarProp::GetVisibleByFlag(PRBool *aVisible, PRUint32 aChromeFlag)
NS_IMETHODIMP
nsBarProp::SetVisibleByFlag(PRBool aVisible, PRUint32 aChromeFlag)
{
NS_ENSURE_TRUE(mBrowserChrome, NS_ERROR_FAILURE);
NS_ENSURE_TRUE(mBrowserChrome, NS_OK);
PRBool enabled = PR_FALSE;

View File

@ -2203,17 +2203,32 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell)
if (mScreen)
mScreen->SetDocShell(aDocShell);
// tell our member elements about the new browserwindow
nsCOMPtr<nsIWebBrowserChrome> browserChrome;
GetWebBrowserChrome(getter_AddRefs(browserChrome));
if (mMenubar) {
mMenubar->SetWebBrowserChrome(browserChrome);
}
if (mToolbar) {
mToolbar->SetWebBrowserChrome(browserChrome);
}
if (mLocationbar) {
mLocationbar->SetWebBrowserChrome(browserChrome);
}
if (mPersonalbar) {
mPersonalbar->SetWebBrowserChrome(browserChrome);
}
if (mStatusbar) {
mStatusbar->SetWebBrowserChrome(browserChrome);
}
if (mScrollbars) {
mScrollbars->SetWebBrowserChrome(browserChrome);
}
if (!mDocShell) {
MaybeForgiveSpamCount();
CleanUp(PR_FALSE);
} else {
// tell our member elements about the new browserwindow
if (mMenubar) {
nsCOMPtr<nsIWebBrowserChrome> browserChrome;
GetWebBrowserChrome(getter_AddRefs(browserChrome));
mMenubar->SetWebBrowserChrome(browserChrome);
}
// Get our enclosing chrome shell and retrieve its global window impl, so
// that we can do some forwarding to the chrome document.
nsCOMPtr<nsIDOMEventTarget> chromeEventHandler;