Bug 1315289 - Use correct API for opening a source in the debugger r=me
authorJames Long <longster@gmail.com>
Mon, 07 Nov 2016 13:10:03 -0500
changeset 321475 e2acfe066887bb24724f0ee3ba3a532e2491a5ff
parent 321474 a19dfd28f8b224e1854e26f06b09263523b39b97
child 321476 cceb2a87580748749fb0932fa4f553b1e60ee8c4
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersme
bugs1315289
milestone52.0a1
Bug 1315289 - Use correct API for opening a source in the debugger r=me
devtools/client/shared/view-source.js
devtools/client/webconsole/test/browser_webconsole_bug_766001_JS_Console_in_Debugger.js
--- a/devtools/client/shared/view-source.js
+++ b/devtools/client/shared/view-source.js
@@ -57,17 +57,17 @@ exports.viewSourceInDebugger = Task.asyn
   let debuggerAlreadyOpen = toolbox.getPanel("jsdebugger");
   let dbg = yield toolbox.loadTool("jsdebugger");
 
   // New debugger frontend
   if (Services.prefs.getBoolPref("devtools.debugger.new-debugger-frontend")) {
     yield toolbox.selectTool("jsdebugger");
     const source = dbg._selectors().getSourceByURL(dbg._getState(), sourceURL);
     if (source) {
-      dbg._actions().selectSourceByURL(sourceURL, { line: sourceLine });
+      dbg._actions().selectSourceURL(sourceURL, { line: sourceLine });
       return true;
     }
 
     exports.viewSource(toolbox, sourceURL, sourceLine);
     return false;
   }
 
   const win = dbg.panelWin;
--- a/devtools/client/webconsole/test/browser_webconsole_bug_766001_JS_Console_in_Debugger.js
+++ b/devtools/client/webconsole/test/browser_webconsole_bug_766001_JS_Console_in_Debugger.js
@@ -6,18 +6,19 @@
 // Test that message source links for js errors and console API calls open in
 // the jsdebugger when clicked.
 
 "use strict";
 
 const TEST_URI = "http://example.com/browser/devtools/client/webconsole/test" +
                  "/test-bug-766001-js-console-links.html";
 
-// Force the old debugger UI since it's directly used (see Bug 1301705)
-Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", false);
+// Force the new debugger UI, in case this gets uplifted with the old
+// debugger still turned on
+Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", true);
 registerCleanupFunction(function* () {
   Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend");
 });
 
 function test() {
   let hud;
 
   requestLongerTimeout(2);
@@ -74,15 +75,14 @@ function test() {
 
     executeSoon(() => {
       EventUtils.sendMouseEvent({ type: "click" }, node.querySelector(".frame-link-filename"));
     });
 
     yield hud.ui.once("source-in-debugger-opened");
 
     let toolbox = yield gDevTools.getToolbox(hud.target);
-    let {panelWin: { DebuggerView: view }} = toolbox.getPanel("jsdebugger");
-    is(view.Sources.selectedValue,
-       getSourceActor(view.Sources, url),
+    let dbg = toolbox.getPanel("jsdebugger");
+    is(dbg._selectors().getSelectedSource(dbg._getState()).get("url"),
+       url,
        "expected source url");
-    is(view.editor.getCursor().line, line - 1, "expected source line");
   }
 }