Bug 952486 - Use CheckPermissions instead of Func for several interfaces. r=bz
authorReuben Morais <reuben.morais@gmail.com>
Sun, 25 May 2014 15:31:11 -0300
changeset 192401 4136b65c1c4b1578631c18dfffff3cec2aa52b4e
parent 192400 8a66b707dd5a31cf85f76beaccf240ceb9a2b042
child 192402 3ebd3510cb7c7ca33ee95a4b1a941e9394e3ff70
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-esr52@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs952486
milestone32.0a1
Bug 952486 - Use CheckPermissions instead of Func for several interfaces. r=bz
content/base/public/nsContentUtils.h
content/base/src/nsContentUtils.cpp
dom/base/Navigator.cpp
dom/base/Navigator.h
dom/battery/BatteryManager.cpp
dom/battery/BatteryManager.h
dom/bluetooth/BluetoothManager.cpp
dom/bluetooth2/BluetoothManager.cpp
dom/permission/tests/mochitest.ini
dom/phonenumberutils/tests/test_phonenumberutils_basics.html
dom/power/PowerManager.cpp
dom/power/PowerManager.h
dom/tests/mochitest/general/test_interfaces.html
dom/webidl/BluetoothAdapter.webidl
dom/webidl/BluetoothAdapterEvent.webidl
dom/webidl/BluetoothAttributeEvent.webidl
dom/webidl/BluetoothDevice.webidl
dom/webidl/BluetoothDeviceEvent.webidl
dom/webidl/BluetoothDiscoveryStateChangedEvent.webidl
dom/webidl/BluetoothManager.webidl
dom/webidl/BluetoothStatusChangedEvent.webidl
dom/webidl/DownloadEvent.webidl
dom/webidl/Downloads.webidl
dom/webidl/MozNFC.webidl
dom/webidl/Navigator.webidl
dom/webidl/PermissionSettings.webidl
dom/webidl/PhoneNumberService.webidl
dom/webidl/PushManager.webidl
--- a/content/base/public/nsContentUtils.h
+++ b/content/base/public/nsContentUtils.h
@@ -1830,21 +1830,16 @@ public:
    * still want chrome to be visible or accessible while content is
    * fullscreen, like on Windows 8 in Metro mode.
    *
    * Note that if the fullscreen API is content only, chrome can still go
    * fullscreen by setting the "fullScreen" attribute on its XUL window.
    */
   static bool IsFullscreenApiContentOnly();
 
-  /**
-   * Returns true if the idle observers API is enabled.
-   */
-  static bool IsIdleObserverAPIEnabled() { return sIsIdleObserverAPIEnabled; }
-
   /*
    * Returns true if the performance timing APIs are enabled.
    */
   static bool IsPerformanceTimingEnabled()
   {
     return sIsPerformanceTimingEnabled;
   }
   
@@ -2223,17 +2218,16 @@ private:
   static nsIInterfaceRequestor* sSameOriginChecker;
 
   static bool sIsHandlingKeyBoardEvent;
   static bool sAllowXULXBL_for_file;
   static bool sIsFullScreenApiEnabled;
   static bool sTrustedFullScreenOnly;
   static bool sFullscreenApiIsContentOnly;
   static uint32_t sHandlingInputTimeout;
-  static bool sIsIdleObserverAPIEnabled;
   static bool sIsPerformanceTimingEnabled;
   static bool sIsResourceTimingEnabled;
 
   static nsHtml5StringParser* sHTMLFragmentParser;
   static nsIParser* sXMLFragmentParser;
   static nsIFragmentContentSink* sXMLFragmentSink;
 
   /**
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -229,17 +229,16 @@ nsString* nsContentUtils::sMetaText = nu
 nsString* nsContentUtils::sOSText = nullptr;
 nsString* nsContentUtils::sAltText = nullptr;
 nsString* nsContentUtils::sModifierSeparator = nullptr;
 
 bool nsContentUtils::sInitialized = false;
 bool nsContentUtils::sIsFullScreenApiEnabled = false;
 bool nsContentUtils::sTrustedFullScreenOnly = true;
 bool nsContentUtils::sFullscreenApiIsContentOnly = false;
-bool nsContentUtils::sIsIdleObserverAPIEnabled = false;
 bool nsContentUtils::sIsPerformanceTimingEnabled = false;
 bool nsContentUtils::sIsResourceTimingEnabled = false;
 
 uint32_t nsContentUtils::sHandlingInputTimeout = 1000;
 
 nsHtml5StringParser* nsContentUtils::sHTMLFragmentParser = nullptr;
 nsIParser* nsContentUtils::sXMLFragmentParser = nullptr;
 nsIFragmentContentSink* nsContentUtils::sXMLFragmentSink = nullptr;
@@ -429,18 +428,16 @@ nsContentUtils::Init()
   // before the profile loads, so users' changes to this pref in about:config
   // won't have any effect on behaviour. We don't really want users messing
   // with this pref, as it affects the security model of the fullscreen API.
   sFullscreenApiIsContentOnly = Preferences::GetBool("full-screen-api.content-only", false);
 
   Preferences::AddBoolVarCache(&sTrustedFullScreenOnly,
                                "full-screen-api.allow-trusted-requests-only");
 
-  sIsIdleObserverAPIEnabled = Preferences::GetBool("dom.idle-observers-api.enabled", true);
-
   Preferences::AddBoolVarCache(&sIsPerformanceTimingEnabled,
                                "dom.enable_performance", true);
 
   Preferences::AddBoolVarCache(&sIsResourceTimingEnabled,
                                "dom.enable_resource_timing", true);
 
   Preferences::AddUintVarCache(&sHandlingInputTimeout,
                                "dom.event.handling-user-input-time-limit",
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -656,22 +656,16 @@ Navigator::JavaEnabled(ErrorResult& aRv)
 void
 Navigator::RefreshMIMEArray()
 {
   if (mMimeTypes) {
     mMimeTypes->Refresh();
   }
 }
 
-bool
-Navigator::HasDesktopNotificationSupport()
-{
-  return Preferences::GetBool("notification.feature.enabled", false);
-}
-
 namespace {
 
 class VibrateWindowListener : public nsIDOMEventListener
 {
 public:
   VibrateWindowListener(nsIDOMWindow* aWindow, nsIDocument* aDocument)
   {
     mWindow = do_GetWeakReference(aWindow);
@@ -2100,51 +2094,16 @@ Navigator::GetOwnPropertyNames(JSContext
 JSObject*
 Navigator::WrapObject(JSContext* cx)
 {
   return NavigatorBinding::Wrap(cx, this);
 }
 
 /* static */
 bool
-Navigator::HasBatterySupport(JSContext* /* unused*/, JSObject* /*unused */)
-{
-  return battery::BatteryManager::HasSupport();
-}
-
-/* static */
-bool
-Navigator::HasPowerSupport(JSContext* /* unused */, JSObject* aGlobal)
-{
-  nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
-  return win && PowerManager::CheckPermission(win);
-}
-
-/* static */
-bool
-Navigator::HasPhoneNumberSupport(JSContext* /* unused */, JSObject* aGlobal)
-{
-  nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
-  return CheckPermission(win, "phonenumberservice");
-}
-
-/* static */
-bool
-Navigator::HasIdleSupport(JSContext*  /* unused */, JSObject* aGlobal)
-{
-  if (!nsContentUtils::IsIdleObserverAPIEnabled()) {
-    return false;
-  }
-
-  nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
-  return CheckPermission(win, "idle");
-}
-
-/* static */
-bool
 Navigator::HasWakeLockSupport(JSContext* /* unused*/, JSObject* /*unused */)
 {
   nsCOMPtr<nsIPowerManagerService> pmService =
     do_GetService(POWERMANAGERSERVICE_CONTRACTID);
   // No service means no wake lock support
   return !!pmService;
 }
 
@@ -2172,98 +2131,22 @@ Navigator::HasMobileMessageSupport(JSCon
     return false;
   }
 
   return true;
 }
 
 /* static */
 bool
-Navigator::HasTelephonySupport(JSContext* cx, JSObject* aGlobal)
-{
-  JS::Rooted<JSObject*> global(cx, aGlobal);
-
-  // First of all, the general pref has to be turned on.
-  bool enabled = false;
-  Preferences::GetBool("dom.telephony.enabled", &enabled);
-  if (!enabled) {
-    return false;
-  }
-
-  nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(global);
-  return win && CheckPermission(win, "telephony");
-}
-
-/* static */
-bool
 Navigator::HasCameraSupport(JSContext* /* unused */, JSObject* aGlobal)
 {
   nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
   return win && nsDOMCameraManager::CheckPermission(win);
 }
 
-#ifdef MOZ_B2G_RIL
-/* static */
-bool
-Navigator::HasMobileConnectionSupport(JSContext* /* unused */,
-                                      JSObject* aGlobal)
-{
-  // First of all, the general pref has to be turned on.
-  bool enabled = false;
-  Preferences::GetBool("dom.mobileconnection.enabled", &enabled);
-  NS_ENSURE_TRUE(enabled, false);
-
-  nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
-  return win && (CheckPermission(win, "mobileconnection") ||
-                 CheckPermission(win, "mobilenetwork"));
-}
-
-/* static */
-bool
-Navigator::HasCellBroadcastSupport(JSContext* /* unused */,
-                                   JSObject* aGlobal)
-{
-  // First of all, the general pref has to be turned on.
-  bool enabled = false;
-  Preferences::GetBool("dom.cellbroadcast.enabled", &enabled);
-  NS_ENSURE_TRUE(enabled, false);
-
-  nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
-  return win && CheckPermission(win, "cellbroadcast");
-}
-
-/* static */
-bool
-Navigator::HasVoicemailSupport(JSContext* /* unused */,
-                               JSObject* aGlobal)
-{
-  // First of all, the general pref has to be turned on.
-  bool enabled = false;
-  Preferences::GetBool("dom.voicemail.enabled", &enabled);
-  NS_ENSURE_TRUE(enabled, false);
-
-  nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
-  return win && CheckPermission(win, "voicemail");
-}
-
-/* static */
-bool
-Navigator::HasIccManagerSupport(JSContext* /* unused */,
-                                JSObject* aGlobal)
-{
-  // First of all, the general pref has to be turned on.
-  bool enabled = false;
-  Preferences::GetBool("dom.icc.enabled", &enabled);
-  NS_ENSURE_TRUE(enabled, false);
-
-  nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
-  return win && CheckPermission(win, "mobileconnection");
-}
-#endif // MOZ_B2G_RIL
-
 /* static */
 bool
 Navigator::HasWifiManagerSupport(JSContext* /* unused */,
                                  JSObject* aGlobal)
 {
   // On XBL scope, the global object is NOT |window|. So we have
   // to use nsContentUtils::GetObjectPrincipal to get the principal
   // and test directly with permission manager.
@@ -2274,67 +2157,31 @@ Navigator::HasWifiManagerSupport(JSConte
     services::GetPermissionManager();
   NS_ENSURE_TRUE(permMgr, false);
 
   uint32_t permission = nsIPermissionManager::DENY_ACTION;
   permMgr->TestPermissionFromPrincipal(principal, "wifi-manage", &permission);
   return nsIPermissionManager::ALLOW_ACTION == permission;
 }
 
-#ifdef MOZ_B2G_BT
-/* static */
-bool
-Navigator::HasBluetoothSupport(JSContext* /* unused */, JSObject* aGlobal)
-{
-  nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
-  return win && bluetooth::BluetoothManager::CheckPermission(win);
-}
-#endif // MOZ_B2G_BT
-
-#ifdef MOZ_B2G_FM
-/* static */
-bool
-Navigator::HasFMRadioSupport(JSContext* /* unused */, JSObject* aGlobal)
-{
-  nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
-  return win && CheckPermission(win, "fmradio");
-}
-#endif // MOZ_B2G_FM
-
 #ifdef MOZ_NFC
 /* static */
 bool
 Navigator::HasNFCSupport(JSContext* /* unused */, JSObject* aGlobal)
 {
   // Do not support NFC if NFC content helper does not exist.
   nsCOMPtr<nsISupports> contentHelper = do_GetService("@mozilla.org/nfc/content-helper;1");
   if (!contentHelper) {
     return false;
   }
 
   nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
   return win && (CheckPermission(win, "nfc-read") ||
                  CheckPermission(win, "nfc-write"));
 }
-
-/* static */
-bool
-Navigator::HasNFCPeerSupport(JSContext* /* unused */, JSObject* aGlobal)
-{
-  nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
-  return win && CheckPermission(win, "nfc-write");
-}
-
-/* static */
-bool
-Navigator::HasNFCManagerSupport(JSContext* /* unused */, JSObject* aGlobal)
-{
-  nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
-  return win && CheckPermission(win, "nfc-manager");
-}
 #endif // MOZ_NFC
 
 #ifdef MOZ_TIME_MANAGER
 /* static */
 bool
 Navigator::HasTimeSupport(JSContext* /* unused */, JSObject* aGlobal)
 {
   nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
@@ -2351,26 +2198,16 @@ Navigator::HasUserMediaSupport(JSContext
   // Make enabling peerconnection enable getUserMedia() as well
   return Preferences::GetBool("media.navigator.enabled", false) ||
          Preferences::GetBool("media.peerconnection.enabled", false);
 }
 #endif // MOZ_MEDIA_NAVIGATOR
 
 /* static */
 bool
-Navigator::HasPushNotificationsSupport(JSContext* /* unused */,
-                                       JSObject* aGlobal)
-{
-  nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
-  return Preferences::GetBool("services.push.enabled", false) &&
-         win && CheckPermission(win, "push");
-}
-
-/* static */
-bool
 Navigator::HasInputMethodSupport(JSContext* /* unused */,
                                  JSObject* aGlobal)
 {
   nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
   if (!win || !Preferences::GetBool("dom.mozInputMethod.enabled", false)) {
     return false;
   }
 
@@ -2468,35 +2305,16 @@ Navigator::HasDataStoreSupport(JSContext
     return false;
   }
 
   return HasDataStoreSupport(doc->NodePrincipal());
 }
 
 /* static */
 bool
-Navigator::HasDownloadsSupport(JSContext* aCx, JSObject* aGlobal)
-{
-  nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
-
-  return win &&
-         CheckPermission(win, "downloads")  &&
-         Preferences::GetBool("dom.mozDownloads.enabled");
-}
-
-/* static */
-bool
-Navigator::HasPermissionSettingsSupport(JSContext* /* unused */, JSObject* aGlobal)
-{
-  nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
-  return CheckPermission(win, "permissions");
-}
-
-/* static */
-bool
 Navigator::HasNetworkStatsSupport(JSContext* /* unused */, JSObject* aGlobal)
 {
   nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
   return CheckPermission(win, "networkstats-manage");
 }
 
 /* static */
 bool
--- a/dom/base/Navigator.h
+++ b/dom/base/Navigator.h
@@ -127,18 +127,16 @@ public:
   void Invalidate();
   nsPIDOMWindow *GetWindow() const
   {
     return mWindow;
   }
 
   void RefreshMIMEArray();
 
-  static bool HasDesktopNotificationSupport();
-
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
 
   /**
    * For use during document.write where our inner window changes.
    */
   void SetWindow(nsPIDOMWindow *aInnerWindow);
 
   /**
@@ -261,76 +259,40 @@ public:
                     JS::Handle<jsid> aId,
                     JS::MutableHandle<JSPropertyDescriptor> aDesc);
   void GetOwnPropertyNames(JSContext* aCx, nsTArray<nsString>& aNames,
                            ErrorResult& aRv);
   void GetLanguages(nsTArray<nsString>& aLanguages);
   void GetAcceptLanguages(nsTArray<nsString>& aLanguages);
 
   // WebIDL helper methods
-  static bool HasBatterySupport(JSContext* /* unused*/, JSObject* /*unused */);
-  static bool HasPowerSupport(JSContext* /* unused */, JSObject* aGlobal);
-  static bool HasPhoneNumberSupport(JSContext* /* unused */, JSObject* aGlobal);
-  static bool HasIdleSupport(JSContext* /* unused */, JSObject* aGlobal);
   static bool HasWakeLockSupport(JSContext* /* unused*/, JSObject* /*unused */);
-  static bool HasDesktopNotificationSupport(JSContext* /* unused*/,
-                                            JSObject* /*unused */)
-  {
-    return HasDesktopNotificationSupport();
-  }
   static bool HasMobileMessageSupport(JSContext* /* unused */,
                                       JSObject* aGlobal);
-  static bool HasTelephonySupport(JSContext* cx,
-                                  JSObject* aGlobal);
   static bool HasCameraSupport(JSContext* /* unused */,
                                JSObject* aGlobal);
-#ifdef MOZ_B2G_RIL
-  static bool HasMobileConnectionSupport(JSContext* /* unused */,
-                                         JSObject* aGlobal);
-  static bool HasCellBroadcastSupport(JSContext* /* unused */,
-                                      JSObject* aGlobal);
-  static bool HasVoicemailSupport(JSContext* /* unused */,
-                                  JSObject* aGlobal);
-  static bool HasIccManagerSupport(JSContext* /* unused */,
-                                   JSObject* aGlobal);
-#endif // MOZ_B2G_RIL
   static bool HasWifiManagerSupport(JSContext* /* unused */,
                                   JSObject* aGlobal);
-#ifdef MOZ_B2G_BT
-  static bool HasBluetoothSupport(JSContext* /* unused */, JSObject* aGlobal);
-#endif // MOZ_B2G_BT
-#ifdef MOZ_B2G_FM
-  static bool HasFMRadioSupport(JSContext* /* unused */, JSObject* aGlobal);
-#endif // MOZ_B2G_FM
 #ifdef MOZ_NFC
   static bool HasNFCSupport(JSContext* /* unused */, JSObject* aGlobal);
-  static bool HasNFCPeerSupport(JSContext* /* unused */, JSObject* aGlobal);
-  static bool HasNFCManagerSupport(JSContext* /* unused */, JSObject* aGlobal);
 #endif // MOZ_NFC
 #ifdef MOZ_TIME_MANAGER
   static bool HasTimeSupport(JSContext* /* unused */, JSObject* aGlobal);
 #endif // MOZ_TIME_MANAGER
 #ifdef MOZ_MEDIA_NAVIGATOR
   static bool HasUserMediaSupport(JSContext* /* unused */,
                                   JSObject* /* unused */);
 #endif // MOZ_MEDIA_NAVIGATOR
 
-  static bool HasPushNotificationsSupport(JSContext* /* unused */,
-                                          JSObject* aGlobal);
-
   static bool HasInputMethodSupport(JSContext* /* unused */, JSObject* aGlobal);
 
   static bool HasDataStoreSupport(nsIPrincipal* aPrincipal);
 
   static bool HasDataStoreSupport(JSContext* cx, JSObject* aGlobal);
 
-  static bool HasDownloadsSupport(JSContext* aCx, JSObject* aGlobal);
-
-  static bool HasPermissionSettingsSupport(JSContext* aCx, JSObject* aGlobal);
-
   static bool HasNetworkStatsSupport(JSContext* aCx, JSObject* aGlobal);
 
   static bool HasFeatureDetectionSupport(JSContext* aCx, JSObject* aGlobal);
 
   nsPIDOMWindow* GetParentObject() const
   {
     return GetWindow();
   }
--- a/dom/battery/BatteryManager.cpp
+++ b/dom/battery/BatteryManager.cpp
@@ -3,17 +3,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <limits>
 #include "BatteryManager.h"
 #include "Constants.h"
 #include "mozilla/DOMEventTargetHelper.h"
 #include "mozilla/Hal.h"
-#include "mozilla/Preferences.h"
 #include "mozilla/dom/BatteryManagerBinding.h"
 #include "nsIDOMClassInfo.h"
 
 /**
  * We have to use macros here because our leak analysis tool things we are
  * leaking strings when we have |static const nsString|. Sad :(
  */
 #define LEVELCHANGE_EVENT_NAME           NS_LITERAL_STRING("levelchange")
@@ -128,17 +127,11 @@ BatteryManager::Notify(const hal::Batter
                                      : DISCHARGINGTIMECHANGE_EVENT_NAME);
     }
   } else if (previousRemainingTime != mRemainingTime) {
     DispatchTrustedEvent(mCharging ? CHARGINGTIMECHANGE_EVENT_NAME
                                    : DISCHARGINGTIMECHANGE_EVENT_NAME);
   }
 }
 
-/* static */ bool
-BatteryManager::HasSupport()
-{
-  return Preferences::GetBool("dom.battery.enabled", true);
-}
-
 } // namespace battery
 } // namespace dom
 } // namespace mozilla
--- a/dom/battery/BatteryManager.h
+++ b/dom/battery/BatteryManager.h
@@ -31,22 +31,16 @@ public:
 
   void Init();
   void Shutdown();
 
   // For IObserver.
   void Notify(const hal::BatteryInformation& aBatteryInfo);
 
   /**
-   * Returns whether the battery api is supported (ie. not disabled by the user)
-   * @return whether the battery api is supported.
-   */
-  static bool HasSupport();
-
-  /**
    * WebIDL Interface
    */
 
   nsPIDOMWindow* GetParentObject() const
   {
      return GetOwner();
   }
 
--- a/dom/bluetooth/BluetoothManager.cpp
+++ b/dom/bluetooth/BluetoothManager.cpp
@@ -189,34 +189,16 @@ BluetoothManager::Create(nsPIDOMWindow* 
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aWindow);
 
   nsRefPtr<BluetoothManager> manager = new BluetoothManager(aWindow);
   return manager.forget();
 }
 
-// static
-bool
-BluetoothManager::CheckPermission(nsPIDOMWindow* aWindow)
-{
-  NS_ASSERTION(aWindow, "Null pointer!");
-
-  nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
-  NS_ENSURE_TRUE(permMgr, false);
-
-  uint32_t permission;
-  nsresult rv =
-    permMgr->TestPermissionFromWindow(aWindow, "bluetooth",
-                                      &permission);
-  NS_ENSURE_SUCCESS(rv, false);
-
-  return permission == nsIPermissionManager::ALLOW_ACTION;
-}
-
 void
 BluetoothManager::Notify(const BluetoothSignal& aData)
 {
   BT_LOGD("[M] %s: %s", __FUNCTION__, NS_ConvertUTF16toUTF8(aData.name()).get());
 
   if (aData.name().EqualsLiteral("AdapterAdded")) {
     DispatchTrustedEvent(NS_LITERAL_STRING("adapteradded"));
   } else if (aData.name().EqualsLiteral("Enabled")) {
--- a/dom/bluetooth2/BluetoothManager.cpp
+++ b/dom/bluetooth2/BluetoothManager.cpp
@@ -189,34 +189,16 @@ BluetoothManager::Create(nsPIDOMWindow* 
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aWindow);
 
   nsRefPtr<BluetoothManager> manager = new BluetoothManager(aWindow);
   return manager.forget();
 }
 
-// static
-bool
-BluetoothManager::CheckPermission(nsPIDOMWindow* aWindow)
-{
-  NS_ASSERTION(aWindow, "Null pointer!");
-
-  nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
-  NS_ENSURE_TRUE(permMgr, false);
-
-  uint32_t permission;
-  nsresult rv =
-    permMgr->TestPermissionFromWindow(aWindow, "bluetooth",
-                                      &permission);
-  NS_ENSURE_SUCCESS(rv, false);
-
-  return permission == nsIPermissionManager::ALLOW_ACTION;
-}
-
 void
 BluetoothManager::Notify(const BluetoothSignal& aData)
 {
   BT_LOGD("[M] %s: %s", __FUNCTION__, NS_ConvertUTF16toUTF8(aData.name()).get());
 
   if (aData.name().EqualsLiteral("AdapterAdded")) {
     DispatchTrustedEvent(NS_LITERAL_STRING("adapteradded"));
   } else if (aData.name().EqualsLiteral("Enabled")) {
--- a/dom/permission/tests/mochitest.ini
+++ b/dom/permission/tests/mochitest.ini
@@ -19,9 +19,9 @@ skip-if = buildapp == 'b2g' || toolkit =
 [test_webapps-manage.html]
 [test_camera.html]
 disabled = disabled until bug 859593 is fixed
 [test_keyboard.html]
 skip-if = toolkit == 'android'
 [test_input-manage.html]
 skip-if = toolkit == 'android'
 [test_wifi-manage.html]
-skip-if = (buildapp != 'b2g') || (buildapp == 'b2g' && toolkit != 'gonk') #b2g-desktop(Bug 931116, b2g desktop specific, initial triage)
+skip-if = (buildapp != 'b2g') || (buildapp == 'b2g' && toolkit != 'gonk') #b2g-desktop(Bug 931116, b2g desktop specific, initial triage)
\ No newline at end of file
--- a/dom/phonenumberutils/tests/test_phonenumberutils_basics.html
+++ b/dom/phonenumberutils/tests/test_phonenumberutils_basics.html
@@ -17,16 +17,13 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 "use strict";
 
 var mozPhoneNumberService = window.navigator.mozPhoneNumberService;
-if (mozPhoneNumberService) {
-  is(mozPhoneNumberService.fuzzyMatch, undefined, "Fuzzy Match should not be accesible");
-  is(mozPhoneNumberService.normalize, undefined, "Normalize should not be accessible");
-}
+ise(mozPhoneNumberService, undefined, "mozPhoneNumberService should not be accessible");
 </script>
 </pre>
 </body>
 </html>
--- a/dom/power/PowerManager.cpp
+++ b/dom/power/PowerManager.cpp
@@ -177,29 +177,16 @@ PowerManager::CpuSleepAllowed()
 }
 
 void
 PowerManager::SetCpuSleepAllowed(bool aAllowed)
 {
   hal::SetCpuSleepAllowed(aAllowed);
 }
 
-bool
-PowerManager::CheckPermission(nsPIDOMWindow* aWindow)
-{
-  nsCOMPtr<nsIPermissionManager> permMgr =
-    services::GetPermissionManager();
-  NS_ENSURE_TRUE(permMgr, false);
-
-  uint32_t permission = nsIPermissionManager::DENY_ACTION;
-  permMgr->TestPermissionFromWindow(aWindow, "power", &permission);
-
-  return permission == nsIPermissionManager::ALLOW_ACTION;
-}
-
 already_AddRefed<PowerManager>
 PowerManager::CreateInstance(nsPIDOMWindow* aWindow)
 {
   nsRefPtr<PowerManager> powerManager = new PowerManager();
   if (NS_FAILED(powerManager->Init(aWindow))) {
     powerManager = nullptr;
   }
 
--- a/dom/power/PowerManager.h
+++ b/dom/power/PowerManager.h
@@ -31,18 +31,16 @@ public:
   PowerManager()
   {
     SetIsDOMBinding();
   }
 
   nsresult Init(nsIDOMWindow *aWindow);
   nsresult Shutdown();
 
-  static bool CheckPermission(nsPIDOMWindow*);
-
   static already_AddRefed<PowerManager> CreateInstance(nsPIDOMWindow*);
 
   // WebIDL
   nsIDOMWindow* GetParentObject() const
   {
     return mWindow;
   }
   virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
--- a/dom/tests/mochitest/general/test_interfaces.html
+++ b/dom/tests/mochitest/general/test_interfaces.html
@@ -772,17 +772,17 @@ var interfaceNamesInGlobalScope =
     "PerformanceResourceTiming",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "PerformanceTiming",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "PeriodicWave",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "PermissionSettings", b2g: true, permission: "permissions"},
 // IMPORTANT: Do not change this list without review from a DOM peer!
-    "PhoneNumberService",
+    {name: "PhoneNumberService", permission: "phonenumberservice"},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "Plugin",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "PluginArray",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "PointerEvent", pref: "dom.w3c_pointer_events.enabled"},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "PopStateEvent",
--- a/dom/webidl/BluetoothAdapter.webidl
+++ b/dom/webidl/BluetoothAdapter.webidl
@@ -27,17 +27,17 @@ dictionary MediaPlayStatus
   // current track length (ms)
   long long   duration = -1;
   // playing time (ms)
   long long   position = -1;
   // one of 'STOPPED'/'PLAYING'/'PAUSED'/'FWD_SEEK'/'REV_SEEK'/'ERROR'
   DOMString   playStatus = "";
 };
 
-[Func="Navigator::HasBluetoothSupport"]
+[CheckPermissions="bluetooth"]
 interface BluetoothAdapter : EventTarget {
   readonly attribute DOMString      address;
   readonly attribute unsigned long  class;
   readonly attribute boolean        discovering;
   readonly attribute DOMString      name;
   readonly attribute boolean        discoverable;
   readonly attribute unsigned long  discoverableTimeout; // in seconds
 
--- a/dom/webidl/BluetoothAdapterEvent.webidl
+++ b/dom/webidl/BluetoothAdapterEvent.webidl
@@ -1,15 +1,15 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-[Func="Navigator::HasBluetoothSupport",
+[CheckPermissions="bluetooth",
  Constructor(DOMString type, optional BluetoothAdapterEventInit eventInitDict)]
 interface BluetoothAdapterEvent : Event
 {
   readonly attribute BluetoothAdapter? adapter;
   readonly attribute DOMString?        address;
 };
 
 dictionary BluetoothAdapterEventInit : EventInit
--- a/dom/webidl/BluetoothAttributeEvent.webidl
+++ b/dom/webidl/BluetoothAttributeEvent.webidl
@@ -1,15 +1,15 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-[Func="Navigator::HasBluetoothSupport",
+[CheckPermissions="bluetooth",
  Constructor(DOMString type,
              optional BluetoothAttributeEventInit eventInitDict)]
 interface BluetoothAttributeEvent : Event
 {
   readonly attribute unsigned short   attr;
   readonly attribute any              value;
   // We don't support sequences in unions yet (Bug 767924)
   /* readonly attribute (BluetoothAdapter or BluetoothAdapterState or
--- a/dom/webidl/BluetoothDevice.webidl
+++ b/dom/webidl/BluetoothDevice.webidl
@@ -1,15 +1,15 @@
 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-[Func="Navigator::HasBluetoothSupport"]
+[CheckPermissions="bluetooth"]
 interface BluetoothDevice : EventTarget {
   readonly attribute DOMString      address;
   readonly attribute DOMString      name;
   readonly attribute DOMString      icon;
   readonly attribute boolean        connected;
   readonly attribute boolean        paired;
   readonly attribute unsigned long  class;
 
--- a/dom/webidl/BluetoothDeviceEvent.webidl
+++ b/dom/webidl/BluetoothDeviceEvent.webidl
@@ -1,16 +1,16 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 [Constructor(DOMString type, optional BluetoothDeviceEventInit eventInitDict),
- Func="Navigator::HasBluetoothSupport"]
+ CheckPermissions="bluetooth"]
 interface BluetoothDeviceEvent : Event
 {
   readonly attribute BluetoothDevice? device;
 };
 
 dictionary BluetoothDeviceEventInit : EventInit
 {
   BluetoothDevice? device = null;
--- a/dom/webidl/BluetoothDiscoveryStateChangedEvent.webidl
+++ b/dom/webidl/BluetoothDiscoveryStateChangedEvent.webidl
@@ -1,17 +1,17 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 [Constructor(DOMString type,
              optional BluetoothDiscoveryStateChangedEventInit eventInitDict),
- Func="Navigator::HasBluetoothSupport"]
+ CheckPermissions="bluetooth"]
 interface BluetoothDiscoveryStateChangedEvent : Event
 {
     readonly attribute boolean discovering;
 };
 
 dictionary BluetoothDiscoveryStateChangedEventInit : EventInit
 {
     boolean discovering = false;
--- a/dom/webidl/BluetoothManager.webidl
+++ b/dom/webidl/BluetoothManager.webidl
@@ -1,14 +1,14 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-[Func="Navigator::HasBluetoothSupport"]
+[CheckPermissions="bluetooth"]
 interface BluetoothManager : EventTarget {
   [Throws]
   readonly attribute boolean      enabled;
 
            attribute EventHandler onenabled;
            attribute EventHandler ondisabled;
            attribute EventHandler onadapteradded;
 
--- a/dom/webidl/BluetoothStatusChangedEvent.webidl
+++ b/dom/webidl/BluetoothStatusChangedEvent.webidl
@@ -1,17 +1,17 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 [Constructor(DOMString type,
              optional BluetoothStatusChangedEventInit eventInitDict),
- Func="Navigator::HasBluetoothSupport"]
+ CheckPermissions="bluetooth"]
 interface BluetoothStatusChangedEvent : Event
 {
   readonly attribute DOMString address;
   readonly attribute boolean status;
 };
 
 dictionary BluetoothStatusChangedEventInit : EventInit
 {
--- a/dom/webidl/DownloadEvent.webidl
+++ b/dom/webidl/DownloadEvent.webidl
@@ -1,16 +1,17 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 [Constructor(DOMString type, optional DownloadEventInit eventInitDict),
- Func="Navigator::HasDownloadsSupport"]
+ Pref="dom.mozDownloads.enabled",
+ CheckPermissions="downloads"]
 interface DownloadEvent : Event
 {
   readonly attribute DOMDownload? download;
 };
 
 dictionary DownloadEventInit : EventInit
 {
   DOMDownload? download = null;
--- a/dom/webidl/Downloads.webidl
+++ b/dom/webidl/Downloads.webidl
@@ -14,18 +14,18 @@ enum DownloadState {
   "downloading",
   "stopped",
   "succeeded",
   "finalized"
 };
 
 //
 // XXXTODO: When we have a generic way to do feature detection in marketplace
-//          we will *STOP* using the pref and use the function like DOMDownload
-//          and DownloadEvent.
+//          we will *STOP* using the pref and use CheckPermissions like 
+//          DOMDownload and DownloadEvent.
 //
 [NoInterfaceObject,
  NavigatorProperty="mozDownloadManager",
  JSImplementation="@mozilla.org/downloads/manager;1",
  Pref="dom.mozDownloads.enabled"]
 interface DOMDownloadManager : EventTarget {
   // This promise returns an array of downloads with all the current
   // download objects.
@@ -38,17 +38,18 @@ interface DOMDownloadManager : EventTarg
   // Removes all the completed downloads from the set.
   Promise clearAllDone();
 
   // Fires when a new download starts.
   attribute EventHandler ondownloadstart;
 };
 
 [JSImplementation="@mozilla.org/downloads/download;1",
- Func="Navigator::HasDownloadsSupport"]
+ Pref="dom.mozDownloads.enabled",
+ CheckPermissions="downloads"]
 interface DOMDownload : EventTarget {
   // The full size of the resource.
   readonly attribute long long totalBytes;
 
   // The number of bytes that we have currently downloaded.
   readonly attribute long long currentBytes;
 
   // The url of the resource.
--- a/dom/webidl/MozNFC.webidl
+++ b/dom/webidl/MozNFC.webidl
@@ -1,16 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
  /* Copyright © 2013 Deutsche Telekom, Inc. */
 
 [NoInterfaceObject,
- Func="Navigator::HasNFCManagerSupport"]
+ CheckPermissions="nfc-manager"]
 interface MozNFCManager {
    /**
     * API to check if the given application's manifest
     * URL is registered with the Chrome Process or not.
     *
     * Returns success if given manifestUrl is registered for 'onpeerready',
     * otherwise error
     */
@@ -44,19 +44,19 @@ interface MozNFCManager {
 
 [JSImplementation="@mozilla.org/navigatorNfc;1",
  NavigatorProperty="mozNfc",
  Func="Navigator::HasNFCSupport"]
 interface MozNFC : EventTarget {
    MozNFCTag getNFCTag(DOMString sessionId);
    MozNFCPeer getNFCPeer(DOMString sessionId);
 
-   [Func="Navigator::HasNFCPeerSupport"]
+   [CheckPermissions="nfc-write"]
    attribute EventHandler onpeerready;
-   [Func="Navigator::HasNFCPeerSupport"]
+   [CheckPermissions="nfc-write"]
    attribute EventHandler onpeerlost;
 };
 
 // Mozilla Only
 partial interface MozNFC {
    [ChromeOnly]
    void eventListenerWasAdded(DOMString aType);
    [ChromeOnly]
--- a/dom/webidl/Navigator.webidl
+++ b/dom/webidl/Navigator.webidl
@@ -109,17 +109,17 @@ interface NavigatorGeolocation {
 };
 Navigator implements NavigatorGeolocation;
 
 // http://www.w3.org/TR/battery-status/#navigatorbattery-interface
 [NoInterfaceObject]
 interface NavigatorBattery {
     // XXXbz Per spec this should be non-nullable, but we return null in
     // torn-down windows.  See bug 884925.
-    [Throws, Func="Navigator::HasBatterySupport"]
+    [Throws, Pref="dom.battery.enabled"]
     readonly attribute BatteryManager? battery;
 };
 Navigator implements NavigatorBattery;
 
 // https://wiki.mozilla.org/WebAPI/DataStore
 [NoInterfaceObject]
 interface NavigatorDataStore {
     [Throws, NewObject, Func="Navigator::HasDataStoreSupport"]
@@ -160,33 +160,33 @@ partial interface Navigator {
   // WebKit/Blink supports this (hardcoded ""); Trident/Presto do not.
   readonly attribute DOMString vendorSub;
   // WebKit/Blink supports this (hardcoded "20030107"); Trident/Presto don't
   readonly attribute DOMString productSub;
   // WebKit/Blink/Trident/Presto support this.
   readonly attribute boolean cookieEnabled;
   [Throws]
   readonly attribute DOMString buildID;
-  [Throws, Func="Navigator::HasPowerSupport"]
+  [Throws, CheckPermissions="power"]
   readonly attribute MozPowerManager mozPower;
 
   // WebKit/Blink/Trident/Presto support this.
   [Throws]
   boolean javaEnabled();
 
   /**
    * Navigator requests to add an idle observer to the existing window.
    */
-  [Throws, Func="Navigator::HasIdleSupport"]
+  [Throws, CheckPermissions="idle", Pref="dom.idle-observers-api.enabled"]
   void addIdleObserver(MozIdleObserver aIdleObserver);
 
   /**
    * Navigator requests to remove an idle observer from the existing window.
    */
-  [Throws, Func="Navigator::HasIdleSupport"]
+  [Throws, CheckPermissions="idle", Pref="dom.idle-observers-api.enabled"]
   void removeIdleObserver(MozIdleObserver aIdleObserver);
 
   /**
    * Request a wake lock for a resource.
    *
    * A page holds a wake lock to request that a resource not be turned
    * off (or otherwise made unavailable).
    *
@@ -221,17 +221,17 @@ partial interface Navigator {
   [Throws, Pref="device.storage.enabled"]
   DeviceStorage? getDeviceStorage(DOMString type);
   [Throws, Pref="device.storage.enabled"]
   sequence<DeviceStorage> getDeviceStorages(DOMString type);
 };
 
 // nsIDOMNavigatorDesktopNotification
 partial interface Navigator {
-  [Throws, Func="Navigator::HasDesktopNotificationSupport"]
+  [Throws, Pref="notification.feature.enabled"]
   readonly attribute DesktopNotificationCenter mozNotification;
 };
 
 // nsIDOMClientInformation
 partial interface Navigator {
   [Throws]
   boolean mozIsLocallyAvailable(DOMString uri, boolean whenOffline);
 };
@@ -262,59 +262,59 @@ partial interface Navigator {
   [Throws, Pref="dom.sysmsg.enabled"]
   void    mozSetMessageHandler (DOMString type, systemMessageCallback? callback);
   [Throws, Pref="dom.sysmsg.enabled"]
   boolean mozHasPendingMessage (DOMString type);
 };
 
 #ifdef MOZ_B2G_RIL
 partial interface Navigator {
-  [Throws, Func="Navigator::HasMobileConnectionSupport"]
+  [Throws, Pref="dom.mobileconnection.enabled", CheckPermissions="mobileconnection mobilenetwork"]
   readonly attribute MozMobileConnectionArray mozMobileConnections;
 };
 
 partial interface Navigator {
-  [Throws, Func="Navigator::HasCellBroadcastSupport"]
+  [Throws, Pref="dom.cellbroadcast.enabled", CheckPermissions="cellbroadcast"]
   readonly attribute MozCellBroadcast mozCellBroadcast;
 };
 
 partial interface Navigator {
-  [Throws, Func="Navigator::HasVoicemailSupport"]
+  [Throws, Pref="dom.voicemail.enabled", CheckPermissions="voicemail"]
   readonly attribute MozVoicemail mozVoicemail;
 };
 
 partial interface Navigator {
-  [Throws, Func="Navigator::HasIccManagerSupport"]
+  [Throws, Pref="dom.icc.enabled", CheckPermissions="mobileconnection"]
   readonly attribute MozIccManager? mozIccManager;
 };
+
+partial interface Navigator {
+  [Throws, Pref="dom.telephony.enabled", CheckPermissions="telephony"]
+  readonly attribute Telephony? mozTelephony;
+};
 #endif // MOZ_B2G_RIL
 
-partial interface Navigator {
-  [Throws, Func="Navigator::HasTelephonySupport"]
-  readonly attribute Telephony? mozTelephony;
-};
-
 #ifdef MOZ_GAMEPAD
 // https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension
 partial interface Navigator {
   [Throws, Pref="dom.gamepad.enabled"]
   sequence<Gamepad?> getGamepads();
 };
 #endif // MOZ_GAMEPAD
 
 #ifdef MOZ_B2G_BT
 partial interface Navigator {
-  [Throws, Func="Navigator::HasBluetoothSupport"]
+  [Throws, CheckPermissions="bluetooth"]
   readonly attribute BluetoothManager mozBluetooth;
 };
 #endif // MOZ_B2G_BT
 
 #ifdef MOZ_B2G_FM
 partial interface Navigator {
-  [Throws, Func="Navigator::HasFMRadioSupport"]
+  [Throws, CheckPermissions="fmradio"]
   readonly attribute FMRadio mozFMRadio;
 };
 #endif // MOZ_B2G_FM
 
 #ifdef MOZ_TIME_MANAGER
 // nsIDOMMozNavigatorTime
 partial interface Navigator {
   [Throws, Func="Navigator::HasTimeSupport"]
--- a/dom/webidl/PermissionSettings.webidl
+++ b/dom/webidl/PermissionSettings.webidl
@@ -1,14 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain at http://mozilla.org/MPL/2.0/. */
 
 [JSImplementation="@mozilla.org/permissionSettings;1",
- Func="Navigator::HasPermissionSettingsSupport",
+ CheckPermissions="permissions",
  Pref="dom.mozPermissionSettings.enabled",
  NavigatorProperty="mozPermissionSettings"]
 interface PermissionSettings
 {
   DOMString get(DOMString permission, DOMString manifestURI, DOMString origin, boolean browserFlag);
 
   void set(DOMString permission, DOMString value, DOMString manifestURI, DOMString origin, boolean browserFlag);
 
--- a/dom/webidl/PhoneNumberService.webidl
+++ b/dom/webidl/PhoneNumberService.webidl
@@ -1,16 +1,15 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-[JSImplementation="@mozilla.org/phoneNumberService;1", NavigatorProperty="mozPhoneNumberService"]
+[JSImplementation="@mozilla.org/phoneNumberService;1",
+ NavigatorProperty="mozPhoneNumberService",
+ CheckPermissions="phonenumberservice"]
 interface PhoneNumberService {
-
-  [Func="Navigator::HasPhoneNumberSupport"]
   DOMRequest fuzzyMatch([TreatNullAs=EmptyString] optional DOMString number1 = "",
                         [TreatNullAs=EmptyString] optional DOMString number2= "");
 
-  [Func="Navigator::HasPhoneNumberSupport"]
   DOMString normalize(DOMString number);
 };
--- a/dom/webidl/PushManager.webidl
+++ b/dom/webidl/PushManager.webidl
@@ -1,12 +1,16 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/.
 */
 
-[NoInterfaceObject, NavigatorProperty="push", JSImplementation="@mozilla.org/push/PushManager;1", Func="Navigator::HasPushNotificationsSupport"]
+[NoInterfaceObject,
+ NavigatorProperty="push",
+ JSImplementation="@mozilla.org/push/PushManager;1",
+ CheckPermissions="push",
+ Pref="services.push.enabled"]
 interface PushManager {
     DOMRequest register();
     DOMRequest unregister(DOMString pushEndpoint);
     DOMRequest registrations();
 };