Bug 1250933 - debugger: connect Workers controller only for TabActor targets;r=ejpbruel
authorJulian Descottes <jdescottes@mozilla.com>
Thu, 25 Feb 2016 14:11:36 +0100
changeset 323939 5f9f5bacc390e2abd9bf9acbb76bd399171900e9
parent 323938 17ba8c582eba5fb32809f1480867c200f69b5e2f
child 323940 ad4d966f23677027aa0bd08f195f1478dd9d6d8c
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersejpbruel
bugs1250933
milestone47.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
Bug 1250933 - debugger: connect Workers controller only for TabActor targets;r=ejpbruel MozReview-Commit-ID: 764nqW7V04N
devtools/client/debugger/debugger-controller.js
devtools/client/debugger/test/mochitest/browser.ini
devtools/client/debugger/test/mochitest/browser_dbg_addon-workers-dbg-enabled.js
--- a/devtools/client/debugger/debugger-controller.js
+++ b/devtools/client/debugger/debugger-controller.js
@@ -292,17 +292,19 @@ var DebuggerController = {
       newSource(packet.source);
 
       // Make sure the events listeners are up to date.
       if (DebuggerView.instrumentsPaneTab == "events-tab") {
         fetchEventListeners();
       }
     });
 
-    this.Workers.connect();
+    if (this._target.isTabActor) {
+      this.Workers.connect();
+    }
     this.ThreadState.connect();
     this.StackFrames.connect();
 
     // Load all of the sources. Note that the server will actually
     // emit individual `newSource` notifications, which trigger
     // separate actions, so this won't do anything other than force
     // the server to traverse sources.
     this.dispatch(actions.loadSources()).then(() => {
--- a/devtools/client/debugger/test/mochitest/browser.ini
+++ b/devtools/client/debugger/test/mochitest/browser.ini
@@ -120,16 +120,18 @@ support-files =
   testactors.js
 
 [browser_dbg_aaa_run_first_leaktest.js]
 skip-if = e10s && debug
 [browser_dbg_addonactor.js]
 tags = addons
 [browser_dbg_addon-sources.js]
 tags = addons
+[browser_dbg_addon-workers-dbg-enabled.js]
+tags = addons
 [browser_dbg_addon-modules.js]
 skip-if = e10s # TODO
 tags = addons
 [browser_dbg_addon-modules-unpacked.js]
 skip-if = e10s # TODO
 tags = addons
 [browser_dbg_addon-panels.js]
 tags = addons
new file mode 100644
--- /dev/null
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_addon-workers-dbg-enabled.js
@@ -0,0 +1,39 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Test that the Addon Debugger works when devtools.debugger.workers is enabled.
+// Workers controller cannot be used when debugging an Addon actor.
+
+const ADDON_URL = EXAMPLE_URL + "addon3.xpi";
+
+function test() {
+  Task.spawn(function*() {
+    info("Enable worker debugging.");
+    yield new Promise(resolve => {
+      SpecialPowers.pushPrefEnv({
+        "set": [["devtools.debugger.workers", true]]
+      }, resolve);
+    });
+
+    let addon = yield addAddon(ADDON_URL);
+    let addonDebugger = yield initAddonDebugger(ADDON_URL);
+
+    is(addonDebugger.title, "Debugger - browser_dbg_addon3",
+                            "Saw the right toolbox title.");
+
+    info("Check that groups and sources are displayed.");
+    let groups = yield addonDebugger.getSourceGroups();
+    is(groups.length, 2, "Should be only two groups.");
+    let sources = groups[0].sources;
+    is(sources.length, 2, "Should be two sources");
+
+    yield addonDebugger.destroy();
+    yield removeAddon(addon);
+    finish();
+  });
+}
+