Merge fx-team to central, a=merge
authorWes Kocher <wkocher@mozilla.com>
Mon, 10 Aug 2015 14:50:01 -0700
changeset 257129 ddb29452ced04ba0a5c790547f97c8cd0c7fc3df
parent 257128 22aeb4618c996c6e67aa930f54313ec1c0ba20e3 (current diff)
parent 257127 bdea09cdb622474b19b41446db7559770cb63fe0 (diff)
child 257130 8cba870a352ca71b53cebee7688847756eb3f5f7
push id63526
push userkwierso@gmail.com
push dateMon, 10 Aug 2015 22:02:03 +0000
treeherdermozilla-inbound@c4ab17503c09 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge fx-team to central, a=merge CLOSED TREE
embedding/android/GeckoSmsManager.java
mobile/android/base/resources/drawable-hdpi-v11/ic_menu_reader_add.png
mobile/android/base/resources/drawable-hdpi-v11/ic_menu_reader_remove.png
--- a/addon-sdk/source/lib/dev/debuggee.js
+++ b/addon-sdk/source/lib/dev/debuggee.js
@@ -6,17 +6,18 @@
 
 module.metadata = {
   "stability": "experimental"
 };
 
 const { Cu } = require("chrome");
 const { Class } = require("../sdk/core/heritage");
 const { MessagePort, MessageChannel } = require("../sdk/messaging");
-const { DebuggerServer } = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
+const { require: devtoolsRequire } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
+const { DebuggerServer } = devtoolsRequire("devtools/server/main");
 
 const outputs = new WeakMap();
 const inputs = new WeakMap();
 const targets = new WeakMap();
 const transports = new WeakMap();
 
 const inputFor = port => inputs.get(port);
 const outputFor = port => outputs.get(port);
--- a/addon-sdk/source/test/addons/page-mod-debugger-post/main.js
+++ b/addon-sdk/source/test/addons/page-mod-debugger-post/main.js
@@ -7,17 +7,18 @@ const { Cu } = require('chrome');
 const { PageMod } = require('sdk/page-mod');
 const tabs = require('sdk/tabs');
 const { closeTab } = require('sdk/tabs/utils');
 const promise = require('sdk/core/promise')
 const { getMostRecentBrowserWindow } = require('sdk/window/utils');
 const { data } = require('sdk/self');
 const { set } = require('sdk/preferences/service');
 
-const { DebuggerServer } = Cu.import('resource://gre/modules/devtools/dbg-server.jsm', {});
+const { require: devtoolsRequire } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
+const { DebuggerServer } = devtoolsRequire("devtools/server/main");
 const { DebuggerClient } = Cu.import('resource://gre/modules/devtools/dbg-client.jsm', {});
 
 let gClient;
 let ok;
 let testName = 'testDebugger';
 let iframeURL = 'data:text/html;charset=utf-8,' + testName;
 let TAB_URL = 'data:text/html;charset=utf-8,' + encodeURIComponent('<iframe src="' + iframeURL + '" />');
 TAB_URL = data.url('index.html');
--- a/addon-sdk/source/test/addons/page-mod-debugger-pre/main.js
+++ b/addon-sdk/source/test/addons/page-mod-debugger-pre/main.js
@@ -7,17 +7,18 @@ const { Cu } = require('chrome');
 const { PageMod } = require('sdk/page-mod');
 const tabs = require('sdk/tabs');
 const { closeTab } = require('sdk/tabs/utils');
 const promise = require('sdk/core/promise')
 const { getMostRecentBrowserWindow } = require('sdk/window/utils');
 const { data } = require('sdk/self');
 const { set } = require('sdk/preferences/service');
 
-const { DebuggerServer } = Cu.import('resource://gre/modules/devtools/dbg-server.jsm', {});
+const { require: devtoolsRequire } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
+const { DebuggerServer } = devtoolsRequire("devtools/server/main");
 const { DebuggerClient } = Cu.import('resource://gre/modules/devtools/dbg-client.jsm', {});
 
 let gClient;
 let ok;
 let testName = 'testDebugger';
 let iframeURL = 'data:text/html;charset=utf-8,' + testName;
 let TAB_URL = 'data:text/html;charset=utf-8,' + encodeURIComponent('<iframe src="' + iframeURL + '" />');
 TAB_URL = data.url('index.html');
--- a/b2g/chrome/content/devtools/debugger.js
+++ b/b2g/chrome/content/devtools/debugger.js
@@ -1,27 +1,27 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- /
 /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
 /* 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";
 
-XPCOMUtils.defineLazyGetter(this, "DebuggerServer", function() {
-  Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
-  return DebuggerServer;
-});
-
 XPCOMUtils.defineLazyGetter(this, "devtools", function() {
   const { devtools } =
     Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
   return devtools;
 });
 
+XPCOMUtils.defineLazyGetter(this, "DebuggerServer", function() {
+  const { DebuggerServer } = devtools.require("devtools/server/main");
+  return DebuggerServer;
+});
+
 XPCOMUtils.defineLazyGetter(this, "B2GTabList", function() {
   const { B2GTabList } =
     devtools.require("resource://gre/modules/DebuggerActors.js");
   return B2GTabList;
 });
 
 // Load the discovery module eagerly, so that it can set a device name at
 // startup.  This does not cause discovery to start listening for packets, as
--- a/browser/base/content/tab-content.js
+++ b/browser/base/content/tab-content.js
@@ -281,16 +281,19 @@ let AboutReaderListener = {
 
       case "Reader:PushState":
         this.updateReaderButton(!!(message.data && message.data.isArticle));
         break;
     }
   },
 
   get isAboutReader() {
+    if (!content) {
+      return false;
+    }
     return content.document.documentURI.startsWith("about:reader");
   },
 
   handleEvent: function(aEvent) {
     if (aEvent.originalTarget.defaultView != content) {
       return;
     }
 
--- a/browser/components/preferences/in-content/applications.xul
+++ b/browser/components/preferences/in-content/applications.xul
@@ -48,18 +48,19 @@
               type="string"/>
 
   <preference id="pref.downloads.disable_button.edit_actions"
               name="pref.downloads.disable_button.edit_actions"
               type="bool"/>
 </preferences>
 
 <keyset>
-  <key key="&focusSearch1.key;" modifiers="accel" id="focusSearch1"/>
-  <key key="&focusSearch2.key;" modifiers="accel" id="focusSearch2"/>
+  <!-- These <key>s have oncommand attributes because of bug 371900 -->
+  <key key="&focusSearch1.key;" modifiers="accel" id="focusSearch1" oncommand=";"/>
+  <key key="&focusSearch2.key;" modifiers="accel" id="focusSearch2" oncommand=";"/>
 </keyset>
 
 <hbox id="header-application"
       class="header"
       hidden="true"
       data-category="paneApplications">
   <label class="header-name">&paneApplications.title;</label>
 </hbox>
--- a/browser/components/sessionstore/test/browser_590268.js
+++ b/browser/components/sessionstore/test/browser_590268.js
@@ -4,16 +4,17 @@
 
 const NUM_TABS = 12;
 
 let stateBackup = ss.getBrowserState();
 
 function test() {
   /** Test for Bug 590268 - Provide access to sessionstore tab data sooner **/
   waitForExplicitFinish();
+  requestLongerTimeout(2);
 
   let startedTest = false;
 
   // wasLoaded will be used to keep track of tabs that have already had SSTabRestoring
   // fired for them.
   let wasLoaded = { };
   let restoringTabsCount = 0;
   let restoredTabsCount = 0;
--- a/browser/devtools/app-manager/test/test_connection_store.html
+++ b/browser/devtools/app-manager/test/test_connection_store.html
@@ -20,31 +20,30 @@ Bug 901519 - [app manager] data store fo
       <span id="status" template='{"type":"textContent","path":"status"}'></span>
       <span id="host" template='{"type":"textContent","path":"host"}'></span>
       <span id="port" template='{"type":"textContent","path":"port"}'></span>
     </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");
+      const {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm");
+      const {DebuggerServer} = require("devtools/server/main");
 
       if (!DebuggerServer.initialized) {
         DebuggerServer.init();
         DebuggerServer.addBrowserActors();
       }
 
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Cu.import("resource://gre/modules/Services.jsm");
         Cu.import("resource:///modules/devtools/gDevTools.jsm");
 
-        const {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
-
         const {ConnectionManager} = require("devtools/client/connection-manager");
         const ConnectionStore = require("devtools/app-manager/connection-store");
 
         let connection = ConnectionManager.createConnection();
         let store = new ConnectionStore(connection);
 
         let root = document.querySelector("#root");
         let status = root.querySelector("#status");
--- a/browser/devtools/app-manager/test/test_device_store.html
+++ b/browser/devtools/app-manager/test/test_device_store.html
@@ -14,36 +14,34 @@ Bug 901520 - [app manager] data store fo
     <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
   </head>
 
   <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");
+      const {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm");
+      const {DebuggerServer} = require("devtools/server/main");
 
       if (!DebuggerServer.initialized) {
         DebuggerServer.init();
         DebuggerServer.addBrowserActors();
       }
 
       function compare(o1, o2, msg) {
         is(JSON.stringify(o1), JSON.stringify(o2), msg);
       }
 
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Cu.import("resource://gre/modules/Services.jsm");
         Cu.import("resource:///modules/devtools/gDevTools.jsm");
 
-
-        const {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
-
         const {ConnectionManager} = require("devtools/client/connection-manager");
         const DeviceStore = require("devtools/app-manager/device-store");
 
         let {getDeviceFront} = require("devtools/server/actors/device");
 
         let connection = ConnectionManager.createConnection();
         let store = new DeviceStore(connection);
 
--- a/browser/devtools/app-manager/test/test_remain_connected.html
+++ b/browser/devtools/app-manager/test/test_remain_connected.html
@@ -13,31 +13,29 @@ Bug 912646 - Closing app toolbox causes 
     <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
     <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
   </head>
 
   <body>
 
     <script type="application/javascript;version=1.8">
       const Cu = Components.utils;
-
-      Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
+      const {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm");
+      const {DebuggerServer} = require("devtools/server/main");
 
       if (!DebuggerServer.initialized) {
         DebuggerServer.init();
         DebuggerServer.addBrowserActors();
       }
 
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Cu.import("resource:///modules/devtools/gDevTools.jsm");
 
-        const {require} =
-          Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
         const {TargetFactory} = require("devtools/framework/target");
         const {Toolbox} = require("devtools/framework/toolbox");
 
         const {Connection, ConnectionManager} =
           require("devtools/client/connection-manager");
         const ConnectionStore =
           require("devtools/app-manager/connection-store");
 
--- a/browser/devtools/canvasdebugger/test/head.js
+++ b/browser/devtools/canvasdebugger/test/head.js
@@ -11,18 +11,19 @@ let { Services } = Cu.import("resource:/
 let gEnableLogging = Services.prefs.getBoolPref("devtools.debugger.log");
 Services.prefs.setBoolPref("devtools.debugger.log", false);
 
 let { generateUUID } = Cc['@mozilla.org/uuid-generator;1'].getService(Ci.nsIUUIDGenerator);
 let { Task } = Cu.import("resource://gre/modules/Task.jsm", {});
 let { Promise: promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
 let { gDevTools } = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
 let { require } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
-let { DebuggerServer } = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
 let { DebuggerClient } = Cu.import("resource://gre/modules/devtools/dbg-client.jsm", {});
+
+let { DebuggerServer } = require("devtools/server/main");
 let { CallWatcherFront } = require("devtools/server/actors/call-watcher");
 let { CanvasFront } = require("devtools/server/actors/canvas");
 let { setTimeout } = require("sdk/timers");
 let DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
 let TiltGL = require("devtools/tilt/tilt-gl");
 let { TargetFactory } = require("devtools/framework/target");
 let { Toolbox } = require("devtools/framework/toolbox");
 let mm = null
--- a/browser/devtools/debugger/test/head.js
+++ b/browser/devtools/debugger/test/head.js
@@ -13,17 +13,17 @@ let gEnableLogging = Services.prefs.getB
 Services.prefs.setBoolPref("devtools.debugger.log", false);
 
 let { Task } = Cu.import("resource://gre/modules/Task.jsm", {});
 let { Promise: promise } = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js", {});
 let { gDevTools } = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
 let { require } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
 let DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
 let { BrowserToolboxProcess } = Cu.import("resource:///modules/devtools/ToolboxProcess.jsm", {});
-let { DebuggerServer } = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
+let { DebuggerServer } = require("devtools/server/main");
 let { DebuggerClient, ObjectClient } =
   Cu.import("resource://gre/modules/devtools/dbg-client.jsm", {});
 let { AddonManager } = Cu.import("resource://gre/modules/AddonManager.jsm", {});
 let EventEmitter = require("devtools/toolkit/event-emitter");
 const { promiseInvoke } = require("devtools/async-utils");
 let { TargetFactory } = require("devtools/framework/target");
 let { Toolbox } = require("devtools/framework/toolbox")
 
--- a/browser/devtools/framework/gDevTools.jsm
+++ b/browser/devtools/framework/gDevTools.jsm
@@ -16,20 +16,19 @@ loader.lazyRequireGetter(this, "TargetFa
 loader.lazyRequireGetter(this, "Toolbox", "devtools/framework/toolbox", true);
 
 XPCOMUtils.defineLazyModuleGetter(this, "promise",
                                   "resource://gre/modules/Promise.jsm", "Promise");
 XPCOMUtils.defineLazyModuleGetter(this, "console",
                                   "resource://gre/modules/devtools/Console.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
                                   "resource:///modules/CustomizableUI.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "DebuggerServer",
-                                  "resource://gre/modules/devtools/dbg-server.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "DebuggerClient",
                                   "resource://gre/modules/devtools/dbg-client.jsm");
+loader.lazyRequireGetter(this, "DebuggerServer", "devtools/server/main", true);
 
 const DefaultTools = require("definitions").defaultTools;
 const EventEmitter = require("devtools/toolkit/event-emitter");
 const Telemetry = require("devtools/shared/telemetry");
 
 const TABS_OPEN_PEAK_HISTOGRAM = "DEVTOOLS_TABS_OPEN_PEAK_LINEAR";
 const TABS_OPEN_AVG_HISTOGRAM = "DEVTOOLS_TABS_OPEN_AVERAGE_LINEAR";
 const TABS_PINNED_PEAK_HISTOGRAM = "DEVTOOLS_TABS_PINNED_PEAK_LINEAR";
--- a/browser/devtools/framework/target.js
+++ b/browser/devtools/framework/target.js
@@ -4,18 +4,17 @@
 
 "use strict";
 
 const {Cc, Ci, Cu} = require("chrome");
 const {Promise: promise} = require("resource://gre/modules/Promise.jsm");
 const EventEmitter = require("devtools/toolkit/event-emitter");
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "DebuggerServer",
-  "resource://gre/modules/devtools/dbg-server.jsm");
+loader.lazyRequireGetter(this, "DebuggerServer", "devtools/server/main", true);
 XPCOMUtils.defineLazyModuleGetter(this, "DebuggerClient",
   "resource://gre/modules/devtools/dbg-client.jsm");
 
 const targets = new WeakMap();
 const promiseTargets = new WeakMap();
 
 /**
  * Functions for creating Targets
--- a/browser/devtools/framework/test/browser_toolbox_tool_remote_reopen.js
+++ b/browser/devtools/framework/test/browser_toolbox_tool_remote_reopen.js
@@ -3,18 +3,17 @@
 
 ///////////////////
 //
 // Whitelisting this test.
 // As part of bug 1077403, the leaking uncaught rejection should be fixed.
 //
 thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created.");
 
-const { DebuggerServer } =
-  Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
+const { DebuggerServer } = require("devtools/server/main");
 const { DebuggerClient } =
   Cu.import("resource://gre/modules/devtools/dbg-client.jsm", {});
 
 /**
  * Bug 979536: Ensure fronts are destroyed after toolbox close.
  *
  * The fronts need to be destroyed manually to unbind their onPacket handlers.
  *
--- a/browser/devtools/framework/test/browser_two_tabs.js
+++ b/browser/devtools/framework/test/browser_two_tabs.js
@@ -1,17 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Check regression when opening two tabs
  */
 
-let { DebuggerServer } =
-  Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
+let { DebuggerServer } = require("devtools/server/main");
 let { DebuggerClient } =
   Cu.import("resource://gre/modules/devtools/dbg-client.jsm", {});
 
 const TAB_URL_1 = "data:text/html;charset=utf-8,foo";
 const TAB_URL_2 = "data:text/html;charset=utf-8,bar";
 
 let gClient;
 let gTab1, gTab2;
--- a/browser/devtools/framework/test/head.js
+++ b/browser/devtools/framework/test/head.js
@@ -14,17 +14,17 @@ function toggleAllTools(state) {
     } else {
       Services.prefs.clearUserPref(tool.visibilityswitch);
     }
   }
 }
 
 function getChromeActors(callback)
 {
-  let { DebuggerServer } = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
+  let { DebuggerServer } = require("devtools/server/main");
   let { DebuggerClient } = Cu.import("resource://gre/modules/devtools/dbg-client.jsm", {});
 
   if (!DebuggerServer.initialized) {
     DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
   DebuggerServer.allowChromeProcess = true;
 
--- a/browser/devtools/inspector/test/doc_frame_script.js
+++ b/browser/devtools/inspector/test/doc_frame_script.js
@@ -34,17 +34,18 @@ addEventListener("DOMWindowCreated", () 
 
 /**
  * Given an actorID and connection prefix, get the corresponding actor from the
  * debugger-server connection.
  * @param {String} actorID
  * @param {String} connPrefix
  */
 function getHighlighterActor(actorID, connPrefix) {
-  let {DebuggerServer} = Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
+  let {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm");
+  let {DebuggerServer} = require("devtools/server/main");
   if (!DebuggerServer.initialized) {
     return;
   }
 
   let conn = DebuggerServer._connections[connPrefix];
   if (!conn) {
     return;
   }
--- a/browser/devtools/performance/test/head.js
+++ b/browser/devtools/performance/test/head.js
@@ -7,17 +7,17 @@ const { classes: Cc, interfaces: Ci, uti
 let { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
 let { Preferences } = Cu.import("resource://gre/modules/Preferences.jsm", {});
 let { Task } = Cu.import("resource://gre/modules/Task.jsm", {});
 let { Promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
 let { require } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
 let { TargetFactory } = require("devtools/framework/target");
 let { gDevTools } = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
 const DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
-let { DebuggerServer } = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
+let { DebuggerServer } = require("devtools/server/main");
 let { console } = require("resource://gre/modules/devtools/Console.jsm");
 let { merge } = require("sdk/util/object");
 let { generateUUID } = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
 let { getPerformanceFront, PerformanceFront } = require("devtools/performance/front");
 
 let mm = null;
 
 const FRAME_SCRIPT_UTILS_URL = "chrome://browser/content/devtools/frame-script-utils.js"
--- a/browser/devtools/scratchpad/scratchpad.js
+++ b/browser/devtools/scratchpad/scratchpad.js
@@ -38,17 +38,17 @@ const WRAP_TEXT = "devtools.scratchpad.w
 const SHOW_TRAILING_SPACE = "devtools.scratchpad.showTrailingSpace";
 const EDITOR_FONT_SIZE = "devtools.scratchpad.editorFontSize";
 const ENABLE_AUTOCOMPLETION = "devtools.scratchpad.enableAutocompletion";
 const TAB_SIZE = "devtools.editor.tabsize";
 const FALLBACK_CHARSET_LIST = "intl.fallbackCharsetList.ISO-8859-1";
 
 const VARIABLES_VIEW_URL = "chrome://browser/content/devtools/widgets/VariablesView.xul";
 
-const {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
+const {require, devtools: loader} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
 
 const Telemetry = require("devtools/shared/telemetry");
 const Editor    = require("devtools/sourceeditor/editor");
 const TargetFactory = require("devtools/framework/target").TargetFactory;
 const EventEmitter = require("devtools/toolkit/event-emitter");
 const {DevToolsWorker} = require("devtools/toolkit/shared/worker");
 const DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
 
@@ -70,18 +70,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
   "resource:///modules/devtools/VariablesViewController.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "EnvironmentClient",
   "resource://gre/modules/devtools/dbg-client.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "ObjectClient",
   "resource://gre/modules/devtools/dbg-client.jsm");
 
-XPCOMUtils.defineLazyModuleGetter(this, "DebuggerServer",
-  "resource://gre/modules/devtools/dbg-server.jsm");
+loader.lazyRequireGetter(this, "DebuggerServer", "devtools/server/main", true);
 
 XPCOMUtils.defineLazyModuleGetter(this, "DebuggerClient",
   "resource://gre/modules/devtools/dbg-client.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "REMOTE_TIMEOUT", () =>
   Services.prefs.getIntPref("devtools.debugger.remote-timeout"));
 
 XPCOMUtils.defineLazyModuleGetter(this, "ShortcutUtils",
--- a/browser/devtools/scratchpad/test/browser_scratchpad_throw_output.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_throw_output.js
@@ -26,23 +26,22 @@ function testThrowOutput()
     tests.push({
       method: "display",
       code: "throw " + value + ";",
       result: "throw " + value + ";\n/*\nException: " + value + "\n*/",
       label: "Correct exception message for '" + value + "' is shown"
     });
   });
 
-  let server = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {})
-               .DebuggerServer;
+  let { DebuggerServer } = require("devtools/server/main");
 
-  let longLength = server.LONG_STRING_LENGTH + 1;
+  let longLength = DebuggerServer.LONG_STRING_LENGTH + 1;
   let longString = new Array(longLength).join("a");
-  let shortedString = longString.substring(0, server.LONG_STRING_INITIAL_LENGTH) +
-                      "\u2026";
+  let shortedString = longString.substring(0,
+    DebuggerServer.LONG_STRING_INITIAL_LENGTH) + "\u2026";
 
   tests.push({
     method: "display",
     code: "throw (new Array(" + longLength + ").join('a'));",
     result: "throw (new Array(" + longLength + ").join('a'));\n" +
             "/*\nException: " + shortedString + "\n*/",
     label: "Correct exception message for a longString is shown"
   });
--- a/browser/devtools/shadereditor/test/head.js
+++ b/browser/devtools/shadereditor/test/head.js
@@ -9,19 +9,19 @@ let { Services } = Cu.import("resource:/
 let gEnableLogging = Services.prefs.getBoolPref("devtools.debugger.log");
 // To enable logging for try runs, just set the pref to true.
 Services.prefs.setBoolPref("devtools.debugger.log", false);
 
 let { Task } = Cu.import("resource://gre/modules/Task.jsm", {});
 let { Promise: promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
 let { gDevTools } = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
 let { require } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
-let { DebuggerServer } = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
 let { DebuggerClient } = Cu.import("resource://gre/modules/devtools/dbg-client.jsm", {});
 
+let { DebuggerServer } = require("devtools/server/main");
 let { WebGLFront } = require("devtools/server/actors/webgl");
 let DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
 let TiltGL = require("devtools/tilt/tilt-gl");
 let {TargetFactory} = require("devtools/framework/target");
 let {Toolbox} = require("devtools/framework/toolbox");
 let mm = null;
 
 const FRAME_SCRIPT_UTILS_URL = "chrome://browser/content/devtools/frame-script-utils.js"
--- a/browser/devtools/webaudioeditor/test/head.js
+++ b/browser/devtools/webaudioeditor/test/head.js
@@ -11,17 +11,17 @@ let { Services } = Cu.import("resource:/
 let gEnableLogging = Services.prefs.getBoolPref("devtools.debugger.log");
 Services.prefs.setBoolPref("devtools.debugger.log", false);
 
 let { Task } = Cu.import("resource://gre/modules/Task.jsm", {});
 let { Promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
 let { gDevTools } = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
 let { require } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
 let { TargetFactory } = require("devtools/framework/target");
-let { DebuggerServer } = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
+let { DebuggerServer } = require("devtools/server/main");
 let { generateUUID } = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
 
 let { WebAudioFront } = require("devtools/server/actors/webaudio");
 let DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
 let audioNodes = require("devtools/server/actors/utils/audionodes.json");
 let mm = null;
 
 const FRAME_SCRIPT_UTILS_URL = "chrome://browser/content/devtools/frame-script-utils.js";
--- a/browser/devtools/webconsole/hudservice.js
+++ b/browser/devtools/webconsole/hudservice.js
@@ -13,17 +13,17 @@ let Heritage = require("sdk/core/heritag
 let {TargetFactory} = require("devtools/framework/target");
 let {Tools} = require("definitions");
 
 loader.lazyGetter(this, "Telemetry", () => require("devtools/shared/telemetry"));
 loader.lazyGetter(this, "WebConsoleFrame", () => require("devtools/webconsole/webconsole").WebConsoleFrame);
 loader.lazyImporter(this, "promise", "resource://gre/modules/Promise.jsm", "Promise");
 loader.lazyImporter(this, "gDevTools", "resource:///modules/devtools/gDevTools.jsm");
 loader.lazyImporter(this, "Services", "resource://gre/modules/Services.jsm");
-loader.lazyImporter(this, "DebuggerServer", "resource://gre/modules/devtools/dbg-server.jsm");
+loader.lazyRequireGetter(this, "DebuggerServer", "devtools/server/main", true);
 loader.lazyImporter(this, "DebuggerClient", "resource://gre/modules/devtools/dbg-client.jsm");
 loader.lazyGetter(this, "showDoorhanger", () => require("devtools/shared/doorhanger").showDoorhanger);
 loader.lazyRequireGetter(this, "sourceUtils", "devtools/shared/source-utils");
 
 const STRINGS_URI = "chrome://browser/locale/devtools/webconsole.properties";
 let l10n = new WebConsoleUtils.l10n(STRINGS_URI);
 
 const BROWSER_CONSOLE_WINDOW_FEATURES = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
--- a/browser/devtools/webconsole/test/browser_output_longstring_expand.js
+++ b/browser/devtools/webconsole/test/browser_output_longstring_expand.js
@@ -5,19 +5,17 @@
 // Test that long strings can be expanded in the console output.
 
 "use strict";
 
 const TEST_URI = "data:text/html;charset=utf8,test for bug 787981 - check " +
                  "that long strings can be expanded in the output.";
 
 let test = asyncTest(function* () {
-  let tempScope = {};
-  Cu.import("resource://gre/modules/devtools/dbg-server.jsm", tempScope);
-  let DebuggerServer = tempScope.DebuggerServer;
+  let { DebuggerServer } = require("devtools/server/main");
 
   let longString = (new Array(DebuggerServer.LONG_STRING_LENGTH + 4))
                     .join("a") + "foobar";
   let initialString =
     longString.substring(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH);
 
   yield loadTab(TEST_URI);
 
--- a/browser/devtools/webconsole/test/browser_webconsole_output_01.js
+++ b/browser/devtools/webconsole/test/browser_webconsole_output_01.js
@@ -10,17 +10,17 @@
 "use strict";
 
 thisTestLeaksUncaughtRejectionsAndShouldBeFixed("null");
 
 // Test the webconsole output for various types of objects.
 
 const TEST_URI = "data:text/html;charset=utf8,test for console output - 01";
 
-let {DebuggerServer} = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
+let {DebuggerServer} = require("devtools/server/main");
 
 let LONG_STRING_LENGTH = DebuggerServer.LONG_STRING_LENGTH;
 let LONG_STRING_INITIAL_LENGTH = DebuggerServer.LONG_STRING_INITIAL_LENGTH;
 DebuggerServer.LONG_STRING_LENGTH = 100;
 DebuggerServer.LONG_STRING_INITIAL_LENGTH = 50;
 
 let longString = (new Array(DebuggerServer.LONG_STRING_LENGTH + 4)).join("a");
 let initialString = longString.substring(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH);
--- a/browser/devtools/webconsole/test/browser_webconsole_promise.js
+++ b/browser/devtools/webconsole/test/browser_webconsole_promise.js
@@ -4,18 +4,17 @@
  */
 
 // Bug 1148759 - Test the webconsole can display promises inside objects.
 
 "use strict";
 
 const TEST_URI = "data:text/html;charset=utf8,test for console and promises";
 
-let {DebuggerServer} =
-  Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
+let {DebuggerServer} = require("devtools/server/main");
 
 let LONG_STRING_LENGTH = DebuggerServer.LONG_STRING_LENGTH;
 let LONG_STRING_INITIAL_LENGTH = DebuggerServer.LONG_STRING_INITIAL_LENGTH;
 DebuggerServer.LONG_STRING_LENGTH = 100;
 DebuggerServer.LONG_STRING_INITIAL_LENGTH = 50;
 
 let longString = (new Array(DebuggerServer.LONG_STRING_LENGTH + 4)).join("a");
 let initialString = longString.substring(0,
--- a/browser/devtools/webide/modules/runtimes.js
+++ b/browser/devtools/webide/modules/runtimes.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 const {Cu, Ci} = require("chrome");
 const {Devices} = Cu.import("resource://gre/modules/devtools/Devices.jsm");
 const {Services} = Cu.import("resource://gre/modules/Services.jsm");
 const {Connection} = require("devtools/client/connection-manager");
-const {DebuggerServer} = require("resource://gre/modules/devtools/dbg-server.jsm");
+const {DebuggerServer} = require("devtools/server/main");
 const {Simulators} = require("devtools/webide/simulators");
 const discovery = require("devtools/toolkit/discovery/discovery");
 const EventEmitter = require("devtools/toolkit/event-emitter");
 const promise = require("promise");
 loader.lazyRequireGetter(this, "AuthenticationResult",
   "devtools/toolkit/security/auth", true);
 loader.lazyRequireGetter(this, "DevToolsUtils",
   "devtools/toolkit/DevToolsUtils");
--- a/browser/devtools/webide/test/browser_tabs.js
+++ b/browser/devtools/webide/test/browser_tabs.js
@@ -4,18 +4,17 @@
 
 const TEST_URI = "http://example.com/browser/browser/devtools/webide/test/doc_tabs.html";
 
 function test() {
   waitForExplicitFinish();
   requestCompleteLog();
 
   Task.spawn(function*() {
-    const { DebuggerServer } =
-      Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
+    const { DebuggerServer } = require("devtools/server/main");
 
     // Since we test the connections set below, destroy the server in case it
     // was left open.
     DebuggerServer.destroy();
     DebuggerServer.init();
     DebuggerServer.addBrowserActors();
 
     let tab = yield addTab(TEST_URI);
--- a/browser/devtools/webide/test/sidebars/browser_tabs.js
+++ b/browser/devtools/webide/test/sidebars/browser_tabs.js
@@ -4,18 +4,17 @@
 
 const TEST_URI = "http://example.com/browser/browser/devtools/webide/test/doc_tabs.html";
 
 function test() {
   waitForExplicitFinish();
   requestCompleteLog();
 
   Task.spawn(function*() {
-    const { DebuggerServer } =
-      Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
+    const { DebuggerServer } = require("devtools/server/main");
 
     Services.prefs.setBoolPref("devtools.webide.sidebars", true);
 
     // Since we test the connections set below, destroy the server in case it
     // was left open.
     DebuggerServer.destroy();
     DebuggerServer.init();
     DebuggerServer.addBrowserActors();
--- a/browser/devtools/webide/test/sidebars/test_autoconnect_runtime.html
+++ b/browser/devtools/webide/test/sidebars/test_autoconnect_runtime.html
@@ -14,17 +14,17 @@
 
   <body>
 
     <script type="application/javascript;version=1.8">
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Task.spawn(function*() {
-          Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
+          const { DebuggerServer } = require("devtools/server/main");
           Services.prefs.setBoolPref("devtools.webide.sidebars", true);
 
           if (!DebuggerServer.initialized) {
             DebuggerServer.init();
             DebuggerServer.addBrowserActors();
           }
 
           let win = yield openWebIDE();
--- a/browser/devtools/webide/test/sidebars/test_autoselect_project.html
+++ b/browser/devtools/webide/test/sidebars/test_autoselect_project.html
@@ -14,17 +14,17 @@
 
   <body>
 
     <script type="application/javascript;version=1.8">
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Task.spawn(function* () {
-          Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
+          const { DebuggerServer } = require("devtools/server/main");
           Services.prefs.setBoolPref("devtools.webide.sidebars", true);
 
           if (!DebuggerServer.initialized) {
             DebuggerServer.init();
             DebuggerServer.addBrowserActors();
           }
 
           let win = yield openWebIDE();
--- a/browser/devtools/webide/test/sidebars/test_device_permissions.html
+++ b/browser/devtools/webide/test/sidebars/test_device_permissions.html
@@ -14,17 +14,17 @@
 
   <body>
 
     <script type="application/javascript;version=1.8">
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Task.spawn(function* () {
-          Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
+          const { DebuggerServer } = require("devtools/server/main");
           Services.prefs.setBoolPref("devtools.webide.sidebars", true);
 
           if (!DebuggerServer.initialized) {
             DebuggerServer.init();
             DebuggerServer.addBrowserActors();
           }
 
           let win = yield openWebIDE();
--- a/browser/devtools/webide/test/sidebars/test_device_preferences.html
+++ b/browser/devtools/webide/test/sidebars/test_device_preferences.html
@@ -14,17 +14,17 @@
 
   <body>
 
     <script type="application/javascript;version=1.8">
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Task.spawn(function* () {
-          Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
+          const { DebuggerServer } = require("devtools/server/main");
           Services.prefs.setBoolPref("devtools.webide.sidebars", true);
 
           if (!DebuggerServer.initialized) {
             DebuggerServer.init();
             DebuggerServer.addBrowserActors();
           }
 
           let win = yield openWebIDE();
--- a/browser/devtools/webide/test/sidebars/test_device_settings.html
+++ b/browser/devtools/webide/test/sidebars/test_device_settings.html
@@ -14,17 +14,17 @@
 
   <body>
 
     <script type="application/javascript;version=1.8">
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Task.spawn(function*() {
-          Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
+          const { DebuggerServer } = require("devtools/server/main");
 
           if (SpecialPowers.isMainProcess()) {
             Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
           }
 
           Services.prefs.setBoolPref("devtools.webide.sidebars", true);
 
           if (!DebuggerServer.initialized) {
--- a/browser/devtools/webide/test/sidebars/test_fullscreenToolbox.html
+++ b/browser/devtools/webide/test/sidebars/test_fullscreenToolbox.html
@@ -23,17 +23,17 @@
         docRuntime.querySelectorAll(".runtime-panel-item-other")[1].click();
         return deferred.promise;
       }
 
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Task.spawn(function* () {
-          Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
+          const { DebuggerServer } = require("devtools/server/main");
           Services.prefs.setBoolPref("devtools.webide.sidebars", true);
           let win = yield openWebIDE();
           let docProject = getProjectDocument(win);
           let docRuntime = getRuntimeDocument(win);
           win.AppManager.update("runtime-list");
 
           yield connectToLocal(win, docRuntime);
 
@@ -56,17 +56,16 @@
           win.Cmds.showRuntimeDetails();
 
           ok(!nbox.hasAttribute("toolboxfullscreen"), "Toolbox is not fullscreen");
 
           yield win.Cmds.disconnectRuntime();
 
           yield closeWebIDE(win);
 
-          const { DebuggerServer } = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
           DebuggerServer.destroy();
 
           SimpleTest.finish();
         });
       }
     </script>
   </body>
 </html>
--- a/browser/devtools/webide/test/sidebars/test_runtime.html
+++ b/browser/devtools/webide/test/sidebars/test_runtime.html
@@ -36,17 +36,17 @@
           function isPlayActive() {
             return !win.document.querySelector("#cmd_play").hasAttribute("disabled");
           }
 
           function isStopActive() {
             return !win.document.querySelector("#cmd_stop").hasAttribute("disabled");
           }
 
-          Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
+          const { DebuggerServer } = require("devtools/server/main");
 
           if (!DebuggerServer.initialized) {
             DebuggerServer.init();
             DebuggerServer.addBrowserActors();
           }
 
           win = yield openWebIDE();
           let docRuntime = getRuntimeDocument(win);
--- a/browser/devtools/webide/test/sidebars/test_telemetry.html
+++ b/browser/devtools/webide/test/sidebars/test_telemetry.html
@@ -14,16 +14,17 @@
 
   <body>
 
     <script type="application/javascript;version=1.8">
       const Telemetry = require("devtools/shared/telemetry");
       const { _DeprecatedUSBRuntime, _WiFiRuntime, _SimulatorRuntime,
               _gRemoteRuntime, _gLocalRuntime, RuntimeTypes }
             = require("devtools/webide/runtimes");
+      const { DebuggerServer } = require("devtools/server/main");
 
       // Because we need to gather stats for the period of time that a tool has
       // been opened we make use of setTimeout() to create tool active times.
       const TOOL_DELAY = 200;
 
       function patchTelemetry() {
         Telemetry.prototype.telemetryInfo = {};
         Telemetry.prototype._oldlog = Telemetry.prototype.log;
@@ -270,17 +271,16 @@
             }
             DebuggerServer.destroy();
             yield removeAllProjects();
             resetTelemetry();
           });
         });
 
         Task.spawn(function*() {
-          Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
           Services.prefs.setBoolPref("devtools.webide.sidebars", true);
 
           if (!DebuggerServer.initialized) {
             DebuggerServer.init();
             DebuggerServer.addBrowserActors();
           }
 
           patchTelemetry();
--- a/browser/devtools/webide/test/test_autoconnect_runtime.html
+++ b/browser/devtools/webide/test/test_autoconnect_runtime.html
@@ -14,18 +14,17 @@
 
   <body>
 
     <script type="application/javascript;version=1.8">
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Task.spawn(function* () {
-
-          Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
+          const { DebuggerServer } = require("devtools/server/main");
 
           if (!DebuggerServer.initialized) {
             DebuggerServer.init();
             DebuggerServer.addBrowserActors();
           }
 
           let win = yield openWebIDE();
 
--- a/browser/devtools/webide/test/test_autoselect_project.html
+++ b/browser/devtools/webide/test/test_autoselect_project.html
@@ -14,18 +14,17 @@
 
   <body>
 
     <script type="application/javascript;version=1.8">
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Task.spawn(function* () {
-
-          Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
+          const { DebuggerServer } = require("devtools/server/main");
 
           if (!DebuggerServer.initialized) {
             DebuggerServer.init();
             DebuggerServer.addBrowserActors();
           }
 
           let win = yield openWebIDE();
 
--- a/browser/devtools/webide/test/test_device_permissions.html
+++ b/browser/devtools/webide/test/test_device_permissions.html
@@ -14,17 +14,17 @@
 
   <body>
 
     <script type="application/javascript;version=1.8">
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Task.spawn(function* () {
-          Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
+          const { DebuggerServer } = require("devtools/server/main");
 
           if (!DebuggerServer.initialized) {
             DebuggerServer.init();
             DebuggerServer.addBrowserActors();
           }
 
           let win = yield openWebIDE();
 
--- a/browser/devtools/webide/test/test_device_preferences.html
+++ b/browser/devtools/webide/test/test_device_preferences.html
@@ -14,17 +14,17 @@
 
   <body>
 
     <script type="application/javascript;version=1.8">
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Task.spawn(function* () {
-          Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
+          const { DebuggerServer } = require("devtools/server/main");
 
           if (!DebuggerServer.initialized) {
             DebuggerServer.init();
             DebuggerServer.addBrowserActors();
           }
 
           let win = yield openWebIDE();
 
--- a/browser/devtools/webide/test/test_device_runtime.html
+++ b/browser/devtools/webide/test/test_device_runtime.html
@@ -14,17 +14,17 @@
 
   <body>
 
     <script type="application/javascript;version=1.8">
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Task.spawn(function* () {
-          Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
+          const { DebuggerServer } = require("devtools/server/main");
 
           if (!DebuggerServer.initialized) {
             DebuggerServer.init();
             DebuggerServer.addBrowserActors();
           }
 
           let win = yield openWebIDE();
 
--- a/browser/devtools/webide/test/test_device_settings.html
+++ b/browser/devtools/webide/test/test_device_settings.html
@@ -14,17 +14,17 @@
 
   <body>
 
     <script type="application/javascript;version=1.8">
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Task.spawn(function*() {
-          Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
+          const { DebuggerServer } = require("devtools/server/main");
 
           if (SpecialPowers.isMainProcess()) {
             Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
           }
 
           if (!DebuggerServer.initialized) {
             DebuggerServer.init();
             DebuggerServer.addBrowserActors();
--- a/browser/devtools/webide/test/test_fullscreenToolbox.html
+++ b/browser/devtools/webide/test/test_fullscreenToolbox.html
@@ -24,17 +24,17 @@
         win.document.querySelectorAll(".runtime-panel-item-other")[1].click();
         return deferred.promise;
       }
 
       window.onload = function() {
         SimpleTest.waitForExplicitFinish();
 
         Task.spawn(function* () {
-          Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
+          const { DebuggerServer } = require("devtools/server/main");
           win = yield openWebIDE();
           win.AppManager.update("runtime-list");
 
           yield connectToLocal(win);
 
           // Select main process
           yield win.Cmds.showProjectPanel();
           yield waitForUpdate(win, "runtime-targets");
@@ -55,17 +55,16 @@
           win.Cmds.showRuntimeDetails();
 
           ok(!nbox.hasAttribute("toolboxfullscreen"), "Toolbox is not fullscreen");
 
           yield win.Cmds.disconnectRuntime();
 
           yield closeWebIDE(win);
 
-          const { DebuggerServer } = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
           DebuggerServer.destroy();
 
           SimpleTest.finish();
         });
       }
 
 
     </script>
--- a/browser/devtools/webide/test/test_runtime.html
+++ b/browser/devtools/webide/test/test_runtime.html
@@ -35,17 +35,17 @@
           function isPlayActive() {
             return !win.document.querySelector("#cmd_play").hasAttribute("disabled");
           }
 
           function isStopActive() {
             return !win.document.querySelector("#cmd_stop").hasAttribute("disabled");
           }
 
-          Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
+          const { DebuggerServer } = require("devtools/server/main");
 
           if (!DebuggerServer.initialized) {
             DebuggerServer.init();
             DebuggerServer.addBrowserActors();
           }
 
           win = yield openWebIDE();
 
--- a/browser/devtools/webide/test/test_telemetry.html
+++ b/browser/devtools/webide/test/test_telemetry.html
@@ -14,16 +14,17 @@
 
   <body>
 
     <script type="application/javascript;version=1.8">
       const Telemetry = require("devtools/shared/telemetry");
       const { _DeprecatedUSBRuntime, _WiFiRuntime, _SimulatorRuntime,
               _gRemoteRuntime, _gLocalRuntime, RuntimeTypes }
             = require("devtools/webide/runtimes");
+      const { DebuggerServer } = require("devtools/server/main");
 
       // Because we need to gather stats for the period of time that a tool has
       // been opened we make use of setTimeout() to create tool active times.
       const TOOL_DELAY = 200;
 
       function patchTelemetry() {
         Telemetry.prototype.telemetryInfo = {};
         Telemetry.prototype._oldlog = Telemetry.prototype.log;
@@ -270,18 +271,16 @@
             }
             DebuggerServer.destroy();
             yield removeAllProjects();
             resetTelemetry();
           });
         });
 
         Task.spawn(function*() {
-          Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
-
           if (!DebuggerServer.initialized) {
             DebuggerServer.init();
             DebuggerServer.addBrowserActors();
           }
 
           patchTelemetry();
 
           // Cycle once, so we can test for multiple opens
--- a/browser/themes/osx/browser.css
+++ b/browser/themes/osx/browser.css
@@ -2634,17 +2634,18 @@ toolbarbutton.chevron > .toolbarbutton-m
 .tabbrowser-tab:focus > .tab-stack > .tab-content > .tab-label:not([pinned]),
 .tabbrowser-tab:focus > .tab-stack > .tab-content > .tab-icon-image[pinned],
 .tabbrowser-tab:focus > .tab-stack > .tab-content > .tab-throbber[pinned] {
   box-shadow: @focusRingShadow@;
 }
 
 #TabsToolbar {
   -moz-appearance: none;
-  margin-bottom: -1px; /* Overlap the inner highlight at the top of the nav-bar */
+  /* overlap the nav-bar's top border */
+  margin-bottom: calc(-1 * var(--tab-toolbar-navbar-overlap));
 }
 
 #main-window:not([customizing]) #navigator-toolbox[inFullscreen] > #TabsToolbar:not(:-moz-lwtheme),
 #main-window:not(:-moz-any([customizing],[tabsintitlebar])) #navigator-toolbox > #TabsToolbar:not(:-moz-lwtheme) {
   -moz-appearance: toolbar;
 }
 
 #TabsToolbar:not(:-moz-lwtheme) {
--- a/dom/mobilemessage/interfaces/nsIMobileMessageCallback.idl
+++ b/dom/mobilemessage/interfaces/nsIMobileMessageCallback.idl
@@ -5,17 +5,17 @@
 #include "nsISupports.idl"
 
 [scriptable, uuid(609692b0-1fc7-404a-91c4-eb2ec4d16c20)]
 interface nsIMobileMessageCallback : nsISupports
 {
   /**
    * All SMS related errors.
    * Make sure to keep this list in sync with the list in:
-   * embedding/android/GeckoSmsManager.java
+   * mobile/android/base/GeckoSmsManager.java
    */
   const unsigned short SUCCESS_NO_ERROR          = 0;
   const unsigned short NO_SIGNAL_ERROR           = 1;
   const unsigned short NOT_FOUND_ERROR           = 2;
   const unsigned short UNKNOWN_ERROR             = 3;
   const unsigned short INTERNAL_ERROR            = 4;
   const unsigned short NO_SIM_CARD_ERROR         = 5;
   const unsigned short RADIO_DISABLED_ERROR      = 6;
deleted file mode 100644
--- a/embedding/android/GeckoSmsManager.java
+++ /dev/null
@@ -1,988 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
- * 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/. */
-
-package org.mozilla.gecko;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import android.util.Log;
-
-import android.app.PendingIntent;
-import android.app.Activity;
-
-import android.database.Cursor;
-
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.ContentResolver;
-import android.content.ContentValues;
-import android.content.ContentUris;
-
-import android.net.Uri;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
-
-import android.telephony.SmsManager;
-import android.telephony.SmsMessage;
-
-import static android.telephony.SmsMessage.MessageClass;
-
-/**
- * This class is returning unique ids for PendingIntent requestCode attribute.
- * There are only |Integer.MAX_VALUE - Integer.MIN_VALUE| unique IDs available,
- * and they wrap around.
- */
-class PendingIntentUID
-{
-  static private int sUID = Integer.MIN_VALUE;
-
-  static public int generate() { return sUID++; }
-}
-
-/**
- * The envelope class contains all information that are needed to keep track of
- * a sent SMS.
- */
-class Envelope
-{
-  enum SubParts {
-    SENT_PART,
-    DELIVERED_PART
-  }
-
-  protected int       mId;
-  protected int       mMessageId;
-  protected long      mMessageTimestamp;
-
-  /**
-   * Number of sent/delivered remaining parts.
-   * @note The array has much slots as SubParts items.
-   */
-  protected int[]     mRemainingParts;
-
-  /**
-   * Whether sending/delivering is currently failing.
-   * @note The array has much slots as SubParts items.
-   */
-  protected boolean[] mFailing;
-
-  /**
-   * Error type (only for sent).
-   */
-  protected int       mError;
-
-  public Envelope(int aId, int aParts) {
-    mId = aId;
-    mMessageId = -1;
-    mMessageTimestamp = 0;
-    mError = GeckoSmsManager.kNoError;
-
-    int size = Envelope.SubParts.values().length;
-    mRemainingParts = new int[size];
-    mFailing = new boolean[size];
-
-    for (int i=0; i<size; ++i) {
-      mRemainingParts[i] = aParts;
-      mFailing[i] = false;
-    }
-  }
-
-  public void decreaseRemainingParts(Envelope.SubParts aType) {
-    --mRemainingParts[aType.ordinal()];
-
-    if (mRemainingParts[SubParts.SENT_PART.ordinal()] >
-        mRemainingParts[SubParts.DELIVERED_PART.ordinal()]) {
-      Log.e("GeckoSmsManager", "Delivered more parts than we sent!?");
-    }
-  }
-
-  public boolean arePartsRemaining(Envelope.SubParts aType) {
-    return mRemainingParts[aType.ordinal()] != 0;
-  }
-
-  public void markAsFailed(Envelope.SubParts aType) {
-    mFailing[aType.ordinal()] = true;
-  }
-
-  public boolean isFailing(Envelope.SubParts aType) {
-    return mFailing[aType.ordinal()];
-  }
-
-  public int getMessageId() {
-    return mMessageId;
-  }
-
-  public void setMessageId(int aMessageId) {
-    mMessageId = aMessageId;
-  }
-
-  public long getMessageTimestamp() {
-    return mMessageTimestamp;
-  }
-
-  public void setMessageTimestamp(long aMessageTimestamp) {
-    mMessageTimestamp = aMessageTimestamp;
-  }
-
-  public int getError() {
-    return mError;
-  }
-
-  public void setError(int aError) {
-    mError = aError;
-  }
-}
-
-/**
- * Postman class is a singleton that manages Envelope instances.
- */
-class Postman
-{
-  public static final int kUnknownEnvelopeId = -1;
-
-  private static final Postman sInstance = new Postman();
-
-  private ArrayList<Envelope> mEnvelopes = new ArrayList<Envelope>(1);
-
-  private Postman() {}
-
-  public static Postman getInstance() {
-    return sInstance;
-  }
-
-  public int createEnvelope(int aParts) {
-    /*
-     * We are going to create the envelope in the first empty slot in the array
-     * list. If there is no empty slot, we create a new one.
-     */
-    int size = mEnvelopes.size();
-
-    for (int i=0; i<size; ++i) {
-      if (mEnvelopes.get(i) == null) {
-        mEnvelopes.set(i, new Envelope(i, aParts));
-        return i;
-      }
-    }
-
-    mEnvelopes.add(new Envelope(size, aParts));
-    return size;
-  }
-
-  public Envelope getEnvelope(int aId) {
-    if (aId < 0 || mEnvelopes.size() <= aId) {
-      Log.e("GeckoSmsManager", "Trying to get an unknown Envelope!");
-      return null;
-    }
-
-    Envelope envelope = mEnvelopes.get(aId);
-    if (envelope == null) {
-      Log.e("GeckoSmsManager", "Trying to get an empty Envelope!");
-    }
-
-    return envelope;
-  }
-
-  public void destroyEnvelope(int aId) {
-    if (aId < 0 || mEnvelopes.size() <= aId) {
-      Log.e("GeckoSmsManager", "Trying to destroy an unknown Envelope!");
-      return;
-    }
-
-    if (mEnvelopes.set(aId, null) == null) {
-      Log.e("GeckoSmsManager", "Trying to destroy an empty Envelope!");
-    }
-  }
-}
-
-class SmsIOThread extends Thread {
-  private final static SmsIOThread sInstance = new SmsIOThread();
-
-  private Handler mHandler;
-
-  public static SmsIOThread getInstance() {
-    return sInstance;
-  }
-
-  public boolean execute(Runnable r) {
-    return mHandler.post(r);
-  }
-
-  public void run() {
-    Looper.prepare();
-
-    mHandler = new Handler();
-
-    Looper.loop();
-  }
-}
-
-class MessagesListManager
-{
-  private static final MessagesListManager sInstance = new MessagesListManager();
-
-  public static MessagesListManager getInstance() {
-    return sInstance;
-  }
-
-  private ArrayList<Cursor> mCursors = new ArrayList<Cursor>(0);
-
-  public int add(Cursor aCursor) {
-    int size = mCursors.size();
-
-    for (int i=0; i<size; ++i) {
-      if (mCursors.get(i) == null) {
-        mCursors.set(i, aCursor);
-        return i;
-      }
-    }
-
-    mCursors.add(aCursor);
-    return size;
-  }
-
-  public Cursor get(int aId) {
-    if (aId < 0 || mCursors.size() <= aId) {
-      Log.e("GeckoSmsManager", "Trying to get an unknown list!");
-      return null;
-    }
-
-    Cursor cursor = mCursors.get(aId);
-    if (cursor == null) {
-      Log.e("GeckoSmsManager", "Trying to get an empty list!");
-    }
-
-    return cursor;
-  }
-
-  public void remove(int aId) {
-    if (aId < 0 || mCursors.size() <= aId) {
-      Log.e("GeckoSmsManager", "Trying to destroy an unknown list!");
-      return;
-    }
-
-    Cursor cursor = mCursors.set(aId, null);
-    if (cursor == null) {
-      Log.e("GeckoSmsManager", "Trying to destroy an empty list!");
-      return;
-    }
-
-    cursor.close();
-  }
-
-  public void clear() {
-    for (int i=0; i<mCursors.size(); ++i) {
-      Cursor c = mCursors.get(i);
-      if (c != null) {
-        c.close();
-      }
-    }
-
-    mCursors.clear();
-  }
-}
-
-public class GeckoSmsManager
-  extends BroadcastReceiver
-  implements ISmsManager
-{
-  public final static String ACTION_SMS_RECEIVED  = "android.provider.Telephony.SMS_RECEIVED";
-  public final static String ACTION_SMS_SENT      = "org.mozilla.gecko.SMS_SENT";
-  public final static String ACTION_SMS_DELIVERED = "org.mozilla.gecko.SMS_DELIVERED";
-
-  /*
-   * Make sure that the following error codes are in sync with the ones
-   * defined in dom/mobilemessage/interfaces/nsIMobileMessageCallback.idl. They are owned
-   * owned by the interface.
-   */
-  public final static int kNoError               = 0;
-  public final static int kNoSignalError         = 1;
-  public final static int kNotFoundError         = 2;
-  public final static int kUnknownError          = 3;
-  public final static int kInternalError         = 4;
-  public final static int kNoSimCardError        = 5;
-  public final static int kRadioDisabledError    = 6;
-  public final static int kInvalidAddressError   = 7;
-  public final static int kFdnCheckError         = 8;
-  public final static int kNonActiveSimCardError = 9;
-  public final static int kStorageFullError      = 10;
-  public final static int kSimNotMatchedError    = 11;
-
-  private final static int kMaxMessageSize    = 160;
-
-  private final static Uri kSmsContentUri     = Uri.parse("content://sms");
-  private final static Uri kSmsSentContentUri = Uri.parse("content://sms/sent");
-
-  private final static int kSmsTypeInbox      = 1;
-  private final static int kSmsTypeSentbox    = 2;
-
-  /*
-   * Keep the following state codes in syng with |DeliveryState| in:
-   * dom/mobilemessage/Types.h
-   */
-  private final static int kDeliveryStateSent          = 0;
-  private final static int kDeliveryStateReceived      = 1;
-  private final static int kDeliveryStateSending       = 2;
-  private final static int kDeliveryStateError         = 3;
-  private final static int kDeliveryStateUnknown       = 4;
-  private final static int kDeliveryStateNotDownloaded = 5;
-  private final static int kDeliveryStateEndGuard      = 6;
-
-  /*
-   * Keep the following status codes in sync with |DeliveryStatus| in:
-   * dom/mobilemessage/Types.h
-   */
-  private final static int kDeliveryStatusNotApplicable = 0;
-  private final static int kDeliveryStatusSuccess       = 1;
-  private final static int kDeliveryStatusPending       = 2;
-  private final static int kDeliveryStatusError         = 3;
-
-  /*
-   * android.provider.Telephony.Sms.STATUS_*. Duplicated because they're not
-   * part of Android public API.
-   */
-  private final static int kInternalDeliveryStatusNone     = -1;
-  private final static int kInternalDeliveryStatusComplete = 0;
-  private final static int kInternalDeliveryStatusPending  = 32;
-  private final static int kInternalDeliveryStatusFailed   = 64;
-
-  /*
-   * Keep the following values in sync with |MessageClass| in:
-   * dom/mobilemessage/Types.h
-   */
-  private final static int kMessageClassNormal  = 0;
-  private final static int kMessageClassClass0  = 1;
-  private final static int kMessageClassClass1  = 2;
-  private final static int kMessageClassClass2  = 3;
-  private final static int kMessageClassClass3  = 4;
-
-  private final static String[] kRequiredMessageRows = new String[] { "_id", "address", "body", "date", "type", "status" };
-
-  public GeckoSmsManager() {
-    SmsIOThread.getInstance().start();
-  }
-
-  public void start() {
-    IntentFilter smsFilter = new IntentFilter();
-    smsFilter.addAction(GeckoSmsManager.ACTION_SMS_RECEIVED);
-    smsFilter.addAction(GeckoSmsManager.ACTION_SMS_SENT);
-    smsFilter.addAction(GeckoSmsManager.ACTION_SMS_DELIVERED);
-
-    GeckoApp.mAppContext.registerReceiver(this, smsFilter);
-  }
-
-  @Override
-  public void onReceive(Context context, Intent intent) {
-    if (intent.getAction().equals(ACTION_SMS_RECEIVED)) {
-      // TODO: Try to find the receiver number to be able to populate
-      //       SmsMessage.receiver.
-      // TODO: Get the id and the date from the stock app saved message.
-      //       Using the stock app saved message require us to wait for it to
-      //       be saved which can lead to race conditions.
-
-      Bundle bundle = intent.getExtras();
-
-      if (bundle == null) {
-        return;
-      }
-
-      Object[] pdus = (Object[]) bundle.get("pdus");
-
-      for (int i=0; i<pdus.length; ++i) {
-        SmsMessage msg = SmsMessage.createFromPdu((byte[])pdus[i]);
-
-        GeckoAppShell.notifySmsReceived(msg.getDisplayOriginatingAddress(),
-                                        msg.getDisplayMessageBody(),
-                                        getGeckoMessageClass(msg.getMessageClass()),
-                                        System.currentTimeMillis());
-      }
-
-      return;
-    }
-
-    if (intent.getAction().equals(ACTION_SMS_SENT) ||
-        intent.getAction().equals(ACTION_SMS_DELIVERED)) {
-      Bundle bundle = intent.getExtras();
-
-      if (bundle == null || !bundle.containsKey("envelopeId") ||
-          !bundle.containsKey("number") || !bundle.containsKey("message") ||
-          !bundle.containsKey("requestId")) {
-        Log.e("GeckoSmsManager", "Got an invalid ACTION_SMS_SENT/ACTION_SMS_DELIVERED!");
-        return;
-      }
-
-      int envelopeId = bundle.getInt("envelopeId");
-      Postman postman = Postman.getInstance();
-
-      Envelope envelope = postman.getEnvelope(envelopeId);
-      if (envelope == null) {
-        Log.e("GeckoSmsManager", "Got an invalid envelope id (or Envelope has been destroyed)!");
-        return;
-      }
-
-      Envelope.SubParts part = intent.getAction().equals(ACTION_SMS_SENT)
-                                 ? Envelope.SubParts.SENT_PART
-                                 : Envelope.SubParts.DELIVERED_PART;
-      envelope.decreaseRemainingParts(part);
-
-
-      if (getResultCode() != Activity.RESULT_OK) {
-        switch (getResultCode()) {
-          case SmsManager.RESULT_ERROR_NULL_PDU:
-            envelope.setError(kInternalError);
-            break;
-          case SmsManager.RESULT_ERROR_NO_SERVICE:
-          case SmsManager.RESULT_ERROR_RADIO_OFF:
-            envelope.setError(kNoSignalError);
-            break;
-          case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
-          default:
-            envelope.setError(kUnknownError);
-            break;
-        }
-        envelope.markAsFailed(part);
-        Log.i("GeckoSmsManager", "SMS part sending failed!");
-      }
-
-      if (envelope.arePartsRemaining(part)) {
-        return;
-      }
-
-      if (envelope.isFailing(part)) {
-        if (part == Envelope.SubParts.SENT_PART) {
-          GeckoAppShell.notifySmsSendFailed(envelope.getError(),
-                                            bundle.getInt("requestId"));
-          Log.i("GeckoSmsManager", "SMS sending failed!");
-        } else {
-          GeckoAppShell.notifySmsDelivery(envelope.getMessageId(),
-                                          kDeliveryStatusError,
-                                          bundle.getString("number"),
-                                          bundle.getString("message"),
-                                          envelope.getMessageTimestamp());
-          Log.i("GeckoSmsManager", "SMS delivery failed!");
-        }
-      } else {
-        if (part == Envelope.SubParts.SENT_PART) {
-          String number = bundle.getString("number");
-          String message = bundle.getString("message");
-          long timestamp = System.currentTimeMillis();
-
-          int id = saveSentMessage(number, message, timestamp);
-
-          GeckoAppShell.notifySmsSent(id, number, message, timestamp,
-                                      bundle.getInt("requestId"));
-
-          envelope.setMessageId(id);
-          envelope.setMessageTimestamp(timestamp);
-
-          Log.i("GeckoSmsManager", "SMS sending was successfull!");
-        } else {
-          GeckoAppShell.notifySmsDelivery(envelope.getMessageId(),
-                                          kDeliveryStatusSuccess,
-                                          bundle.getString("number"),
-                                          bundle.getString("message"),
-                                          envelope.getMessageTimestamp());
-          Log.i("GeckoSmsManager", "SMS succesfully delivered!");
-        }
-      }
-
-      // Destroy the envelope object only if the SMS has been sent and delivered.
-      if (!envelope.arePartsRemaining(Envelope.SubParts.SENT_PART) &&
-          !envelope.arePartsRemaining(Envelope.SubParts.DELIVERED_PART)) {
-        postman.destroyEnvelope(envelopeId);
-      }
-
-      return;
-    }
-  }
-
-  public void send(String aNumber, String aMessage, int aRequestId) {
-    int envelopeId = Postman.kUnknownEnvelopeId;
-
-    try {
-      SmsManager sm = SmsManager.getDefault();
-
-      Intent sentIntent = new Intent(ACTION_SMS_SENT);
-      Intent deliveredIntent = new Intent(ACTION_SMS_DELIVERED);
-
-      Bundle bundle = new Bundle();
-      bundle.putString("number", aNumber);
-      bundle.putString("message", aMessage);
-      bundle.putInt("requestId", aRequestId);
-
-      if (aMessage.length() <= kMaxMessageSize) {
-        envelopeId = Postman.getInstance().createEnvelope(1);
-        bundle.putInt("envelopeId", envelopeId);
-
-        sentIntent.putExtras(bundle);
-        deliveredIntent.putExtras(bundle);
-
-        /*
-         * There are a few things to know about getBroadcast and pending intents:
-         * - the pending intents are in a shared pool maintained by the system;
-         * - each pending intent is identified by a token;
-         * - when a new pending intent is created, if it has the same token as
-         *   another intent in the pool, one of them has to be removed.
-         *
-         * To prevent having a hard time because of this situation, we give a
-         * unique id to all pending intents we are creating. This unique id is
-         * generated by GetPendingIntentUID().
-         */
-        PendingIntent sentPendingIntent =
-          PendingIntent.getBroadcast(GeckoApp.mAppContext,
-                                     PendingIntentUID.generate(), sentIntent,
-                                     PendingIntent.FLAG_CANCEL_CURRENT);
-
-        PendingIntent deliveredPendingIntent =
-          PendingIntent.getBroadcast(GeckoApp.mAppContext,
-                                     PendingIntentUID.generate(), deliveredIntent,
-                                     PendingIntent.FLAG_CANCEL_CURRENT);
-
-        sm.sendTextMessage(aNumber, "", aMessage,
-                           sentPendingIntent, deliveredPendingIntent);
-      } else {
-        ArrayList<String> parts = sm.divideMessage(aMessage);
-        envelopeId = Postman.getInstance().createEnvelope(parts.size());
-        bundle.putInt("envelopeId", envelopeId);
-
-        sentIntent.putExtras(bundle);
-        deliveredIntent.putExtras(bundle);
-
-        ArrayList<PendingIntent> sentPendingIntents =
-          new ArrayList<PendingIntent>(parts.size());
-        ArrayList<PendingIntent> deliveredPendingIntents =
-          new ArrayList<PendingIntent>(parts.size());
-
-        for (int i=0; i<parts.size(); ++i) {
-          sentPendingIntents.add(
-            PendingIntent.getBroadcast(GeckoApp.mAppContext,
-                                       PendingIntentUID.generate(), sentIntent,
-                                       PendingIntent.FLAG_CANCEL_CURRENT)
-          );
-
-          deliveredPendingIntents.add(
-            PendingIntent.getBroadcast(GeckoApp.mAppContext,
-                                       PendingIntentUID.generate(), deliveredIntent,
-                                       PendingIntent.FLAG_CANCEL_CURRENT)
-          );
-        }
-
-        sm.sendMultipartTextMessage(aNumber, "", parts, sentPendingIntents,
-                                    deliveredPendingIntents);
-      }
-    } catch (Exception e) {
-      Log.e("GeckoSmsManager", "Failed to send an SMS: ", e);
-
-      if (envelopeId != Postman.kUnknownEnvelopeId) {
-        Postman.getInstance().destroyEnvelope(envelopeId);
-      }
-
-      GeckoAppShell.notifySmsSendFailed(kUnknownError, aRequestId);
-    }
-  }
-
-  public int saveSentMessage(String aRecipient, String aBody, long aDate) {
-    try {
-      ContentValues values = new ContentValues();
-      values.put("address", aRecipient);
-      values.put("body", aBody);
-      values.put("date", aDate);
-      // Always 'PENDING' because we always request status report.
-      values.put("status", kInternalDeliveryStatusPending);
-
-      ContentResolver cr = GeckoApp.mAppContext.getContentResolver();
-      Uri uri = cr.insert(kSmsSentContentUri, values);
-
-      long id = ContentUris.parseId(uri);
-
-      // The DOM API takes a 32bits unsigned int for the id. It's unlikely that
-      // we happen to need more than that but it doesn't cost to check.
-      if (id > Integer.MAX_VALUE) {
-        throw new IdTooHighException();
-      }
-
-      return (int)id;
-    } catch (IdTooHighException e) {
-      Log.e("GeckoSmsManager", "The id we received is higher than the higher allowed value.");
-      return -1;
-    } catch (Exception e) {
-      Log.e("GeckoSmsManager", "Something went wrong when trying to write a sent message: " + e);
-      return -1;
-    }
-  }
-
-  public void getMessage(int aMessageId, int aRequestId) {
-    class GetMessageRunnable implements Runnable {
-      private int mMessageId;
-      private int mRequestId;
-
-      GetMessageRunnable(int aMessageId, int aRequestId) {
-        mMessageId = aMessageId;
-        mRequestId = aRequestId;
-      }
-
-      @Override
-      public void run() {
-        Cursor cursor = null;
-
-        try {
-          ContentResolver cr = GeckoApp.mAppContext.getContentResolver();
-          Uri message = ContentUris.withAppendedId(kSmsContentUri, mMessageId);
-
-          cursor = cr.query(message, kRequiredMessageRows, null, null, null);
-          if (cursor == null || cursor.getCount() == 0) {
-            throw new NotFoundException();
-          }
-
-          if (cursor.getCount() != 1) {
-            throw new TooManyResultsException();
-          }
-
-          cursor.moveToFirst();
-
-          if (cursor.getInt(cursor.getColumnIndex("_id")) != mMessageId) {
-            throw new UnmatchingIdException();
-          }
-
-          int type = cursor.getInt(cursor.getColumnIndex("type"));
-          int deliveryStatus;
-          String sender = "";
-          String receiver = "";
-
-          if (type == kSmsTypeInbox) {
-            deliveryStatus = kDeliveryStatusSuccess;
-            sender = cursor.getString(cursor.getColumnIndex("address"));
-          } else if (type == kSmsTypeSentbox) {
-            deliveryStatus = getGeckoDeliveryStatus(cursor.getInt(cursor.getColumnIndex("status")));
-            receiver = cursor.getString(cursor.getColumnIndex("address"));
-          } else {
-            throw new InvalidTypeException();
-          }
-
-          GeckoAppShell.notifyGetSms(cursor.getInt(cursor.getColumnIndex("_id")),
-                                     deliveryStatus,
-                                     receiver, sender,
-                                     cursor.getString(cursor.getColumnIndex("body")),
-                                     cursor.getLong(cursor.getColumnIndex("date")),
-                                     mRequestId);
-        } catch (NotFoundException e) {
-          Log.i("GeckoSmsManager", "Message id " + mMessageId + " not found");
-          GeckoAppShell.notifyGetSmsFailed(kNotFoundError, mRequestId);
-        } catch (UnmatchingIdException e) {
-          Log.e("GeckoSmsManager", "Requested message id (" + mMessageId +
-                                   ") is different from the one we got.");
-          GeckoAppShell.notifyGetSmsFailed(kUnknownError, mRequestId);
-        } catch (TooManyResultsException e) {
-          Log.e("GeckoSmsManager", "Get too many results for id " + mMessageId);
-          GeckoAppShell.notifyGetSmsFailed(kUnknownError, mRequestId);
-        } catch (InvalidTypeException e) {
-          Log.i("GeckoSmsManager", "Message has an invalid type, we ignore it.");
-          GeckoAppShell.notifyGetSmsFailed(kNotFoundError, mRequestId);
-        } catch (Exception e) {
-          Log.e("GeckoSmsManager", "Error while trying to get message: " + e);
-          GeckoAppShell.notifyGetSmsFailed(kUnknownError, mRequestId);
-        } finally {
-          if (cursor != null) {
-            cursor.close();
-          }
-        }
-      }
-    }
-
-    if (!SmsIOThread.getInstance().execute(new GetMessageRunnable(aMessageId, aRequestId))) {
-      Log.e("GeckoSmsManager", "Failed to add GetMessageRunnable to the SmsIOThread");
-      GeckoAppShell.notifyGetSmsFailed(kUnknownError, aRequestId);
-    }
-  }
-
-  public void deleteMessage(int aMessageId, int aRequestId) {
-    class DeleteMessageRunnable implements Runnable {
-      private int mMessageId;
-      private int mRequestId;
-
-      DeleteMessageRunnable(int aMessageId, int aRequestId) {
-        mMessageId = aMessageId;
-        mRequestId = aRequestId;
-      }
-
-      @Override
-      public void run() {
-        try {
-          ContentResolver cr = GeckoApp.mAppContext.getContentResolver();
-          Uri message = ContentUris.withAppendedId(kSmsContentUri, mMessageId);
-
-          int count = cr.delete(message, null, null);
-
-          if (count > 1) {
-            throw new TooManyResultsException();
-          }
-
-          GeckoAppShell.notifySmsDeleted(count == 1, mRequestId);
-        } catch (TooManyResultsException e) {
-          Log.e("GeckoSmsManager", "Delete more than one message? " + e);
-          GeckoAppShell.notifySmsDeleteFailed(kUnknownError, mRequestId);
-        } catch (Exception e) {
-          Log.e("GeckoSmsManager", "Error while trying to delete a message: " + e);
-          GeckoAppShell.notifySmsDeleteFailed(kUnknownError, mRequestId);
-        }
-      }
-    }
-
-    if (!SmsIOThread.getInstance().execute(new DeleteMessageRunnable(aMessageId, aRequestId))) {
-      Log.e("GeckoSmsManager", "Failed to add GetMessageRunnable to the SmsIOThread");
-      GeckoAppShell.notifySmsDeleteFailed(kUnknownError, aRequestId);
-    }
-  }
-
-  public void createMessageList(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, int aDeliveryState, boolean aReverse, int aRequestId) {
-    class CreateMessageListRunnable implements Runnable {
-      private long     mStartDate;
-      private long     mEndDate;
-      private String[] mNumbers;
-      private int      mNumbersCount;
-      private int      mDeliveryState;
-      private boolean  mReverse;
-      private int      mRequestId;
-
-      CreateMessageListRunnable(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, int aDeliveryState, boolean aReverse, int aRequestId) {
-        mStartDate = aStartDate;
-        mEndDate = aEndDate;
-        mNumbers = aNumbers;
-        mNumbersCount = aNumbersCount;
-        mDeliveryState = aDeliveryState;
-        mReverse = aReverse;
-        mRequestId = aRequestId;
-      }
-
-      @Override
-      public void run() {
-        Cursor cursor = null;
-        boolean closeCursor = true;
-
-        try {
-          // TODO: should use the |selectionArgs| argument in |ContentResolver.query()|.
-          ArrayList<String> restrictions = new ArrayList<String>();
-
-          if (mStartDate != 0) {
-            restrictions.add("date >= " + mStartDate);
-          }
-
-          if (mEndDate != 0) {
-            restrictions.add("date <= " + mEndDate);
-          }
-
-          if (mNumbersCount > 0) {
-            String numberRestriction = "address IN ('" + mNumbers[0] + "'";
-
-            for (int i=1; i<mNumbersCount; ++i) {
-              numberRestriction += ", '" + mNumbers[i] + "'";
-            }
-            numberRestriction += ")";
-
-            restrictions.add(numberRestriction);
-          }
-
-          if (mDeliveryState == kDeliveryStateUnknown) {
-            restrictions.add("type IN ('" + kSmsTypeSentbox + "', '" + kSmsTypeInbox + "')");
-          } else if (mDeliveryState == kDeliveryStateSent) {
-            restrictions.add("type = " + kSmsTypeSentbox);
-          } else if (mDeliveryState == kDeliveryStateReceived) {
-            restrictions.add("type = " + kSmsTypeInbox);
-          } else {
-            throw new UnexpectedDeliveryStateException();
-          }
-
-          String restrictionText = restrictions.size() > 0 ? restrictions.get(0) : "";
-
-          for (int i=1; i<restrictions.size(); ++i) {
-            restrictionText += " AND " + restrictions.get(i);
-          }
-
-          ContentResolver cr = GeckoApp.mAppContext.getContentResolver();
-          cursor = cr.query(kSmsContentUri, kRequiredMessageRows, restrictionText, null,
-                            mReverse ? "date DESC" : "date ASC");
-
-          if (cursor.getCount() == 0) {
-            GeckoAppShell.notifyNoMessageInList(mRequestId);
-            return;
-          }
-
-          cursor.moveToFirst();
-
-          int type = cursor.getInt(cursor.getColumnIndex("type"));
-          int deliveryStatus;
-          String sender = "";
-          String receiver = "";
-
-          if (type == kSmsTypeInbox) {
-            deliveryStatus = kDeliveryStatusSuccess;
-            sender = cursor.getString(cursor.getColumnIndex("address"));
-          } else if (type == kSmsTypeSentbox) {
-            deliveryStatus = getGeckoDeliveryStatus(cursor.getInt(cursor.getColumnIndex("status")));
-            receiver = cursor.getString(cursor.getColumnIndex("address"));
-          } else {
-            throw new UnexpectedDeliveryStateException();
-          }
-
-          int listId = MessagesListManager.getInstance().add(cursor);
-          closeCursor = false;
-          GeckoAppShell.notifyListCreated(listId,
-                                          cursor.getInt(cursor.getColumnIndex("_id")),
-                                          deliveryStatus,
-                                          receiver, sender,
-                                          cursor.getString(cursor.getColumnIndex("body")),
-                                          cursor.getLong(cursor.getColumnIndex("date")),
-                                          mRequestId);
-        } catch (UnexpectedDeliveryStateException e) {
-          Log.e("GeckoSmsManager", "Unexcepted delivery state type: " + e);
-          GeckoAppShell.notifyReadingMessageListFailed(kUnknownError, mRequestId);
-        } catch (Exception e) {
-          Log.e("GeckoSmsManager", "Error while trying to create a message list cursor: " + e);
-          GeckoAppShell.notifyReadingMessageListFailed(kUnknownError, mRequestId);
-        } finally {
-          // Close the cursor if MessagesListManager isn't taking care of it.
-          // We could also just check if it is in the MessagesListManager list but
-          // that would be less efficient.
-          if (cursor != null && closeCursor) {
-            cursor.close();
-          }
-        }
-      }
-    }
-
-    if (!SmsIOThread.getInstance().execute(new CreateMessageListRunnable(aStartDate, aEndDate, aNumbers, aNumbersCount, aDeliveryState, aReverse, aRequestId))) {
-      Log.e("GeckoSmsManager", "Failed to add CreateMessageListRunnable to the SmsIOThread");
-      GeckoAppShell.notifyReadingMessageListFailed(kUnknownError, aRequestId);
-    }
-  }
-
-  public void getNextMessageInList(int aListId, int aRequestId) {
-    class GetNextMessageInListRunnable implements Runnable {
-      private int mListId;
-      private int mRequestId;
-
-      GetNextMessageInListRunnable(int aListId, int aRequestId) {
-        mListId = aListId;
-        mRequestId = aRequestId;
-      }
-
-      @Override
-      public void run() {
-        try {
-          Cursor cursor = MessagesListManager.getInstance().get(mListId);
-
-          if (!cursor.moveToNext()) {
-            MessagesListManager.getInstance().remove(mListId);
-            GeckoAppShell.notifyNoMessageInList(mRequestId);
-            return;
-          }
-
-          int type = cursor.getInt(cursor.getColumnIndex("type"));
-          int deliveryStatus;
-          String sender = "";
-          String receiver = "";
-
-          if (type == kSmsTypeInbox) {
-            deliveryStatus = kDeliveryStatusSuccess;
-            sender = cursor.getString(cursor.getColumnIndex("address"));
-          } else if (type == kSmsTypeSentbox) {
-            deliveryStatus = getGeckoDeliveryStatus(cursor.getInt(cursor.getColumnIndex("status")));
-            receiver = cursor.getString(cursor.getColumnIndex("address"));
-          } else {
-            throw new UnexpectedDeliveryStateException();
-          }
-
-          int listId = MessagesListManager.getInstance().add(cursor);
-          GeckoAppShell.notifyGotNextMessage(cursor.getInt(cursor.getColumnIndex("_id")),
-                                             deliveryStatus,
-                                             receiver, sender,
-                                             cursor.getString(cursor.getColumnIndex("body")),
-                                             cursor.getLong(cursor.getColumnIndex("date")),
-                                             mRequestId);
-        } catch (UnexpectedDeliveryStateException e) {
-          Log.e("GeckoSmsManager", "Unexcepted delivery state type: " + e);
-          GeckoAppShell.notifyReadingMessageListFailed(kUnknownError, mRequestId);
-        } catch (Exception e) {
-          Log.e("GeckoSmsManager", "Error while trying to get the next message of a list: " + e);
-          GeckoAppShell.notifyReadingMessageListFailed(kUnknownError, mRequestId);
-        }
-      }
-    }
-
-    if (!SmsIOThread.getInstance().execute(new GetNextMessageInListRunnable(aListId, aRequestId))) {
-      Log.e("GeckoSmsManager", "Failed to add GetNextMessageInListRunnable to the SmsIOThread");
-      GeckoAppShell.notifyReadingMessageListFailed(kUnknownError, aRequestId);
-    }
-  }
-
-  public void clearMessageList(int aListId) {
-    MessagesListManager.getInstance().remove(aListId);
-  }
-
-  public void stop() {
-    GeckoApp.mAppContext.unregisterReceiver(this);
-  }
-
-  public void shutdown() {
-    SmsIOThread.getInstance().interrupt();
-    MessagesListManager.getInstance().clear();
-  }
-
-  private int getGeckoDeliveryStatus(int aDeliveryStatus) {
-    if (aDeliveryStatus == kInternalDeliveryStatusNone) {
-      return kDeliveryStatusNotApplicable;
-    }
-    if (aDeliveryStatus >= kInternalDeliveryStatusFailed) {
-      return kDeliveryStatusError;
-    }
-    if (aDeliveryStatus >= kInternalDeliveryStatusPending) {
-      return kDeliveryStatusPending;
-    }
-    return kDeliveryStatusSuccess;
-  }
-
-  private int getGeckoMessageClass(MessageClass aMessageClass) {
-    switch (aMessageClass) {
-      case UNKNOWN:
-        return kMessageClassNormal;
-      case CLASS_0:
-        return kMessageClassClass0;
-      case CLASS_1:
-        return kMessageClassClass1;
-      case CLASS_2:
-        return kMessageClassClass2;
-      case CLASS_3:
-        return kMessageClassClass3;
-    }
-  }
-
-  class IdTooHighException extends Exception {
-    private static final long serialVersionUID = 395697882128640L;
-  }
-
-  class InvalidTypeException extends Exception {
-    private static final long serialVersionUID = 23359904803795434L;
-  }
-
-  class NotFoundException extends Exception {
-    private static final long serialVersionUID = 266226999371957426L;
-  }
-
-  class TooManyResultsException extends Exception {
-    private static final long serialVersionUID = 48899777673841920L;
-  }
-
-  class UnexpectedDeliveryStateException extends Exception {
-    private static final long serialVersionUID = 5044567998961920L;
-  }
-
-  class UnmatchingIdException extends Exception {
-    private static final long serialVersionUID = 1935649715512128L;
-  }
-}
--- a/mobile/android/base/GeckoSmsManager.java
+++ b/mobile/android/base/GeckoSmsManager.java
@@ -276,17 +276,17 @@ public class GeckoSmsManager
   implements ISmsManager
 {
   public final static String ACTION_SMS_RECEIVED  = "android.provider.Telephony.SMS_RECEIVED";
   public final static String ACTION_SMS_SENT      = "org.mozilla.gecko.SMS_SENT";
   public final static String ACTION_SMS_DELIVERED = "org.mozilla.gecko.SMS_DELIVERED";
 
   /*
    * Make sure that the following error codes are in sync with |ErrorType| in:
-   * dom/mobilemessage/Types.h
+   * dom/mobilemessage/interfaces/nsIMobileMessageCallback.idl
    * The error code are owned by the DOM.
    */
   public final static int kNoError               = 0;
   public final static int kNoSignalError         = 1;
   public final static int kNotFoundError         = 2;
   public final static int kUnknownError          = 3;
   public final static int kInternalError         = 4;
   public final static int kNoSimCardError        = 5;
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/drawable-hdpi-v11/ic_menu_reader_add.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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/. -->
+
+<!-- Note: After removing all MDPI assets, the reader icons were being resolved
+           incorrectly for MDPI-V11 devices because of the way we use dummy
+           resources to cater for API 9 builds.  To fix we renamed the HDPI-V11
+           reader resources and point to them in the HDPI-V11 and MDPI-V11
+           drawable folders.  See Bug 1179758 for more info. -->
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+        android:src="@drawable/ic_menu_reader_add_asset" />
rename from mobile/android/base/resources/drawable-hdpi-v11/ic_menu_reader_add.png
rename to mobile/android/base/resources/drawable-hdpi-v11/ic_menu_reader_add_asset.png
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/drawable-hdpi-v11/ic_menu_reader_remove.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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/. -->
+
+<!-- Note: After removing all MDPI assets, the reader icons were being resolved
+           incorrectly for MDPI-V11 devices because of the way we use dummy
+           resources to cater for API 9 builds.  To fix we renamed the HDPI-V11
+           reader resources and point to them in the HDPI-V11 and MDPI-V11
+           drawable folders.  See Bug 1179758 for more info. -->
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+        android:src="@drawable/ic_menu_reader_remove_asset" />
rename from mobile/android/base/resources/drawable-hdpi-v11/ic_menu_reader_remove.png
rename to mobile/android/base/resources/drawable-hdpi-v11/ic_menu_reader_remove_asset.png
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/drawable-mdpi-v11/ic_menu_reader_add.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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/. -->
+
+<!-- Note: After removing all MDPI assets, the reader icons were being resolved
+           incorrectly for MDPI-V11 devices because of the way we use dummy
+           resources to cater for API 9 builds.  To fix we renamed the HDPI-V11
+           reader resources and point to them in the HDPI-V11 and MDPI-V11
+           drawable folders.  See Bug 1179758 for more info. -->
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+        android:src="@drawable/ic_menu_reader_add_asset" />
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/drawable-mdpi-v11/ic_menu_reader_remove.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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/. -->
+
+<!-- Note: After removing all MDPI assets, the reader icons were being resolved
+           incorrectly for MDPI-V11 devices because of the way we use dummy
+           resources to cater for API 9 builds.  To fix we renamed the HDPI-V11
+           reader resources and point to them in the HDPI-V11 and MDPI-V11
+           drawable folders.  See Bug 1179758 for more info. -->
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+        android:src="@drawable/ic_menu_reader_remove_asset" />
--- a/mobile/android/base/tabs/TabsPanel.java
+++ b/mobile/android/base/tabs/TabsPanel.java
@@ -40,46 +40,46 @@ import android.widget.LinearLayout;
 import android.widget.RelativeLayout;
 
 public class TabsPanel extends LinearLayout
                        implements GeckoPopupMenu.OnMenuItemClickListener,
                                   LightweightTheme.OnChangeListener,
                                   IconTabWidget.OnTabChangedListener {
     private static final String LOGTAG = "Gecko" + TabsPanel.class.getSimpleName();
 
-    public static enum Panel {
+    public enum Panel {
         NORMAL_TABS,
         PRIVATE_TABS,
     }
 
-    public static interface PanelView {
-        public void setTabsPanel(TabsPanel panel);
-        public void show();
-        public void hide();
-        public boolean shouldExpand();
+    public interface PanelView {
+        void setTabsPanel(TabsPanel panel);
+        void show();
+        void hide();
+        boolean shouldExpand();
     }
 
-    public static interface CloseAllPanelView extends PanelView {
-        public void closeAll();
+    public interface CloseAllPanelView extends PanelView {
+        void closeAll();
     }
 
-    public static interface TabsLayout extends CloseAllPanelView {
-        public void setEmptyView(View view);
+    public interface TabsLayout extends CloseAllPanelView {
+        void setEmptyView(View view);
     }
 
     public static View createTabsLayout(final Context context, final AttributeSet attrs) {
         if (HardwareUtils.isTablet()) {
             return new TabsGridLayout(context, attrs);
         } else {
             return new TabsListLayout(context, attrs);
         }
     }
 
-    public static interface TabsLayoutChangeListener {
-        public void onTabsLayoutChange(int width, int height);
+    public interface TabsLayoutChangeListener {
+        void onTabsLayoutChange(int width, int height);
     }
 
     private final Context mContext;
     private final GeckoApp mActivity;
     private final LightweightTheme mTheme;
     private RelativeLayout mHeader;
     private TabsLayoutContainer mTabsContainer;
     private PanelView mPanel;
--- a/mobile/android/chrome/content/RemoteDebugger.js
+++ b/mobile/android/chrome/content/RemoteDebugger.js
@@ -1,17 +1,20 @@
 // -*- Mode: js; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
 /* 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/. */
 /* globals DebuggerServer */
 "use strict";
 
-XPCOMUtils.defineLazyModuleGetter(this, "DebuggerServer",
-                                  "resource://gre/modules/devtools/dbg-server.jsm");
+XPCOMUtils.defineLazyGetter(this, "DebuggerServer", () => {
+  let { require } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
+  let { DebuggerServer } = require("devtools/server/main");
+  return DebuggerServer;
+});
 
 let RemoteDebugger = {
   init() {
     USBRemoteDebugger.init();
     WiFiRemoteDebugger.init();
   },
 
   get isAnyEnabled() {
--- a/mobile/android/chrome/content/aboutPrivateBrowsing.xhtml
+++ b/mobile/android/chrome/content/aboutPrivateBrowsing.xhtml
@@ -27,17 +27,17 @@
   <body class="private">
     <img class="showPrivate masq" src="chrome://browser/skin/images/privatebrowsing-mask-and-shield.svg" />
     <img class="showNormal masq" src="chrome://browser/skin/images/privatebrowsing-mask.png" />
 
     <h1 class="showPrivate">&privatebrowsingpage.title;<br />&privatebrowsingpage.title.private;</h1>
     <h1 class="showNormal">&privatebrowsingpage.title.normal1;</h1>
 
     <div class="contentSection">
-      <p class="showPrivate">&privatebrowsingpage.description.private3;</p>
+      <p class="showPrivate">&privatebrowsingpage.description.private4;</p>
       <p class="showNormal">&privatebrowsingpage.description.normal2;</p>
 
       <p class="showPrivate"><a href="https://support.mozilla.org/kb/private-browsing-firefox-android">&privatebrowsingpage.link.private;</a></p>
       <p class="showNormal"><a href="#" id="newPrivateTabLink">&privatebrowsingpage.link.normal;</a></p>
     </div>
 
   </body>
 </html>
--- a/mobile/android/locales/en-US/chrome/aboutPrivateBrowsing.dtd
+++ b/mobile/android/locales/en-US/chrome/aboutPrivateBrowsing.dtd
@@ -5,13 +5,13 @@
 <!ENTITY privatebrowsingpage.title "Private Browsing">
 
 <!-- Localisation note: the plus sign here is a shorthand way of expressing the word "and". Contextually the privatebrowsingpage.title.private string
                         is used as a title, with the privatebrowsingpage.title string preceding it but on a separate line.
                         So the final line will say "Private Browsing + Tracking Protection". -->
 <!ENTITY privatebrowsingpage.title.private "+ Tracking Protection">
 <!ENTITY privatebrowsingpage.title.normal1 "You are not in Private Browsing">
 
-<!ENTITY privatebrowsingpage.description.private3 "Firefox will prevent you from being tracked and won't remember any history, but downloaded files and new bookmarks will still be saved to your device.">
+<!ENTITY privatebrowsingpage.description.private4 "&brandShortName; will prevent you from being tracked and won't remember any history, but downloaded files and new bookmarks will still be saved to your device.">
 <!ENTITY privatebrowsingpage.description.normal2 "In Private Browsing, we won't keep any of your browsing history or cookies. Bookmarks you add and files you download will still be saved on your device.">
 
 <!ENTITY privatebrowsingpage.link.private "Want to learn more?">
 <!ENTITY privatebrowsingpage.link.normal "Open a new private tab">
--- a/testing/xpcshell/head.js
+++ b/testing/xpcshell/head.js
@@ -373,18 +373,19 @@ function _setupDebuggerServer(breakpoint
                       .getService(Components.interfaces.nsIEnvironment);
   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, OriginalLocation} =
-    Components.utils.import('resource://gre/modules/devtools/dbg-server.jsm', {});
+  let { require } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
+  let { DebuggerServer } = require("devtools/server/main");
+  let { OriginalLocation } = require("devtools/server/actors/common");
   DebuggerServer.init();
   DebuggerServer.addBrowserActors();
   DebuggerServer.addActors("resource://testing-common/dbg-actors.js");
   DebuggerServer.allowChromeProcess = true;
 
   // An observer notification that tells us when we can "resume" script
   // execution.
   let obsSvc = Components.classes["@mozilla.org/observer-service;1"].
--- a/toolkit/components/telemetry/TelemetrySession.jsm
+++ b/toolkit/components/telemetry/TelemetrySession.jsm
@@ -865,22 +865,16 @@ let Impl = {
 
     let failedProfileLockCount = Telemetry.failedProfileLockCount;
     if (failedProfileLockCount)
       ret.failedProfileLockCount = failedProfileLockCount;
 
     for (let ioCounter in this._startupIO)
       ret[ioCounter] = this._startupIO[ioCounter];
 
-    let hasPingBeenSent = false;
-    try {
-      hasPingBeenSent = Telemetry.getHistogramById("TELEMETRY_SUCCESS").snapshot().sum > 0;
-    } catch(e) {
-    }
-
     ret.savedPings = TelemetryStorage.pendingPingCount;
 
     ret.activeTicks = -1;
     let sr = TelemetryController.getSessionRecorder();
     if (sr) {
       let activeTicks = sr.activeTicks;
       if (isSubsession) {
         activeTicks = sr.activeTicks - this._subsessionStartActiveTicks;
--- a/toolkit/devtools/apps/tests/debugger-protocol-helper.js
+++ b/toolkit/devtools/apps/tests/debugger-protocol-helper.js
@@ -1,18 +1,18 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
-const { DebuggerServer } = Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
 const { DebuggerClient } = Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
 const { require } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
+const { DebuggerServer } = require("devtools/server/main");
 const { FileUtils } = Cu.import("resource://gre/modules/FileUtils.jsm");
 const { Services } = Cu.import("resource://gre/modules/Services.jsm");
 
 let gClient, gActor;
 
 function connect(onDone) {
 
   if (Services.appinfo.name == "B2G") {
--- a/toolkit/devtools/apps/tests/unit/head_apps.js
+++ b/toolkit/devtools/apps/tests/unit/head_apps.js
@@ -2,23 +2,23 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 const Cr = Components.results;
 const CC = Components.Constructor;
 
-Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
 Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/FileUtils.jsm");
 const {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
+const {DebuggerServer} = require("devtools/server/main");
 const {AppActorFront} = require("devtools/app-actor-front");
 
 let gClient, gActor, gActorFront;
 
 function connect(onDone) {
   // Initialize a loopback remote protocol connection
   DebuggerServer.init();
   // We need to register browser actors to have `listTabs` working
--- a/toolkit/devtools/client/connection-manager.js
+++ b/toolkit/devtools/client/connection-manager.js
@@ -5,20 +5,20 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const {Cc, Ci, Cu, Cr} = require("chrome");
 const {setTimeout, clearTimeout} = require('sdk/timers');
 const EventEmitter = require("devtools/toolkit/event-emitter");
 const DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
+const { DebuggerServer } = require("devtools/server/main");
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
-Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
 DevToolsUtils.defineLazyModuleGetter(this, "Task",
   "resource://gre/modules/Task.jsm");
 
 const REMOTE_TIMEOUT = "devtools.debugger.remote-timeout";
 
 /**
  * Connection Manager.
  *
--- a/toolkit/devtools/security/tests/unit/head_dbg.js
+++ b/toolkit/devtools/security/tests/unit/head_dbg.js
@@ -12,16 +12,17 @@ const { require } =
   Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
 const { Promise: promise } =
   Cu.import("resource://gre/modules/Promise.jsm", {});
 const { Task } = Cu.import("resource://gre/modules/Task.jsm", {});
 
 const Services = require("Services");
 const DevToolsUtils = require("devtools/toolkit/DevToolsUtils.js");
 const xpcInspector = require("xpcInspector");
+const { DebuggerServer } = require("devtools/server/main");
 
 // We do not want to log packets by default, because in some tests,
 // we can be sending large amounts of data. The test harness has
 // trouble dealing with logging all the data, and we end up with
 // intermittent time outs (e.g. bug 775924).
 // Services.prefs.setBoolPref("devtools.debugger.log", true);
 // Services.prefs.setBoolPref("devtools.debugger.log.verbose", true);
 // Enable remote debugging for the relevant tests.
@@ -34,17 +35,16 @@ function tryImport(url) {
     Cu.import(url);
   } catch (e) {
     dump("Error importing " + url + "\n");
     dump(DevToolsUtils.safeErrorString(e) + "\n");
     throw e;
   }
 }
 
-tryImport("resource://gre/modules/devtools/dbg-server.jsm");
 tryImport("resource://gre/modules/devtools/dbg-client.jsm");
 
 // Convert an nsIScriptError 'aFlags' value into an appropriate string.
 function scriptErrorFlagsToKind(aFlags) {
   var kind;
   if (aFlags & Ci.nsIScriptError.warningFlag)
     kind = "warning";
   if (aFlags & Ci.nsIScriptError.exceptionFlag)
--- a/toolkit/devtools/server/child.js
+++ b/toolkit/devtools/server/child.js
@@ -10,17 +10,17 @@ let chromeGlobal = this;
 
 // Encapsulate in its own scope to allows loading this frame script
 // more than once.
 (function () {
   let Cu = Components.utils;
   let { require } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
   const DevToolsUtils = require("devtools/toolkit/DevToolsUtils.js");
   const { dumpn } = DevToolsUtils;
-  const { DebuggerServer, ActorPool } = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
+  const { DebuggerServer, ActorPool } = require("devtools/server/main");
 
   // Note that this frame script may be evaluated in non-e10s build
   // In such case, DebuggerServer is already going to be initialized.
   if (!DebuggerServer.initialized) {
     DebuggerServer.init();
     DebuggerServer.isInChildProcess = true;
   }
 
--- a/toolkit/devtools/server/tests/browser/head.js
+++ b/toolkit/devtools/server/tests/browser/head.js
@@ -5,17 +5,17 @@
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 const {console} = Cu.import("resource://gre/modules/devtools/Console.jsm", {});
 const {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
 const {DebuggerClient} = Cu.import("resource://gre/modules/devtools/dbg-client.jsm", {});
-const {DebuggerServer} = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
+const {DebuggerServer} = require("devtools/server/main");
 
 const PATH = "browser/toolkit/devtools/server/tests/browser/";
 const MAIN_DOMAIN = "http://test1.example.org/" + PATH;
 const ALT_DOMAIN = "http://sectest1.example.org/" + PATH;
 const ALT_DOMAIN_SECURED = "https://sectest1.example.org:443/" + PATH;
 
 // All tests are asynchronous.
 waitForExplicitFinish();
--- a/toolkit/devtools/server/tests/mochitest/director-helpers.js
+++ b/toolkit/devtools/server/tests/mochitest/director-helpers.js
@@ -1,13 +1,12 @@
 var Cu = Components.utils;
 Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
-Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
 const {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
-
+const {DebuggerServer} = require("devtools/server/main");
 const Services = require("Services");
 
 // Always log packets when running tests.
 Services.prefs.setBoolPref("devtools.debugger.log", true);
 Services.prefs.setBoolPref("dom.mozBrowserFramesEnabled", true);
 
 SimpleTest.registerCleanupFunction(function() {
   Services.prefs.clearUserPref("devtools.debugger.log");
--- a/toolkit/devtools/server/tests/mochitest/inspector-helpers.js
+++ b/toolkit/devtools/server/tests/mochitest/inspector-helpers.js
@@ -1,13 +1,13 @@
 var Cu = Components.utils;
 
 const {require} = 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");
+const {DebuggerServer} = require("devtools/server/main");
 Cu.import("resource://gre/modules/Task.jsm");
 
 const Services = require("Services");
 const {_documentWalker} = require("devtools/server/actors/inspector");
 
 // Always log packets when running tests.
 Services.prefs.setBoolPref("devtools.debugger.log", true);
 SimpleTest.registerCleanupFunction(function() {
--- a/toolkit/devtools/server/tests/mochitest/memory-helpers.js
+++ b/toolkit/devtools/server/tests/mochitest/memory-helpers.js
@@ -6,20 +6,20 @@ Cu.import("resource://gre/modules/Servic
 
 // Always log packets when running tests.
 Services.prefs.setBoolPref("devtools.debugger.log", true);
 SimpleTest.registerCleanupFunction(function() {
   Services.prefs.clearUserPref("devtools.debugger.log");
 });
 
 Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
-Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
 
 Cu.import("resource://gre/modules/Task.jsm");
 let { require } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
+let { DebuggerServer } = require("devtools/server/main");
 
 let { MemoryFront } = require("devtools/server/actors/memory");
 
 function startServerAndGetSelectedTabMemory() {
   DebuggerServer.init();
   DebuggerServer.addBrowserActors();
   var client = new DebuggerClient(DebuggerServer.connectPipe());
 
--- a/toolkit/devtools/server/tests/mochitest/test_connectToChild.html
+++ b/toolkit/devtools/server/tests/mochitest/test_connectToChild.html
@@ -13,17 +13,18 @@ Bug 966991 - Test DebuggerServer.connect
 <pre id="test">
 <script type="application/javascript;version=1.8">
 
 let Cu = Components.utils;
 let Cc = Components.classes;
 let Ci = Components.interfaces;
 
 Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
-Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
+let { require } = Cu.import("resource://gre/modules/devtools/Loader.jsm");
+let { DebuggerServer } = require("devtools/server/main");
 
 window.onload = function() {
   SimpleTest.waitForExplicitFinish();
 
   SpecialPowers.pushPrefEnv({
     "set": [
       // Always log packets when running tests.
       ["devtools.debugger.log", true],
@@ -38,17 +39,18 @@ function runTests() {
   iframe.mozbrowser = true;
   document.body.appendChild(iframe);
 
   let mm = iframe.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader.messageManager;
 
   // Register a test actor in the child process so that we can know if and when
   // this fake actor is disconnected.
   mm.loadFrameScript("data:text/javascript,new " + function FrameScriptScope() {
-    const {DebuggerServer} = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
+    const { require } = Cu.import("resource://gre/modules/devtools/Loader.jsm");
+    const { DebuggerServer } = require("devtools/server/main");
 
     if (!DebuggerServer.initialized) {
       DebuggerServer.init();
     }
 
     function TestActor() {dump("instanciate test actor\n");}
     TestActor.prototype = {
       actorPrefix: "test",
--- a/toolkit/devtools/server/tests/mochitest/test_connection-manager.html
+++ b/toolkit/devtools/server/tests/mochitest/test_connection-manager.html
@@ -13,18 +13,18 @@ Bug 898485 - [app manager] Implement an 
 <pre id="test">
 <script>
 
 window.onload = function() {
   SimpleTest.waitForExplicitFinish();
 
   var Cu = Components.utils;
 
-  Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
   var {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
+  var {DebuggerServer} = require("devtools/server/main");
   Cu.import("resource://gre/modules/Services.jsm");
 
   if (!DebuggerServer.initialized) {
     DebuggerServer.init();
     DebuggerServer.addBrowserActors();
   }
 
   var {ConnectionManager, Connection} = require("devtools/client/connection-manager");
--- a/toolkit/devtools/server/tests/mochitest/test_device.html
+++ b/toolkit/devtools/server/tests/mochitest/test_device.html
@@ -16,17 +16,17 @@ Bug 895360 - [app manager] Device meta d
 window.onload = function() {
   var Cu = Components.utils;
   var Cc = Components.classes;
   var Ci = Components.interfaces;
 
   Cu.import("resource://gre/modules/PermissionsTable.jsm");
   var {require} = 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");
+  var {DebuggerServer} = require("devtools/server/main");
   Cu.import("resource://gre/modules/Services.jsm");
 
   SimpleTest.waitForExplicitFinish();
 
   var {getDeviceFront} = require("devtools/server/actors/device");
 
   if (!DebuggerServer.initialized) {
     DebuggerServer.init();
--- a/toolkit/devtools/server/tests/mochitest/test_framerate_01.html
+++ b/toolkit/devtools/server/tests/mochitest/test_framerate_01.html
@@ -23,17 +23,17 @@ window.onload = function() {
   // Always log packets when running tests.
   Services.prefs.setBoolPref("devtools.debugger.log", true);
   SimpleTest.registerCleanupFunction(function() {
     Services.prefs.clearUserPref("devtools.debugger.log");
   });
 
   var { require } = 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");
+  var { DebuggerServer } = require("devtools/server/main");
 
   SimpleTest.waitForExplicitFinish();
 
   var {FramerateFront} = require("devtools/server/actors/framerate");
 
   function plotFPS(ticks, interval = 100, clamp = 60) {
     var timeline = [];
     var totalTicks = ticks.length;
--- a/toolkit/devtools/server/tests/mochitest/test_framerate_02.html
+++ b/toolkit/devtools/server/tests/mochitest/test_framerate_02.html
@@ -23,17 +23,17 @@ window.onload = function() {
   // Always log packets when running tests.
   Services.prefs.setBoolPref("devtools.debugger.log", true);
   SimpleTest.registerCleanupFunction(function() {
     Services.prefs.clearUserPref("devtools.debugger.log");
   });
 
   var {require} = 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");
+  var {DebuggerServer} = require("devtools/server/main");
 
   SimpleTest.waitForExplicitFinish();
 
   var {FramerateFront} = require("devtools/server/actors/framerate");
 
   function plotFPS(ticks, interval = 100, clamp = 60) {
     var timeline = [];
     var totalTicks = ticks.length;
--- a/toolkit/devtools/server/tests/mochitest/test_framerate_03.html
+++ b/toolkit/devtools/server/tests/mochitest/test_framerate_03.html
@@ -23,17 +23,17 @@ window.onload = function() {
   // Always log packets when running tests.
   Services.prefs.setBoolPref("devtools.debugger.log", true);
   SimpleTest.registerCleanupFunction(function() {
     Services.prefs.clearUserPref("devtools.debugger.log");
   });
 
   var {require} = 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");
+  var {DebuggerServer} = require("devtools/server/main");
 
   SimpleTest.waitForExplicitFinish();
 
   var {FramerateFront} = require("devtools/server/actors/framerate");
   var START_TICK = 2000;
   var STOP_TICK = 3000;
   var TOTAL_TIME = 5000;
 
--- a/toolkit/devtools/server/tests/mochitest/test_framerate_05.html
+++ b/toolkit/devtools/server/tests/mochitest/test_framerate_05.html
@@ -23,17 +23,17 @@ window.onload = function() {
   // Always log packets when running tests.
   Services.prefs.setBoolPref("devtools.debugger.log", true);
   SimpleTest.registerCleanupFunction(function() {
     Services.prefs.clearUserPref("devtools.debugger.log");
   });
 
   var {require} = 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");
+  var {DebuggerServer} = require("devtools/server/main");
 
   SimpleTest.waitForExplicitFinish();
 
   var {FramerateFront} = require("devtools/server/actors/framerate");
 
   DebuggerServer.init();
   DebuggerServer.addBrowserActors();
 
--- a/toolkit/devtools/server/tests/mochitest/test_getProcess.html
+++ b/toolkit/devtools/server/tests/mochitest/test_getProcess.html
@@ -12,18 +12,19 @@ Bug 1060093 - Test DebuggerServer.getPro
 <body>
 <pre id="test">
 <script type="application/javascript;version=1.8">
 
 let Cu = Components.utils;
 let Cc = Components.classes;
 let Ci = Components.interfaces;
 
+let {require} = 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");
+let {DebuggerServer} = require("devtools/server/main");
 
 window.onload = function() {
   SimpleTest.waitForExplicitFinish();
 
   SpecialPowers.pushPrefEnv({
     "set": [
       // Always log packets when running tests.
       ["devtools.debugger.log", true],
--- a/toolkit/devtools/server/tests/mochitest/test_preference.html
+++ b/toolkit/devtools/server/tests/mochitest/test_preference.html
@@ -15,17 +15,17 @@ Bug 943251 - Allow accessing about:confi
 
 function runTests() {
   var Cu = Components.utils;
   var Cc = Components.classes;
   var Ci = Components.interfaces;
 
   var {require} = 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");
+  var {DebuggerServer} = require("devtools/server/main");
   Cu.import("resource://gre/modules/Services.jsm");
 
   SimpleTest.waitForExplicitFinish();
 
   var {getPreferenceFront} = require("devtools/server/actors/preference");
 
   DebuggerServer.init();
   DebuggerServer.addBrowserActors();
--- a/toolkit/devtools/server/tests/mochitest/test_registerActor.html
+++ b/toolkit/devtools/server/tests/mochitest/test_registerActor.html
@@ -15,17 +15,17 @@ Bug 895360 - [app manager] Device meta d
 var gClient;
 window.onload = function() {
   var Cu = Components.utils;
   var Cc = Components.classes;
   var Ci = Components.interfaces;
 
   var {require} = 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");
+  var {DebuggerServer} = require("devtools/server/main");
   Cu.import("resource://gre/modules/Services.jsm");
 
   SimpleTest.waitForExplicitFinish();
 
   var {ActorRegistryFront} = require("devtools/server/actors/actor-registry");
   var actorURL = "chrome://mochitests/content/chrome/toolkit/devtools/server/tests/mochitest/hello-actor.js";
 
   if (!DebuggerServer.initialized) {
--- a/toolkit/devtools/server/tests/mochitest/test_settings.html
+++ b/toolkit/devtools/server/tests/mochitest/test_settings.html
@@ -16,17 +16,17 @@ Bug 1022797 - Settings support from WebI
 
 function runTests() {
   var Cu = Components.utils;
   var Cc = Components.classes;
   var Ci = Components.interfaces;
 
   var {require} = 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");
+  var {DebuggerServer} = require("devtools/server/main");
 
   if (SpecialPowers.isMainProcess()) {
     Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
   }
 
   SimpleTest.waitForExplicitFinish();
 
   var {getSettingsFront, _setDefaultSettings} = require("devtools/server/actors/settings");
--- a/toolkit/devtools/server/tests/mochitest/test_setupInParentChild.html
+++ b/toolkit/devtools/server/tests/mochitest/test_setupInParentChild.html
@@ -13,18 +13,19 @@ Bug 1181100 - Test DebuggerServerConnect
 <pre id="test">
 <script type="application/javascript;version=1.8">
 
 let Cu = Components.utils;
 let Cc = Components.classes;
 let Ci = Components.interfaces;
 
 Cu.import("resource://gre/modules/Services.jsm");
+let {require} = 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");
+let {DebuggerServer} = require("devtools/server/main");
 
 window.onload = function() {
   SimpleTest.waitForExplicitFinish();
 
   SpecialPowers.pushPrefEnv({
     "set": [
       // Always log packets when running tests.
       ["devtools.debugger.log", true],
--- a/toolkit/devtools/server/tests/unit/test_dbgactor.js
+++ b/toolkit/devtools/server/tests/unit/test_dbgactor.js
@@ -1,14 +1,11 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
-Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
-
 var gClient;
 var gDebuggee;
 
 const xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
 
 function run_test()
 {
   initTestDebuggerServer();
--- a/toolkit/devtools/server/tests/unit/test_dbgclient_debuggerstatement.js
+++ b/toolkit/devtools/server/tests/unit/test_dbgclient_debuggerstatement.js
@@ -1,14 +1,11 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
-Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
-
 var gClient;
 var gTabClient;
 var gDebuggee;
 
 function run_test()
 {
   initTestDebuggerServer();
   gDebuggee = testGlobal("test-1");
--- a/toolkit/devtools/server/tests/unit/test_dbgglobal.js
+++ b/toolkit/devtools/server/tests/unit/test_dbgglobal.js
@@ -1,14 +1,11 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
-Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
-
 function run_test()
 {
   // Should get an exception if we try to interact with DebuggerServer
   // before we initialize it...
   check_except(function() {
     DebuggerServer.createListener();
   });
   check_except(DebuggerServer.closeAllListeners);
--- a/toolkit/devtools/transport/tests/unit/head_dbg.js
+++ b/toolkit/devtools/transport/tests/unit/head_dbg.js
@@ -21,29 +21,18 @@ const DevToolsUtils = require("devtools/
 // we can be sending large amounts of data. The test harness has
 // trouble dealing with logging all the data, and we end up with
 // intermittent time outs (e.g. bug 775924).
 // Services.prefs.setBoolPref("devtools.debugger.log", true);
 // Services.prefs.setBoolPref("devtools.debugger.log.verbose", true);
 // Enable remote debugging for the relevant tests.
 Services.prefs.setBoolPref("devtools.debugger.remote-enabled", true);
 
-function tryImport(url) {
-  try {
-    Cu.import(url);
-  } catch (e) {
-    dump("Error importing " + url + "\n");
-    dump(DevToolsUtils.safeErrorString(e) + "\n");
-    throw e;
-  }
-}
-
-tryImport("resource://gre/modules/devtools/dbg-server.jsm");
-tryImport("resource://gre/modules/devtools/dbg-client.jsm");
-tryImport("resource://gre/modules/devtools/Loader.jsm");
+const { DebuggerServer } = require("devtools/server/main");
+Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
 
 function testExceptionHook(ex) {
   try {
     do_report_unexpected_exception(ex);
   } catch(ex) {
     return {throw: ex}
   }
   return undefined;
--- a/toolkit/devtools/transport/tests/unit/test_bulk_error.js
+++ b/toolkit/devtools/transport/tests/unit/test_bulk_error.js
@@ -1,19 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-let { DebuggerServer } =
-  Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
-let { DebuggerClient } =
-  Cu.import("resource://gre/modules/devtools/dbg-client.jsm", {});
 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() {
   initTestDebuggerServer();
   add_test_bulk_actor();
 
   add_task(function*() {
     yield test_string_error(socket_transport, json_reply);
     yield test_string_error(local_transport, json_reply);
--- a/toolkit/devtools/transport/tests/unit/test_client_server_bulk.js
+++ b/toolkit/devtools/transport/tests/unit/test_client_server_bulk.js
@@ -1,20 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-let { DebuggerServer } =
-  Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
-let { DebuggerClient } =
-  Cu.import("resource://gre/modules/devtools/dbg-client.jsm", {});
 let { FileUtils } = Cu.import("resource://gre/modules/FileUtils.jsm", {});
 let { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {});
-let { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
 let Pipe = CC("@mozilla.org/pipe;1", "nsIPipe", "init");
-let { Promise: promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
 
 function run_test() {
   initTestDebuggerServer();
   add_test_bulk_actor();
 
   add_task(function*() {
     yield test_bulk_request_cs(socket_transport, "jsonReply", "json");
     yield test_bulk_request_cs(local_transport, "jsonReply", "json");
--- a/toolkit/devtools/transport/tests/unit/test_dbgsocket.js
+++ b/toolkit/devtools/transport/tests/unit/test_dbgsocket.js
@@ -1,14 +1,11 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
-Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
-
 let gPort;
 let gExtraListener;
 
 function run_test()
 {
   do_print("Starting test at " + new Date().toTimeString());
   initTestDebuggerServer();
 
--- a/toolkit/devtools/transport/tests/unit/test_dbgsocket_connection_drop.js
+++ b/toolkit/devtools/transport/tests/unit/test_dbgsocket_connection_drop.js
@@ -3,19 +3,16 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
  * Bug 755412 - checks if the server drops the connection on an improperly
  * framed packet, i.e. when the length header is invalid.
  */
 
-Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
-Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
-
 const { RawPacket } = require("devtools/toolkit/transport/packets");
 
 function run_test() {
   do_print("Starting test at " + new Date().toTimeString());
   initTestDebuggerServer();
 
   add_task(test_socket_conn_drops_after_invalid_header);
   add_task(test_socket_conn_drops_after_invalid_header_2);
--- a/toolkit/devtools/transport/tests/unit/test_no_bulk.js
+++ b/toolkit/devtools/transport/tests/unit/test_no_bulk.js
@@ -1,19 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-let { DebuggerServer } =
-  Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
-let { DebuggerClient } =
-  Cu.import("resource://gre/modules/devtools/dbg-client.jsm", {});
 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();
 
   add_task(function*() {
     yield test_bulk_send_error(socket_transport);
--- a/toolkit/devtools/transport/tests/unit/test_queue.js
+++ b/toolkit/devtools/transport/tests/unit/test_queue.js
@@ -1,18 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * This test verifies that the transport's queue operates correctly when various
  * packets are scheduled simultaneously.
  */
 
-let { DebuggerServer } =
-  Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
 let { FileUtils } = Cu.import("resource://gre/modules/FileUtils.jsm", {});
 let { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {});
 
 function run_test() {
   initTestDebuggerServer();
 
   add_task(function*() {
     yield test_transport(socket_transport);
--- a/toolkit/devtools/transport/tests/unit/test_transport_bulk.js
+++ b/toolkit/devtools/transport/tests/unit/test_transport_bulk.js
@@ -1,16 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-let { DebuggerServer } =
-  Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
 let { FileUtils } = Cu.import("resource://gre/modules/FileUtils.jsm", {});
 let { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {});
-let { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
 
 function run_test() {
   initTestDebuggerServer();
 
   add_task(function*() {
     yield test_bulk_transfer_transport(socket_transport);
     yield test_bulk_transfer_transport(local_transport);
     DebuggerServer.destroy();
--- a/toolkit/devtools/webconsole/test/common.js
+++ b/toolkit/devtools/webconsole/test/common.js
@@ -13,25 +13,25 @@ const {Task} = Cu.import("resource://gre
 // This gives logging to stdout for tests
 var {console} = Cu.import("resource://gre/modules/devtools/Console.jsm", {});
 
 let {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
 let WebConsoleUtils = require("devtools/toolkit/webconsole/utils").Utils;
 
 let ConsoleAPIStorage = Cc["@mozilla.org/consoleAPI-storage;1"]
                           .getService(Ci.nsIConsoleAPIStorage);
+let {DebuggerServer} = require("devtools/server/main");
 
 let {ConsoleServiceListener, ConsoleAPIListener} =
   require("devtools/toolkit/webconsole/utils");
 
 function initCommon()
 {
   //Services.prefs.setBoolPref("devtools.debugger.log", true);
 
-  Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
   Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
 }
 
 function initDebuggerServer()
 {
   if (!DebuggerServer.initialized) {
     DebuggerServer.init();
     DebuggerServer.addBrowserActors();
--- a/webapprt/RemoteDebugger.jsm
+++ b/webapprt/RemoteDebugger.jsm
@@ -7,17 +7,18 @@
 this.EXPORTED_SYMBOLS = ["RemoteDebugger"];
 
 let Cc = Components.classes;
 let Ci = Components.interfaces;
 let Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import('resource://gre/modules/devtools/dbg-server.jsm');
+let { require } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
+let { DebuggerServer } = require("devtools/server/main");
 
 this.RemoteDebugger = {
   init: function(port) {
     if (!DebuggerServer.initialized) {
       DebuggerServer.init();
       DebuggerServer.addBrowserActors("webapprt:webapp");
       DebuggerServer.addActors("chrome://webapprt/content/dbg-webapp-actors.js");
     }
--- a/webapprt/test/chrome/browser_debugger.js
+++ b/webapprt/test/chrome/browser_debugger.js
@@ -1,10 +1,11 @@
 Cu.import("resource://gre/modules/Services.jsm");
-let { DebuggerServer } = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
+let { require } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
+let { DebuggerServer } = require("devtools/server/main");
 let { DebuggerClient } = Cu.import("resource://gre/modules/devtools/dbg-client.jsm", {});
 let { RemoteDebugger } = Cu.import("resource://webapprt/modules/RemoteDebugger.jsm", {});
 
 function test() {
   waitForExplicitFinish();
 
   loadWebapp("debugger.webapp", undefined, () => {
     RemoteDebugger.init(Services.prefs.getIntPref('devtools.debugger.remote-port'));