Bug 1306397 - Remove B2G event 'network-active-changed' and consumers from non-B2G/Gonk files: devtools. r?jryans draft
authorSebastian Hengst <archaeopteryx@coole-files.de>
Thu, 29 Sep 2016 19:53:44 +0200
changeset 419100 9e5e41423ffba1a2872ba5c678db09902c0232fe
parent 419099 2eb15fe1e3970a459f9e7b58a5cc9ebffeb24986
child 532494 007c0736b49f8b80996bfb39b7df2a996dfbb447
push id30846
push userarchaeopteryx@coole-files.de
push dateThu, 29 Sep 2016 17:54:44 +0000
reviewersjryans
bugs1306397
milestone52.0a1
Bug 1306397 - Remove B2G event 'network-active-changed' and consumers from non-B2G/Gonk files: devtools. r?jryans MozReview-Commit-ID: 2qoD29sZvSQ
devtools/shared/discovery/discovery.js
--- 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();