Bug 766206 - Workaround to get Marionette working on B2G again, r=mdas, DONTBUILD because NPOTB
authorJonathan Griffin <jgriffin@mozilla.com>
Tue, 19 Jun 2012 11:43:19 -0700
changeset 99719 a84944a6727f448e183f0543694c072238cd1874
parent 99718 47e5c4fe2bb00e011756430b3009451e2e3253c8
child 99720 1f7af949b2809ea37436462acec391282f5e7983
push id1729
push userlsblakk@mozilla.com
push dateMon, 16 Jul 2012 20:02:43 +0000
treeherdermozilla-aurora@f4e75e148951 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmdas, DONTBUILD
bugs766206
milestone16.0a1
Bug 766206 - Workaround to get Marionette working on B2G again, r=mdas, DONTBUILD because NPOTB
testing/marionette/components/marionettecomponent.js
--- a/testing/marionette/components/marionettecomponent.js
+++ b/testing/marionette/components/marionettecomponent.js
@@ -1,16 +1,17 @@
 /* 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/. */
 
 const {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';
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/FileUtils.jsm");
 Cu.import("resource://gre/modules/services-common/log4moz.js");
 
 function MarionetteComponent() {
   this._loaded = false;
@@ -67,20 +68,26 @@ MarionetteComponent.prototype = {
       catch(e) {
         port = 2828;
       }
       try {
         Cu.import('resource:///modules/devtools/dbg-server.jsm');
         DebuggerServer.addActors('chrome://marionette/content/marionette-actors.js');
         // This pref is required for the remote debugger to open a socket,
         // so force it to true.  See bug 761252.
-        Services.prefs.setBoolPref('devtools.debugger.remote-enabled', true);
+        let original = false;
+        try {
+          original = Services.prefs.getBoolPref(DEBUGGER_ENABLED_PREF);
+        }
+        catch() { }
+        Services.prefs.setBoolPref(DEBUGGER_ENABLED_PREF, true);
         // Always allow remote connections.
         DebuggerServer.initTransport(function () { return true; });
         DebuggerServer.openListener(port, true);
+        Services.prefs.setBoolPref(DEBUGGER_ENABLED_PREF, original);
       }
       catch(e) {
         this.logger.error('exception: ' + e.name + ', ' + e.message);
       }
     }
   },
 
   uninit: function mc_uninit() {