Bug 1318467. Get rid of IsCallerChrome in barprop code. r=bkelly
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 18 Nov 2016 16:13:07 -0500
changeset 323491 26cf229b0fee1e44c2171324e1c5e2b8f349194a
parent 323490 491ce96f65477289e4891b14ff5da700d0677779
child 323492 f958c1dd30d0073fa48ae81ddde53eac379c4e20
push id30978
push usercbook@mozilla.com
push dateMon, 21 Nov 2016 14:44:46 +0000
treeherdermozilla-central@0534254e9a40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly
bugs1318467
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1318467. Get rid of IsCallerChrome in barprop code. r=bkelly
dom/base/BarProps.cpp
dom/base/BarProps.h
--- a/dom/base/BarProps.cpp
+++ b/dom/base/BarProps.cpp
@@ -61,22 +61,22 @@ BarProp::GetVisibleByFlag(uint32_t aChro
     return false;
   }
 
   return (chromeFlags & aChromeFlag);
 }
 
 void
 BarProp::SetVisibleByFlag(bool aVisible, uint32_t aChromeFlag,
-                          ErrorResult& aRv)
+                          CallerType aCallerType, ErrorResult& aRv)
 {
   nsCOMPtr<nsIWebBrowserChrome> browserChrome = GetBrowserChrome();
   NS_ENSURE_TRUE_VOID(browserChrome);
 
-  if (!nsContentUtils::IsCallerChrome()) {
+  if (aCallerType != CallerType::System) {
     return;
   }
 
   uint32_t chromeFlags;
 
   if (NS_FAILED(browserChrome->GetChromeFlags(&chromeFlags))) {
     aRv.Throw(NS_ERROR_FAILURE);
     return;
@@ -119,17 +119,18 @@ bool
 MenubarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv)
 {
   return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_MENUBAR, aRv);
 }
 
 void
 MenubarProp::SetVisible(bool aVisible, CallerType aCallerType, ErrorResult& aRv)
 {
-  BarProp::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_MENUBAR, aRv);
+  BarProp::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_MENUBAR,
+                            aCallerType, aRv);
 }
 
 //
 // ToolbarProp class implementation
 //
 
 ToolbarProp::ToolbarProp(nsGlobalWindow *aWindow)
   : BarProp(aWindow)
@@ -145,17 +146,17 @@ ToolbarProp::GetVisible(CallerType aCall
 {
   return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_TOOLBAR, aRv);
 }
 
 void
 ToolbarProp::SetVisible(bool aVisible, CallerType aCallerType, ErrorResult& aRv)
 {
   BarProp::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_TOOLBAR,
-                            aRv);
+                            aCallerType, aRv);
 }
 
 //
 // LocationbarProp class implementation
 //
 
 LocationbarProp::LocationbarProp(nsGlobalWindow *aWindow)
   : BarProp(aWindow)
@@ -173,17 +174,17 @@ LocationbarProp::GetVisible(CallerType a
                                    aRv);
 }
 
 void
 LocationbarProp::SetVisible(bool aVisible, CallerType aCallerType,
                             ErrorResult& aRv)
 {
   BarProp::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_LOCATIONBAR,
-                            aRv);
+                            aCallerType, aRv);
 }
 
 //
 // PersonalbarProp class implementation
 //
 
 PersonalbarProp::PersonalbarProp(nsGlobalWindow *aWindow)
   : BarProp(aWindow)
@@ -202,17 +203,17 @@ PersonalbarProp::GetVisible(CallerType a
 }
 
 void
 PersonalbarProp::SetVisible(bool aVisible, CallerType aCallerType,
                             ErrorResult& aRv)
 {
   BarProp::SetVisibleByFlag(aVisible,
                             nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR,
-                            aRv);
+                            aCallerType, aRv);
 }
 
 //
 // StatusbarProp class implementation
 //
 
 StatusbarProp::StatusbarProp(nsGlobalWindow *aWindow)
   : BarProp(aWindow)
@@ -229,17 +230,18 @@ StatusbarProp::GetVisible(CallerType aCa
   return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_STATUSBAR, aRv);
 }
 
 void
 StatusbarProp::SetVisible(bool aVisible, CallerType aCallerType,
                           ErrorResult& aRv)
 {
   return BarProp::SetVisibleByFlag(aVisible,
-                                   nsIWebBrowserChrome::CHROME_STATUSBAR, aRv);
+                                   nsIWebBrowserChrome::CHROME_STATUSBAR,
+                                   aCallerType, aRv);
 }
 
 //
 // ScrollbarsProp class implementation
 //
 
 ScrollbarsProp::ScrollbarsProp(nsGlobalWindow *aWindow)
 : BarProp(aWindow)
--- a/dom/base/BarProps.h
+++ b/dom/base/BarProps.h
@@ -46,17 +46,18 @@ public:
   virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) = 0;
   virtual void SetVisible(bool aVisible, CallerType aCallerType,
                           ErrorResult& aRv) = 0;
 
 protected:
   virtual ~BarProp();
 
   bool GetVisibleByFlag(uint32_t aChromeFlag, ErrorResult& aRv);
-  void SetVisibleByFlag(bool aVisible, uint32_t aChromeFlag, ErrorResult &aRv);
+  void SetVisibleByFlag(bool aVisible, uint32_t aChromeFlag,
+                        CallerType aCallerType, ErrorResult &aRv);
 
   already_AddRefed<nsIWebBrowserChrome> GetBrowserChrome();
 
   RefPtr<nsGlobalWindow> mDOMWindow;
 };
 
 // Script "menubar" object
 class MenubarProp final : public BarProp