Bug 1314057 - Update canvasdebugger to use the new debugger r=jlast
☠☠ backed out by be14b8d9e4cc ☠ ☠
authorDavid Walsh <dwalsh@mozilla.com>
Thu, 13 Sep 2018 10:28:20 -0500
changeset 436510 f992a076c6f2a0a834db2b217fd964cb9271fbbf
parent 436509 b356beaa690fee6b93370b7b7261ef346a6d16c6
child 436511 1d626fdff4f36e157c317791534b902771faa94d
push id34645
push userdluca@mozilla.com
push dateSat, 15 Sep 2018 09:47:39 +0000
treeherdermozilla-central@73a2f427e2fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlast
bugs1314057
milestone64.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 1314057 - Update canvasdebugger to use the new debugger r=jlast
devtools/client/application/test/browser.ini
devtools/client/application/test/browser_application_panel_debug-service-worker.js
devtools/client/canvasdebugger/test/browser.ini
devtools/client/canvasdebugger/test/browser_canvas-frontend-call-stack-01.js
devtools/client/canvasdebugger/test/browser_canvas-frontend-call-stack-02.js
devtools/client/canvasdebugger/test/head.js
devtools/client/debugger/new/test/mochitest/browser.ini
devtools/client/debugger/new/test/mochitest/helpers.js
devtools/client/debugger/new/test/mochitest/helpers/context.js
devtools/client/inspector/markup/test/browser.ini
devtools/client/inspector/markup/test/browser_markup_shadowdom_open_debugger.js
--- a/devtools/client/application/test/browser.ini
+++ b/devtools/client/application/test/browser.ini
@@ -7,16 +7,17 @@ support-files =
   service-workers/debug.html
   service-workers/dynamic-registration.html
   service-workers/empty.html
   service-workers/empty-sw.js
   service-workers/scope-page.html
   service-workers/simple.html
   service-workers/simple-unicode.html
   !/devtools/client/debugger/new/test/mochitest/helpers.js
+  !/devtools/client/debugger/new/test/mochitest/helpers/context.js
   !/devtools/client/shared/test/frame-script-utils.js
   !/devtools/client/shared/test/shared-head.js
   !/devtools/client/shared/test/telemetry-test-helpers.js
 
 [browser_application_panel_debug-service-worker.js]
 [browser_application_panel_list-domain-workers.js]
 [browser_application_panel_list-several-workers.js]
 [browser_application_panel_list-single-worker.js]
--- a/devtools/client/application/test/browser_application_panel_debug-service-worker.js
+++ b/devtools/client/application/test/browser_application_panel_debug-service-worker.js
@@ -3,16 +3,21 @@
 
 "use strict";
 
 /* import-globals-from ../../debugger/new/test/mochitest/helpers.js */
 Services.scriptloader.loadSubScript(
   "chrome://mochitests/content/browser/devtools/client/debugger/new/test/mochitest/helpers.js",
   this);
 
+/* import-globals-from ../../debugger/new/test/mochitest/helpers/context.js */
+Services.scriptloader.loadSubScript(
+  "chrome://mochitests/content/browser/devtools/client/debugger/new/test/mochitest/helpers/context.js",
+  this);
+
 const TAB_URL = URL_ROOT + "service-workers/debug.html";
 
 add_task(async function() {
   await enableApplicationPanel();
 
   const { panel, tab, target } = await openNewTabAndApplicationPanel(TAB_URL);
   const doc = panel.panelWin.document;
 
--- a/devtools/client/canvasdebugger/test/browser.ini
+++ b/devtools/client/canvasdebugger/test/browser.ini
@@ -12,16 +12,17 @@ support-files =
   doc_simple-canvas-transparent.html
   doc_webgl-bindings.html
   doc_webgl-enum.html
   doc_webgl-drawArrays.html
   doc_webgl-drawElements.html
   head.js
   !/devtools/client/shared/test/frame-script-utils.js
   !/devtools/client/shared/test/shared-head.js
+  !/devtools/client/debugger/new/test/mochitest/helpers/context.js
   !/devtools/client/shared/test/telemetry-test-helpers.js
 
 [browser_canvas-actor-test-01.js]
 [browser_canvas-actor-test-02.js]
 [browser_canvas-actor-test-03.js]
 [browser_canvas-actor-test-04.js]
 [browser_canvas-actor-test-05.js]
 [browser_canvas-actor-test-06.js]
--- a/devtools/client/canvasdebugger/test/browser_canvas-frontend-call-stack-01.js
+++ b/devtools/client/canvasdebugger/test/browser_canvas-frontend-call-stack-01.js
@@ -1,20 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Tests if the a function call's stack is properly displayed in the UI.
  */
 
-// Force the old debugger UI since it's directly used (see Bug 1301705)
-Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", false);
-registerCleanupFunction(function() {
-  Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend");
-});
+requestLongerTimeout(2);
 
 async function ifTestingSupported() {
   const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_DEEP_STACK_URL);
   const { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
 
   await reload(target);
 
   const recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
@@ -65,18 +61,14 @@ async function ifTestingSupported() {
     "doc_simple-canvas-deep-stack.html:35",
     "The fourth function on the stack has the correct location.");
 
   const jumpedToSource = once(window, EVENTS.SOURCE_SHOWN_IN_JS_DEBUGGER);
   EventUtils.sendMouseEvent({ type: "mousedown" }, $(".call-item-stack-fn-location", callItem.target));
   await jumpedToSource;
 
   const toolbox = await gDevTools.getToolbox(target);
-  const { panelWin: { DebuggerView: view } } = toolbox.getPanel("jsdebugger");
-
-  is(view.Sources.selectedValue, getSourceActor(view.Sources, SIMPLE_CANVAS_DEEP_STACK_URL),
-    "The expected source was shown in the debugger.");
-  is(view.editor.getCursor().line, 25,
-    "The expected source line is highlighted in the debugger.");
+  const dbg = createDebuggerContext(toolbox);
+  await validateDebuggerLocation(dbg, SIMPLE_CANVAS_DEEP_STACK_URL, 26);
 
   await teardown(panel);
   finish();
 }
--- a/devtools/client/canvasdebugger/test/browser_canvas-frontend-call-stack-02.js
+++ b/devtools/client/canvasdebugger/test/browser_canvas-frontend-call-stack-02.js
@@ -1,21 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Tests if the a function call's stack is properly displayed in the UI
  * and jumping to source in the debugger for the topmost call item works.
  */
 
-// Force the old debugger UI since it's directly used (see Bug 1301705)
-Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", false);
-registerCleanupFunction(function() {
-  Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend");
-});
+requestLongerTimeout(2);
 
 async function ifTestingSupported() {
   const { target, panel } = await initCanvasDebuggerFrontend(SIMPLE_CANVAS_DEEP_STACK_URL);
   const { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
 
   await reload(target);
 
   const recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
@@ -40,18 +36,14 @@ async function ifTestingSupported() {
   ok($all(".call-item-stack-fn", callItem.target).length >= 4,
      "There should be at least 4 functions on the stack for the draw call.");
 
   const jumpedToSource = once(window, EVENTS.SOURCE_SHOWN_IN_JS_DEBUGGER);
   EventUtils.sendMouseEvent({ type: "mousedown" }, $(".call-item-location", callItem.target));
   await jumpedToSource;
 
   const toolbox = await gDevTools.getToolbox(target);
-  const { panelWin: { DebuggerView: view } } = toolbox.getPanel("jsdebugger");
-
-  is(view.Sources.selectedValue, getSourceActor(view.Sources, SIMPLE_CANVAS_DEEP_STACK_URL),
-    "The expected source was shown in the debugger.");
-  is(view.editor.getCursor().line, 23,
-    "The expected source line is highlighted in the debugger.");
+  const dbg = createDebuggerContext(toolbox);
+  await validateDebuggerLocation(dbg, SIMPLE_CANVAS_DEEP_STACK_URL, 24);
 
   await teardown(panel);
   finish();
 }
--- a/devtools/client/canvasdebugger/test/head.js
+++ b/devtools/client/canvasdebugger/test/head.js
@@ -1,21 +1,27 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /* eslint no-unused-vars: [2, {"vars": "local"}] */
 /* import-globals-from ../../shared/test/shared-head.js */
+/* import-globals-from ../../debugger/new/test/mochitest/helpers/context.js */
 
 "use strict";
 
 // Load the shared-head file first.
 Services.scriptloader.loadSubScript(
   "chrome://mochitests/content/browser/devtools/client/shared/test/shared-head.js",
   this);
 
+// Import helpers for the new debugger
+Services.scriptloader.loadSubScript(
+  "chrome://mochitests/content/browser/devtools/client/debugger/new/test/mochitest/helpers/context.js",
+  this);
+
 var { generateUUID } = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
 
 var { DebuggerClient } = require("devtools/shared/client/debugger-client");
 var { DebuggerServer } = require("devtools/server/main");
 var { CallWatcherFront } = require("devtools/shared/fronts/call-watcher");
 var { CanvasFront } = require("devtools/shared/fronts/canvas");
 var { Toolbox } = require("devtools/client/framework/toolbox");
 var { isWebGLSupported } = require("devtools/client/shared/webgl-utils");
@@ -168,8 +174,18 @@ function teardown({target}) {
     removeTab(tab);
   });
 }
 
 function getSourceActor(aSources, aURL) {
   const item = aSources.getItemForAttachment(a => a.source.url === aURL);
   return item ? item.value : null;
 }
+
+async function validateDebuggerLocation(dbg, url, line) {
+  const location = dbg.selectors.getSelectedLocation(dbg.getState());
+  const sourceUrl = dbg.selectors.getSelectedSource(dbg.getState()).url;
+
+  is(sourceUrl, url,
+    "The expected source was shown in the debugger.");
+  is(location.line, line,
+    "The expected source line is highlighted in the debugger.");
+}
--- a/devtools/client/debugger/new/test/mochitest/browser.ini
+++ b/devtools/client/debugger/new/test/mochitest/browser.ini
@@ -1,15 +1,16 @@
 [DEFAULT]
 tags = devtools
 subsuite = devtools
 skip-if = (os == 'linux' && debug && bits == 32)
 support-files =
   head.js
   helpers.js
+  helpers/context.js
   !/devtools/client/shared/test/shared-head.js
   !/devtools/client/shared/test/telemetry-test-helpers.js
   ## START-SOURCEMAPPED-FIXTURES - Generated by examples/sourcemapped/build.js
   examples/sourcemapped/polyfill-bundle.js
   examples/sourcemapped/output/parcel/babel-bindings-with-flow.js
   examples/sourcemapped/output/parcel/babel-bindings-with-flow.map
   examples/sourcemapped/output/parcel/babel-classes.js
   examples/sourcemapped/output/parcel/babel-classes.map
--- a/devtools/client/debugger/new/test/mochitest/helpers.js
+++ b/devtools/client/debugger/new/test/mochitest/helpers.js
@@ -1,16 +1,21 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Helper methods to drive with the debugger during mochitests. This file can be safely
  * required from other panel test files.
  */
 
+// Import helpers for the new debugger
+Services.scriptloader.loadSubScript(
+  "chrome://mochitests/content/browser/devtools/client/debugger/new/test/mochitest/helpers/context.js",
+  this);
+
 var { Toolbox } = require("devtools/client/framework/toolbox");
 var { Task } = require("devtools/shared/task");
 var asyncStorage = require("devtools/shared/async-storage");
 
 const sourceUtils = {
   isLoaded: source => source.loadedState === "loaded"
 };
 
@@ -457,33 +462,16 @@ function isSelectedFrameSelected(dbg, st
   const isLoaded = source.loadedState && sourceUtils.isLoaded(source);
   if (!isLoaded) {
     return false;
   }
 
   return source.id == sourceId;
 }
 
-function createDebuggerContext(toolbox) {
-  const panel = toolbox.getPanel("jsdebugger");
-  const win = panel.panelWin;
-  const { store, client, selectors, actions } = panel.getVarsForTests();
-
-  return {
-    actions: actions,
-    selectors: selectors,
-    getState: store.getState,
-    store: store,
-    client: client,
-    toolbox: toolbox,
-    win: win,
-    panel: panel
-  };
-}
-
 /**
  * Clear all the debugger related preferences.
  */
 function clearDebuggerPreferences() {
   asyncStorage.clear()
   Services.prefs.clearUserPref("devtools.recordreplay.enabled");
   Services.prefs.clearUserPref("devtools.debugger.pause-on-exceptions");
   Services.prefs.clearUserPref("devtools.debugger.pause-on-caught-exceptions");
new file mode 100644
--- /dev/null
+++ b/devtools/client/debugger/new/test/mochitest/helpers/context.js
@@ -0,0 +1,23 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Helper method to create a "dbg" context for other tools to use
+ */
+
+function createDebuggerContext(toolbox) {
+  const panel = toolbox.getPanel("jsdebugger");
+  const win = panel.panelWin;
+  const { store, client, selectors, actions } = panel.getVarsForTests();
+
+  return {
+    actions: actions,
+    selectors: selectors,
+    getState: store.getState,
+    store: store,
+    client: client,
+    toolbox: toolbox,
+    win: win,
+    panel: panel
+  };
+}
\ No newline at end of file
--- a/devtools/client/inspector/markup/test/browser.ini
+++ b/devtools/client/inspector/markup/test/browser.ini
@@ -65,16 +65,17 @@ support-files =
   lib_react_16.2.0_min.js
   lib_react_dom_15.3.1_min.js
   lib_react_dom_15.4.1.js
   lib_react_dom_16.2.0_min.js
   lib_react_with_addons_15.3.1_min.js
   lib_react_with_addons_15.4.1.js
   react_external_listeners.js
   !/devtools/client/debugger/new/test/mochitest/helpers.js
+  !/devtools/client/debugger/new/test/mochitest/helpers/context.js
   !/devtools/client/inspector/test/head.js
   !/devtools/client/inspector/test/shared-head.js
   !/devtools/client/shared/test/shared-head.js
   !/devtools/client/shared/test/shared-redux-head.js
   !/devtools/client/shared/test/telemetry-test-helpers.js
   !/devtools/client/shared/test/test-actor.js
   !/devtools/client/shared/test/test-actor-registry.js
 
--- a/devtools/client/inspector/markup/test/browser_markup_shadowdom_open_debugger.js
+++ b/devtools/client/inspector/markup/test/browser_markup_shadowdom_open_debugger.js
@@ -10,16 +10,21 @@
 // Test that the markup view is correctly updated to show those items if the custom
 // element definition happens after opening the inspector.
 
 /* import-globals-from ../../../debugger/new/test/mochitest/helpers.js */
 Services.scriptloader.loadSubScript(
   "chrome://mochitests/content/browser/devtools/client/debugger/new/test/mochitest/helpers.js",
   this);
 
+/* import-globals-from ../../../debugger/new/test/mochitest/helpers/context.js */
+Services.scriptloader.loadSubScript(
+  "chrome://mochitests/content/browser/devtools/client/debugger/new/test/mochitest/helpers/context.js",
+  this);
+
 const TEST_URL = `data:text/html;charset=utf-8,` + encodeURIComponent(`
 <test-component></test-component>
 <other-component>some-content</other-component>
 
 <script>
   "use strict";
   window.attachTestComponent = function() {
     customElements.define("test-component", class extends HTMLElement {