Backed out 2 changesets (bug 1055139) for bad network touches
authorPhil Ringnalda <philringnalda@gmail.com>
Mon, 01 Sep 2014 17:11:35 -0700
changeset 224561 95b54a829a57a25743164fd601e46f84ef9e5eda
parent 224560 93b6e71b019a2d9ffd8c47e70319de67be1aef4f
child 224562 967b3014896d4fac3fbba9c69182ad99feae9efc
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1055139
milestone34.0a1
backs out93b6e71b019a2d9ffd8c47e70319de67be1aef4f
49cb37b48c053a911487accee55e1039de48684b
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 2 changesets (bug 1055139) for bad network touches CLOSED TREE Backed out changeset 93b6e71b019a (bug 1055139) Backed out changeset 49cb37b48c05 (bug 1055139)
browser/components/loop/MozLoopPushHandler.jsm
--- a/browser/components/loop/MozLoopPushHandler.jsm
+++ b/browser/components/loop/MozLoopPushHandler.jsm
@@ -16,17 +16,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource://gre/modules/devtools/Console.jsm");
 
 /**
  * We don't have push notifications on desktop currently, so this is a
  * workaround to get them going for us.
  */
 let MozLoopPushHandler = {
   // This is the uri of the push server.
-  pushServerUri: undefined,
+  pushServerUri: Services.prefs.getCharPref("services.push.serverURL"),
   // This is the channel id we're using for notifications
   channelID: "8b1081ce-9b35-42b5-b8f5-3ff8cb813a50",
   // This is the UserAgent UUID assigned by the PushServer
   uaID: undefined,
   // Stores the push url if we're registered and we have one.
   pushUrl: undefined,
   // Set to true once the channelID has been registered with the PushServer.
   registered: false,
@@ -196,73 +196,28 @@ let MozLoopPushHandler = {
    * was received, calling asyncOpen() on the same interface will
    * trigger a "alreay open socket" exception even though the channel
    * is logically closed.
    */
   _openSocket: function() {
     if (this._mockPushHandler) {
       // For tests, use the mock instance.
       this._websocket = this._mockPushHandler;
-      // For tests, we also don't retreive the push server URL from the network
-      this.pushServerUri = Services.prefs.getCharPref("services.push.serverURL");
     } else if (!Services.io.offline) {
       this._websocket = Cc["@mozilla.org/network/protocol;1?name=wss"]
                         .createInstance(Ci.nsIWebSocketChannel);
     } else {
       this._registerCallback("offline");
       console.warn("MozLoopPushHandler - IO offline");
       return;
     }
 
     this._websocket.protocol = "push-notification";
-
-    let performOpen = () => {
-      let uri = Services.io.newURI(this.pushServerUri, null, null);
-      this._websocket.asyncOpen(uri, this.pushServerUri, this, null);
-    }
-
-    let pushServerURLFetchError = () => {
-      console.warn("MozLoopPushHandler - Could not retrieve push server URL from Loop server; using default");
-      this.pushServerUri = Services.prefs.getCharPref("services.push.serverURL");
-      performOpen();
-    }
-
-    if (!this.pushServerUri) {
-      // Get push server to use from the Loop server
-      let pushUrlEndpoint = Services.prefs.getCharPref("loop.server") + "/push-server-config";
-      let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
-                createInstance(Ci.nsIXMLHttpRequest);
-      req.open("GET", pushUrlEndpoint);
-      req.onload = () => {
-        if (req.status >= 200 && req.status < 300) {
-          let pushServerConfig;
-          try {
-            pushServerConfig = JSON.parse(req.responseText);
-          } catch (e) {
-            console.warn("MozLoopPushHandler - Error parsing JSON response for push server URL");
-            pushServerURLFetchError();
-          }
-          if (pushServerConfig.pushServerURI) {
-            this.pushServerUri = pushServerConfig.pushServerURI;
-            performOpen();
-          } else {
-            console.warn("MozLoopPushHandler - push server URL config lacks pushServerURI parameter");
-            pushServerURLFetchError();
-          }
-        } else {
-          console.warn("MozLoopPushHandler - push server URL retrieve error: " + req.status);
-          pushServerURLFetchError();
-        }
-      };
-      req.onerror = pushServerURLFetchError;
-      req.send();
-    } else {
-      // this.pushServerUri already set -- just open the channel
-      performOpen();
-    }
+    let uri = Services.io.newURI(this.pushServerUri, null, null);
+    this._websocket.asyncOpen(uri, this.pushServerUri, this, null);
   },
 
   /**
    * Handles registering a service
    */
   _registerChannel: function() {
     this.registered = false;
     try { // in case websocket has closed