Bug 952486 - Use CheckPermissions instead of Func for several interfaces. r=bz

This commit is contained in:
Reuben Morais 2014-05-25 15:31:11 -03:00
parent 24b03739fb
commit 7943a9dc65
28 changed files with 42 additions and 333 deletions

View File

@ -1835,11 +1835,6 @@ public:
*/
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.
*/
@ -2228,7 +2223,6 @@ private:
static bool sTrustedFullScreenOnly;
static bool sFullscreenApiIsContentOnly;
static uint32_t sHandlingInputTimeout;
static bool sIsIdleObserverAPIEnabled;
static bool sIsPerformanceTimingEnabled;
static bool sIsResourceTimingEnabled;

View File

@ -234,7 +234,6 @@ 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;
@ -434,8 +433,6 @@ nsContentUtils::Init()
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);

View File

@ -661,12 +661,6 @@ Navigator::RefreshMIMEArray()
}
}
bool
Navigator::HasDesktopNotificationSupport()
{
return Preferences::GetBool("notification.feature.enabled", false);
}
namespace {
class VibrateWindowListener : public nsIDOMEventListener
@ -2103,41 +2097,6 @@ 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 */)
@ -2175,23 +2134,6 @@ Navigator::HasMobileMessageSupport(JSContext* /* unused */, JSObject* aGlobal)
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)
@ -2200,65 +2142,6 @@ Navigator::HasCameraSupport(JSContext* /* unused */, JSObject* 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 */,
@ -2279,26 +2162,6 @@ Navigator::HasWifiManagerSupport(JSContext* /* unused */,
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
@ -2314,22 +2177,6 @@ Navigator::HasNFCSupport(JSContext* /* unused */, JSObject* 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
@ -2354,16 +2201,6 @@ Navigator::HasUserMediaSupport(JSContext* /* unused */,
}
#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 */,
@ -2471,25 +2308,6 @@ Navigator::HasDataStoreSupport(JSContext* aCx, JSObject* aGlobal)
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)

View File

@ -132,8 +132,6 @@ public:
void RefreshMIMEArray();
static bool HasDesktopNotificationSupport();
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
/**
@ -266,44 +264,15 @@ public:
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);
@ -313,19 +282,12 @@ public:
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);

View File

@ -8,7 +8,6 @@
#include "Constants.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/Hal.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/BatteryManagerBinding.h"
#include "nsIDOMClassInfo.h"
@ -133,12 +132,6 @@ BatteryManager::Notify(const hal::BatteryInformation& aBatteryInfo)
}
}
/* static */ bool
BatteryManager::HasSupport()
{
return Preferences::GetBool("dom.battery.enabled", true);
}
} // namespace battery
} // namespace dom
} // namespace mozilla

View File

@ -35,12 +35,6 @@ public:
// 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
*/

View File

@ -194,24 +194,6 @@ BluetoothManager::Create(nsPIDOMWindow* 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)
{

View File

@ -194,24 +194,6 @@ BluetoothManager::Create(nsPIDOMWindow* 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)
{

View File

@ -24,4 +24,4 @@ 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)

View File

@ -22,10 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=674720
"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>

View File

@ -182,19 +182,6 @@ 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)
{

View File

@ -36,8 +36,6 @@ public:
nsresult Init(nsIDOMWindow *aWindow);
nsresult Shutdown();
static bool CheckPermission(nsPIDOMWindow*);
static already_AddRefed<PowerManager> CreateInstance(nsPIDOMWindow*);
// WebIDL

View File

@ -777,7 +777,7 @@ var interfaceNamesInGlobalScope =
// 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!

View File

@ -32,7 +32,7 @@ dictionary MediaPlayStatus
DOMString playStatus = "";
};
[Func="Navigator::HasBluetoothSupport"]
[CheckPermissions="bluetooth"]
interface BluetoothAdapter : EventTarget {
readonly attribute DOMString address;
readonly attribute unsigned long class;

View File

@ -4,7 +4,7 @@
* 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
{

View File

@ -4,7 +4,7 @@
* 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

View File

@ -4,7 +4,7 @@
* 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;

View File

@ -5,7 +5,7 @@
*/
[Constructor(DOMString type, optional BluetoothDeviceEventInit eventInitDict),
Func="Navigator::HasBluetoothSupport"]
CheckPermissions="bluetooth"]
interface BluetoothDeviceEvent : Event
{
readonly attribute BluetoothDevice? device;

View File

@ -6,7 +6,7 @@
[Constructor(DOMString type,
optional BluetoothDiscoveryStateChangedEventInit eventInitDict),
Func="Navigator::HasBluetoothSupport"]
CheckPermissions="bluetooth"]
interface BluetoothDiscoveryStateChangedEvent : Event
{
readonly attribute boolean discovering;

View File

@ -3,7 +3,7 @@
* 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;

View File

@ -6,7 +6,7 @@
[Constructor(DOMString type,
optional BluetoothStatusChangedEventInit eventInitDict),
Func="Navigator::HasBluetoothSupport"]
CheckPermissions="bluetooth"]
interface BluetoothStatusChangedEvent : Event
{
readonly attribute DOMString address;

View File

@ -5,7 +5,8 @@
*/
[Constructor(DOMString type, optional DownloadEventInit eventInitDict),
Func="Navigator::HasDownloadsSupport"]
Pref="dom.mozDownloads.enabled",
CheckPermissions="downloads"]
interface DownloadEvent : Event
{
readonly attribute DOMDownload? download;

View File

@ -19,8 +19,8 @@ enum DownloadState {
//
// 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",
@ -43,7 +43,8 @@ interface DOMDownloadManager : EventTarget {
};
[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;

View File

@ -5,7 +5,7 @@
/* Copyright © 2013 Deutsche Telekom, Inc. */
[NoInterfaceObject,
Func="Navigator::HasNFCManagerSupport"]
CheckPermissions="nfc-manager"]
interface MozNFCManager {
/**
* API to check if the given application's manifest
@ -49,9 +49,9 @@ 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;
};

View File

@ -114,7 +114,7 @@ Navigator implements NavigatorGeolocation;
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;
@ -165,7 +165,7 @@ partial interface Navigator {
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.
@ -175,13 +175,13 @@ partial interface Navigator {
/**
* 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);
/**
@ -226,7 +226,7 @@ partial interface Navigator {
// nsIDOMNavigatorDesktopNotification
partial interface Navigator {
[Throws, Func="Navigator::HasDesktopNotificationSupport"]
[Throws, Pref="notification.feature.enabled"]
readonly attribute DesktopNotificationCenter mozNotification;
};
@ -267,30 +267,30 @@ partial interface Navigator {
#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;
};
#endif // MOZ_B2G_RIL
partial interface Navigator {
[Throws, Func="Navigator::HasTelephonySupport"]
[Throws, Pref="dom.telephony.enabled", CheckPermissions="telephony"]
readonly attribute Telephony? mozTelephony;
};
#endif // MOZ_B2G_RIL
#ifdef MOZ_GAMEPAD
// https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension
@ -302,14 +302,14 @@ partial interface Navigator {
#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

View File

@ -3,7 +3,7 @@
* 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

View File

@ -4,13 +4,12 @@
* 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);
};

View File

@ -4,7 +4,11 @@
* 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);