Bug 152256, honor the pref to prevent sites from hiding the statusbar in the window.statusbar.visible=false case also. r=bzbarsky sr=jst

git-svn-id: svn://10.0.0.236/trunk@123564 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
caillon%returnzero.com 2002-06-19 04:09:57 +00:00
parent 3513f4811b
commit 438ada5443
2 changed files with 21 additions and 1 deletions

View File

@ -48,6 +48,9 @@
#include "nsIDOMWindowInternal.h"
#include "nsDOMClassInfo.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
//
// Basic (virtual) BarProp class implementation
//
@ -237,6 +240,23 @@ StatusbarPropImpl::GetVisible(PRBool *aVisible)
NS_IMETHODIMP
StatusbarPropImpl::SetVisible(PRBool aVisible)
{
if (!aVisible) {
// See if the user is forbidding sites from hiding the statusbar.
nsresult rv;
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIPrefBranch> prefBranch;
rv = prefs->GetBranch("dom.disable_window_open_feature.", getter_AddRefs(prefBranch));
if (NS_SUCCEEDED(rv)) {
PRBool forceEnable = PR_FALSE;
rv = prefBranch->GetBoolPref("status", &forceEnable);
if (NS_SUCCEEDED(rv) && forceEnable && !GlobalWindowImpl::IsCallerChrome()) {
return NS_OK;
}
}
}
}
return BarPropImpl::SetVisibleByFlag(aVisible,
nsIWebBrowserChrome::CHROME_STATUSBAR);
}

View File

@ -205,6 +205,7 @@ public:
GlobalWindowImpl();
static void ShutDown();
static PRBool IsCallerChrome();
protected:
// Object Management
@ -247,7 +248,6 @@ protected:
nsresult CheckSecurityWidthAndHeight(PRInt32* width, PRInt32* height);
nsresult CheckSecurityLeftAndTop(PRInt32* left, PRInt32* top);
static nsresult CheckSecurityIsChromeCaller(PRBool *isChrome);
static PRBool IsCallerChrome();
void MakeScriptDialogTitle(const nsAString &aInTitle, nsAString &aOutTitle);