зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1419771 - Introduce DOMPrefs, a thread-safe access to preferences for DOM - part 17 - Network Information enabled, r=asuth
This commit is contained in:
Родитель
1b4b3007e5
Коммит
bbefbae583
|
@ -50,6 +50,7 @@ PREF(StreamsEnabled, "dom.streams.enabled")
|
|||
PREF(RequestContextEnabled, "dom.requestcontext.enabled")
|
||||
PREF(OffscreenCanvasEnabled, "gfx.offscreencanvas.enabled")
|
||||
PREF(WebkitBlinkDirectoryPickerEnabled, "dom.webkitBlink.dirPicker.enabled")
|
||||
PREF(NetworkInformationEnabled, "dom.netinfo.enabled")
|
||||
|
||||
#undef PREF
|
||||
|
||||
|
@ -72,6 +73,7 @@ PREF_WEBIDL(StreamsEnabled)
|
|||
PREF_WEBIDL(RequestContextEnabled)
|
||||
PREF_WEBIDL(OffscreenCanvasEnabled)
|
||||
PREF_WEBIDL(WebkitBlinkDirectoryPickerEnabled)
|
||||
PREF_WEBIDL(NetworkInformationEnabled)
|
||||
|
||||
#undef PREF_WEBIDL
|
||||
|
||||
|
|
|
@ -79,6 +79,10 @@ public:
|
|||
// Returns true if the dom.webkitBlink.dirPicker.enabled pref is set.
|
||||
static bool WebkitBlinkDirectoryPickerEnabled();
|
||||
static bool WebkitBlinkDirectoryPickerEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
// Returns true if the dom.netinfo.enabled pref is set.
|
||||
static bool NetworkInformationEnabled();
|
||||
static bool NetworkInformationEnabled(JSContext* aCx, JSObject* aObj);
|
||||
};
|
||||
|
||||
} // dom namespace
|
||||
|
|
|
@ -106,18 +106,6 @@ Connection::Update(ConnectionType aType, bool aIsWifi, uint32_t aDHCPGateway,
|
|||
}
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
Connection::IsEnabled(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return Preferences::GetBool("dom.netinfo.enabled");
|
||||
}
|
||||
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
return workerPrivate->NetworkInformationEnabled();
|
||||
}
|
||||
|
||||
/* static */ Connection*
|
||||
Connection::CreateForWindow(nsPIDOMWindowInner* aWindow)
|
||||
{
|
||||
|
|
|
@ -37,8 +37,6 @@ public:
|
|||
|
||||
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
|
||||
|
||||
static bool IsEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
static Connection*
|
||||
CreateForWindow(nsPIDOMWindowInner* aWindow);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ enum ConnectionType {
|
|||
"unknown"
|
||||
};
|
||||
|
||||
[Func="mozilla::dom::network::Connection::IsEnabled",
|
||||
[Func="mozilla::dom::DOMPrefs::NetworkInformationEnabled",
|
||||
Exposed=(Window,Worker)]
|
||||
interface NetworkInformation : EventTarget {
|
||||
readonly attribute ConnectionType type;
|
||||
|
|
|
@ -16,6 +16,6 @@ WorkerNavigator implements NavigatorStorage;
|
|||
// http://wicg.github.io/netinfo/#extensions-to-the-navigator-interface
|
||||
[Exposed=(Worker)]
|
||||
partial interface WorkerNavigator {
|
||||
[Func="mozilla::dom::network::Connection::IsEnabled", Throws]
|
||||
[Func="mozilla::dom::DOMPrefs::NetworkInformationEnabled", Throws]
|
||||
readonly attribute NetworkInformation connection;
|
||||
};
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
// * First argument is the name of the pref.
|
||||
// * The name of the function that updates the new value of a pref.
|
||||
|
||||
WORKER_SIMPLE_PREF("dom.netinfo.enabled", NetworkInformationEnabled, NETWORKINFORMATION_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.fetchObserver.enabled", FetchObserverEnabled, FETCHOBSERVER_ENABLED)
|
||||
WORKER_SIMPLE_PREF("privacy.resistFingerprinting", ResistFingerprintingEnabled, RESISTFINGERPRINTING_ENABLED)
|
||||
WORKER_SIMPLE_PREF("devtools.enabled", DevToolsEnabled, DEVTOOLS_ENABLED)
|
||||
|
|
Загрузка…
Ссылка в новой задаче