Bug 1260529 - Showing a source in the editor should not update the cursor position. r=jlong
authorJason Laster <jlaster@mozilla.com>
Thu, 07 Apr 2016 12:48:00 -0400
changeset 316031 1c4fa11bd2590aeb85c26a971048ef7ca1afaeaf
parent 316030 48fac32381ec9ae8f0041d83441b3a347004e0d7
child 316032 99a4af2f94e85fae6f24bcbe58a7230316da4077
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlong
bugs1260529
milestone48.0a1
Bug 1260529 - Showing a source in the editor should not update the cursor position. r=jlong
devtools/client/debugger/debugger-view.js
devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-disabled-reload.js
devtools/client/debugger/test/mochitest/browser_dbg_location-changes-04-breakpoint.js
devtools/client/debugger/test/mochitest/browser_dbg_scripts-switching-01.js
devtools/client/debugger/test/mochitest/browser_dbg_scripts-switching-02.js
devtools/client/debugger/test/mochitest/browser_dbg_search-global-05.js
devtools/client/debugger/test/mochitest/browser_dbg_search-sources-01.js
devtools/client/debugger/test/mochitest/browser_dbg_stack-06.js
--- a/devtools/client/debugger/debugger-view.js
+++ b/devtools/client/debugger/debugger-view.js
@@ -426,17 +426,16 @@ var DebuggerView = {
    * @param boolean shouldUpdateText
             Forces a text and mode reset
    */
   _setEditorText: function(documentKey, aTextContent = "", shouldUpdateText = false) {
     const isNew = this._setEditorDocument(documentKey);
 
     this.editor.clearDebugLocation();
     this.editor.clearHistory();
-    this.editor.setCursor({ line: 0, ch: 0});
     this.editor.removeBreakpoints();
 
     // Only set editor's text and mode if it is a new document
     if (isNew || shouldUpdateText) {
       this.editor.setMode(Editor.modes.text);
       this.editor.setText(aTextContent);
     }
   },
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-disabled-reload.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-disabled-reload.js
@@ -74,32 +74,32 @@ function test() {
 
         callInTab(gTab, "firstCall");
         yield waitForDebuggerEvents(gPanel, gEvents.FETCHED_SCOPES);
         yield ensureSourceIs(gPanel, "-01.js");
         yield ensureCaretAt(gPanel, 5);
         yield verifyView({ disabled: false });
 
         executeSoon(() => gDebugger.gThreadClient.resume());
-        yield waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1);
+        yield waitForSourceAndCaretAndScopes(gPanel, "-02.js", 6);
         yield verifyView({ disabled: false });
       });
     }
 
     function testWhenBreakpointEnabledAndSecondSourceShown() {
       return Task.spawn(function*() {
         yield ensureSourceIs(gPanel, "-02.js", true);
         yield verifyView({ disabled: false });
 
         callInTab(gTab, "firstCall");
         yield waitForSourceAndCaretAndScopes(gPanel, "-01.js", 1);
         yield verifyView({ disabled: false });
 
         executeSoon(() => gDebugger.gThreadClient.resume());
-        yield waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1);
+        yield waitForSourceAndCaretAndScopes(gPanel, "-02.js", 6);
         yield verifyView({ disabled: false });
       });
     }
 
     function testWhenBreakpointDisabledAndSecondSourceShown() {
       return Task.spawn(function*() {
         yield ensureSourceIs(gPanel, "-02.js", true);
         yield verifyView({ disabled: true });
--- a/devtools/client/debugger/test/mochitest/browser_dbg_location-changes-04-breakpoint.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_location-changes-04-breakpoint.js
@@ -147,18 +147,15 @@ function test() {
       sourceShown = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN);
       yield actions.selectSource(getSourceForm(gSources, SOURCE_URL));
       yield sourceShown;
       is(gEditor.getText().indexOf("debugger"), 148,
          "The correct source is shown in the source editor.")
       is(gEditor.getBreakpoints().length, 1,
          "One breakpoint should be shown for the first source.");
 
-      //yield waitForTime(2000);
-      yield ensureCaretAt(gPanel, 1, 1, true);
-
-      //yield waitForTime(50000);
+      yield ensureCaretAt(gPanel, 6, 1, true);
       resumeDebuggerThenCloseAndFinish(gPanel);
     });
 
     callInTab(gTab, "runDebuggerStatement");
   });
 }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_scripts-switching-01.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_scripts-switching-01.js
@@ -19,136 +19,136 @@ function test() {
 
     const gLabel1 = "code_script-switching-01.js";
     const gLabel2 = "code_script-switching-02.js";
 
     function testSourcesDisplay() {
       let deferred = promise.defer();
 
       is(gSources.itemCount, 2,
-         "Found the expected number of sources.");
+         "Found the expected number of sources. (1)");
 
       is(gSources.items[0].target.querySelector(".dbg-source-item").getAttribute("tooltiptext"),
          EXAMPLE_URL + "code_script-switching-01.js",
-         "The correct tooltip text is displayed for the first source.");
+         "The correct tooltip text is displayed for the first source. (1)");
       is(gSources.items[1].target.querySelector(".dbg-source-item").getAttribute("tooltiptext"),
          EXAMPLE_URL + "code_script-switching-02.js",
-         "The correct tooltip text is displayed for the second source.");
+         "The correct tooltip text is displayed for the second source. (1)");
 
       ok(getSourceActor(gSources, EXAMPLE_URL + gLabel1),
-         "First source url is incorrect.");
+         "First source url is incorrect. (1)");
       ok(getSourceActor(gSources, EXAMPLE_URL + gLabel2),
-         "Second source url is incorrect.");
+         "Second source url is incorrect. (1)");
 
       ok(gSources.getItemForAttachment(e => e.label == gLabel1),
-         "First source label is incorrect.");
+         "First source label is incorrect. (1)");
       ok(gSources.getItemForAttachment(e => e.label == gLabel2),
-         "Second source label is incorrect.");
+         "Second source label is incorrect. (1)");
 
       ok(gSources.selectedItem,
-         "There should be a selected item in the sources pane.");
+         "There should be a selected item in the sources pane. (1)");
       is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel2,
-         "The selected value is the sources pane is incorrect.");
+         "The selected value is the sources pane is incorrect. (1)");
 
       is(gEditor.getText().search(/firstCall/), -1,
-         "The first source is not displayed.");
+         "The first source is not displayed. (1)");
       is(gEditor.getText().search(/debugger/), 166,
-         "The second source is displayed.");
+         "The second source is displayed. (1)");
 
       ok(gDebugger.document.title.endsWith(EXAMPLE_URL + gLabel2),
-         "Title with second source is correct.");
+         "Title with second source is correct. (1)");
 
       ok(isCaretPos(gPanel, 6),
-         "Editor caret location is correct.");
+         "Editor caret location is correct. (1)");
 
       // The editor's debug location takes a tick to update.
       is(gEditor.getDebugLocation(), 5,
-         "Editor debugger location is correct.");
+         "Editor debugger location is correct. (1)");
       ok(gEditor.hasLineClass(5, "debug-line"),
          "The debugged line is highlighted appropriately (1).");
 
       waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(deferred.resolve);
       gSources.selectedIndex = 0;
 
       return deferred.promise;
     }
 
     function testSwitchPaused1() {
       let deferred = promise.defer();
 
       ok(gSources.selectedItem,
-         "There should be a selected item in the sources pane.");
+         "There should be a selected item in the sources pane. (2)");
       is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel1,
-         "The selected value is the sources pane is incorrect.");
+         "The selected value is the sources pane is incorrect. (2)");
 
       is(gEditor.getText().search(/firstCall/), 118,
-         "The first source is displayed.");
+         "The first source is displayed. (2)");
       is(gEditor.getText().search(/debugger/), -1,
-         "The second source is not displayed.");
+         "The second source is not displayed. (2)");
 
       // The editor's debug location takes a tick to update.
       ok(isCaretPos(gPanel, 1),
-         "Editor caret location is correct.");
+         "Editor caret location is correct. (2)");
       is(gEditor.getDebugLocation(), null,
-         "Editor debugger location is correct.");
+         "Editor debugger location is correct. (2)");
       ok(!gEditor.hasLineClass(5, "debug-line"),
-         "The debugged line highlight was removed.");
+         "The debugged line highlight was removed. (2)");
 
       waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(deferred.resolve);
       gSources.selectedIndex = 1;
       return deferred.promise;
     }
 
     function testSwitchPaused2() {
       let deferred = promise.defer();
 
       ok(gSources.selectedItem,
-         "There should be a selected item in the sources pane.");
+         "There should be a selected item in the sources pane. (3)");
       is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel2,
-         "The selected value is the sources pane is incorrect.");
+         "The selected value is the sources pane is incorrect. (3)");
 
       is(gEditor.getText().search(/firstCall/), -1,
-         "The first source is not displayed.");
+         "The first source is not displayed. (3)");
       is(gEditor.getText().search(/debugger/), 166,
-         "The second source is displayed.");
+         "The second source is displayed. (3)");
 
-      ok(isCaretPos(gPanel, 1),
-         "Editor caret location is correct.");
+      ok(isCaretPos(gPanel, 6),
+         "Editor caret location is correct. (3)");
       is(gEditor.getDebugLocation(), 5,
-         "Editor debugger location is correct.");
+         "Editor debugger location is correct. (3)");
       ok(gEditor.hasLineClass(5, "debug-line"),
-         "The debugged line is highlighted appropriately (2).");
+         "The debugged line is highlighted appropriately (3).");
 
       // Step out twice.
       waitForThreadEvents(gPanel, "paused").then(() => {
         waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(deferred.resolve);
         gDebugger.gThreadClient.stepOut();
       })
       gDebugger.gThreadClient.stepOut();
 
       return deferred.promise;
     }
 
     function testSwitchRunning() {
       ok(gSources.selectedItem,
-         "There should be a selected item in the sources pane.");
+         "There should be a selected item in the sources pane. (4)");
       is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel1,
-         "The selected value is the sources pane is incorrect.");
+         "The selected value is the sources pane is incorrect. (4)");
 
       is(gEditor.getText().search(/firstCall/), 118,
-         "The first source is displayed.");
+         "The first source is displayed. (4)");
       is(gEditor.getText().search(/debugger/), -1,
-         "The second source is not displayed.");
+         "The second source is not displayed. (4)");
 
       ok(isCaretPos(gPanel, 6),
-         "Editor caret location is correct.");
+         "Editor caret location is correct. (4)");
       is(gEditor.getDebugLocation(), 5,
-         "Editor debugger location is correct.");
+         "Editor debugger location is correct. (4)");
       ok(gEditor.hasLineClass(5, "debug-line"),
-         "The debugged line is highlighted appropriately (3).");
+         "The debugged line is highlighted appropriately (3). (4)");
     }
 
     Task.spawn(function*() {
       yield waitForSourceShown(gPanel, "-01.js", 1);
       ok(gDebugger.document.title.endsWith(EXAMPLE_URL + gLabel1),
          "Title with first source is correct.");
 
       const shown = waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_scripts-switching-02.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_scripts-switching-02.js
@@ -20,130 +20,130 @@ function test() {
     const gDebugger = gPanel.panelWin;
     const gEditor = gDebugger.DebuggerView.editor;
     const gSources = gDebugger.DebuggerView.Sources;
 
     function testSourcesDisplay() {
       let deferred = promise.defer();
 
       is(gSources.itemCount, 2,
-         "Found the expected number of sources.");
+         "Found the expected number of sources. (1)");
 
       ok(getSourceActor(gSources, EXAMPLE_URL + gLabel1),
-         "First source url is incorrect.");
+         "First source url is incorrect. (1)");
       ok(getSourceActor(gSources, EXAMPLE_URL + gLabel2 + gParams),
-         "Second source url is incorrect.");
+         "Second source url is incorrect. (1)");
 
       ok(gSources.getItemForAttachment(e => e.label == gLabel1),
-         "First source label is incorrect.");
+         "First source label is incorrect. (1)");
       ok(gSources.getItemForAttachment(e => e.label == gLabel2),
-         "Second source label is incorrect.");
+         "Second source label is incorrect. (1)");
 
       ok(gSources.selectedItem,
-         "There should be a selected item in the sources pane.");
+         "There should be a selected item in the sources pane. (1)");
       is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel2 + gParams,
-         "The selected value is the sources pane is incorrect.");
+         "The selected value is the sources pane is incorrect. (1)");
 
       is(gEditor.getText().search(/firstCall/), -1,
-         "The first source is not displayed.");
+         "The first source is not displayed. (1)");
       is(gEditor.getText().search(/debugger/), 166,
-         "The second source is displayed.");
+         "The second source is displayed. (1)");
 
       ok(isCaretPos(gPanel, 6),
-         "Editor caret location is correct.");
+         "Editor caret location is correct. (1)");
       is(gEditor.getDebugLocation(), 5,
-         "Editor debugger location is correct.");
+         "Editor debugger location is correct. (1)");
       ok(gEditor.hasLineClass(5, "debug-line"),
-         "The debugged line is highlighted appropriately.");
+         "The debugged line is highlighted appropriately. (1)");
 
       waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(deferred.resolve);
       gSources.selectedItem = e => e.attachment.label == gLabel1;
 
       return deferred.promise;
     }
 
     function testSwitchPaused1() {
       let deferred = promise.defer();
 
       ok(gSources.selectedItem,
-         "There should be a selected item in the sources pane.");
+         "There should be a selected item in the sources pane. (2)");
       is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel1,
-         "The selected value is the sources pane is incorrect.");
+         "The selected value is the sources pane is incorrect. (2)");
 
       is(gEditor.getText().search(/firstCall/), 118,
-         "The first source is displayed.");
+         "The first source is displayed. (2)");
       is(gEditor.getText().search(/debugger/), -1,
-         "The second source is not displayed.");
+         "The second source is not displayed. (2)");
 
       // The editor's debug location takes a tick to update.
       ok(isCaretPos(gPanel, 1),
-         "Editor caret location is correct.");
+         "Editor caret location is correct. (2)");
 
       is(gEditor.getDebugLocation(), null,
-         "Editor debugger location is correct.");
+         "Editor debugger location is correct. (2)");
       ok(!gEditor.hasLineClass(5, "debug-line"),
-         "The debugged line highlight was removed.");
+         "The debugged line highlight was removed. (2)");
 
       waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(deferred.resolve);
       gSources.selectedItem = e => e.attachment.label == gLabel2;
 
       return deferred.promise;
     }
 
     function testSwitchPaused2() {
       let deferred = promise.defer();
 
       ok(gSources.selectedItem,
-         "There should be a selected item in the sources pane.");
+         "There should be a selected item in the sources pane. (3)");
       is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel2 + gParams,
-         "The selected value is the sources pane is incorrect.");
+         "The selected value is the sources pane is incorrect. (3)");
 
       is(gEditor.getText().search(/firstCall/), -1,
-         "The first source is not displayed.");
+         "The first source is not displayed. (3)");
       is(gEditor.getText().search(/debugger/), 166,
-         "The second source is displayed.");
+         "The second source is displayed. (3)");
 
       // The editor's debug location takes a tick to update.
-      ok(isCaretPos(gPanel, 1),
-         "Editor caret location is correct.");
+      ok(isCaretPos(gPanel, 6),
+         "Editor caret location is correct. (3)");
       is(gEditor.getDebugLocation(), 5,
-         "Editor debugger location is correct.");
+         "Editor debugger location is correct. (3)");
       ok(gEditor.hasLineClass(5, "debug-line"),
-         "The debugged line is highlighted appropriately.");
+         "The debugged line is highlighted appropriately. (3)");
 
       // Step out three times.
       waitForThreadEvents(gPanel, "paused").then(() => {
         waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(deferred.resolve);
         gDebugger.gThreadClient.stepOut();
       });
       gDebugger.gThreadClient.stepOut();
 
       return deferred.promise;
     }
 
     function testSwitchRunning() {
       let deferred = promise.defer();
 
       ok(gSources.selectedItem,
-         "There should be a selected item in the sources pane.");
+         "There should be a selected item in the sources pane. (4)");
       is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel1,
-         "The selected value is the sources pane is incorrect.");
+         "The selected value is the sources pane is incorrect. (4)");
 
       is(gEditor.getText().search(/firstCall/), 118,
-         "The first source is displayed.");
+         "The first source is displayed. (4)");
       is(gEditor.getText().search(/debugger/), -1,
-         "The second source is not displayed.");
+         "The second source is not displayed. (4)");
 
       // The editor's debug location takes a tick to update.
       ok(isCaretPos(gPanel, 6),
-         "Editor caret location is correct.");
+         "Editor caret location is correct. (4)");
       is(gEditor.getDebugLocation(), 5,
-         "Editor debugger location is correct.");
+         "Editor debugger location is correct. (4)");
       ok(gEditor.hasLineClass(5, "debug-line"),
-         "The debugged line is highlighted appropriately.");
+         "The debugged line is highlighted appropriately. (4)");
 
       deferred.resolve();
 
       return deferred.promise;
     }
 
     Task.spawn(function*() {
       yield waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1);
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-global-05.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-global-05.js
@@ -44,21 +44,21 @@ function doSearch() {
   gDebugger.once(gDebugger.EVENTS.GLOBAL_SEARCH_MATCH_FOUND, () => {
     // Some operations are synchronously dispatched on the main thread,
     // to avoid blocking UI, thus giving the impression of faster searching.
     executeSoon(() => {
       info("Current source url:\n" + getSelectedSourceURL(gSources));
       info("Debugger editor text:\n" + gEditor.getText());
 
       ok(isCaretPos(gPanel, 6),
-        "The editor shouldn't have jumped to a matching line yet.");
+        "The editor shouldn't have jumped to a matching line yet. (1)");
       ok(getSelectedSourceURL(gSources).includes("-02.js"),
-        "The current source shouldn't have changed after a global search.");
+        "The current source shouldn't have changed after a global search. (2)");
       is(gSources.visibleItems.length, 2,
-        "Not all the sources are shown after the global search.");
+        "Not all the sources are shown after the global search. (3)");
 
       deferred.resolve();
     });
   });
 
   setText(gSearchBox, "!a");
 
   return deferred.promise;
@@ -70,48 +70,48 @@ function testExpandCollapse() {
   let item1 = gDebugger.SourceResults.getItemForElement(sourceResults[1]);
   let firstHeader = sourceResults[0].querySelector(".dbg-results-header");
   let secondHeader = sourceResults[1].querySelector(".dbg-results-header");
 
   EventUtils.sendMouseEvent({ type: "click" }, firstHeader);
   EventUtils.sendMouseEvent({ type: "click" }, secondHeader);
 
   is(item0.instance.expanded, false,
-    "The first source results should be collapsed on click.")
+    "The first source results should be collapsed on click. (2)")
   is(item1.instance.expanded, false,
-    "The second source results should be collapsed on click.")
+    "The second source results should be collapsed on click. (2)")
 
   EventUtils.sendMouseEvent({ type: "click" }, firstHeader);
   EventUtils.sendMouseEvent({ type: "click" }, secondHeader);
 
   is(item0.instance.expanded, true,
-    "The first source results should be expanded on an additional click.");
+    "The first source results should be expanded on an additional click. (3)");
   is(item1.instance.expanded, true,
-    "The second source results should be expanded on an additional click.");
+    "The second source results should be expanded on an additional click. (3)");
 }
 
 function testClickLineToJump() {
   let deferred = promise.defer();
 
   let sourceResults = gDebugger.document.querySelectorAll(".dbg-source-results");
   let firstHeader = sourceResults[0].querySelector(".dbg-results-header");
   let firstLine = sourceResults[0].querySelector(".dbg-results-line-contents");
 
   waitForSourceAndCaret(gPanel, "-01.js", 1, 1).then(() => {
     info("Current source url:\n" + getSelectedSourceURL(gSources));
     info("Debugger editor text:\n" + gEditor.getText());
 
     ok(isCaretPos(gPanel, 1, 5),
-      "The editor didn't jump to the correct line (1).");
+      "The editor didn't jump to the correct line (4).");
     is(gEditor.getSelection(), "A",
-      "The editor didn't select the correct text (1).");
+      "The editor didn't select the correct text (4).");
     ok(getSelectedSourceURL(gSources).includes("-01.js"),
-      "The currently shown source is incorrect (1).");
+      "The currently shown source is incorrect (4).");
     is(gSources.visibleItems.length, 2,
-      "Not all the sources are shown after the global search (1).");
+      "Not all the sources are shown after the global search (4).");
 
     deferred.resolve();
   });
 
   EventUtils.sendMouseEvent({ type: "click" }, firstLine);
 
   return deferred.promise;
 }
@@ -119,28 +119,28 @@ function testClickLineToJump() {
 function testClickMatchToJump() {
   let deferred = promise.defer();
 
   let sourceResults = gDebugger.document.querySelectorAll(".dbg-source-results");
   let secondHeader = sourceResults[1].querySelector(".dbg-results-header");
   let secondMatches = sourceResults[1].querySelectorAll(".dbg-results-line-contents-string[match=true]");
   let lastMatch = Array.slice(secondMatches).pop();
 
-  waitForSourceAndCaret(gPanel, "-02.js", 1, 1).then(() => {
+  waitForSourceAndCaret(gPanel, "-02.js", 13, 3).then(() => {
     info("Current source url:\n" + getSelectedSourceURL(gSources));
     info("Debugger editor text:\n" + gEditor.getText());
 
     ok(isCaretPos(gPanel, 13, 3),
-      "The editor didn't jump to the correct line (2).");
+      "The editor didn't jump to the correct line (5).");
     is(gEditor.getSelection(), "a",
-      "The editor didn't select the correct text (2).");
+      "The editor didn't select the correct text (5).");
     ok(getSelectedSourceURL(gSources).includes("-02.js"),
-      "The currently shown source is incorrect (2).");
+      "The currently shown source is incorrect (5).");
     is(gSources.visibleItems.length, 2,
-      "Not all the sources are shown after the global search (2).");
+      "Not all the sources are shown after the global search (5).");
 
     deferred.resolve();
   });
 
   EventUtils.sendMouseEvent({ type: "click" }, lastMatch);
 
   return deferred.promise;
 }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-sources-01.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-sources-01.js
@@ -207,17 +207,17 @@ function test() {
         waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
         waitForSourceShown(gPanel, "-01.js"),
       ]);
 
       backspaceText(gSearchBox, 6);
 
       return finished.then(() => promise.all([
         ensureSourceIs(gPanel, "-01.js"),
-        ensureCaretAt(gPanel, 1),
+        ensureCaretAt(gPanel, 2, 9),
         verifyContents({ itemCount: 2, hidden: false })
       ]));
     }
 
     function verifyContents(aArgs) {
       is(gSources.visibleItems.length, 2,
         "The unmatched sources in the widget should not be hidden.");
       is(gSearchView.itemCount, aArgs.itemCount,
--- a/devtools/client/debugger/test/mochitest/browser_dbg_stack-06.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_stack-06.js
@@ -35,29 +35,29 @@ function performTest() {
     "Newest frame should also be selected in the mirrored view.");
   is(gSources.selectedIndex, 1,
     "The second source is selected in the widget.");
   is(gEditor.getText().search(/firstCall/), -1,
     "The first source is not displayed.");
   is(gEditor.getText().search(/debugger/), 166,
     "The second source is displayed.");
 
-  waitForSourceAndCaret(gPanel, "-01.js", 1).then(waitForTick).then(() => {
+  waitForSourceAndCaret(gPanel, "-01.js", 5).then(waitForTick).then(() => {
     is(gFrames.selectedIndex, 0,
       "Oldest frame should be selected after click.");
     is(gClassicFrames.selectedIndex, 1,
       "Oldest frame should also be selected in the mirrored view.");
     is(gSources.selectedIndex, 0,
       "The first source is now selected in the widget.");
     is(gEditor.getText().search(/firstCall/), 118,
       "The first source is displayed.");
     is(gEditor.getText().search(/debugger/), -1,
       "The second source is not displayed.");
 
-    waitForSourceAndCaret(gPanel, "-02.js", 1).then(waitForTick).then(() => {
+    waitForSourceAndCaret(gPanel, "-02.js", 6).then(waitForTick).then(() => {
       is(gFrames.selectedIndex, 1,
         "Newest frame should be selected again after click.");
       is(gClassicFrames.selectedIndex, 0,
         "Newest frame should also be selected again in the mirrored view.");
       is(gSources.selectedIndex, 1,
         "The second source is selected in the widget.");
       is(gEditor.getText().search(/firstCall/), -1,
         "The first source is not displayed.");