merge fx-team to mozilla-central a=merge
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Wed, 03 Dec 2014 13:38:31 +0100
changeset 218287 a9fc46355661f97946e05355264767bfd77ab6a7
parent 218274 59b7bf5d119dfeb360cd5fdc24d5adc5824973fd (current diff)
parent 218286 e16e9086a2457cbb6a2f7657589a1672188b4b3b (diff)
child 218291 5c598106e00618ae9b4c0085d84e9a57b35d5140
child 218307 cf88e4903bb6130f3fac2b03da0ae0fdcd11058d
child 218321 56c4ff0d6219054abf954b8fc55b54db8421dae1
push id27926
push usercbook@mozilla.com
push dateWed, 03 Dec 2014 12:39:10 +0000
treeherdermozilla-central@a9fc46355661 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone37.0a1
first release with
nightly linux32
a9fc46355661 / 37.0a1 / 20141204030201 / files
nightly linux64
a9fc46355661 / 37.0a1 / 20141204030201 / files
nightly mac
a9fc46355661 / 37.0a1 / 20141204030201 / files
nightly win32
a9fc46355661 / 37.0a1 / 20141204030201 / files
nightly win64
a9fc46355661 / 37.0a1 / 20141204030201 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
merge fx-team to mozilla-central a=merge
--- a/addon-sdk/source/test/addons/page-mod-debugger-post/main.js
+++ b/addon-sdk/source/test/addons/page-mod-debugger-post/main.js
@@ -24,17 +24,17 @@ TAB_URL = data.url('index.html');
 let mod;
 
 exports.testDebugger = function(assert, done) {
   ok = assert.ok.bind(assert);
   assert.pass('starting test');
   set('devtools.debugger.log', true);
 
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     tabs.open({
       url: TAB_URL,
--- a/addon-sdk/source/test/addons/page-mod-debugger-pre/main.js
+++ b/addon-sdk/source/test/addons/page-mod-debugger-pre/main.js
@@ -31,17 +31,17 @@ exports.testDebugger = function(assert, 
   mod = PageMod({
     include: TAB_URL,
     attachTo: ['existing', 'top', 'frame'],
     contentScriptFile: data.url('script.js'),
   });
   ok(true, 'PageMod was created');
 
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     tabs.open({
       url: TAB_URL,
--- a/b2g/chrome/content/devtools/debugger.js
+++ b/b2g/chrome/content/devtools/debugger.js
@@ -69,17 +69,17 @@ let RemoteDebugger = {
   },
 
   initServer: function() {
     if (DebuggerServer.initialized) {
       return;
     }
 
     // Ask for remote connections.
-    DebuggerServer.init(this.prompt.bind(this));
+    DebuggerServer.init();
 
     // /!\ Be careful when adding a new actor, especially global actors.
     // Any new global actor will be exposed and returned by the root actor.
 
     // Add Firefox-specific actors, but prevent tab actors to be loaded in
     // the parent process, unless we enable certified apps debugging.
     let restrictPrivileges = Services.prefs.getBoolPref("devtools.debugger.forbid-certified-apps");
     DebuggerServer.addBrowserActors("navigator:browser", restrictPrivileges);
@@ -114,16 +114,18 @@ let RemoteDebugger = {
 #ifdef MOZ_WIDGET_GONK
     DebuggerServer.on("connectionchange", function() {
       AdbController.updateState();
     });
 #endif
   }
 };
 
+RemoteDebugger.prompt = RemoteDebugger.prompt.bind(RemoteDebugger);
+
 let USBRemoteDebugger = {
 
   get isDebugging() {
     if (!this._listener) {
       return false;
     }
 
     return DebuggerServer._connections &&
@@ -139,16 +141,17 @@ let USBRemoteDebugger = {
 
     let portOrPath =
       Services.prefs.getCharPref("devtools.debugger.unix-domain-socket") ||
       "/data/local/debugger-socket";
 
     try {
       debug("Starting USB debugger on " + portOrPath);
       this._listener = DebuggerServer.openListener(portOrPath);
+      this._listener.allowConnection = RemoteDebugger.prompt;
       // Temporary event, until bug 942756 lands and offers a way to know
       // when the server is up and running.
       Services.obs.notifyObservers(null, "debugger-server-started", null);
     } catch (e) {
       debug("Unable to start USB debugger server: " + e);
     }
   },
 
@@ -174,16 +177,17 @@ let WiFiRemoteDebugger = {
       return;
     }
 
     RemoteDebugger.initServer();
 
     try {
       debug("Starting WiFi debugger");
       this._listener = DebuggerServer.openListener(-1);
+      this._listener.allowConnection = RemoteDebugger.prompt;
       let port = this._listener.port;
       debug("Started WiFi debugger on " + port);
       discovery.addService("devtools", { port: port });
     } catch (e) {
       debug("Unable to start WiFi debugger server: " + e);
     }
   },
 
--- a/browser/devtools/app-manager/test/test_connection_store.html
+++ b/browser/devtools/app-manager/test/test_connection_store.html
@@ -23,17 +23,17 @@ Bug 901519 - [app manager] data store fo
     </div>
 
     <script type="application/javascript;version=1.8" src="chrome://browser/content/devtools/app-manager/template.js"></script>
     <script type="application/javascript;version=1.8">
       const Cu = Components.utils;
       Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
 
       if (!DebuggerServer.initialized) {
-        DebuggerServer.init(function () { return true; });
+        DebuggerServer.init();
         DebuggerServer.addBrowserActors();
       }
 
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Cu.import("resource://gre/modules/Services.jsm");
         Cu.import("resource:///modules/devtools/gDevTools.jsm");
--- a/browser/devtools/app-manager/test/test_device_store.html
+++ b/browser/devtools/app-manager/test/test_device_store.html
@@ -17,17 +17,17 @@ Bug 901520 - [app manager] data store fo
   <body>
 
     <script type="application/javascript;version=1.8" src="chrome://browser/content/devtools/app-manager/template.js"></script>
     <script type="application/javascript;version=1.8">
       const Cu = Components.utils;
       Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
 
       if (!DebuggerServer.initialized) {
-        DebuggerServer.init(function () { return true; });
+        DebuggerServer.init();
         DebuggerServer.addBrowserActors();
       }
 
       function compare(o1, o2, msg) {
         is(JSON.stringify(o1), JSON.stringify(o2), msg);
       }
 
       window.onload = function() {
--- a/browser/devtools/app-manager/test/test_remain_connected.html
+++ b/browser/devtools/app-manager/test/test_remain_connected.html
@@ -17,17 +17,17 @@ Bug 912646 - Closing app toolbox causes 
   <body>
 
     <script type="application/javascript;version=1.8">
       const Cu = Components.utils;
 
       Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
 
       if (!DebuggerServer.initialized) {
-        DebuggerServer.init(function () { return true; });
+        DebuggerServer.init();
         DebuggerServer.addBrowserActors();
       }
 
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Cu.import("resource:///modules/devtools/gDevTools.jsm");
 
--- a/browser/devtools/canvasdebugger/test/head.js
+++ b/browser/devtools/canvasdebugger/test/head.js
@@ -179,17 +179,17 @@ function navigate(aTarget, aUrl, aWaitFo
 
 function reload(aTarget, aWaitForTargetEvent = "navigate") {
   executeSoon(() => aTarget.activeTab.reload());
   return once(aTarget, aWaitForTargetEvent);
 }
 
 function initServer() {
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 }
 
 function initCallWatcherBackend(aUrl) {
   info("Initializing a call watcher front.");
   initServer();
 
--- a/browser/devtools/debugger/test/browser_dbg_addonactor.js
+++ b/browser/devtools/debugger/test/browser_dbg_addonactor.js
@@ -5,17 +5,17 @@
 
 const ADDON3_URL = EXAMPLE_URL + "addon3.xpi";
 const ADDON_MODULE_URL = "resource://jid1-ami3akps3baaeg-at-jetpack/browser_dbg_addon3/lib/main.js";
 
 var gAddon, gClient, gThreadClient;
 
 function test() {
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     is(aType, "browser",
       "Root actor should identify itself as a browser.");
--- a/browser/devtools/debugger/test/browser_dbg_break-on-dom-event-01.js
+++ b/browser/devtools/debugger/test/browser_dbg_break-on-dom-event-01.js
@@ -6,17 +6,17 @@
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_event-listeners-01.html";
 
 let gClient, gThreadClient, gInput, gButton;
 
 function test() {
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     is(aType, "browser",
       "Root actor should identify itself as a browser.");
--- a/browser/devtools/debugger/test/browser_dbg_break-on-dom-event-02.js
+++ b/browser/devtools/debugger/test/browser_dbg_break-on-dom-event-02.js
@@ -7,17 +7,17 @@
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_event-listeners-03.html";
 
 let gClient, gThreadClient;
 
 function test() {
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     is(aType, "browser",
       "Root actor should identify itself as a browser.");
--- a/browser/devtools/debugger/test/browser_dbg_chrome-debugging.js
+++ b/browser/devtools/debugger/test/browser_dbg_chrome-debugging.js
@@ -15,17 +15,17 @@ let gNewChromeSource = promise.defer()
 let { DevToolsLoader } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
 let loader = new DevToolsLoader();
 loader.invisibleToDebugger = true;
 loader.main("devtools/server/main");
 let DebuggerServer = loader.DebuggerServer;
 
 function test() {
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     is(aType, "browser",
       "Root actor should identify itself as a browser.");
--- a/browser/devtools/debugger/test/browser_dbg_debugger-statement.js
+++ b/browser/devtools/debugger/test/browser_dbg_debugger-statement.js
@@ -7,17 +7,17 @@
 
 const TAB_URL = EXAMPLE_URL + "doc_inline-debugger-statement.html";
 
 let gClient;
 let gTab;
 
 function test() {
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     is(aType, "browser",
       "Root actor should identify itself as a browser.");
--- a/browser/devtools/debugger/test/browser_dbg_event-listeners-01.js
+++ b/browser/devtools/debugger/test/browser_dbg_event-listeners-01.js
@@ -7,17 +7,17 @@
 
 const TAB_URL = EXAMPLE_URL + "doc_event-listeners-01.html";
 
 let gClient;
 let gTab;
 
 function test() {
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     is(aType, "browser",
       "Root actor should identify itself as a browser.");
--- a/browser/devtools/debugger/test/browser_dbg_event-listeners-02.js
+++ b/browser/devtools/debugger/test/browser_dbg_event-listeners-02.js
@@ -8,17 +8,17 @@
 
 const TAB_URL = EXAMPLE_URL + "doc_event-listeners-03.html";
 
 let gClient;
 let gTab;
 
 function test() {
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     is(aType, "browser",
       "Root actor should identify itself as a browser.");
--- a/browser/devtools/debugger/test/browser_dbg_event-listeners-03.js
+++ b/browser/devtools/debugger/test/browser_dbg_event-listeners-03.js
@@ -8,17 +8,17 @@
 
 const TAB_URL = EXAMPLE_URL + "doc_native-event-handler.html";
 
 let gClient;
 let gTab;
 
 function test() {
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     is(aType, "browser",
       "Root actor should identify itself as a browser.");
--- a/browser/devtools/debugger/test/browser_dbg_globalactor.js
+++ b/browser/devtools/debugger/test/browser_dbg_globalactor.js
@@ -7,17 +7,17 @@
 
 const CHROME_URL = "chrome://mochitests/content/browser/browser/devtools/debugger/test/"
 const ACTORS_URL = CHROME_URL + "testactors.js";
 
 function test() {
   let gClient;
 
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   DebuggerServer.addActors(ACTORS_URL);
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
--- a/browser/devtools/debugger/test/browser_dbg_listaddons.js
+++ b/browser/devtools/debugger/test/browser_dbg_listaddons.js
@@ -6,17 +6,17 @@
  */
 const ADDON1_URL = EXAMPLE_URL + "addon1.xpi";
 const ADDON2_URL = EXAMPLE_URL + "addon2.xpi";
 
 let gAddon1, gAddon1Actor, gAddon2, gAddon2Actor, gClient;
 
 function test() {
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     is(aType, "browser",
       "Root actor should identify itself as a browser.");
--- a/browser/devtools/debugger/test/browser_dbg_listtabs-01.js
+++ b/browser/devtools/debugger/test/browser_dbg_listtabs-01.js
@@ -7,17 +7,17 @@
 
 const TAB1_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
 const TAB2_URL = EXAMPLE_URL + "doc_empty-tab-02.html";
 
 let gTab1, gTab1Actor, gTab2, gTab2Actor, gClient;
 
 function test() {
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     is(aType, "browser",
       "Root actor should identify itself as a browser.");
--- a/browser/devtools/debugger/test/browser_dbg_listtabs-02.js
+++ b/browser/devtools/debugger/test/browser_dbg_listtabs-02.js
@@ -20,17 +20,17 @@ let gNewWindow;
 // Stock onListChanged handler.
 let onListChangedCount = 0;
 function onListChangedHandler() {
   onListChangedCount++;
 }
 
 function test() {
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   gTabList = new BrowserTabList("fake DebuggerServerConnection");
   gTabList._testing = true;
   gTabList.onListChanged = onListChangedHandler;
 
   checkSingleTab()
--- a/browser/devtools/debugger/test/browser_dbg_listtabs-03.js
+++ b/browser/devtools/debugger/test/browser_dbg_listtabs-03.js
@@ -22,17 +22,17 @@ function listTabs() {
 function request(params) {
   let deferred = promise.defer();
   gClient.request(params, deferred.resolve);
   return deferred.promise;
 }
 
 function test() {
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect(Task.async(function*(aType, aTraits) {
     is(aType, "browser",
       "Root actor should identify itself as a browser.");
--- a/browser/devtools/debugger/test/browser_dbg_multiple-windows.js
+++ b/browser/devtools/debugger/test/browser_dbg_multiple-windows.js
@@ -9,17 +9,17 @@
 const TAB1_URL = EXAMPLE_URL + "doc_script-switching-01.html";
 const TAB2_URL = EXAMPLE_URL + "doc_script-switching-02.html";
 
 let gNewTab, gNewWindow;
 let gClient;
 
 function test() {
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     is(aType, "browser",
       "Root actor should identify itself as a browser.");
--- a/browser/devtools/debugger/test/browser_dbg_navigation.js
+++ b/browser/devtools/debugger/test/browser_dbg_navigation.js
@@ -7,17 +7,17 @@
 
 const TAB1_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
 const TAB2_URL = EXAMPLE_URL + "doc_empty-tab-02.html";
 
 let gClient;
 
 function test() {
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     is(aType, "browser",
       "Root actor should identify itself as a browser.");
--- a/browser/devtools/debugger/test/browser_dbg_tabactor-01.js
+++ b/browser/devtools/debugger/test/browser_dbg_tabactor-01.js
@@ -8,17 +8,17 @@
 const CHROME_URL = "chrome://mochitests/content/browser/browser/devtools/debugger/test/"
 const ACTORS_URL = CHROME_URL + "testactors.js";
 const TAB_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
 
 let gClient;
 
 function test() {
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   DebuggerServer.addActors(ACTORS_URL);
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
--- a/browser/devtools/debugger/test/browser_dbg_tabactor-02.js
+++ b/browser/devtools/debugger/test/browser_dbg_tabactor-02.js
@@ -8,17 +8,17 @@
 const CHROME_URL = "chrome://mochitests/content/browser/browser/devtools/debugger/test/"
 const ACTORS_URL = CHROME_URL + "testactors.js";
 const TAB_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
 
 let gClient;
 
 function test() {
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   DebuggerServer.addActors(ACTORS_URL);
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
--- a/browser/devtools/debugger/test/head.js
+++ b/browser/devtools/debugger/test/head.js
@@ -546,17 +546,17 @@ function AddonDebugger() {
   EventEmitter.decorate(this);
 }
 
 AddonDebugger.prototype = {
   init: Task.async(function*(aUrl) {
     info("Initializing an addon debugger panel.");
 
     if (!DebuggerServer.initialized) {
-      DebuggerServer.init(() => true);
+      DebuggerServer.init();
       DebuggerServer.addBrowserActors();
     }
 
     this.frame = document.createElement("iframe");
     this.frame.setAttribute("height", 400);
     document.documentElement.appendChild(this.frame);
     window.addEventListener("message", this._onMessage);
 
--- a/browser/devtools/framework/connect/connect.js
+++ b/browser/devtools/framework/connect/connect.js
@@ -57,19 +57,19 @@ function submit() {
   Services.prefs.setCharPref("devtools.debugger.remote-host", host);
 
   let port = document.getElementById("port").value;
   Services.prefs.setIntPref("devtools.debugger.remote-port", port);
 
   // Initiate the connection
   let transport;
   try {
-    transport = debuggerSocketConnect(host, port);
+    transport = DebuggerClient.socketConnect(host, port);
   } catch(e) {
-    // Bug 921850: catch rare exception from debuggerSocketConnect
+    // Bug 921850: catch rare exception from DebuggerClient.socketConnect
     showError("unexpected");
     return;
   }
   gClient = new DebuggerClient(transport);
   let delay = Services.prefs.getIntPref("devtools.debugger.remote-timeout");
   gConnectionTimeout = setTimeout(handleConnectionTimeout, delay);
   gClient.connect(onConnectionReady);
 }
--- a/browser/devtools/framework/test/browser_target_remote.js
+++ b/browser/devtools/framework/test/browser_target_remote.js
@@ -8,17 +8,17 @@ let { DebuggerClient } =
 let { devtools } =
   Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
 
 // Ensure target is closed if client is closed directly
 function test() {
   waitForExplicitFinish();
 
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(function () { return true; });
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   var client = new DebuggerClient(DebuggerServer.connectPipe());
   client.connect(() => {
     client.listTabs(response => {
       let options = {
         form: response,
--- a/browser/devtools/framework/test/browser_target_support.js
+++ b/browser/devtools/framework/test/browser_target_support.js
@@ -56,17 +56,17 @@ function* testTarget (client, target) {
   close(target, client);
 }
 
 // Ensure target is closed if client is closed directly
 function test() {
   waitForExplicitFinish();
 
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(function () { return true; });
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   var client = new DebuggerClient(DebuggerServer.connectPipe());
   client.connect(() => {
     client.listTabs(response => {
       let options = {
         form: response,
--- a/browser/devtools/framework/test/browser_toolbox_tool_remote_reopen.js
+++ b/browser/devtools/framework/test/browser_toolbox_tool_remote_reopen.js
@@ -61,17 +61,17 @@ function runTools(target) {
     yield toolbox.destroy();
   });
 }
 
 function getClient() {
   let deferred = promise.defer();
 
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   let client = new DebuggerClient(transport);
 
   client.connect(() => {
     deferred.resolve(client);
--- a/browser/devtools/framework/test/browser_two_tabs.js
+++ b/browser/devtools/framework/test/browser_two_tabs.js
@@ -18,17 +18,17 @@ const TAB_URL_2 = "data:text/html;charse
 let gClient;
 let gTab1, gTab2;
 let gTabActor1, gTabActor2;
 
 function test() {
   waitForExplicitFinish();
 
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   openTabs();
 }
 
 function openTabs() {
   // Open two tabs, select the second
--- a/browser/devtools/framework/toolbox-options.js
+++ b/browser/devtools/framework/toolbox-options.js
@@ -76,16 +76,19 @@ function OptionsPanel(iframeWindow, tool
   this.panelWin = iframeWindow;
 
   this.toolbox = toolbox;
   this.isReady = false;
 
   this._prefChanged = this._prefChanged.bind(this);
   this._themeRegistered = this._themeRegistered.bind(this);
   this._themeUnregistered = this._themeUnregistered.bind(this);
+  this._disableJSClicked = this._disableJSClicked.bind(this);
+
+  this.disableJSNode = this.panelDoc.getElementById("devtools-disable-javascript");
 
   this._addListeners();
 
   Services.obs.addObserver(this, kDeveditionChangedNotification, false);
   const EventEmitter = require("devtools/toolkit/event-emitter");
   EventEmitter.decorate(this);
 }
 
@@ -107,21 +110,16 @@ OptionsPanel.prototype = {
 
     return targetPromise.then(() => {
       this.setupToolsList();
       this.setupToolbarButtonsList();
       this.setupThemeList();
       this.setupBrowserThemeButton();
       this.populatePreferences();
       this.updateDefaultTheme();
-
-      this._disableJSClicked = this._disableJSClicked.bind(this);
-
-      let disableJSNode = this.panelDoc.getElementById("devtools-disable-javascript");
-      disableJSNode.addEventListener("click", this._disableJSClicked, false);
     }).then(() => {
       this.isReady = true;
       this.emit("ready");
       return this;
     }).then(null, function onError(aReason) {
       Cu.reportError("OptionsPanel open failed. " +
                      aReason.error + ": " + aReason.message);
     });
@@ -364,21 +362,25 @@ OptionsPanel.prototype = {
           break;
         }
       }
       menulist.addEventListener("command", function() {
         setPrefAndEmit(this.getAttribute("data-pref"), this.value);
       }.bind(menulist));
     }
 
-    this.target.client.attachTab(this.target.activeTab._actor, (response) => {
-      this._origJavascriptEnabled = response.javascriptEnabled;
-
-      this._populateDisableJSCheckbox();
-    });
+    if (this.target.activeTab) {
+      this.target.client.attachTab(this.target.activeTab._actor, (response) => {
+        this._origJavascriptEnabled = response.javascriptEnabled;
+        this.disableJSNode.checked = !this._origJavascriptEnabled
+        this.disableJSNode.addEventListener("click", this._disableJSClicked, false);
+      });
+    } else {
+      this.disableJSNode.hidden = true;
+    }
   },
 
   updateDefaultTheme: function() {
     // Make sure a theme is set in case the previous one coming from
     // an extension isn't available anymore.
     let themeBox = this.panelDoc.getElementById("devtools-theme-box");
     if (themeBox.selectedIndex == -1) {
       themeBox.selectedItem = themeBox.querySelector("[value=light]");
@@ -390,21 +392,16 @@ OptionsPanel.prototype = {
     let themeBox = this.panelDoc.getElementById("devtools-theme-box");
     let themeOption = themeBox.querySelector("[value=" + currentTheme + "]");
 
     if (themeOption) {
       themeBox.selectedItem = themeOption;
     }
   },
 
-  _populateDisableJSCheckbox: function() {
-    let cbx = this.panelDoc.getElementById("devtools-disable-javascript");
-    cbx.checked = !this._origJavascriptEnabled;
-  },
-
   /**
    * Disables JavaScript for the currently loaded tab. We force a page refresh
    * here because setting docShell.allowJavascript to true fails to block JS
    * execution from event listeners added using addEventListener(), AJAX calls
    * and timers. The page refresh prevents these things from being added in the
    * first place.
    *
    * @param {Event} event
@@ -442,33 +439,31 @@ OptionsPanel.prototype = {
   destroy: function() {
     if (this.destroyPromise) {
       return this.destroyPromise;
     }
 
     let deferred = promise.defer();
 
     this.destroyPromise = deferred.promise;
-
-    let disableJSNode = this.panelDoc.getElementById("devtools-disable-javascript");
-    disableJSNode.removeEventListener("click", this._disableJSClicked, false);
-
     this._removeListeners();
 
-    this.panelWin = this.panelDoc = null;
-    this._disableJSClicked = null;
+    if (this.target.activeTab) {
+      this.disableJSNode.removeEventListener("click", this._disableJSClicked, false);
+      // If JavaScript is disabled we need to revert it to it's original value.
+      let options = {
+        "javascriptEnabled": this._origJavascriptEnabled
+      };
+      this.target.activeTab.reconfigure(options, () => {
+        this.toolbox = null;
+        deferred.resolve();
+      }, true);
+    }
 
-    // If JavaScript is disabled we need to revert it to it's original value.
-    let options = {
-      "javascriptEnabled": this._origJavascriptEnabled
-    };
-    this.target.activeTab.reconfigure(options, () => {
-      this.toolbox = null;
-      deferred.resolve();
-    }, true);
+    this.panelWin = this.panelDoc = this.disableJSNode = null;
 
     Services.obs.removeObserver(this, kDeveditionChangedNotification);
 
     return deferred.promise;
   }
 };
 
 /* Set a pref and emit the pref-changed event if needed. */
--- a/browser/devtools/framework/toolbox-process-window.js
+++ b/browser/devtools/framework/toolbox-process-window.js
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
 let { gDevTools } = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
 let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
 let { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
-let { debuggerSocketConnect, DebuggerClient } =
+let { DebuggerClient } =
   Cu.import("resource://gre/modules/devtools/dbg-client.jsm", {});
 let { ViewHelpers } =
   Cu.import("resource:///modules/devtools/ViewHelpers.jsm", {});
 
 /**
  * Shortcuts for accessing various debugger preferences.
  */
 let Prefs = new ViewHelpers.Prefs("devtools.debugger", {
@@ -21,17 +21,17 @@ let Prefs = new ViewHelpers.Prefs("devto
   chromeDebuggingPort: ["Int", "chrome-debugging-port"]
 });
 
 let gToolbox, gClient;
 
 function connect() {
   window.removeEventListener("load", connect);
   // Initiate the connection
-  let transport = debuggerSocketConnect(
+  let transport = DebuggerClient.socketConnect(
     Prefs.chromeDebuggingHost,
     Prefs.chromeDebuggingPort
   );
   gClient = new DebuggerClient(transport);
   gClient.connect(() => {
     let addonID = getParameterByName("addonID");
 
     if (addonID) {
--- a/browser/devtools/performance/test/head.js
+++ b/browser/devtools/performance/test/head.js
@@ -134,17 +134,17 @@ function onceSpread(aTarget, aEventName,
 function test () {
   Task.spawn(spawnTest).then(finish, handleError);
 }
 
 function initBackend(aUrl) {
   info("Initializing a performance front.");
 
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   return Task.spawn(function*() {
     let tab = yield addTab(aUrl);
     let target = TargetFactory.forTab(tab);
 
     yield target.makeRemote();
--- a/browser/devtools/shadereditor/test/head.js
+++ b/browser/devtools/shadereditor/test/head.js
@@ -229,17 +229,17 @@ function reload(aTarget, aWaitForTargetE
   executeSoon(() => aTarget.activeTab.reload());
   return once(aTarget, aWaitForTargetEvent);
 }
 
 function initBackend(aUrl) {
   info("Initializing a shader editor front.");
 
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   return Task.spawn(function*() {
     let tab = yield addTab(aUrl);
     let target = TargetFactory.forTab(tab);
 
     yield target.makeRemote();
--- a/browser/devtools/webaudioeditor/test/head.js
+++ b/browser/devtools/webaudioeditor/test/head.js
@@ -124,17 +124,17 @@ function navigate(aTarget, aUrl, aWaitFo
 function test () {
   Task.spawn(spawnTest).then(finish, handleError);
 }
 
 function initBackend(aUrl) {
   info("Initializing a web audio editor front.");
 
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   return Task.spawn(function*() {
     let tab = yield addTab(aUrl);
     let target = TargetFactory.forTab(tab);
 
     yield target.makeRemote();
--- a/browser/devtools/webide/test/browser_tabs.js
+++ b/browser/devtools/webide/test/browser_tabs.js
@@ -10,17 +10,17 @@ function test() {
 
   Task.spawn(function() {
     const { DebuggerServer } =
       Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
 
     // Since we test the connections set below, destroy the server in case it
     // was left open.
     DebuggerServer.destroy();
-    DebuggerServer.init(function () { return true; });
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
 
     let tab = yield addTab(TEST_URI);
 
     let win = yield openWebIDE();
 
     yield connectToLocal(win);
 
--- a/browser/devtools/webide/test/test_autoconnect_runtime.html
+++ b/browser/devtools/webide/test/test_autoconnect_runtime.html
@@ -16,17 +16,17 @@
 
     <script type="application/javascript;version=1.8">
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Task.spawn(function* () {
 
           Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
-          DebuggerServer.init(function () { return true; });
+          DebuggerServer.init();
           DebuggerServer.addBrowserActors();
 
           let win = yield openWebIDE();
 
           let fakeRuntime = {
             type: "USB",
             connect: function(connection) {
               is(connection, win.AppManager.connection, "connection is valid");
--- a/browser/devtools/webide/test/test_device_preferences.html
+++ b/browser/devtools/webide/test/test_device_preferences.html
@@ -16,17 +16,17 @@
     <script type="application/javascript;version=1.8">
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Task.spawn(function* () {
           Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
 
           if (!DebuggerServer.initialized) {
-            DebuggerServer.init(function () { return true; });
+            DebuggerServer.init();
             DebuggerServer.addBrowserActors();
           }
 
           let win = yield openWebIDE();
 
           let prefIframe = win.document.querySelector("#deck-panel-devicepreferences");
 
           yield documentIsLoaded(prefIframe.contentWindow.document);
--- a/browser/devtools/webide/test/test_deviceinfo.html
+++ b/browser/devtools/webide/test/test_deviceinfo.html
@@ -17,17 +17,17 @@
     <script type="application/javascript;version=1.8">
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Task.spawn(function* () {
           Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
 
           if (!DebuggerServer.initialized) {
-            DebuggerServer.init(function () { return true; });
+            DebuggerServer.init();
             DebuggerServer.addBrowserActors();
           }
 
           let win = yield openWebIDE();
 
           let permIframe = win.document.querySelector("#deck-panel-permissionstable");
           let infoIframe = win.document.querySelector("#deck-panel-runtimedetails");
 
--- a/browser/devtools/webide/test/test_runtime.html
+++ b/browser/devtools/webide/test/test_runtime.html
@@ -38,17 +38,17 @@
 
           function isStopActive() {
             return !win.document.querySelector("#cmd_stop").hasAttribute("disabled");
           }
 
           Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
 
           if (!DebuggerServer.initialized) {
-            DebuggerServer.init(function () { return true; });
+            DebuggerServer.init();
             DebuggerServer.addBrowserActors();
           }
 
           win = yield openWebIDE();
 
           win.AppManager.runtimeList.usb.push({
             connect: function(connection) {
               is(connection, win.AppManager.connection, "connection is valid");
--- a/browser/devtools/webide/test/test_telemetry.html
+++ b/browser/devtools/webide/test/test_telemetry.html
@@ -218,17 +218,17 @@
             resetTelemetry();
           });
         });
 
         Task.spawn(function*() {
           Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
 
           if (!DebuggerServer.initialized) {
-            DebuggerServer.init(function () { return true; });
+            DebuggerServer.init();
             DebuggerServer.addBrowserActors();
           }
 
           patchTelemetry();
 
           // Cycle once, so we can test for multiple opens
           yield cycleWebIDE();
 
--- a/browser/themes/linux/jar.mn
+++ b/browser/themes/linux/jar.mn
@@ -211,16 +211,17 @@ browser.jar:
   skin/classic/browser/devedition/search.svg          (../shared/devedition/search.svg)
   skin/classic/browser/devedition/urlbar-history-dropmarker.svg            (../shared/devedition/urlbar-history-dropmarker.svg)
 * skin/classic/browser/devtools/common.css            (../shared/devtools/common.css)
 * skin/classic/browser/devtools/dark-theme.css        (../shared/devtools/dark-theme.css)
 * skin/classic/browser/devtools/light-theme.css       (../shared/devtools/light-theme.css)
   skin/classic/browser/devtools/filters.svg           (../shared/devtools/filters.svg)
   skin/classic/browser/devtools/controls.png          (../shared/devtools/images/controls.png)
   skin/classic/browser/devtools/controls@2x.png       (../shared/devtools/images/controls@2x.png)
+  skin/classic/browser/devtools/performance-icons.svg  (../shared/devtools/images/performance-icons.svg)
   skin/classic/browser/devtools/newtab.png             (../shared/devtools/images/newtab.png)
   skin/classic/browser/devtools/newtab@2x.png          (../shared/devtools/images/newtab@2x.png)
   skin/classic/browser/devtools/newtab-inverted.png    (../shared/devtools/images/newtab-inverted.png)
   skin/classic/browser/devtools/newtab-inverted@2x.png (../shared/devtools/images/newtab-inverted@2x.png)
 * skin/classic/browser/devtools/widgets.css           (devtools/widgets.css)
   skin/classic/browser/devtools/filetype-dir-close.svg        (../shared/devtools/images/filetypes/dir-close.svg)
   skin/classic/browser/devtools/filetype-dir-open.svg         (../shared/devtools/images/filetypes/dir-open.svg)
   skin/classic/browser/devtools/filetype-globe.svg            (../shared/devtools/images/filetypes/globe.svg)
--- a/browser/themes/osx/jar.mn
+++ b/browser/themes/osx/jar.mn
@@ -337,16 +337,17 @@ browser.jar:
   skin/classic/browser/devedition/search.svg                (../shared/devedition/search.svg)
   skin/classic/browser/devedition/urlbar-history-dropmarker.svg            (../shared/devedition/urlbar-history-dropmarker.svg)
 * skin/classic/browser/devtools/common.css                  (../shared/devtools/common.css)
 * skin/classic/browser/devtools/dark-theme.css              (../shared/devtools/dark-theme.css)
 * skin/classic/browser/devtools/light-theme.css             (../shared/devtools/light-theme.css)
   skin/classic/browser/devtools/filters.svg                 (../shared/devtools/filters.svg)
   skin/classic/browser/devtools/controls.png                (../shared/devtools/images/controls.png)
   skin/classic/browser/devtools/controls@2x.png             (../shared/devtools/images/controls@2x.png)
+  skin/classic/browser/devtools/performance-icons.svg       (../shared/devtools/images/performance-icons.svg)
   skin/classic/browser/devtools/newtab.png                  (../shared/devtools/images/newtab.png)
   skin/classic/browser/devtools/newtab@2x.png               (../shared/devtools/images/newtab@2x.png)
   skin/classic/browser/devtools/newtab-inverted.png         (../shared/devtools/images/newtab-inverted.png)
   skin/classic/browser/devtools/newtab-inverted@2x.png      (../shared/devtools/images/newtab-inverted@2x.png)
 * skin/classic/browser/devtools/widgets.css                 (devtools/widgets.css)
   skin/classic/browser/devtools/filetype-dir-close.svg      (../shared/devtools/images/filetypes/dir-close.svg)
   skin/classic/browser/devtools/filetype-dir-open.svg       (../shared/devtools/images/filetypes/dir-open.svg)
   skin/classic/browser/devtools/filetype-globe.svg          (../shared/devtools/images/filetypes/globe.svg)
new file mode 100644
--- /dev/null
+++ b/browser/themes/shared/devtools/images/performance-icons.svg
@@ -0,0 +1,41 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px">
+<style>
+  g {
+    fill: #edf0f1;
+  }
+  g:not(:target) {
+    display: none;
+  }
+</style>
+<g id="call-tree">
+  <rect x="1px" y="3.5px" width="14px" height="2px" rx="1" ry="1"/>
+  <rect x="1px" y="7.5px" width="7px" height="2px" rx="1" ry="1"/>
+  <rect x="11px" y="7.5px" width="4px" height="2px" rx="1" ry="1"/>
+  <rect x="4px" y="11.5px" width="4px" height="2px" rx="1" ry="1"/>
+</g>
+<g id="flamechart">
+  <rect x="1px" y="3px" width="14px" height="4px" style="shape-rendering: crispEdges"/>
+  <rect x="1px" y="5px" width="3px" height="5px" rx="1" ry="1"/>
+  <rect x="4px" y="5px" width="3px" height="10px" rx="1" ry="1"/>
+  <rect x="7px" y="5px" width="5px" height="3px" rx="1" ry="1"/>
+  <rect x="12px" y="5px" width="3px" height="7px" rx="1" ry="1"/>
+</g>
+<g id="frame">
+  <rect x="1px" y="4px" width="2px" height="13px" rx="1" ry="1"/>
+  <rect x="5px" y="12px" width="2px" height="5px" rx="1" ry="1"/>
+  <rect x="9px" y="9px" width="2px" height="8px" rx="1" ry="1"/>
+  <rect x="13px" y="7px" width="2px" height="10px" rx="1" ry="1"/>
+</g>
+<g id="markers">
+  <path d="m2.1,2.1h9.6c.6,0 1.1,.5 1.1,1.1 0,.6-.5,1.1-1.1,1.1h-9.6c-.6,0-1.1-.5-1.1-1.1 .1-.6 .5-1.1 1.1-1.1z"/>
+  <path d="m7.4,5.3h7.4c.6,0 1.1,.5 1.1,1.1 0,.6-.5,1.1-1.1,1.1h-7.4c-.5-.1-1-.5-1-1.1 0-.6 .5-1.1 1-1.1z"/>
+  <path d="m5.3,8.5h3.2c.6,0 1.1,.5 1.1,1.1 0,.6-.5,1.1-1.1,1.1h-3.2c-.6,0-1.1-.5-1.1-1.1 .1-.6 .5-1.1 1.1-1.1z"/>
+  <path d="m4.3,11.7h2.1c.6,0 1.1,.5 1.1,1.1 0,.6-.5,1.1-1.1,1.1h-2.1c-.6,0-1.1-.5-1.1-1.1 0-.6 .5-1.1 1.1-1.1z"/>
+  <path d="m4.3,11.7h2.1c.6,0 1.1,.5 1.1,1.1 0,.6-.5,1.1-1.1,1.1h-2.1c-.6,0-1.1-.5-1.1-1.1 0-.6 .5-1.1 1.1-1.1z" style="transform: translateX(7px)"/>
+</g>
+<g id="waterfall">
+  <rect x="1px" y="3px" width="8px" height="2.5px" rx="1" ry="1"/>
+  <rect x="5px" y="7px" width="8px" height="2.5px" rx="1" ry="1"/>
+  <rect x="7px" y="11.5px" width="8px" height="2.5px" rx="1" ry="1"/>
+</g>
+</svg>
\ No newline at end of file
--- a/browser/themes/windows/jar.mn
+++ b/browser/themes/windows/jar.mn
@@ -246,16 +246,17 @@ browser.jar:
         skin/classic/browser/devedition/search.svg                  (../shared/devedition/search.svg)
         skin/classic/browser/devedition/urlbar-history-dropmarker.svg            (../shared/devedition/urlbar-history-dropmarker.svg)
 *       skin/classic/browser/devtools/common.css                    (../shared/devtools/common.css)
 *       skin/classic/browser/devtools/dark-theme.css                (../shared/devtools/dark-theme.css)
 *       skin/classic/browser/devtools/light-theme.css               (../shared/devtools/light-theme.css)
         skin/classic/browser/devtools/filters.svg                   (../shared/devtools/filters.svg)
         skin/classic/browser/devtools/controls.png                  (../shared/devtools/images/controls.png)
         skin/classic/browser/devtools/controls@2x.png               (../shared/devtools/images/controls@2x.png)
+        skin/classic/browser/devtools/performance-icons.svg         (../shared/devtools/images/performance-icons.svg)
         skin/classic/browser/devtools/newtab.png                    (../shared/devtools/images/newtab.png)
         skin/classic/browser/devtools/newtab@2x.png                 (../shared/devtools/images/newtab@2x.png)
         skin/classic/browser/devtools/newtab-inverted.png           (../shared/devtools/images/newtab-inverted.png)
         skin/classic/browser/devtools/newtab-inverted@2x.png        (../shared/devtools/images/newtab-inverted@2x.png)
 *       skin/classic/browser/devtools/widgets.css                   (devtools/widgets.css)
         skin/classic/browser/devtools/filetype-dir-close.svg        (../shared/devtools/images/filetypes/dir-close.svg)
         skin/classic/browser/devtools/filetype-dir-open.svg         (../shared/devtools/images/filetypes/dir-open.svg)
         skin/classic/browser/devtools/filetype-globe.svg            (../shared/devtools/images/filetypes/globe.svg)
@@ -691,16 +692,17 @@ browser.jar:
         skin/classic/aero/browser/devedition/search.svg              (../shared/devedition/search.svg)
         skin/classic/aero/browser/devedition/urlbar-history-dropmarker.svg            (../shared/devedition/urlbar-history-dropmarker.svg)
 *       skin/classic/aero/browser/devtools/common.css                (../shared/devtools/common.css)
 *       skin/classic/aero/browser/devtools/dark-theme.css            (../shared/devtools/dark-theme.css)
 *       skin/classic/aero/browser/devtools/light-theme.css           (../shared/devtools/light-theme.css)
         skin/classic/aero/browser/devtools/filters.svg               (../shared/devtools/filters.svg)
         skin/classic/aero/browser/devtools/controls.png              (../shared/devtools/images/controls.png)
         skin/classic/aero/browser/devtools/controls@2x.png           (../shared/devtools/images/controls@2x.png)
+        skin/classic/aero/browser/devtools/performance-icons.svg     (../shared/devtools/images/performance-icons.svg)
         skin/classic/aero/browser/devtools/newtab.png                (../shared/devtools/images/newtab.png)
         skin/classic/aero/browser/devtools/newtab@2x.png             (../shared/devtools/images/newtab@2x.png)
         skin/classic/aero/browser/devtools/newtab-inverted.png       (../shared/devtools/images/newtab-inverted.png)
         skin/classic/aero/browser/devtools/newtab-inverted@2x.png    (../shared/devtools/images/newtab-inverted@2x.png)
 *       skin/classic/aero/browser/devtools/widgets.css               (devtools/widgets.css)
         skin/classic/aero/browser/devtools/filetype-dir-close.svg    (../shared/devtools/images/filetypes/dir-close.svg)
         skin/classic/aero/browser/devtools/filetype-dir-open.svg     (../shared/devtools/images/filetypes/dir-open.svg)
         skin/classic/aero/browser/devtools/filetype-globe.svg        (../shared/devtools/images/filetypes/globe.svg)
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -7290,25 +7290,26 @@ var RemoteDebugger = {
   _restart: function rd_restart() {
     this._stop();
     this._start();
   },
 
   _start: function rd_start() {
     try {
       if (!DebuggerServer.initialized) {
-        DebuggerServer.init(this._showConnectionPrompt.bind(this));
+        DebuggerServer.init();
         DebuggerServer.addBrowserActors();
         DebuggerServer.registerModule("resource://gre/modules/dbg-browser-actors.js");
       }
 
       let pathOrPort = this._getPath();
       if (!pathOrPort)
         pathOrPort = this._getPort();
-      DebuggerServer.openListener(pathOrPort);
+      let listener = DebuggerServer.openListener(pathOrPort);
+      listener.allowConnection = this._showConnectionPrompt.bind(this);
       dump("Remote debugger listening at path " + pathOrPort);
     } catch(e) {
       dump("Remote debugger didn't start: " + e);
     }
   },
 
   _stop: function rd_start() {
     DebuggerServer.closeAllListeners();
--- a/testing/xpcshell/head.js
+++ b/testing/xpcshell/head.js
@@ -349,17 +349,17 @@ function _initDebugging(port) {
   if (env.get("DEVTOOLS_DEBUGGER_LOG")) {
     prefs.setBoolPref("devtools.debugger.log", true);
   }
   if (env.get("DEVTOOLS_DEBUGGER_LOG_VERBOSE")) {
     prefs.setBoolPref("devtools.debugger.log.verbose", true);
   }
 
   let {DebuggerServer} = Components.utils.import('resource://gre/modules/devtools/dbg-server.jsm', {});
-  DebuggerServer.init(() => true);
+  DebuggerServer.init();
   DebuggerServer.addBrowserActors();
   DebuggerServer.addActors("resource://testing-common/dbg-actors.js");
 
   // An observer notification that tells us when we can "resume" script
   // execution.
   let obsSvc = Components.classes["@mozilla.org/observer-service;1"].
                getService(Components.interfaces.nsIObserverService);
   let initialized = false;
@@ -401,17 +401,18 @@ function _initDebugging(port) {
   do_print("*******************************************************************");
   do_print("Waiting for the debugger to connect on port " + port)
   do_print("")
   do_print("To connect the debugger, open a Firefox instance, select 'Connect'");
   do_print("from the Developer menu and specify the port as " + port);
   do_print("*******************************************************************");
   do_print("")
 
-  DebuggerServer.openListener(port);
+  let listener = DebuggerServer.openListener(port);
+  listener.allowConnection = () => true;
 
   // spin an event loop until the debugger connects.
   let thr = Components.classes["@mozilla.org/thread-manager;1"]
               .getService().currentThread;
   while (!initialized) {
     do_print("Still waiting for debugger to connect...");
     thr.processNextEvent(true);
   }
--- a/toolkit/devtools/apps/tests/debugger-protocol-helper.js
+++ b/toolkit/devtools/apps/tests/debugger-protocol-helper.js
@@ -23,24 +23,24 @@ function connect(onDone) {
     let settingsService = Cc["@mozilla.org/settingsService;1"].getService(Ci.nsISettingsService);
     settingsService.createLock().set("devtools.debugger.remote-enabled", true, null);
     // We can't use `set` callback as it is fired before shell.js code listening for this setting
     // is actually called. Same thing applies to mozsettings-changed obs notification.
     // So listen to a custom event until bug 942756 lands
     let observer = {
       observe: function (subject, topic, data) {
         Services.obs.removeObserver(observer, "debugger-server-started");
-        let transport = debuggerSocketConnect("127.0.0.1", 6000);
+        let transport = DebuggerClient.socketConnect("127.0.0.1", 6000);
         startClient(transport, onDone);
       }
     };
     Services.obs.addObserver(observer, "debugger-server-started", false);
   } else {
     // Initialize a loopback remote protocol connection
-    DebuggerServer.init(function () { return true; });
+    DebuggerServer.init();
     // We need to register browser actors to have `listTabs` working
     // and also have a root actor
     DebuggerServer.addBrowserActors();
     let transport = DebuggerServer.connectPipe();
     startClient(transport, onDone);
   }
 }
 
--- a/toolkit/devtools/apps/tests/unit/head_apps.js
+++ b/toolkit/devtools/apps/tests/unit/head_apps.js
@@ -16,17 +16,17 @@ Cu.import("resource://gre/modules/FileUt
 const {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
 const {require} = devtools;
 const {AppActorFront} = require("devtools/app-actor-front");
 
 let gClient, gActor, gActorFront;
 
 function connect(onDone) {
   // Initialize a loopback remote protocol connection
-  DebuggerServer.init(function () { return true; });
+  DebuggerServer.init();
   // We need to register browser actors to have `listTabs` working
   // and also have a root actor
   DebuggerServer.addBrowserActors();
 
   // Setup client and actor used in all tests
   gClient = new DebuggerClient(DebuggerServer.connectPipe());
   gClient.connect(function onConnect() {
     gClient.listTabs(function onListTabs(aResponse) {
--- a/toolkit/devtools/client/connection-manager.js
+++ b/toolkit/devtools/client/connection-manager.js
@@ -226,20 +226,20 @@ Connection.prototype = {
     let transport;
     if (this._customTransport) {
       transport = this._customTransport;
     } else {
       if (!this.host) {
         transport = DebuggerServer.connectPipe();
       } else {
         try {
-          transport = debuggerSocketConnect(this.host, this.port);
+          transport = DebuggerClient.socketConnect(this.host, this.port);
         } catch (e) {
           // In some cases, especially on Mac, the openOutputStream call in
-          // debuggerSocketConnect may throw NS_ERROR_NOT_INITIALIZED.
+          // DebuggerClient.socketConnect may throw NS_ERROR_NOT_INITIALIZED.
           // It occurs when we connect agressively to the simulator,
           // and keep trying to open a socket to the server being started in
           // the simulator.
           this._onDisconnected();
           return;
         }
       }
     }
@@ -294,9 +294,8 @@ Connection.prototype = {
     this.log("connection timeout. Possible causes: didn't click on 'accept' (prompt).");
     this.emit(Connection.Events.TIMEOUT);
     this.disconnect();
   },
 }
 
 exports.ConnectionManager = ConnectionManager;
 exports.Connection = Connection;
-
--- a/toolkit/devtools/client/dbg-client.jsm
+++ b/toolkit/devtools/client/dbg-client.jsm
@@ -16,32 +16,27 @@ this.Ci = Ci;
 this.Cc = Cc;
 this.Cu = Cu;
 this.Cr = Cr;
 this.CC = CC;
 
 this.EXPORTED_SYMBOLS = ["DebuggerTransport",
                          "DebuggerClient",
                          "RootClient",
-                         "debuggerSocketConnect",
                          "LongStringClient",
                          "EnvironmentClient",
                          "ObjectClient"];
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/NetUtil.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
 let promise = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js").Promise;
 const { defer, resolve, reject } = promise;
 
-XPCOMUtils.defineLazyServiceGetter(this, "socketTransportService",
-                                   "@mozilla.org/network/socket-transport-service;1",
-                                   "nsISocketTransportService");
-
 XPCOMUtils.defineLazyModuleGetter(this, "console",
                                   "resource://gre/modules/devtools/Console.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "devtools",
                                   "resource://gre/modules/devtools/Loader.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "events", () => {
   return devtools.require("sdk/event/core");
@@ -79,16 +74,21 @@ function dumpv(msg) {
     dumpn(msg);
   }
 }
 
 let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
   .getService(Ci.mozIJSSubScriptLoader);
 loader.loadSubScript("resource://gre/modules/devtools/transport/transport.js", this);
 
+DevToolsUtils.defineLazyGetter(this, "DebuggerSocket", () => {
+  let { DebuggerSocket } = devtools.require("devtools/toolkit/security/socket");
+  return DebuggerSocket;
+});
+
 /**
  * TODO: Get rid of this API in favor of EventTarget (bug 1042642)
  *
  * Add simple event notification to a prototype object. Any object that has
  * some use for event notifications or the observer pattern in general can be
  * augmented with the necessary facilities by passing its prototype to this
  * function.
  *
@@ -366,16 +366,22 @@ DebuggerClient.Argument = function (aPos
 
 DebuggerClient.Argument.prototype.getArgument = function (aParams) {
   if (!(this.position in aParams)) {
     throw new Error("Bad index into params: " + this.position);
   }
   return aParams[this.position];
 };
 
+// Expose this to save callers the trouble of importing DebuggerSocket
+DebuggerClient.socketConnect = function(host, port) {
+  // Defined here instead of just copying the function to allow lazy-load
+  return DebuggerSocket.connect(host, port);
+};
+
 DebuggerClient.prototype = {
   /**
    * Connect to the server and start exchanging protocol messages.
    *
    * @param aOnConnected function
    *        If specified, will be called when the greeting packet is
    *        received from the debugging server.
    */
@@ -2573,38 +2579,8 @@ EnvironmentClient.prototype = {
     name: args(0),
     value: args(1)
   }, {
     telemetry: "ASSIGN"
   })
 };
 
 eventSource(EnvironmentClient.prototype);
-
-/**
- * Connects to a debugger server socket and returns a DebuggerTransport.
- *
- * @param aHost string
- *        The host name or IP address of the debugger server.
- * @param aPort number
- *        The port number of the debugger server.
- */
-this.debuggerSocketConnect = function (aHost, aPort)
-{
-  let s = socketTransportService.createTransport(null, 0, aHost, aPort, null);
-  // By default the CONNECT socket timeout is very long, 65535 seconds,
-  // so that if we race to be in CONNECT state while the server socket is still
-  // initializing, the connection is stuck in connecting state for 18.20 hours!
-  s.setTimeout(Ci.nsISocketTransport.TIMEOUT_CONNECT, 2);
-
-  // openOutputStream may throw NS_ERROR_NOT_INITIALIZED if we hit some race
-  // where the nsISocketTransport gets shutdown in between its instantiation and
-  // the call to this method.
-  let transport;
-  try {
-    transport = new DebuggerTransport(s.openInputStream(0, 0, 0),
-                                      s.openOutputStream(0, 0, 0));
-  } catch(e) {
-    DevToolsUtils.reportException("debuggerSocketConnect", e);
-    throw e;
-  }
-  return transport;
-}
--- a/toolkit/devtools/gcli/source/lib/gcli/connectors/rdp.js
+++ b/toolkit/devtools/gcli/source/lib/gcli/connectors/rdp.js
@@ -13,17 +13,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 'use strict';
 
 var Cu = require('chrome').Cu;
 
-var debuggerSocketConnect = Cu.import('resource://gre/modules/devtools/dbg-client.jsm', {}).debuggerSocketConnect;
 var DebuggerClient = Cu.import('resource://gre/modules/devtools/dbg-client.jsm', {}).DebuggerClient;
 
 var Promise = require('../util/promise').Promise;
 var Connection = require('./connectors').Connection;
 
 /**
  * What port should we use by default?
  */
@@ -67,17 +66,17 @@ RdpConnection.create = function(url) {
   this.port = undefined; // TODO: Split out the port number
 
   this.requests = {};
   this.nextRequestId = 0;
 
   this._emit = this._emit.bind(this);
 
   return new Promise(function(resolve, reject) {
-    this.transport = debuggerSocketConnect(this.host, this.port);
+    this.transport = DebuggerClient.socketConnect(this.host, this.port);
     this.client = new DebuggerClient(this.transport);
     this.client.connect(function() {
       this.client.listTabs(function(response) {
         this.actor = response.gcliActor;
         resolve();
       }.bind(this));
     }.bind(this));
   }.bind(this));
--- a/toolkit/devtools/security/moz.build
+++ b/toolkit/devtools/security/moz.build
@@ -14,8 +14,12 @@ XPIDL_MODULE = 'devtools_security'
 
 UNIFIED_SOURCES += [
     'LocalCertService.cpp',
 ]
 
 FAIL_ON_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
+
+EXTRA_JS_MODULES.devtools.security += [
+    'socket.js',
+]
new file mode 100644
--- /dev/null
+++ b/toolkit/devtools/security/socket.js
@@ -0,0 +1,203 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
+/* 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/. */
+
+"use strict";
+
+let { Ci, Cc, CC, Cr } = require("chrome");
+let Services = require("Services");
+let DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
+let { dumpn } = DevToolsUtils;
+loader.lazyRequireGetter(this, "DebuggerTransport",
+  "devtools/toolkit/transport/transport", true);
+loader.lazyRequireGetter(this, "DebuggerServer",
+  "devtools/server/main", true);
+
+DevToolsUtils.defineLazyGetter(this, "ServerSocket", () => {
+  return CC("@mozilla.org/network/server-socket;1",
+            "nsIServerSocket",
+            "initSpecialConnection");
+});
+
+DevToolsUtils.defineLazyGetter(this, "UnixDomainServerSocket", () => {
+  return CC("@mozilla.org/network/server-socket;1",
+            "nsIServerSocket",
+            "initWithFilename");
+});
+
+DevToolsUtils.defineLazyGetter(this, "nsFile", () => {
+  return CC("@mozilla.org/file/local;1", "nsIFile", "initWithPath");
+});
+
+DevToolsUtils.defineLazyGetter(this, "socketTransportService", () => {
+  return Cc["@mozilla.org/network/socket-transport-service;1"]
+         .getService(Ci.nsISocketTransportService);
+});
+
+const DBG_STRINGS_URI = "chrome://global/locale/devtools/debugger.properties";
+
+/**
+ * Connects to a debugger server socket and returns a DebuggerTransport.
+ *
+ * @param host string
+ *        The host name or IP address of the debugger server.
+ * @param port number
+ *        The port number of the debugger server.
+ */
+function socketConnect(host, port) {
+  let s = socketTransportService.createTransport(null, 0, host, port, null);
+  // By default the CONNECT socket timeout is very long, 65535 seconds,
+  // so that if we race to be in CONNECT state while the server socket is still
+  // initializing, the connection is stuck in connecting state for 18.20 hours!
+  s.setTimeout(Ci.nsISocketTransport.TIMEOUT_CONNECT, 2);
+
+  // openOutputStream may throw NS_ERROR_NOT_INITIALIZED if we hit some race
+  // where the nsISocketTransport gets shutdown in between its instantiation and
+  // the call to this method.
+  let transport;
+  try {
+    transport = new DebuggerTransport(s.openInputStream(0, 0, 0),
+                                      s.openOutputStream(0, 0, 0));
+  } catch(e) {
+    DevToolsUtils.reportException("socketConnect", e);
+    throw e;
+  }
+  return transport;
+}
+
+/**
+ * Creates a new socket listener for remote connections to the DebuggerServer.
+ * This helps contain and organize the parts of the server that may differ or
+ * are particular to one given listener mechanism vs. another.
+ */
+function SocketListener() {}
+
+/**
+ * Prompt the user to accept or decline the incoming connection. This is the
+ * default implementation that products embedding the debugger server may
+ * choose to override.  A separate security handler can be specified for each
+ * socket via |allowConnection| on a socket listener instance.
+ *
+ * @return true if the connection should be permitted, false otherwise
+ */
+SocketListener.defaultAllowConnection = () => {
+  let bundle = Services.strings.createBundle(DBG_STRINGS_URI);
+  let title = bundle.GetStringFromName("remoteIncomingPromptTitle");
+  let msg = bundle.GetStringFromName("remoteIncomingPromptMessage");
+  let disableButton = bundle.GetStringFromName("remoteIncomingPromptDisable");
+  let prompt = Services.prompt;
+  let flags = prompt.BUTTON_POS_0 * prompt.BUTTON_TITLE_OK +
+              prompt.BUTTON_POS_1 * prompt.BUTTON_TITLE_CANCEL +
+              prompt.BUTTON_POS_2 * prompt.BUTTON_TITLE_IS_STRING +
+              prompt.BUTTON_POS_1_DEFAULT;
+  let result = prompt.confirmEx(null, title, msg, flags, null, null,
+                                disableButton, null, { value: false });
+  if (result === 0) {
+    return true;
+  }
+  if (result === 2) {
+    DebuggerServer.closeAllListeners();
+    Services.prefs.setBoolPref("devtools.debugger.remote-enabled", false);
+  }
+  return false;
+};
+
+SocketListener.prototype = {
+
+  /**
+   * Listens on the given port or socket file for remote debugger connections.
+   *
+   * @param portOrPath int, string
+   *        If given an integer, the port to listen on.
+   *        Otherwise, the path to the unix socket domain file to listen on.
+   */
+  open: function(portOrPath) {
+    let flags = Ci.nsIServerSocket.KeepWhenOffline;
+    // A preference setting can force binding on the loopback interface.
+    if (Services.prefs.getBoolPref("devtools.debugger.force-local")) {
+      flags |= Ci.nsIServerSocket.LoopbackOnly;
+    }
+
+    try {
+      let backlog = 4;
+      let port = Number(portOrPath);
+      if (port) {
+        this._socket = new ServerSocket(port, flags, backlog);
+      } else {
+        let file = nsFile(portOrPath);
+        if (file.exists())
+          file.remove(false);
+        this._socket = new UnixDomainServerSocket(file, parseInt("666", 8),
+                                                  backlog);
+      }
+      this._socket.asyncListen(this);
+    } catch (e) {
+      dumpn("Could not start debugging listener on '" + portOrPath + "': " + e);
+      throw Cr.NS_ERROR_NOT_AVAILABLE;
+    }
+  },
+
+  /**
+   * Closes the SocketListener.  Notifies the server to remove the listener from
+   * the set of active SocketListeners.
+   */
+  close: function() {
+    this._socket.close();
+    DebuggerServer._removeListener(this);
+  },
+
+  /**
+   * Gets the port that a TCP socket listener is listening on, or null if this
+   * is not a TCP socket (so there is no port).
+   */
+  get port() {
+    if (!this._socket) {
+      return null;
+    }
+    return this._socket.port;
+  },
+
+  /**
+   * Prompt the user to accept or decline the incoming connection. The default
+   * implementation is used unless this is overridden on a particular socket
+   * listener instance.
+   *
+   * @return true if the connection should be permitted, false otherwise
+   */
+  allowConnection: SocketListener.defaultAllowConnection,
+
+  // nsIServerSocketListener implementation
+
+  onSocketAccepted:
+  DevToolsUtils.makeInfallible(function(socket, socketTransport) {
+    if (Services.prefs.getBoolPref("devtools.debugger.prompt-connection") &&
+        !this.allowConnection()) {
+      return;
+    }
+    dumpn("New debugging connection on " +
+          socketTransport.host + ":" + socketTransport.port);
+
+    let input = socketTransport.openInputStream(0, 0, 0);
+    let output = socketTransport.openOutputStream(0, 0, 0);
+    let transport = new DebuggerTransport(input, output);
+    DebuggerServer._onConnection(transport);
+  }, "SocketListener.onSocketAccepted"),
+
+  onStopListening: function(socket, status) {
+    dumpn("onStopListening, status: " + status);
+  }
+
+};
+
+// TODO: These high-level entry points will branch based on TLS vs. bare TCP as
+// part of bug 1059001.
+exports.DebuggerSocket = {
+  createListener() {
+    return new SocketListener();
+  },
+  connect(host, port) {
+    return socketConnect(host, port);
+  }
+};
--- a/toolkit/devtools/server/actors/script.js
+++ b/toolkit/devtools/server/actors/script.js
@@ -2116,31 +2116,17 @@ ThreadActor.prototype = {
    * Check if scripts from the provided source URL are allowed to be stored in
    * the cache.
    *
    * @param aSourceUrl String
    *        The url of the script's source that will be stored.
    * @returns true, if the script can be added, false otherwise.
    */
   _allowSource: function (aSource) {
-    let url = getSourceURL(aSource);
-
-    if (isHiddenSource(aSource)) {
-      return false;
-    }
-
-    // Ignore XBL bindings for content debugging.
-    if (url && url.indexOf("chrome://") == 0) {
-      return false;
-    }
-    // Ignore about:* pages for content debugging.
-    if (url && url.indexOf("about:") == 0) {
-      return false;
-    }
-    return true;
+    return !isHiddenSource(aSource);
   },
 
   /**
    * Restore any pre-existing breakpoints to the scripts that we have access to.
    */
   _restoreBreakpoints: function () {
     if (this.breakpointStore.size === 0) {
       return;
@@ -5196,26 +5182,17 @@ function ChromeDebuggerActor(aConnection
 }
 
 ChromeDebuggerActor.prototype = Object.create(ThreadActor.prototype);
 
 update(ChromeDebuggerActor.prototype, {
   constructor: ChromeDebuggerActor,
 
   // A constant prefix that will be used to form the actor ID by the server.
-  actorPrefix: "chromeDebugger",
-
-  /**
-   * Override the eligibility check for scripts and sources to make sure every
-   * script and source with a URL is stored when debugging chrome.
-   */
-
-  _allowSource: function(aSource) {
-    return !isHiddenSource(aSource);
-  }
+  actorPrefix: "chromeDebugger"
 });
 
 exports.ChromeDebuggerActor = ChromeDebuggerActor;
 
 /**
  * Creates an actor for handling add-on debugging. AddonThreadActor is
  * a thin wrapper over ThreadActor.
  *
--- a/toolkit/devtools/server/main.js
+++ b/toolkit/devtools/server/main.js
@@ -8,23 +8,28 @@
 
 /**
  * Toolkit glue for the remote debugging protocol, loaded into the
  * debugging global.
  */
 let { Ci, Cc, CC, Cu, Cr } = require("chrome");
 let Services = require("Services");
 let { ActorPool, RegisteredActorFactory, ObservedActorFactory } = require("devtools/server/actors/common");
-let { DebuggerTransport, LocalDebuggerTransport, ChildDebuggerTransport } =
+let { LocalDebuggerTransport, ChildDebuggerTransport } =
   require("devtools/toolkit/transport/transport");
 let DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
 let { dumpn, dumpv, dbg_assert } = DevToolsUtils;
 let EventEmitter = require("devtools/toolkit/event-emitter");
 let Debugger = require("Debugger");
 
+DevToolsUtils.defineLazyGetter(this, "DebuggerSocket", () => {
+  let { DebuggerSocket } = require("devtools/toolkit/security/socket");
+  return DebuggerSocket;
+});
+
 // On B2G, `this` != Global scope, so `Ci` won't be binded on `this`
 // (i.e. this.Ci is undefined) Then later, when using loadSubScript,
 // Ci,... won't be defined for sub scripts.
 this.Ci = Ci;
 this.Cc = Cc;
 this.CC = CC;
 this.Cu = Cu;
 this.Cr = Cr;
@@ -37,22 +42,16 @@ this.dumpv = dumpv;
 this.dbg_assert = dbg_assert;
 
 // Overload `Components` to prevent SDK loader exception on Components
 // object usage
 Object.defineProperty(this, "Components", {
   get: function () require("chrome").components
 });
 
-const DBG_STRINGS_URI = "chrome://global/locale/devtools/debugger.properties";
-
-DevToolsUtils.defineLazyGetter(this, "nsFile", () => {
-  return CC("@mozilla.org/file/local;1", "nsIFile", "initWithPath");
-});
-
 if (isWorker) {
   dumpn.wantLogging = true;
   dumpv.wantVerbose = true;
 } else {
   const LOG_PREF = "devtools.debugger.log";
   const VERBOSE_PREF = "devtools.debugger.log.verbose";
 
   dumpn.wantLogging = Services.prefs.getBoolPref(LOG_PREF);
@@ -79,29 +78,16 @@ function loadSubScript(aURL)
 
 let events = require("sdk/event/core");
 let {defer, resolve, reject, all} = require("devtools/toolkit/deprecated-sync-thenables");
 this.defer = defer;
 this.resolve = resolve;
 this.reject = reject;
 this.all = all;
 
-// XPCOM constructors
-DevToolsUtils.defineLazyGetter(this, "ServerSocket", () => {
-  return CC("@mozilla.org/network/server-socket;1",
-            "nsIServerSocket",
-            "initSpecialConnection");
-});
-
-DevToolsUtils.defineLazyGetter(this, "UnixDomainServerSocket", () => {
-  return CC("@mozilla.org/network/server-socket;1",
-            "nsIServerSocket",
-            "initWithFilename");
-});
-
 var gRegisteredModules = Object.create(null);
 
 /**
  * The ModuleAPI object is passed to modules loaded using the
  * DebuggerServer.registerModule() API.  Modules can use this
  * object to register actor factories.
  * Factories registered through the module API will be removed
  * when the module is unregistered or when the server is
@@ -166,95 +152,49 @@ var DebuggerServer = {
   // Map of tab actor names to actor constructors provided by extensions.
   tabActorFactories: {},
 
   LONG_STRING_LENGTH: 10000,
   LONG_STRING_INITIAL_LENGTH: 1000,
   LONG_STRING_READ_LENGTH: 65 * 1024,
 
   /**
-   * A handler function that prompts the user to accept or decline the incoming
-   * connection.
-   */
-  _allowConnection: null,
-
-  /**
    * The windowtype of the chrome window to use for actors that use the global
    * window (i.e the global style editor). Set this to your main window type,
    * for example "navigator:browser".
    */
   chromeWindowType: null,
 
   /**
-   * Prompt the user to accept or decline the incoming connection. This is the
-   * default implementation that products embedding the debugger server may
-   * choose to override.
-   *
-   * @return true if the connection should be permitted, false otherwise
+   * Initialize the debugger server.
    */
-  _defaultAllowConnection: function DS__defaultAllowConnection() {
-    let bundle = Services.strings.createBundle(DBG_STRINGS_URI)
-    let title = bundle.GetStringFromName("remoteIncomingPromptTitle");
-    let msg = bundle.GetStringFromName("remoteIncomingPromptMessage");
-    let disableButton = bundle.GetStringFromName("remoteIncomingPromptDisable");
-    let prompt = Services.prompt;
-    let flags = prompt.BUTTON_POS_0 * prompt.BUTTON_TITLE_OK +
-                prompt.BUTTON_POS_1 * prompt.BUTTON_TITLE_CANCEL +
-                prompt.BUTTON_POS_2 * prompt.BUTTON_TITLE_IS_STRING +
-                prompt.BUTTON_POS_1_DEFAULT;
-    let result = prompt.confirmEx(null, title, msg, flags, null, null,
-                                  disableButton, null, { value: false });
-    if (result == 0) {
-      return true;
-    }
-    if (result == 2) {
-      DebuggerServer.closeAllListeners();
-      Services.prefs.setBoolPref("devtools.debugger.remote-enabled", false);
-    }
-    return false;
-  },
-
-  /**
-   * Initialize the debugger server.
-   *
-   * @param function aAllowConnectionCallback
-   *        The embedder-provider callback, that decides whether an incoming
-   *        remote protocol conection should be allowed or refused.
-   */
-  init: function DS_init(aAllowConnectionCallback) {
+  init: function DS_init() {
     if (this.initialized) {
       return;
     }
 
-    this.initTransport(aAllowConnectionCallback);
+    this.initTransport();
 
     this._initialized = true;
   },
 
   protocol: require("devtools/server/protocol"),
 
   /**
    * Initialize the debugger server's transport variables.  This can be
    * in place of init() for cases where the jsdebugger isn't needed.
-   *
-   * @param function aAllowConnectionCallback
-   *        The embedder-provider callback, that decides whether an incoming
-   *        remote protocol conection should be allowed or refused.
    */
-  initTransport: function DS_initTransport(aAllowConnectionCallback) {
+  initTransport: function DS_initTransport() {
     if (this._transportInitialized) {
       return;
     }
 
     this._connections = {};
     this._nextConnID = 0;
     this._transportInitialized = true;
-    this._allowConnection = aAllowConnectionCallback ?
-                            aAllowConnectionCallback :
-                            this._defaultAllowConnection;
   },
 
   get initialized() this._initialized,
 
   /**
    * Performs cleanup tasks before shutting down the debugger server. Such tasks
    * include clearing any actor constructors added at runtime. This method
    * should be called whenever a debugger server is no longer useful, to avoid
@@ -273,17 +213,16 @@ var DebuggerServer = {
     for (let id of Object.getOwnPropertyNames(gRegisteredModules)) {
       this.unregisterModule(id);
     }
     gRegisteredModules = {};
 
     this.closeAllListeners();
     this.globalActorFactories = {};
     this.tabActorFactories = {};
-    this._allowConnection = null;
     this._transportInitialized = false;
     this._initialized = false;
 
     dumpn("Debugger server is shut down.");
   },
 
   /**
    * Load a subscript into the debugging global.
@@ -616,17 +555,17 @@ var DebuggerServer = {
    *         returned.
    */
   openListener: function(portOrPath) {
     if (!Services.prefs.getBoolPref("devtools.debugger.remote-enabled")) {
       return;
     }
     this._checkInit();
 
-    let listener = new SocketListener(this);
+    let listener = DebuggerSocket.createListener();
     listener.open(portOrPath);
     this._listeners.push(listener);
     return listener;
   },
 
   /**
    * Remove a SocketListener instance from the server's set of active
    * SocketListeners.  This is called by a SocketListener after it is closed.
@@ -1084,104 +1023,16 @@ includes.forEach(name => {
 });
 
 // Export ActorPool for requirers of main.js
 if (this.exports) {
   exports.ActorPool = ActorPool;
 }
 
 /**
- * Creates a new socket listener for remote connections to a given
- * DebuggerServer.  This helps contain and organize the parts of the server that
- * may differ or are particular to one given listener mechanism vs. another.
- */
-function SocketListener(server) {
-  this._server = server;
-}
-
-SocketListener.prototype = {
-
-  /**
-   * Listens on the given port or socket file for remote debugger connections.
-   *
-   * @param portOrPath int, string
-   *        If given an integer, the port to listen on.
-   *        Otherwise, the path to the unix socket domain file to listen on.
-   */
-  open: function(portOrPath) {
-    let flags = Ci.nsIServerSocket.KeepWhenOffline;
-    // A preference setting can force binding on the loopback interface.
-    if (Services.prefs.getBoolPref("devtools.debugger.force-local")) {
-      flags |= Ci.nsIServerSocket.LoopbackOnly;
-    }
-
-    try {
-      let backlog = 4;
-      let port = Number(portOrPath);
-      if (port) {
-        this._socket = new ServerSocket(port, flags, backlog);
-      } else {
-        let file = nsFile(portOrPath);
-        if (file.exists())
-          file.remove(false);
-        this._socket = new UnixDomainServerSocket(file, parseInt("666", 8),
-                                                  backlog);
-      }
-      this._socket.asyncListen(this);
-    } catch (e) {
-      dumpn("Could not start debugging listener on '" + portOrPath + "': " + e);
-      throw Cr.NS_ERROR_NOT_AVAILABLE;
-    }
-  },
-
-  /**
-   * Closes the SocketListener.  Notifies the server to remove the listener from
-   * the set of active SocketListeners.
-   */
-  close: function() {
-    this._socket.close();
-    this._server._removeListener(this);
-    this._server = null;
-  },
-
-  /**
-   * Gets the port that a TCP socket listener is listening on, or null if this
-   * is not a TCP socket (so there is no port).
-   */
-  get port() {
-    if (!this._socket) {
-      return null;
-    }
-    return this._socket.port;
-  },
-
-  // nsIServerSocketListener implementation
-
-  onSocketAccepted:
-  DevToolsUtils.makeInfallible(function(aSocket, aTransport) {
-    if (Services.prefs.getBoolPref("devtools.debugger.prompt-connection") &&
-        !this._server._allowConnection()) {
-      return;
-    }
-    dumpn("New debugging connection on " +
-          aTransport.host + ":" + aTransport.port);
-
-    let input = aTransport.openInputStream(0, 0, 0);
-    let output = aTransport.openOutputStream(0, 0, 0);
-    let transport = new DebuggerTransport(input, output);
-    this._server._onConnection(transport);
-  }, "SocketListener.onSocketAccepted"),
-
-  onStopListening: function(aSocket, status) {
-    dumpn("onStopListening, status: " + status);
-  }
-
-};
-
-/**
  * Creates a DebuggerServerConnection.
  *
  * Represents a connection to this debugging global from a client.
  * Manages a set of actors and actor pools, allocates actor ids, and
  * handles incoming requests.
  *
  * @param aPrefix string
  *        All actor IDs created by this connection should be prefixed
--- a/toolkit/devtools/server/tests/browser/head.js
+++ b/toolkit/devtools/server/tests/browser/head.js
@@ -51,17 +51,17 @@ let addTab = Task.async(function* (url) 
 });
 
 function initDebuggerServer() {
   try {
     // Sometimes debugger server does not get destroyed correctly by previous
     // tests.
     DebuggerServer.destroy();
   } catch (ex) { }
-  DebuggerServer.init(() => true);
+  DebuggerServer.init();
   DebuggerServer.addBrowserActors();
 }
 
 /**
  * Connect a debugger client.
  * @param {DebuggerClient}
  * @return {Promise} Resolves to the selected tabActor form when the client is
  * connected.
--- a/toolkit/devtools/server/tests/mochitest/inspector-helpers.js
+++ b/toolkit/devtools/server/tests/mochitest/inspector-helpers.js
@@ -11,17 +11,17 @@ const {_documentWalker} = devtools.requi
 // Always log packets when running tests.
 Services.prefs.setBoolPref("devtools.debugger.log", true);
 SimpleTest.registerCleanupFunction(function() {
   Services.prefs.clearUserPref("devtools.debugger.log");
 });
 
 
 if (!DebuggerServer.initialized) {
-  DebuggerServer.init(() => true);
+  DebuggerServer.init();
   DebuggerServer.addBrowserActors();
   SimpleTest.registerCleanupFunction(function() {
     DebuggerServer.destroy();
   });
 }
 
 var gAttachCleanups = [];
 
--- a/toolkit/devtools/server/tests/mochitest/memory-helpers.js
+++ b/toolkit/devtools/server/tests/mochitest/memory-helpers.js
@@ -15,17 +15,17 @@ Cu.import("resource://gre/modules/devtoo
 
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/devtools/Loader.jsm");
 let { require } = devtools;
 
 let { MemoryFront } = require("devtools/server/actors/memory");
 
 function startServerAndGetSelectedTabMemory() {
-  DebuggerServer.init(() => true);
+  DebuggerServer.init();
   DebuggerServer.addBrowserActors();
   var client = new DebuggerClient(DebuggerServer.connectPipe());
 
   return new Promise((resolve, reject) => {
     client.connect(response => {
       if (response.error) {
         reject(new Error(response.error + ": " + response.message));
         return;
--- a/toolkit/devtools/server/tests/mochitest/test_attachProcess.html
+++ b/toolkit/devtools/server/tests/mochitest/test_attachProcess.html
@@ -39,17 +39,17 @@ function runTests() {
   iframe.setAttribute("remote", "true");
   iframe.setAttribute("src", "data:text/html,foo");
   document.body.appendChild(iframe);
 
   let mm = iframe.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader.messageManager;
 
   // Instantiate a minimal server
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(function () { return true; });
+    DebuggerServer.init();
   }
   if (!DebuggerServer.createRootActor) {
     DebuggerServer.addBrowserActors();
   }
 
   function firstClient() {
     // Fake a first connection to the content process
     let transport = DebuggerServer.connectPipe();
--- a/toolkit/devtools/server/tests/mochitest/test_connectToChild.html
+++ b/toolkit/devtools/server/tests/mochitest/test_connectToChild.html
@@ -63,17 +63,17 @@ function runTests() {
     TestActor.prototype.requestTypes = {
       "hello": TestActor.prototype.hello
     };
     DebuggerServer.addTabActor(TestActor, "testActor");
   }, false);
 
   // Instantiate a minimal server
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(function () { return true; });
+    DebuggerServer.init();
   }
   if (!DebuggerServer.createRootActor) {
     DebuggerServer.addBrowserActors();
   }
 
   function firstClient() {
     // Fake a first connection to an iframe
     let transport = DebuggerServer.connectPipe();
--- a/toolkit/devtools/server/tests/mochitest/test_connection-manager.html
+++ b/toolkit/devtools/server/tests/mochitest/test_connection-manager.html
@@ -18,17 +18,17 @@ window.onload = function() {
 
   var Cu = Components.utils;
 
   Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
   Cu.import("resource://gre/modules/devtools/Loader.jsm");
   Cu.import("resource://gre/modules/Services.jsm");
 
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(function () { return true; });
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   var {ConnectionManager, Connection} = devtools.require("devtools/client/connection-manager");
 
   var orgCount = ConnectionManager.connections.length;
 
   ConnectionManager.once("new", (event, c) => {
--- a/toolkit/devtools/server/tests/mochitest/test_device.html
+++ b/toolkit/devtools/server/tests/mochitest/test_device.html
@@ -24,17 +24,17 @@ window.onload = function() {
   Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
   Cu.import("resource://gre/modules/Services.jsm");
 
   SimpleTest.waitForExplicitFinish();
 
   var {getDeviceFront} = devtools.require("devtools/server/actors/device");
 
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(function () { return true; });
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   var client = new DebuggerClient(DebuggerServer.connectPipe());
   client.connect(function onConnect() {
     client.listTabs(function onListTabs(aResponse) {
       var d = getDeviceFront(client, aResponse);
 
--- a/toolkit/devtools/server/tests/mochitest/test_framerate_01.html
+++ b/toolkit/devtools/server/tests/mochitest/test_framerate_01.html
@@ -30,17 +30,17 @@ window.onload = function() {
   Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
   Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
 
   SimpleTest.waitForExplicitFinish();
 
   var {FramerateFront} = devtools.require("devtools/server/actors/framerate");
 
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(function () { return true; });
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   var client = new DebuggerClient(DebuggerServer.connectPipe());
   client.connect(function onConnect() {
     client.listTabs(function onListTabs(aResponse) {
       var form = aResponse.tabs[aResponse.selected];
       var front = FramerateFront(client, form);
--- a/toolkit/devtools/server/tests/mochitest/test_framerate_02.html
+++ b/toolkit/devtools/server/tests/mochitest/test_framerate_02.html
@@ -30,17 +30,17 @@ window.onload = function() {
   Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
   Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
 
   SimpleTest.waitForExplicitFinish();
 
   var {FramerateFront} = devtools.require("devtools/server/actors/framerate");
 
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(function () { return true; });
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   var client = new DebuggerClient(DebuggerServer.connectPipe());
   client.connect(function onConnect() {
     client.listTabs(function onListTabs(aResponse) {
       var form = aResponse.tabs[aResponse.selected];
       var front = FramerateFront(client, form);
--- a/toolkit/devtools/server/tests/mochitest/test_framerate_03.html
+++ b/toolkit/devtools/server/tests/mochitest/test_framerate_03.html
@@ -33,17 +33,17 @@ window.onload = function() {
   SimpleTest.waitForExplicitFinish();
 
   var {FramerateFront} = devtools.require("devtools/server/actors/framerate");
   var START_TICK = 2000;
   var STOP_TICK = 3000;
   var TOTAL_TIME = 5000;
 
   if (!DebuggerServer.initialized) {
-    DebuggerServer.init(function () { return true; });
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   var client = new DebuggerClient(DebuggerServer.connectPipe());
   client.connect(function onConnect() {
     client.listTabs(function onListTabs(aResponse) {
       var form = aResponse.tabs[aResponse.selected];
       var front = FramerateFront(client, form);
--- a/toolkit/devtools/server/tests/mochitest/test_framerate_05.html
+++ b/toolkit/devtools/server/tests/mochitest/test_framerate_05.html
@@ -29,17 +29,17 @@ window.onload = function() {
   Cu.import("resource://gre/modules/devtools/Loader.jsm");
   Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
   Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
 
   SimpleTest.waitForExplicitFinish();
 
   var {FramerateFront} = devtools.require("devtools/server/actors/framerate");
 
-  DebuggerServer.init(function () { return true; });
+  DebuggerServer.init();
   DebuggerServer.addBrowserActors();
 
   var client = new DebuggerClient(DebuggerServer.connectPipe());
   client.connect(function onConnect() {
     client.listTabs(function onListTabs(aResponse) {
       var form = aResponse.tabs[aResponse.selected];
       var front = FramerateFront(client, form);
 
--- a/toolkit/devtools/server/tests/mochitest/test_preference.html
+++ b/toolkit/devtools/server/tests/mochitest/test_preference.html
@@ -22,17 +22,17 @@ function runTests() {
   Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
   Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
   Cu.import("resource://gre/modules/Services.jsm");
 
   SimpleTest.waitForExplicitFinish();
 
   var {getPreferenceFront} = devtools.require("devtools/server/actors/preference");
 
-  DebuggerServer.init(function () { return true; });
+  DebuggerServer.init();
   DebuggerServer.addBrowserActors();
 
   var client = new DebuggerClient(DebuggerServer.connectPipe());
   client.connect(function onConnect() {
     client.listTabs(function onListTabs(aResponse) {
       var p = getPreferenceFront(client, aResponse);
 
       var prefs = {};
--- a/toolkit/devtools/server/tests/unit/test_add_actors.js
+++ b/toolkit/devtools/server/tests/unit/test_add_actors.js
@@ -11,17 +11,17 @@ var gActors;
  * in order to add actors after initialization but rather can add actors anytime
  * regardless of the object's state.
  */
 function run_test()
 {
   DebuggerServer.addActors("resource://test/pre_init_global_actors.js");
   DebuggerServer.addActors("resource://test/pre_init_tab_actors.js");
 
-  DebuggerServer.init(function () { return true; });
+  DebuggerServer.init();
   DebuggerServer.addBrowserActors();
 
   DebuggerServer.addActors("resource://test/post_init_global_actors.js");
   DebuggerServer.addActors("resource://test/post_init_tab_actors.js");
 
   add_test(init);
   add_test(test_pre_init_global_actor);
   add_test(test_pre_init_tab_actor);
--- a/toolkit/devtools/server/tests/unit/test_client_request.js
+++ b/toolkit/devtools/server/tests/unit/test_client_request.js
@@ -23,17 +23,17 @@ TestActor.prototype.requestTypes = {
   "hello": TestActor.prototype.hello,
   "error": TestActor.prototype.error
 };
 
 function run_test()
 {
   DebuggerServer.addGlobalActor(TestActor);
 
-  DebuggerServer.init(function () { return true; });
+  DebuggerServer.init();
   DebuggerServer.addBrowserActors();
 
   add_test(init);
   add_test(test_client_request_callback);
   add_test(test_client_request_promise);
   add_test(test_client_request_promise_error);
   add_test(test_client_request_event_emitter);
   add_test(close_client);
--- a/toolkit/devtools/server/tests/unit/test_dbgglobal.js
+++ b/toolkit/devtools/server/tests/unit/test_dbgglobal.js
@@ -10,17 +10,17 @@ function run_test()
   // before we initialize it...
   check_except(function() {
     DebuggerServer.openListener(-1);
   });
   check_except(DebuggerServer.closeAllListeners);
   check_except(DebuggerServer.connectPipe);
 
   // Allow incoming connections.
-  DebuggerServer.init(function () { return true; });
+  DebuggerServer.init();
 
   // These should still fail because we haven't added a createRootActor
   // implementation yet.
   check_except(function() {
     DebuggerServer.openListener(-1);
   });
   check_except(DebuggerServer.closeAllListeners);
   check_except(DebuggerServer.connectPipe);
--- a/toolkit/devtools/server/tests/unit/test_eventlooplag_actor.js
+++ b/toolkit/devtools/server/tests/unit/test_eventlooplag_actor.js
@@ -6,17 +6,17 @@
  */
 
 "use strict";
 
 function run_test()
 {
   let {EventLoopLagFront} = devtools.require("devtools/server/actors/eventlooplag");
 
-  DebuggerServer.init(function () { return true; });
+  DebuggerServer.init();
   DebuggerServer.addBrowserActors();
 
   // As seen in EventTracer.cpp
   let threshold = 20;
   let interval = 10;
 
 
   let front;
--- a/toolkit/devtools/server/tests/unit/test_memory_footprint.js
+++ b/toolkit/devtools/server/tests/unit/test_memory_footprint.js
@@ -20,17 +20,17 @@ function run_test() {
 
 function check_footprint(step, max) {
   var footprint = (gMgr.residentUnique - gRefMemory) / 1024;
   ok(footprint < max, "Footprint after " + step + " is " + footprint + " kB (should be less than " + max + " kB).");
   run_next_test();
 }
 
 function init_server() {
-  DebuggerServer.init(function () { return true; });
+  DebuggerServer.init();
   check_footprint("DebuggerServer.init()", 500);
 }
 
 function add_browser_actors() {
   DebuggerServer.addBrowserActors();
   check_footprint("DebuggerServer.addBrowserActors()", 12000);
 }
 
--- a/toolkit/devtools/server/tests/unit/test_monitor_actor.js
+++ b/toolkit/devtools/server/tests/unit/test_monitor_actor.js
@@ -6,17 +6,17 @@
  */
 
 "use strict";
 
 function run_test()
 {
   let EventEmitter = devtools.require("devtools/toolkit/event-emitter");
 
-  DebuggerServer.init(function () { return true; });
+  DebuggerServer.init();
   DebuggerServer.addBrowserActors();
 
   let client = new DebuggerClient(DebuggerServer.connectPipe());
 
   function MonitorClient(client, form) {
     this.client = client;
     this.actor = form.monitorActor;
     this.events = ["update"];
--- a/toolkit/devtools/server/tests/unit/test_profiler_activation-01.js
+++ b/toolkit/devtools/server/tests/unit/test_profiler_activation-01.js
@@ -21,17 +21,17 @@ function connect_client(callback)
 }
 
 function run_test()
 {
   // Ensure the profiler is not running when the test starts (it could
   // happen if the MOZ_PROFILER_STARTUP environment variable is set).
   Profiler.StopProfiler();
 
-  DebuggerServer.init(() => true);
+  DebuggerServer.init();
   DebuggerServer.addBrowserActors();
 
   connect_client((client1, actor1) => {
     connect_client((client2, actor2) => {
       test_activate(client1, actor1, client2, actor2, () => {
         do_test_finished();
       });
     });
--- a/toolkit/devtools/server/tests/unit/test_profiler_activation-02.js
+++ b/toolkit/devtools/server/tests/unit/test_profiler_activation-02.js
@@ -22,17 +22,17 @@ function connect_client(callback)
 }
 
 function run_test()
 {
   // Ensure the profiler is already running when the test starts.
   Profiler.StartProfiler(1000000, 1, ["js"], 1);
 
   DevToolsUtils.waitForTime(WAIT_TIME).then(() => {
-    DebuggerServer.init(() => true);
+    DebuggerServer.init();
     DebuggerServer.addBrowserActors();
 
     connect_client((client, actor) => {
       test_start_time(client, actor, () => {
         client.close(do_test_finished);
       });
     });
   });
--- a/toolkit/devtools/server/tests/unit/test_profiler_close.js
+++ b/toolkit/devtools/server/tests/unit/test_profiler_close.js
@@ -17,17 +17,17 @@ function connect_client(callback)
     client.listTabs(response => {
       callback(client, response.profilerActor);
     });
   });
 }
 
 function run_test()
 {
-  DebuggerServer.init(() => true);
+  DebuggerServer.init();
   DebuggerServer.addBrowserActors();
 
   connect_client((client1, actor1) => {
     connect_client((client2, actor2) => {
       test_close(client1, actor1, client2, actor2, () => {
         client1.close(() => {
           client2.close(() => {
             do_test_finished();
--- a/toolkit/devtools/server/tests/unit/test_profiler_data.js
+++ b/toolkit/devtools/server/tests/unit/test_profiler_data.js
@@ -19,17 +19,17 @@ function connect_client(callback)
     client.listTabs(response => {
       callback(client, response.profilerActor);
     });
   });
 }
 
 function run_test()
 {
-  DebuggerServer.init(() => true);
+  DebuggerServer.init();
   DebuggerServer.addBrowserActors();
 
   connect_client((client, actor) => {
     activate_profiler(client, actor, () => {
       test_data(client, actor, () => {
         deactivate_profiler(client, actor, () => {
           client.close(do_test_finished);
         })
--- a/toolkit/devtools/server/tests/unit/test_profiler_events-01.js
+++ b/toolkit/devtools/server/tests/unit/test_profiler_events-01.js
@@ -16,17 +16,17 @@ function connect_client(callback)
     client.listTabs(response => {
       callback(client, response.profilerActor);
     });
   });
 }
 
 function run_test()
 {
-  DebuggerServer.init(() => true);
+  DebuggerServer.init();
   DebuggerServer.addBrowserActors();
 
   connect_client((client, actor) => {
     activate_profiler(client, actor, () => {
       test_events(client, actor, () => {
         client.close(do_test_finished);
       });
     });
--- a/toolkit/devtools/server/tests/unit/test_profiler_events-02.js
+++ b/toolkit/devtools/server/tests/unit/test_profiler_events-02.js
@@ -17,17 +17,17 @@ function connect_client(callback)
     client.listTabs(response => {
       callback(client, response.profilerActor);
     });
   });
 }
 
 function run_test()
 {
-  DebuggerServer.init(() => true);
+  DebuggerServer.init();
   DebuggerServer.addBrowserActors();
 
   connect_client((client, actor) => {
     activate_profiler(client, actor, () => {
       test_events(client, actor, () => {
         client.close(do_test_finished);
       });
     });
--- a/toolkit/devtools/server/tests/unit/test_protocol_async.js
+++ b/toolkit/devtools/server/tests/unit/test_protocol_async.js
@@ -86,17 +86,17 @@ let RootFront = protocol.FrontClass(Root
     // Root owns itself.
     this.manage(this);
   }
 });
 
 function run_test()
 {
   DebuggerServer.createRootActor = RootActor;
-  DebuggerServer.init(() => true);
+  DebuggerServer.init();
 
   let trace = connectPipeTracing();
   let client = new DebuggerClient(trace);
   let rootClient;
 
   client.connect((applicationType, traits) => {
     rootClient = RootFront(client);
 
--- a/toolkit/devtools/server/tests/unit/test_protocol_children.js
+++ b/toolkit/devtools/server/tests/unit/test_protocol_children.js
@@ -255,17 +255,17 @@ let RootFront = protocol.FrontClass(Root
   })
 });
 
 function run_test()
 {
   DebuggerServer.createRootActor = (conn => {
     return RootActor(conn);
   });
-  DebuggerServer.init(() => true);
+  DebuggerServer.init();
 
   let trace = connectPipeTracing();
   let client = new DebuggerClient(trace);
   client.connect((applicationType, traits) => {
     trace.expectReceive({"from":"<actorid>","applicationType":"xpcshell-tests","traits":[]})
     do_check_eq(applicationType, "xpcshell-tests");
 
     let rootFront = RootFront(client);
--- a/toolkit/devtools/server/tests/unit/test_protocol_formtype.js
+++ b/toolkit/devtools/server/tests/unit/test_protocol_formtype.js
@@ -121,17 +121,17 @@ let RootFront = protocol.FrontClass(Root
     this.lastForm = v;
   }
 });
 
 const run_test = Test(function*() {
   DebuggerServer.createRootActor = (conn => {
     return RootActor(conn);
   });
-  DebuggerServer.init(() => true);
+  DebuggerServer.init();
 
   const connection = DebuggerServer.connectPipe();
   const conn = new DebuggerClient(connection);
   const client = Async(conn);
 
   yield client.connect();
 
   let rootFront = RootFront(conn);
--- a/toolkit/devtools/server/tests/unit/test_protocol_longstring.js
+++ b/toolkit/devtools/server/tests/unit/test_protocol_longstring.js
@@ -78,17 +78,17 @@ let RootFront = protocol.FrontClass(Root
 });
 
 function run_test()
 {
   DebuggerServer.createRootActor = (conn => {
     return RootActor(conn);
   });
 
-  DebuggerServer.init(() => true);
+  DebuggerServer.init();
   let trace = connectPipeTracing();
   let client = new DebuggerClient(trace);
   let rootClient;
 
   let strfront = null;
 
   let expectRootChildren = function(size) {
     do_check_eq(rootActor.__poolMap.size, size + 1);
--- a/toolkit/devtools/server/tests/unit/test_protocol_simple.js
+++ b/toolkit/devtools/server/tests/unit/test_protocol_simple.js
@@ -156,17 +156,17 @@ let RootFront = protocol.FrontClass(Root
   }
 });
 
 function run_test()
 {
   DebuggerServer.createRootActor = (conn => {
     return RootActor(conn);
   });
-  DebuggerServer.init(() => true);
+  DebuggerServer.init();
 
   check_except(() => {
     let badActor = ActorClass({
       missing: preEvent("missing-event", function() {
       })
     })
   });
 
--- a/toolkit/devtools/server/tests/unit/test_registerClient.js
+++ b/toolkit/devtools/server/tests/unit/test_registerClient.js
@@ -48,17 +48,17 @@ TestClient.prototype = {
     onDone();
   }
 };
 
 function run_test()
 {
   DebuggerServer.addGlobalActor(TestActor);
 
-  DebuggerServer.init(function () { return true; });
+  DebuggerServer.init();
   DebuggerServer.addBrowserActors();
 
   add_test(init);
   add_test(test_client_events);
   add_test(close_client);
   run_next_test();
 }
 
--- a/toolkit/devtools/server/tests/unit/test_register_actor.js
+++ b/toolkit/devtools/server/tests/unit/test_register_actor.js
@@ -11,17 +11,17 @@ function check_actors(expect) {
 
   do_check_eq(expect, DebuggerServer.globalActorFactories.hasOwnProperty("registeredActor2"));
   do_check_eq(expect, DebuggerServer.globalActorFactories.hasOwnProperty("registeredActor1"));
 }
 
 function run_test()
 {
   // Allow incoming connections.
-  DebuggerServer.init(function () { return true; });
+  DebuggerServer.init();
   DebuggerServer.addBrowserActors();
 
   add_test(test_deprecated_api);
   add_test(test_lazy_api);
   add_test(cleanup);
   run_next_test();
 }
 
--- a/toolkit/devtools/server/tests/unit/test_requestTypes.js
+++ b/toolkit/devtools/server/tests/unit/test_requestTypes.js
@@ -33,17 +33,17 @@ function test_existent_actor(aClient, an
     deferred.resolve();
   });
 
   return deferred.promise;
 }
 
 function run_test()
 {
-  DebuggerServer.init(function () { return true; });
+  DebuggerServer.init();
   DebuggerServer.addBrowserActors();
   var client = new DebuggerClient(DebuggerServer.connectPipe());
   client.connect(function() {
     client.listTabs(function(aResponse) {
       test_requestTypes_request(client, aResponse.chromeDebugger);
     });
   });
 
--- a/toolkit/devtools/transport/tests/unit/head_dbg.js
+++ b/toolkit/devtools/transport/tests/unit/head_dbg.js
@@ -191,17 +191,17 @@ function attachTestTabAndResume(aClient,
 function initTestDebuggerServer() {
   DebuggerServer.registerModule("devtools/server/actors/script", {
     prefix: "script",
     constructor: "ScriptActor",
     type: { global: true, tab: true }
   });
   DebuggerServer.registerModule("xpcshell-test/testactors");
   // Allow incoming connections.
-  DebuggerServer.init(function () { return true; });
+  DebuggerServer.init();
 }
 
 function finishClient(aClient) {
   aClient.close(function() {
     do_test_finished();
   });
 }
 
@@ -255,21 +255,22 @@ function writeTestTempFile(aFileName, aC
     stream.close();
   }
 }
 
 /*** Transport Factories ***/
 
 function socket_transport() {
   if (!DebuggerServer.listeningSockets) {
-    DebuggerServer.openListener(-1);
+    let listener = DebuggerServer.openListener(-1);
+    listener.allowConnection = () => true;
   }
   let port = DebuggerServer._listeners[0].port;
   do_print("Debugger server port is " + port);
-  return debuggerSocketConnect("127.0.0.1", port);
+  return DebuggerClient.socketConnect("127.0.0.1", port);
 }
 
 function local_transport() {
   return DebuggerServer.connectPipe();
 }
 
 /*** Sample Data ***/
 
--- a/toolkit/devtools/transport/tests/unit/test_dbgsocket.js
+++ b/toolkit/devtools/transport/tests/unit/test_dbgsocket.js
@@ -17,27 +17,30 @@ function run_test()
   add_test(test_pipe_conn);
 
   run_next_test();
 }
 
 function test_socket_conn()
 {
   do_check_eq(DebuggerServer.listeningSockets, 0);
-  do_check_true(DebuggerServer.openListener(-1));
+  let listener = DebuggerServer.openListener(-1);
+  listener.allowConnection = () => true;
+  do_check_true(listener);
   do_check_eq(DebuggerServer.listeningSockets, 1);
   gPort = DebuggerServer._listeners[0].port;
   do_print("Debugger server port is " + gPort);
   // Open a second, separate listener
   gExtraListener = DebuggerServer.openListener(-1);
+  gExtraListener.allowConnection = () => true;
   do_check_eq(DebuggerServer.listeningSockets, 2);
 
   do_print("Starting long and unicode tests at " + new Date().toTimeString());
   let unicodeString = "(╯°□°)╯︵ ┻━┻";
-  let transport = debuggerSocketConnect("127.0.0.1", gPort);
+  let transport = DebuggerClient.socketConnect("127.0.0.1", gPort);
   transport.hooks = {
     onPacket: function(aPacket) {
       this.onPacket = function(aPacket) {
         do_check_eq(aPacket.unicode, unicodeString);
         transport.close();
       }
       // Verify that things work correctly when bigger than the output
       // transport buffers and when transporting unicode...
@@ -61,17 +64,17 @@ function test_socket_shutdown()
   do_check_eq(DebuggerServer.listeningSockets, 1);
   do_check_true(DebuggerServer.closeAllListeners());
   do_check_eq(DebuggerServer.listeningSockets, 0);
   // Make sure closing the listener twice does nothing.
   do_check_false(DebuggerServer.closeAllListeners());
   do_check_eq(DebuggerServer.listeningSockets, 0);
 
   do_print("Connecting to a server socket at " + new Date().toTimeString());
-  let transport = debuggerSocketConnect("127.0.0.1", gPort);
+  let transport = DebuggerClient.socketConnect("127.0.0.1", gPort);
   transport.hooks = {
     onPacket: function(aPacket) {
       // Shouldn't reach this, should never connect.
       do_check_true(false);
     },
 
     onClosed: function(aStatus) {
       do_print("test_socket_shutdown onClosed called at " + new Date().toTimeString());
--- a/toolkit/devtools/transport/tests/unit/test_dbgsocket_connection_drop.js
+++ b/toolkit/devtools/transport/tests/unit/test_dbgsocket_connection_drop.js
@@ -43,18 +43,19 @@ function test_socket_conn_drops_after_to
   for (let i = 0; i < 8; i++) {
     rawPacket += rawPacket;
   }
   return test_helper(rawPacket + ':');
 }
 
 function test_helper(payload) {
   let listener = DebuggerServer.openListener(-1);
+  listener.allowConnection = () => true;
 
-  let transport = debuggerSocketConnect("127.0.0.1", listener.port);
+  let transport = DebuggerClient.socketConnect("127.0.0.1", listener.port);
   transport.hooks = {
     onPacket: function(aPacket) {
       this.onPacket = function(aPacket) {
         do_throw(new Error("This connection should be dropped."));
         transport.close();
       };
 
       // Inject the payload directly into the stream.
--- a/toolkit/devtools/transport/tests/unit/test_no_bulk.js
+++ b/toolkit/devtools/transport/tests/unit/test_no_bulk.js
@@ -8,17 +8,17 @@ let { DebuggerClient } =
 let { FileUtils } = Cu.import("resource://gre/modules/FileUtils.jsm", {});
 let { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {});
 let Pipe = CC("@mozilla.org/pipe;1", "nsIPipe", "init");
 let { Promise: promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
 
 function run_test() {
   DebuggerServer.registerModule("xpcshell-test/testactors-no-bulk");
   // Allow incoming connections.
-  DebuggerServer.init(function () { return true; });
+  DebuggerServer.init();
 
   add_task(function() {
     yield test_bulk_send_error(socket_transport);
     yield test_bulk_send_error(local_transport);
     DebuggerServer.destroy();
   });
 
   run_next_test();
--- a/toolkit/modules/tests/xpcshell/test_sqlite.js
+++ b/toolkit/modules/tests/xpcshell/test_sqlite.js
@@ -3,16 +3,17 @@
 
 "use strict";
 
 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
 do_get_profile();
 
 Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/PromiseUtils.jsm");
 Cu.import("resource://gre/modules/osfile.jsm");
 Cu.import("resource://gre/modules/FileUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/Sqlite.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 // To spin the event loop in test.
@@ -1036,28 +1037,33 @@ add_task(function* test_forget_witness_o
 
   yield c.close();
   // After close, witness should have forgotten the connection
   do_check_true(forgetCalled);
 });
 
 add_task(function* test_close_database_on_gc() {
   failTestsOnAutoClose(false);
-  let deferred = Promise.defer();
+  let finalPromise;
 
-  for (let i = 0; i < 100; ++i) {
-    let c = yield getDummyDatabase("gc_" + i);
-    c._connectionData._deferredClose.promise.then(deferred.resolve);
+  {
+    let collectedPromises = [];
+    for (let i = 0; i < 100; ++i) {
+      let deferred = PromiseUtils.defer();
+      let c = yield getDummyDatabase("gc_" + i);
+      c._connectionData._deferredClose.promise.then(deferred.resolve);
+      collectedPromises.push(deferred.promise);
+    }
+    finalPromise = Promise.all(collectedPromises);
   }
 
   // Call getDummyDatabase once more to clear any remaining
   // references. This is needed at the moment, otherwise
   // garbage-collection takes place after the shutdown barrier and the
   // test will timeout. Once that is fixed, we can remove this line
-  // and be fine as long as at least one connection is
-  // garbage-collected.
+  // and be fine as long as the connections are garbage-collected.
   let last = yield getDummyDatabase("gc_last");
   yield last.close();
 
   Components.utils.forceGC();
-  yield deferred.promise;
+  yield finalPromise;
   failTestsOnAutoClose(true);
 });