Bug 820463 - Revert early-loading changes, r=mdas
authorJonathan Griffin <jgriffin@mozilla.com>
Mon, 17 Dec 2012 15:18:58 -0800
changeset 123043 53e402890d35b9d0147e9c03fb32a9f05c7b937f
parent 123042 50914b4cc5d87c20c03a50fed36e1ca75f51ea3e
child 123044 39b595bc7d78995e15f82e444d354a2b944ca92e
push idunknown
push userunknown
push dateunknown
reviewersmdas
bugs820463
milestone20.0a1
Bug 820463 - Revert early-loading changes, r=mdas
testing/marionette/components/marionettecomponent.js
--- a/testing/marionette/components/marionettecomponent.js
+++ b/testing/marionette/components/marionettecomponent.js
@@ -3,17 +3,16 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 const {Constructor: CC, classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
 const MARIONETTE_CONTRACTID = "@mozilla.org/marionette;1";
 const MARIONETTE_CID = Components.ID("{786a1369-dca5-4adc-8486-33d23c88010a}");
 const DEBUGGER_ENABLED_PREF = 'devtools.debugger.remote-enabled';
 const MARIONETTE_ENABLED_PREF = 'marionette.defaultPrefs.enabled';
-const MARIONETTE_LOADEARLY_PREF = 'marionette.loadearly';
 const DEBUGGER_FORCELOCAL_PREF = 'devtools.debugger.force-local';
 const MARIONETTE_FORCELOCAL_PREF = 'marionette.force-local';
 
 const ServerSocket = CC("@mozilla.org/network/server-socket;1",
                         "nsIServerSocket",
                         "init");
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
@@ -36,63 +35,56 @@ function MarionetteComponent() {
 
 MarionetteComponent.prototype = {
   classDescription: "Marionette component",
   classID: MARIONETTE_CID,
   contractID: MARIONETTE_CONTRACTID,
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
   _xpcom_categories: [{category: "profile-after-change", service: true}],
   original_forcelocal: null,
+  appName: Services.appinfo.name,
 
   onSocketAccepted: function mc_onSocketAccepted(aSocket, aTransport) {
     this.logger.info("onSocketAccepted for Marionette dummy socket");
   },
 
   onStopListening: function mc_onStopListening(aSocket, status) {
     this.logger.info("onStopListening for Marionette dummy socket, code " + status);
     aSocket.close();
   },
 
   observe: function mc_observe(aSubject, aTopic, aData) {
     let observerService = Services.obs;
     switch (aTopic) {
       case "profile-after-change":
-        let appName = Services.appinfo.name;
         let enabled = false;
-        let loadearly = appName == 'B2G' ? false : true;
         try {
           enabled = Services.prefs.getBoolPref(MARIONETTE_ENABLED_PREF);
-          loadearly = Services.prefs.getBoolPref(MARIONETTE_LOADEARLY_PREF);
         } catch(e) {}
         if (enabled) {
-          this.logger.info("marionette enabled, loadearly: " + loadearly);
+          this.logger.info("marionette enabled");
 
           //add observers
-          if (loadearly) {
-            observerService.addObserver(this, "final-ui-startup", false);
-          }
-          else {
-            observerService.addObserver(this, "system-message-listener-ready", false);
-          }
+          observerService.addObserver(this, "final-ui-startup", false);
           observerService.addObserver(this, "xpcom-shutdown", false);
         }
         else {
           this.logger.info("marionette not enabled");
         }
         break;
-      case "system-message-listener-ready":
-        this.logger.info("marionette initializing at system-message-listener-ready");
-        observerService.removeObserver(this, "system-message-listener-ready");
+      case "final-ui-startup":
+        this.logger.info("marionette initializing at " + aTopic);
+        observerService.removeObserver(this, aTopic);
 
         try {
           this.original_forcelocal = Services.prefs.getBoolPref(DEBUGGER_FORCELOCAL_PREF);
         }
         catch(e) {}
 
-        let marionette_forcelocal = false;
+        let marionette_forcelocal = this.appName == 'B2G' ? false : true;
         try {
           marionette_forcelocal = Services.prefs.getBoolPref(MARIONETTE_FORCELOCAL_PREF);
         }
         catch(e) {}
         Services.prefs.setBoolPref(DEBUGGER_FORCELOCAL_PREF, marionette_forcelocal);
 
         if (!marionette_forcelocal) {
           // See bug 800138.  Because the first socket that opens with
@@ -100,21 +92,16 @@ MarionetteComponent.prototype = {
           // This allows the following attempt by Marionette to open a socket
           // to succeed.
           let insaneSacrificialGoat = new ServerSocket(666, false, 4);
           insaneSacrificialGoat.asyncListen(this);
         }
 
         this.init();
         break;
-      case "final-ui-startup":
-        this.logger.info("marionette initializing at final-ui-startup");
-        observerService.removeObserver(this, "final-ui-startup");
-        this.init();
-        break;
       case "xpcom-shutdown":
         observerService.removeObserver(this, "xpcom-shutdown");
         this.uninit();
         break;
     }
   },
 
   init: function mc_init() {