Backed out changeset 6f17a72e69cc (bug 1367424)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Tue, 06 Jun 2017 13:02:29 +0200
changeset 410620 3b60060e152977255d780db5d4504a80075107cd
parent 410619 a36d3b0c90df1e7f6427d30269bf25e3364344dd
child 410621 1330312e91c96fea39eb4881672c5f9a7776bef1
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1367424
milestone55.0a1
backs out6f17a72e69cc9ccab071091347f6bb5cf7a57bab
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 6f17a72e69cc (bug 1367424)
addon-sdk/source/lib/dev/debuggee.js
addon-sdk/source/lib/dev/toolbox.js
addon-sdk/source/lib/dev/utils.js
addon-sdk/source/lib/sdk/addon/runner.js
addon-sdk/source/test/addons/page-mod-debugger-post/main.js
addon-sdk/source/test/addons/page-mod-debugger-pre/main.js
--- 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 { DevToolsShim } = Cu.import("chrome://devtools-shim/content/DevToolsShim.jsm", {});
+const { require: devtoolsRequire } = Cu.import("resource://devtools/shared/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);
@@ -43,18 +44,22 @@ const Debuggee = Class({
     }
     outputFor(this).close();
   },
   start: function() {
     const target = targets.get(this);
     if (target.isLocalTab) {
       // Since a remote protocol connection will be made, let's start the
       // DebuggerServer here, once and for all tools.
-      let transport = DevToolsShim.connectDebuggerServer();
-      transports.set(this, transport);
+      if (!DebuggerServer.initialized) {
+        DebuggerServer.init();
+        DebuggerServer.addBrowserActors();
+      }
+
+      transports.set(this, DebuggerServer.connectPipe());
     }
     // TODO: Implement support for remote connections (See Bug 980421)
     else {
       throw Error("Remote targets are not yet supported");
     }
 
     // pipe messages send to the debuggee to an actual
     // server via remote debugging protocol transport.
--- a/addon-sdk/source/lib/dev/toolbox.js
+++ b/addon-sdk/source/lib/dev/toolbox.js
@@ -10,17 +10,17 @@ module.metadata = {
 
 const { Cu, Cc, Ci } = require("chrome");
 const { Class } = require("../sdk/core/heritage");
 const { Disposable, setup } = require("../sdk/core/disposable");
 const { contract, validate } = require("../sdk/util/contract");
 const { each, pairs, values } = require("../sdk/util/sequence");
 const { onEnable, onDisable } = require("../dev/theme/hooks");
 
-const { DevToolsShim } = Cu.import("chrome://devtools-shim/content/DevToolsShim.jsm", {});
+const { gDevTools } = Cu.import("resource://devtools/client/framework/gDevTools.jsm", {});
 
 // This is temporary workaround to allow loading of the developer tools client - volcan
 // into a toolbox panel, this hack won't be necessary as soon as devtools patch will be
 // shipped in nightly, after which it can be removed. Bug 1038517
 const registerSDKURI = () => {
   const ioService = Cc['@mozilla.org/network/io-service;1']
                       .getService(Ci.nsIIOService);
   const resourceHandler = ioService.getProtocolHandler("resource")
@@ -41,17 +41,17 @@ const Tool = Class({
     this.panels = panels;
     this.themes = themes;
 
     each(([key, Panel]) => {
       const { url, label, tooltip, icon, invertIconForLightTheme,
               invertIconForDarkTheme } = validate(Panel.prototype);
       const { id } = Panel.prototype;
 
-      DevToolsShim.registerTool({
+      gDevTools.registerTool({
         id: id,
         url: "about:blank",
         label: label,
         tooltip: tooltip,
         icon: icon,
         invertIconForLightTheme: invertIconForLightTheme,
         invertIconForDarkTheme: invertIconForDarkTheme,
         isTargetSupported: target => target.isLocalTab,
@@ -65,37 +65,37 @@ const Tool = Class({
         }
       });
     }, pairs(panels));
 
     each(([key, theme]) => {
       validate(theme);
       setup(theme);
 
-      DevToolsShim.registerTheme({
+      gDevTools.registerTheme({
         id: theme.id,
         label: theme.label,
         stylesheets: theme.getStyles(),
         classList: theme.getClassList(),
         onApply: (window, oldTheme) => {
           onEnable(theme, { window: window,
                             oldTheme: oldTheme });
         },
         onUnapply: (window, newTheme) => {
           onDisable(theme, { window: window,
                             newTheme: newTheme });
         }
       });
     }, pairs(themes));
   },
   dispose: function() {
-    each(Panel => DevToolsShim.unregisterTool(Panel.prototype.id),
+    each(Panel => gDevTools.unregisterTool(Panel.prototype.id),
          values(this.panels));
 
-    each(Theme => DevToolsShim.unregisterTheme(Theme.prototype.id),
+    each(Theme => gDevTools.unregisterTheme(Theme.prototype.id),
          values(this.themes));
   }
 });
 
 validate.define(Tool, contract({
   panels: {
     is: ["object", "undefined"]
   },
--- a/addon-sdk/source/lib/dev/utils.js
+++ b/addon-sdk/source/lib/dev/utils.js
@@ -1,39 +1,40 @@
 /* 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";
 
 const { Cu } = require("chrome");
-const { DevToolsShim } = Cu.import("chrome://devtools-shim/content/DevToolsShim.jsm", {});
+const { gDevTools } = Cu.import("resource://devtools/client/framework/gDevTools.jsm", {});
+const { devtools } = Cu.import("resource://devtools/shared/Loader.jsm", {});
 
 const { getActiveTab } = require("../sdk/tabs/utils");
 const { getMostRecentBrowserWindow } = require("../sdk/window/utils");
 
 const targetFor = target => {
   target = target || getActiveTab(getMostRecentBrowserWindow());
-  return DevToolsShim.getTargetForTab(target);
+  return devtools.TargetFactory.forTab(target);
 };
 
 const getId = id => ((id.prototype && id.prototype.id) || id.id || id);
 
 const getCurrentPanel = toolbox => toolbox.getCurrentPanel();
 exports.getCurrentPanel = getCurrentPanel;
 
 const openToolbox = (id, tab) => {
   id = getId(id);
-  return DevToolsShim.showToolbox(targetFor(tab), id);
+  return gDevTools.showToolbox(targetFor(tab), id);
 };
 exports.openToolbox = openToolbox;
 
-const closeToolbox = tab => DevToolsShim.closeToolbox(targetFor(tab));
+const closeToolbox = tab => gDevTools.closeToolbox(targetFor(tab));
 exports.closeToolbox = closeToolbox;
 
-const getToolbox = tab => DevToolsShim.getToolbox(targetFor(tab));
+const getToolbox = tab => gDevTools.getToolbox(targetFor(tab));
 exports.getToolbox = getToolbox;
 
 const openToolboxPanel = (id, tab) => {
   id = getId(id);
-  return DevToolsShim.showToolbox(targetFor(tab), id).then(getCurrentPanel);
+  return gDevTools.showToolbox(targetFor(tab), id).then(getCurrentPanel);
 };
 exports.openToolboxPanel = openToolboxPanel;
--- a/addon-sdk/source/lib/sdk/addon/runner.js
+++ b/addon-sdk/source/lib/sdk/addon/runner.js
@@ -12,17 +12,22 @@ const { id, loadReason } = require('../s
 const { descriptor, Sandbox, evaluate, main, resolveURI } = require('toolkit/loader');
 const { exit, env, staticArgs } = require('../system');
 const { when: unload } = require('../system/unload');
 const globals = require('../system/globals');
 const { get } = require('../preferences/service');
 const { preferences } = metadata;
 
 const Startup = Cu.import("resource://gre/modules/sdk/system/Startup.js", {}).exports;
-const { DevToolsShim } = Cu.import("chrome://devtools-shim/content/DevToolsShim.jsm", {});
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function () {
+  return Cu.import("resource://devtools/client/framework/ToolboxProcess.jsm", {}).
+         BrowserToolboxProcess;
+});
 
 // Initializes default preferences
 function setDefaultPrefs(prefsURI) {
   const prefs = Cc['@mozilla.org/preferences-service;1'].
                 getService(Ci.nsIPrefService).
                 QueryInterface(Ci.nsIPrefBranch2);
   const branch = prefs.getDefaultBranch('');
   const sandbox = Sandbox({
@@ -146,17 +151,17 @@ function run(options) {
         staticArgs: staticArgs
       }, {
         print: function print(_) { dump(_ + '\n') },
         quit: exit
       });
     }
 
     if (get("extensions." + id + ".sdk.debug.show", false)) {
-      DevToolsShim.initBrowserToolboxProcessForAddon(id);
+      BrowserToolboxProcess.init({ addonID: id });
     }
   } catch (error) {
     console.exception(error);
     throw error;
   }
 }
 exports.startup = startup;
 
--- 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,32 +7,40 @@ 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 { DevToolsShim } = Cu.import("chrome://devtools-shim/content/DevToolsShim.jsm", {});
+const { require: devtoolsRequire } = Cu.import("resource://devtools/shared/Loader.jsm", {});
+const { DebuggerServer } = devtoolsRequire("devtools/server/main");
+const { DebuggerClient } = devtoolsRequire("devtools/shared/client/main");
 
 var gClient;
 var ok;
 var testName = 'testDebugger';
 var iframeURL = 'data:text/html;charset=utf-8,' + testName;
 var TAB_URL = 'data:text/html;charset=utf-8,' + encodeURIComponent('<iframe src="' + iframeURL + '" />');
 TAB_URL = data.url('index.html');
 var mod;
 
 exports.testDebugger = function(assert, done) {
   ok = assert.ok.bind(assert);
   assert.pass('starting test');
   set('devtools.debugger.log', true);
 
-  gClient = DevToolsShim.createDebuggerClient();
+  if (!DebuggerServer.initialized) {
+    DebuggerServer.init();
+    DebuggerServer.addBrowserActors();
+  }
+
+  let transport = DebuggerServer.connectPipe();
+  gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     tabs.open({
       url: TAB_URL,
       onLoad: function(tab) {
         assert.pass('tab loaded');
 
         attachTabActorForUrl(gClient, TAB_URL).
           then(_ => { assert.pass('attachTabActorForUrl called'); return _; }).
--- 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,19 @@ 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 { DevToolsShim } = Cu.import("chrome://devtools-shim/content/DevToolsShim.jsm", {});
+const { require: devtoolsRequire } = Cu.import("resource://devtools/shared/Loader.jsm", {});
+const { DebuggerServer } = devtoolsRequire("devtools/server/main");
+const { DebuggerClient } = devtoolsRequire("devtools/shared/client/main");
 
 var gClient;
 var ok;
 var testName = 'testDebugger';
 var iframeURL = 'data:text/html;charset=utf-8,' + testName;
 var TAB_URL = 'data:text/html;charset=utf-8,' + encodeURIComponent('<iframe src="' + iframeURL + '" />');
 TAB_URL = data.url('index.html');
 var mod;
@@ -29,17 +31,23 @@ exports.testDebugger = function(assert, 
 
   mod = PageMod({
     include: TAB_URL,
     attachTo: ['existing', 'top', 'frame'],
     contentScriptFile: data.url('script.js'),
   });
   ok(true, 'PageMod was created');
 
-  gClient = DevToolsShim.createDebuggerClient();
+  if (!DebuggerServer.initialized) {
+    DebuggerServer.init();
+    DebuggerServer.addBrowserActors();
+  }
+
+  let transport = DebuggerServer.connectPipe();
+  gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     tabs.open({
       url: TAB_URL,
       onLoad: function(tab) {
         assert.pass('tab loaded');
 
         attachTabActorForUrl(gClient, TAB_URL).
           then(_ => { assert.pass('attachTabActorForUrl called'); return _; }).