зеркало из https://github.com/mozilla/gecko-dev.git
Bug 939056 - B2G NFC: Enable/disable MOZ_NFC at runtime. r=bz
This commit is contained in:
Родитель
3a2a73567c
Коммит
78b23d6e7a
|
@ -1808,6 +1808,12 @@ Navigator::HasFMRadioSupport(JSContext* /* unused */, JSObject* aGlobal)
|
||||||
bool
|
bool
|
||||||
Navigator::HasNfcSupport(JSContext* /* unused */, JSObject* aGlobal)
|
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);
|
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
|
||||||
return win && (CheckPermission(win, "nfc-read") ||
|
return win && (CheckPermission(win, "nfc-read") ||
|
||||||
CheckPermission(win, "nfc-write"));
|
CheckPermission(win, "nfc-write"));
|
||||||
|
|
Загрузка…
Ссылка в новой задаче