Bug 1052855 - Traces link to a first line of a function instead of the function declaration. r=fitzgen
authorJakub Jurovych <jjurovych@mozilla.com>
Tue, 19 Aug 2014 14:56:00 +0200
changeset 223205 68d1093896b12f3ef4f25bb0bea924236c41c727
parent 223204 48553b4c1e9f7e8ae894f90c5186da613b9f15ba
child 223206 6ab8a358adb97cc31fefbc0907d07c6943949dc3
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfitzgen
bugs1052855
milestone34.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 1052855 - Traces link to a first line of a function instead of the function declaration. r=fitzgen
browser/devtools/debugger/test/browser_dbg_tracing-03.js
toolkit/devtools/server/actors/tracer.js
toolkit/devtools/server/tests/unit/test_trace_actor-05.js
--- a/browser/devtools/debugger/test/browser_dbg_tracing-03.js
+++ b/browser/devtools/debugger/test/browser_dbg_tracing-03.js
@@ -53,17 +53,17 @@ function clickButton() {
                             gDebuggee);
 }
 
 function clickTraceLog() {
   filterTraces(gPanel, t => t.querySelector(".trace-name[value=main]"))[0].click();
 }
 
 function testCorrectLine() {
-  is(gDebugger.DebuggerView.editor.getCursor().line, 19,
+  is(gDebugger.DebuggerView.editor.getCursor().line, 18,
      "The editor should have the function definition site's line selected.");
 }
 
 registerCleanupFunction(function() {
   gTab = null;
   gDebuggee = null;
   gPanel = null;
   gDebugger = null;
--- a/toolkit/devtools/server/actors/tracer.js
+++ b/toolkit/devtools/server/actors/tracer.js
@@ -274,17 +274,17 @@ TracerActor.prototype = {
 
     if (this._requestsForTraceType.location && aFrame.script) {
       // We should return the location of the start of the script, but
       // Debugger.Script does not provide complete start locations (bug
       // 901138). Instead, return the current offset (the location of the first
       // statement in the function).
       packet.location = {
         url: aFrame.script.url,
-        line: aFrame.script.getOffsetLine(aFrame.offset),
+        line: aFrame.script.startLine,
         column: getOffsetColumn(aFrame.offset, aFrame.script)
       };
     }
 
     if (this._parent.threadActor && aFrame.script) {
       packet.blackBoxed = this._parent.threadActor.sources.isBlackBoxed(aFrame.script.url);
     } else {
       packet.blackBoxed = false;
--- a/toolkit/devtools/server/tests/unit/test_trace_actor-05.js
+++ b/toolkit/devtools/server/tests/unit/test_trace_actor-05.js
@@ -83,23 +83,19 @@ function test_enter_exit_frame()
     .then(function() {
       let url = getFileUrl("tracerlocations.js");
 
       check_location(traces[0].location, { url: url, line: 1, column: 0 });
 
       do_check_eq(traces[1].name, "foo");
 
       // XXX: foo's definition is at tracerlocations.js:3:0, but Debugger.Script
-      // does not provide complete definition locations (bug 901138). Therefore,
-      // we use the first statement in the function (tracerlocations.js:4:2) as
-      // an approximation.
-      //
-      // However, |column| will always be 0 until we can get bug 863089
-      // fixed.
-      check_location(traces[1].location, { url: url, line: 4, column: 0 });
+      // does not provide complete definition locations (bug 901138). |column|
+      // will always be 0 until we can get bug 863089 fixed.
+      check_location(traces[1].location, { url: url, line: 3, column: 0 });
       check_location(traces[1].callsite, { url: url, line: 8, column: 0 });
 
       do_check_eq(typeof traces[1].parameterNames, "object");
       do_check_eq(traces[1].parameterNames.length, 1);
       do_check_eq(traces[1].parameterNames[0], "x");
 
       do_check_eq(typeof traces[1].arguments, "object");
       do_check_true(Array.isArray(traces[1].arguments));