diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 11b4444bef5a..31b7d9d45324 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -2183,33 +2183,6 @@ Navigator::HasWakeLockSupport(JSContext* /* unused*/, JSObject* /*unused */) return !!pmService; } -/* static */ -bool -Navigator::HasMobileMessageSupport(JSContext* /* unused */, JSObject* aGlobal) -{ - nsCOMPtr win = GetWindowFromGlobal(aGlobal); - -#ifndef MOZ_WEBSMS_BACKEND - return false; -#endif - - // First of all, the general pref has to be turned on. - bool enabled = false; - Preferences::GetBool("dom.sms.enabled", &enabled); - if (!enabled) { - return false; - } - - NS_ENSURE_TRUE(win, false); - NS_ENSURE_TRUE(win->GetDocShell(), false); - - if (!CheckPermission(win, "sms")) { - return false; - } - - return true; -} - /* static */ bool Navigator::HasCameraSupport(JSContext* /* unused */, JSObject* aGlobal) @@ -2255,16 +2228,6 @@ Navigator::HasNFCSupport(JSContext* /* unused */, JSObject* aGlobal) } #endif // MOZ_NFC -#ifdef MOZ_TIME_MANAGER -/* static */ -bool -Navigator::HasTimeSupport(JSContext* /* unused */, JSObject* aGlobal) -{ - nsCOMPtr win = GetWindowFromGlobal(aGlobal); - return win && CheckPermission(win, "time"); -} -#endif // MOZ_TIME_MANAGER - #ifdef MOZ_MEDIA_NAVIGATOR /* static */ bool @@ -2366,22 +2329,6 @@ Navigator::HasDataStoreSupport(JSContext* aCx, JSObject* aGlobal) return HasDataStoreSupport(doc->NodePrincipal()); } -/* static */ -bool -Navigator::HasNetworkStatsSupport(JSContext* /* unused */, JSObject* aGlobal) -{ - nsCOMPtr win = GetWindowFromGlobal(aGlobal); - return CheckPermission(win, "networkstats-manage"); -} - -/* static */ -bool -Navigator::HasFeatureDetectionSupport(JSContext* /* unused */, JSObject* aGlobal) -{ - nsCOMPtr win = GetWindowFromGlobal(aGlobal); - return CheckPermission(win, "feature-detection"); -} - #ifdef MOZ_B2G /* static */ bool diff --git a/dom/base/Navigator.h b/dom/base/Navigator.h index bfcd23cb17f4..c841f59455e9 100644 --- a/dom/base/Navigator.h +++ b/dom/base/Navigator.h @@ -268,8 +268,6 @@ public: // WebIDL helper methods static bool HasWakeLockSupport(JSContext* /* unused*/, JSObject* /*unused */); - static bool HasMobileMessageSupport(JSContext* /* unused */, - JSObject* aGlobal); static bool HasCameraSupport(JSContext* /* unused */, JSObject* aGlobal); static bool HasWifiManagerSupport(JSContext* /* unused */, @@ -277,9 +275,6 @@ public: #ifdef MOZ_NFC static bool HasNFCSupport(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 */); @@ -291,10 +286,6 @@ public: static bool HasDataStoreSupport(JSContext* cx, JSObject* aGlobal); - static bool HasNetworkStatsSupport(JSContext* aCx, JSObject* aGlobal); - - static bool HasFeatureDetectionSupport(JSContext* aCx, JSObject* aGlobal); - #ifdef MOZ_B2G static bool HasMobileIdSupport(JSContext* aCx, JSObject* aGlobal); #endif diff --git a/dom/webidl/MozNetworkStats.webidl b/dom/webidl/MozNetworkStats.webidl index 5e71732c67d6..fdb6d8f40da5 100644 --- a/dom/webidl/MozNetworkStats.webidl +++ b/dom/webidl/MozNetworkStats.webidl @@ -26,8 +26,8 @@ dictionary NetworkStatsAlarmOptions [JSImplementation="@mozilla.org/networkstats;1", ChromeOnly, - Pref="dom.mozNetworkStats.enabled", - Func="Navigator::HasNetworkStatsSupport"] + CheckPermissions="networkstats-manage", + Pref="dom.mozNetworkStats.enabled"] interface MozNetworkStats { /** * App manifest URL of an application for specifying the per-app stats of the diff --git a/dom/webidl/MozNetworkStatsAlarm.webidl b/dom/webidl/MozNetworkStatsAlarm.webidl index dd2a4fb8ffad..a363288a5457 100644 --- a/dom/webidl/MozNetworkStatsAlarm.webidl +++ b/dom/webidl/MozNetworkStatsAlarm.webidl @@ -4,8 +4,8 @@ [JSImplementation="@mozilla.org/networkstatsalarm;1", ChromeOnly, - Pref="dom.mozNetworkStats.enabled", - Func="Navigator::HasNetworkStatsSupport"] + CheckPermissions="networkstats-manage", + Pref="dom.mozNetworkStats.enabled"] interface MozNetworkStatsAlarm { readonly attribute unsigned long alarmId; readonly attribute MozNetworkStatsInterface network; diff --git a/dom/webidl/MozNetworkStatsData.webidl b/dom/webidl/MozNetworkStatsData.webidl index 0c4799417872..894e95b2f7be 100644 --- a/dom/webidl/MozNetworkStatsData.webidl +++ b/dom/webidl/MozNetworkStatsData.webidl @@ -4,8 +4,8 @@ [JSImplementation="@mozilla.org/networkStatsdata;1", ChromeOnly, - Pref="dom.mozNetworkStats.enabled", - Func="Navigator::HasNetworkStatsSupport"] + CheckPermissions="networkstats-manage", + Pref="dom.mozNetworkStats.enabled"] interface MozNetworkStatsData { readonly attribute unsigned long rxBytes; // Received bytes. readonly attribute unsigned long txBytes; // Sent bytes. diff --git a/dom/webidl/MozNetworkStatsInterface.webidl b/dom/webidl/MozNetworkStatsInterface.webidl index 8221ab962cb6..1eb14c18e33a 100644 --- a/dom/webidl/MozNetworkStatsInterface.webidl +++ b/dom/webidl/MozNetworkStatsInterface.webidl @@ -12,8 +12,8 @@ dictionary NetworkInterface { */ [Constructor(optional NetworkInterface networkinterface), JSImplementation="@mozilla.org/networkstatsinterface;1", - Pref="dom.mozNetworkStats.enabled", - Func="Navigator::HasNetworkStatsSupport"] + CheckPermissions="networkstats-manage", + Pref="dom.mozNetworkStats.enabled"] interface MozNetworkStatsInterface { readonly attribute long type; diff --git a/dom/webidl/Navigator.webidl b/dom/webidl/Navigator.webidl index 18a45860537a..6cb56e03bb45 100644 --- a/dom/webidl/Navigator.webidl +++ b/dom/webidl/Navigator.webidl @@ -83,7 +83,7 @@ interface NavigatorStorageUtils { [NoInterfaceObject] interface NavigatorFeatures { - [Func="Navigator::HasFeatureDetectionSupport"] + [CheckPermissions="feature-detection"] Promise getFeature(DOMString name); }; @@ -252,10 +252,12 @@ partial interface Navigator { boolean mozIsLocallyAvailable(DOMString uri, boolean whenOffline); }; +#ifdef MOZ_WEBSMS_BACKEND partial interface Navigator { - [Func="Navigator::HasMobileMessageSupport"] + [CheckPermissions="sms", Pref="dom.sms.enabled"] readonly attribute MozMobileMessageManager? mozMobileMessage; }; +#endif // NetworkInformation partial interface Navigator { @@ -331,7 +333,7 @@ partial interface Navigator { #ifdef MOZ_TIME_MANAGER // nsIDOMMozNavigatorTime partial interface Navigator { - [Throws, Func="Navigator::HasTimeSupport"] + [Throws, CheckPermissions="time"] readonly attribute MozTimeManager mozTime; }; #endif // MOZ_TIME_MANAGER