mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-15 22:44:13 +00:00
Bug 940765 - Root before preference checking, r=bz
This commit is contained in:
parent
8c13061a40
commit
41c9799518
@ -1703,14 +1703,16 @@ Navigator::HasMobileMessageSupport(JSContext* /* unused */, JSObject* aGlobal)
|
||||
|
||||
/* static */
|
||||
bool
|
||||
Navigator::HasTelephonySupport(JSContext* /* unused */, JSObject* aGlobal)
|
||||
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);
|
||||
NS_ENSURE_TRUE(enabled, false);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
|
||||
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(global);
|
||||
return win && CheckPermission(win, "telephony");
|
||||
}
|
||||
|
||||
@ -1854,8 +1856,10 @@ bool Navigator::HasInputMethodSupport(JSContext* /* unused */,
|
||||
|
||||
/* static */
|
||||
bool
|
||||
Navigator::HasDataStoreSupport(JSContext* /* unused */, JSObject* aGlobal)
|
||||
Navigator::HasDataStoreSupport(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.datastore.enabled", &enabled);
|
||||
@ -1866,7 +1870,7 @@ Navigator::HasDataStoreSupport(JSContext* /* unused */, JSObject* aGlobal)
|
||||
return true;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
|
||||
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(global);
|
||||
if (!win) {
|
||||
return false;
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ public:
|
||||
}
|
||||
static bool HasMobileMessageSupport(JSContext* /* unused */,
|
||||
JSObject* aGlobal);
|
||||
static bool HasTelephonySupport(JSContext* /* unused */,
|
||||
static bool HasTelephonySupport(JSContext* cx,
|
||||
JSObject* aGlobal);
|
||||
static bool HasCameraSupport(JSContext* /* unused */,
|
||||
JSObject* aGlobal);
|
||||
@ -286,7 +286,7 @@ public:
|
||||
|
||||
static bool HasInputMethodSupport(JSContext* /* unused */, JSObject* aGlobal);
|
||||
|
||||
static bool HasDataStoreSupport(JSContext* /* unused */, JSObject* aGlobal);
|
||||
static bool HasDataStoreSupport(JSContext* cx, JSObject* aGlobal);
|
||||
|
||||
nsPIDOMWindow* GetParentObject() const
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user