diff --git a/dom/webidl/MozConnection.webidl b/dom/webidl/MozConnection.webidl deleted file mode 100644 index 038b408b0ab4..000000000000 --- a/dom/webidl/MozConnection.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. - */ - -[Pref="dom.network.enabled", NoInterfaceObject] -interface MozConnection : EventTarget { - readonly attribute unrestricted double bandwidth; - readonly attribute boolean metered; - - attribute EventHandler onchange; -}; - diff --git a/dom/webidl/Navigator.webidl b/dom/webidl/Navigator.webidl index f98c3e624bac..225c0585d58e 100644 --- a/dom/webidl/Navigator.webidl +++ b/dom/webidl/Navigator.webidl @@ -235,10 +235,10 @@ partial interface Navigator { readonly attribute MozMobileMessageManager? mozMobileMessage; }; -// nsIDOMMozNavigatorNetwork +// NetworkInformation partial interface Navigator { - [Pref="dom.network.enabled"] - readonly attribute MozConnection? mozConnection; + [Throws, Pref="dom.netinfo.enabled"] + readonly attribute NetworkInformation connection; }; // nsIDOMNavigatorCamera diff --git a/dom/webidl/NetworkInformation.webidl b/dom/webidl/NetworkInformation.webidl new file mode 100644 index 000000000000..97f751b60631 --- /dev/null +++ b/dom/webidl/NetworkInformation.webidl @@ -0,0 +1,24 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. + * + * The origin of this IDL file is https://w3c.github.io/netinfo/ + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +enum ConnectionType { + "cellular", + "bluetooth", + "ethernet", + "wifi", + "other", + "none" +}; + +[Pref="dom.netinfo.enabled"] +interface NetworkInformation : EventTarget { + readonly attribute ConnectionType type; + attribute EventHandler ontypechange; +}; diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index fc71066095e5..06ee65566ba3 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -4185,9 +4185,8 @@ pref("profiler.enabled", false); pref("profiler.interval", 10); pref("profiler.entries", 100000); -// Network API -pref("dom.network.enabled", true); -pref("dom.network.metered", false); +// Network Information API +pref("dom.netinfo.enabled", true); #ifdef XP_WIN // On 32-bit Windows, fire a low-memory notification if we have less than this