Bug 1317606. Get rid of LegacyIsCallerChromeOrNativeCode in barprop code. r=bkelly

This commit is contained in:
Boris Zbarsky 2016-11-15 12:46:32 -05:00
parent 784a52fd02
commit 192d20fb6e
3 changed files with 40 additions and 28 deletions

View File

@ -116,13 +116,13 @@ MenubarProp::~MenubarProp()
}
bool
MenubarProp::GetVisible(ErrorResult& aRv)
MenubarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv)
{
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_MENUBAR, aRv);
}
void
MenubarProp::SetVisible(bool aVisible, ErrorResult& aRv)
MenubarProp::SetVisible(bool aVisible, CallerType aCallerType, ErrorResult& aRv)
{
BarProp::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_MENUBAR, aRv);
}
@ -141,13 +141,13 @@ ToolbarProp::~ToolbarProp()
}
bool
ToolbarProp::GetVisible(ErrorResult& aRv)
ToolbarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv)
{
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_TOOLBAR, aRv);
}
void
ToolbarProp::SetVisible(bool aVisible, ErrorResult& aRv)
ToolbarProp::SetVisible(bool aVisible, CallerType aCallerType, ErrorResult& aRv)
{
BarProp::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_TOOLBAR,
aRv);
@ -167,14 +167,15 @@ LocationbarProp::~LocationbarProp()
}
bool
LocationbarProp::GetVisible(ErrorResult& aRv)
LocationbarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv)
{
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_LOCATIONBAR,
aRv);
}
void
LocationbarProp::SetVisible(bool aVisible, ErrorResult& aRv)
LocationbarProp::SetVisible(bool aVisible, CallerType aCallerType,
ErrorResult& aRv)
{
BarProp::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_LOCATIONBAR,
aRv);
@ -194,14 +195,15 @@ PersonalbarProp::~PersonalbarProp()
}
bool
PersonalbarProp::GetVisible(ErrorResult& aRv)
PersonalbarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv)
{
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR,
aRv);
}
void
PersonalbarProp::SetVisible(bool aVisible, ErrorResult& aRv)
PersonalbarProp::SetVisible(bool aVisible, CallerType aCallerType,
ErrorResult& aRv)
{
BarProp::SetVisibleByFlag(aVisible,
nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR,
@ -222,13 +224,14 @@ StatusbarProp::~StatusbarProp()
}
bool
StatusbarProp::GetVisible(ErrorResult& aRv)
StatusbarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv)
{
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_STATUSBAR, aRv);
}
void
StatusbarProp::SetVisible(bool aVisible, ErrorResult& aRv)
StatusbarProp::SetVisible(bool aVisible, CallerType aCallerType,
ErrorResult& aRv)
{
return BarProp::SetVisibleByFlag(aVisible,
nsIWebBrowserChrome::CHROME_STATUSBAR, aRv);
@ -248,7 +251,7 @@ ScrollbarsProp::~ScrollbarsProp()
}
bool
ScrollbarsProp::GetVisible(ErrorResult& aRv)
ScrollbarsProp::GetVisible(CallerType aCallerType, ErrorResult& aRv)
{
if (!mDOMWindow) {
return true;
@ -274,9 +277,10 @@ ScrollbarsProp::GetVisible(ErrorResult& aRv)
}
void
ScrollbarsProp::SetVisible(bool aVisible, ErrorResult& aRv)
ScrollbarsProp::SetVisible(bool aVisible, CallerType aCallerType,
ErrorResult& aRv)
{
if (!nsContentUtils::LegacyIsCallerChromeOrNativeCode()) {
if (aCallerType != CallerType::System) {
return;
}

View File

@ -17,6 +17,7 @@
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
#include "nsPIDOMWindow.h"
#include "mozilla/dom/BindingDeclarations.h"
class nsGlobalWindow;
class nsIWebBrowserChrome;
@ -42,8 +43,9 @@ public:
virtual JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
virtual bool GetVisible(ErrorResult& aRv) = 0;
virtual void SetVisible(bool aVisible, ErrorResult& aRv) = 0;
virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) = 0;
virtual void SetVisible(bool aVisible, CallerType aCallerType,
ErrorResult& aRv) = 0;
protected:
virtual ~BarProp();
@ -63,8 +65,9 @@ public:
explicit MenubarProp(nsGlobalWindow *aWindow);
virtual ~MenubarProp();
virtual bool GetVisible(ErrorResult& aRv) override;
virtual void SetVisible(bool aVisible, ErrorResult& aRv) override;
virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override;
virtual void SetVisible(bool aVisible, CallerType aCallerType,
ErrorResult& aRv) override;
};
// Script "toolbar" object
@ -74,8 +77,9 @@ public:
explicit ToolbarProp(nsGlobalWindow *aWindow);
virtual ~ToolbarProp();
virtual bool GetVisible(ErrorResult& aRv) override;
virtual void SetVisible(bool aVisible, ErrorResult& aRv) override;
virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override;
virtual void SetVisible(bool aVisible, CallerType aCallerType,
ErrorResult& aRv) override;
};
// Script "locationbar" object
@ -85,8 +89,9 @@ public:
explicit LocationbarProp(nsGlobalWindow *aWindow);
virtual ~LocationbarProp();
virtual bool GetVisible(ErrorResult& aRv) override;
virtual void SetVisible(bool aVisible, ErrorResult& aRv) override;
virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override;
virtual void SetVisible(bool aVisible, CallerType aCallerType,
ErrorResult& aRv) override;
};
// Script "personalbar" object
@ -96,8 +101,9 @@ public:
explicit PersonalbarProp(nsGlobalWindow *aWindow);
virtual ~PersonalbarProp();
virtual bool GetVisible(ErrorResult& aRv) override;
virtual void SetVisible(bool aVisible, ErrorResult& aRv) override;
virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override;
virtual void SetVisible(bool aVisible, CallerType aCallerType,
ErrorResult& aRv) override;
};
// Script "statusbar" object
@ -107,8 +113,9 @@ public:
explicit StatusbarProp(nsGlobalWindow *aWindow);
virtual ~StatusbarProp();
virtual bool GetVisible(ErrorResult& aRv) override;
virtual void SetVisible(bool aVisible, ErrorResult& aRv) override;
virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override;
virtual void SetVisible(bool aVisible, CallerType aCallerType,
ErrorResult& aRv) override;
};
// Script "scrollbars" object
@ -118,8 +125,9 @@ public:
explicit ScrollbarsProp(nsGlobalWindow *aWindow);
virtual ~ScrollbarsProp();
virtual bool GetVisible(ErrorResult& aRv) override;
virtual void SetVisible(bool aVisible, ErrorResult& aRv) override;
virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override;
virtual void SetVisible(bool aVisible, CallerType aCallerType,
ErrorResult& aRv) override;
};
} // namespace dom

View File

@ -6,6 +6,6 @@
interface BarProp
{
[Throws]
[Throws, NeedsCallerType]
attribute boolean visible;
};