Bug 1306397 - Remove B2G event 'network-active-changed' and consumers from non-B2G/Gonk files: devtools. r?jryans
MozReview-Commit-ID: 2qoD29sZvSQ
--- a/devtools/shared/discovery/discovery.js
+++ b/devtools/shared/discovery/discovery.js
@@ -255,18 +255,16 @@ function Discovery() {
};
this._expectingReplies = {
from: new Set()
};
this._onRemoteScan = this._onRemoteScan.bind(this);
this._onRemoteUpdate = this._onRemoteUpdate.bind(this);
this._purgeMissingDevices = this._purgeMissingDevices.bind(this);
-
- Services.obs.addObserver(this, "network-active-changed", false);
}
Discovery.prototype = {
/**
* Add a new service offered by this device.
* @param service string
* Name of the service
@@ -375,34 +373,16 @@ Discovery.prototype = {
if (!this._transports.update) {
return; // Not listening
}
this._transports.update.off("message", this._onRemoteUpdate);
this._transports.update.destroy();
this._transports.update = null;
},
- observe: function (subject, topic, data) {
- if (topic !== "network-active-changed") {
- return;
- }
- let activeNetworkInfo = subject;
- if (!activeNetworkInfo) {
- log("No active network info");
- return;
- }
- activeNetworkInfo = activeNetworkInfo.QueryInterface(Ci.nsINetworkInfo);
- log("Active network changed to: " + activeNetworkInfo.type);
- // UDP sockets go down when the device goes offline, so we'll restart them
- // when the active network goes back to WiFi.
- if (activeNetworkInfo.type === Ci.nsINetworkInfo.NETWORK_TYPE_WIFI) {
- this._restartListening();
- }
- },
-
_restartListening: function () {
if (this._transports.scan) {
this._stopListeningForScan();
this._startListeningForScan();
}
if (this._transports.update) {
this._stopListeningForUpdate();
this._startListeningForUpdate();