|
|
|
Lines 1814-1847
bool Navigator::HasUserMediaSupport(JSCo
|
Link Here
|
|---|
|
| 1814 |
{ |
1814 |
{ |
| 1815 |
// Make enabling peerconnection enable getUserMedia() as well |
1815 |
// Make enabling peerconnection enable getUserMedia() as well |
| 1816 |
return Preferences::GetBool("media.navigator.enabled", false) || |
1816 |
return Preferences::GetBool("media.navigator.enabled", false) || |
| 1817 |
Preferences::GetBool("media.peerconnection.enabled", false); |
1817 |
Preferences::GetBool("media.peerconnection.enabled", false); |
| 1818 |
} |
1818 |
} |
| 1819 |
#endif // MOZ_MEDIA_NAVIGATOR |
1819 |
#endif // MOZ_MEDIA_NAVIGATOR |
| 1820 |
|
1820 |
|
| 1821 |
/* static */ |
1821 |
/* static */ |
| 1822 |
bool Navigator::HasPushNotificationsSupport(JSContext* /* unused */, |
1822 |
bool |
| 1823 |
JSObject* aGlobal) |
1823 |
Navigator::HasPushNotificationsSupport(JSContext* /* unused */, |
|
|
1824 |
JSObject* aGlobal) |
| 1824 |
{ |
1825 |
{ |
| 1825 |
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal); |
1826 |
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal); |
| 1826 |
return win && Preferences::GetBool("services.push.enabled", false) && CheckPermission(win, "push"); |
1827 |
return win && Preferences::GetBool("services.push.enabled", false) && |
|
|
1828 |
CheckPermission(win, "push"); |
| 1827 |
} |
1829 |
} |
| 1828 |
|
1830 |
|
| 1829 |
/* static */ |
1831 |
/* static */ |
| 1830 |
bool Navigator::HasInputMethodSupport(JSContext* /* unused */, |
1832 |
bool |
| 1831 |
JSObject* aGlobal) |
1833 |
Navigator::HasInputMethodSupport(JSContext* /* unused */, |
|
|
1834 |
JSObject* aGlobal) |
| 1832 |
{ |
1835 |
{ |
| 1833 |
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal); |
1836 |
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal); |
| 1834 |
return Preferences::GetBool("dom.mozInputMethod.testing", false) || |
1837 |
return Preferences::GetBool("dom.mozInputMethod.testing", false) || |
| 1835 |
(Preferences::GetBool("dom.mozInputMethod.enabled", false) && |
1838 |
(Preferences::GetBool("dom.mozInputMethod.enabled", false) && |
| 1836 |
win && CheckPermission(win, "input")); |
1839 |
win && CheckPermission(win, "input")); |
| 1837 |
} |
1840 |
} |
| 1838 |
|
1841 |
|
| 1839 |
/* static */ |
1842 |
/* static */ |
|
|
1843 |
bool |
| 1844 |
Navigator::HasServiceWorkerSupport(JSContext* /* unused */, |
| 1845 |
JSObject* aGlobal) |
| 1846 |
{ |
| 1847 |
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal); |
| 1848 |
return win && Preferences::GetBool("dom.workers.serviceWorkers.enabled", false); |
| 1849 |
} |
| 1850 |
|
| 1851 |
already_AddRefed<Promise> |
| 1852 |
Navigator::RegisterServiceWorker(const nsAString &scope, |
| 1853 |
const nsAString &scriptURL, |
| 1854 |
ErrorResult& aRv) |
| 1855 |
{ |
| 1856 |
AutoSafeJSContext cx; |
| 1857 |
JS::Rooted<JS::Value> reason(cx, JS::UndefinedValue()); |
| 1858 |
return Promise::Reject(GetWindow(), cx, reason, aRv); |
| 1859 |
} |
| 1860 |
|
| 1861 |
already_AddRefed<Promise> |
| 1862 |
Navigator::UnregisterServiceWorker(const nsAString &scope, |
| 1863 |
ErrorResult& aRv) |
| 1864 |
{ |
| 1865 |
AutoSafeJSContext cx; |
| 1866 |
JS::Rooted<JS::Value> reason(cx, JS::UndefinedValue()); |
| 1867 |
return Promise::Reject(GetWindow(), cx, reason, aRv); |
| 1868 |
} |
| 1869 |
|
| 1870 |
/* static */ |
| 1840 |
already_AddRefed<nsPIDOMWindow> |
1871 |
already_AddRefed<nsPIDOMWindow> |
| 1841 |
Navigator::GetWindowFromGlobal(JSObject* aGlobal) |
1872 |
Navigator::GetWindowFromGlobal(JSObject* aGlobal) |
| 1842 |
{ |
1873 |
{ |
| 1843 |
nsCOMPtr<nsPIDOMWindow> win = |
1874 |
nsCOMPtr<nsPIDOMWindow> win = |
| 1844 |
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(aGlobal)); |
1875 |
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(aGlobal)); |
| 1845 |
MOZ_ASSERT(!win || win->IsInnerWindow()); |
1876 |
MOZ_ASSERT(!win || win->IsInnerWindow()); |
| 1846 |
return win.forget(); |
1877 |
return win.forget(); |
| 1847 |
} |
1878 |
} |