Backed out changeset 792fd0ab86d1 (bug 1503436) for failing damp at damp | debugger/custom.js on a CLOSED TREE
authorAndreea Pavel <apavel@mozilla.com>
Thu, 01 Nov 2018 23:43:49 +0200
changeset 500453 09e5201164c98469f6e50ddf2fe73a7e288123d8
parent 500452 1dbaae27c584753c9d22f33265c76e66d044cb2e
child 500454 713199b324b447d27f43d61e6aa81711db4f835d
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1503436
milestone65.0a1
backs out792fd0ab86d1c254369b5003cac95dc19590a9d4
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
Backed out changeset 792fd0ab86d1 (bug 1503436) for failing damp at damp | debugger/custom.js on a CLOSED TREE
devtools/server/actors/source.js
devtools/server/actors/utils/closest-scripts.js
devtools/server/actors/utils/dbg-source.js
devtools/server/actors/utils/moz.build
devtools/server/tests/unit/setBreakpoint-on-column-minified.js
devtools/server/tests/unit/test_setBreakpoint-at-the-beginning-of-a-minified-fn.js
devtools/server/tests/unit/test_setBreakpoint-at-the-end-of-a-minified-fn.js
devtools/server/tests/unit/xpcshell.ini
--- a/devtools/server/actors/source.js
+++ b/devtools/server/actors/source.js
@@ -11,17 +11,16 @@ const Services = require("Services");
 const { BreakpointActor, setBreakpointAtEntryPoints } = require("devtools/server/actors/breakpoint");
 const { OriginalLocation, GeneratedLocation } = require("devtools/server/actors/common");
 const { createValueGrip } = require("devtools/server/actors/object/utils");
 const { ActorClassWithSpec } = require("devtools/shared/protocol");
 const DevToolsUtils = require("devtools/shared/DevToolsUtils");
 const { assert, fetch } = DevToolsUtils;
 const { joinURI } = require("devtools/shared/path");
 const { sourceSpec } = require("devtools/shared/specs/source");
-const { findClosestScriptBySource } = require("devtools/server/actors/utils/closest-scripts");
 
 loader.lazyRequireGetter(this, "SourceMapConsumer", "source-map", true);
 loader.lazyRequireGetter(this, "SourceMapGenerator", "source-map", true);
 loader.lazyRequireGetter(this, "mapURIToAddonID", "devtools/server/actors/utils/map-uri-to-addon-id");
 loader.lazyRequireGetter(this, "arrayBufferGrip", "devtools/server/actors/array-buffer", true);
 
 function isEvalSource(source) {
   const introType = source.introductionType;
@@ -974,30 +973,17 @@ const SourceActor = ActorClassWithSpec(s
             entryPoints.push({ script, offsets: [offset] });
           }
         }
       }
 
       // If we don't find any matching entrypoints,
       // then we should see if the breakpoint comes before or after the column offsets.
       if (entryPoints.length === 0) {
-        // It's not entirely clear if the scripts that make it here can come
-        // from a variety of sources. This function allows filtering by URL
-        // so it seems like it may be possible and we are erring on the side
-        // of caution by handling it here.
-        const closestScripts = findClosestScriptBySource(
-          columnToOffsetMaps.map(pair => pair[0]),
-          generatedLine,
-          generatedColumn,
-        );
-
-        const columnToOffsetLookup = new Map(columnToOffsetMaps);
-        for (const script of closestScripts) {
-          const columnToOffsetMap = columnToOffsetLookup.get(script);
-
+        for (const [script, columnToOffsetMap] of columnToOffsetMaps) {
           if (columnToOffsetMap.length > 0) {
             const firstColumnOffset = columnToOffsetMap[0];
             const lastColumnOffset = columnToOffsetMap[columnToOffsetMap.length - 1];
 
             if (generatedColumn < firstColumnOffset.columnNumber) {
               entryPoints.push({ script, offsets: [firstColumnOffset.offset] });
             }
 
deleted file mode 100644
--- a/devtools/server/actors/utils/closest-scripts.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-const { findSourceOffset } = require("devtools/server/actors/utils/dbg-source");
-
-function findClosestScriptBySource(scripts, generatedLine, generatedColumn) {
-  const bySource = new Map();
-  for (const script of scripts) {
-    const { source } = script;
-    if (script.format !== "js" || !source) {
-      continue;
-    }
-
-    let sourceScripts = bySource.get(source);
-    if (!sourceScripts) {
-      sourceScripts = [];
-      bySource.set(source, sourceScripts);
-    }
-
-    sourceScripts.push(script);
-  }
-
-  const closestScripts = [];
-  for (const sourceScripts of bySource.values()) {
-    const closest = findClosestScript(sourceScripts, generatedLine, generatedColumn);
-    if (closest) {
-      closestScripts.push(closest);
-    }
-  }
-  return closestScripts;
-}
-exports.findClosestScriptBySource = findClosestScriptBySource;
-
-function findClosestScript(scripts, generatedLine, generatedColumn) {
-  if (scripts.length === 0) {
-    return null;
-  }
-  const { source } = scripts[0];
-
-  const offset = findSourceOffset(
-    source,
-    generatedLine,
-    generatedColumn,
-  );
-
-  let closest = null;
-  for (const script of scripts) {
-    if (script.source !== source) {
-      throw new Error("All scripts must be from a single source.");
-    }
-
-    if (
-      offset >= script.sourceStart &&
-      offset < script.sourceStart + script.sourceLength &&
-      (!closest || script.sourceLength < closest.sourceLength)
-    ) {
-      closest = script;
-    }
-  }
-
-  return closest;
-}
deleted file mode 100644
--- a/devtools/server/actors/utils/dbg-source.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-/**
- * Get the source text offset equivalent to a given line/column pair.
- *
- * @param {Debugger.Source} source
- * @param {number} line The 1-based line number.
- * @param {number} column The 0-based column number.
- * @returns {number} The codepoint offset into the source's text.
- */
-function findSourceOffset(source, line, column) {
-  const offsets = getSourceLineOffsets(source);
-  const offset = offsets[line - 1];
-
-  if (offset) {
-    // Make sure that columns that technically don't exist in the line text
-    // don't cause the offset to wrap to the next line.
-    return Math.min(offset.start + column, offset.textEnd);
-  }
-
-  return line < 0 ? 0 : offsets[offsets.length - 1].end;
-}
-exports.findSourceOffset = findSourceOffset;
-
-const NEWLINE = /(\r?\n|\r|\u2028|\u2029)/g;
-const SOURCE_OFFSETS = new WeakMap();
-/**
- * Generate and cache line information for a given source to track what
- * text offsets mark the start and end of lines. Each entry in the array
- * represents a line in the source text.
- *
- * @param {Debugger.Source} source
- * @returns {Array<{ start, textEnd, end }>}
- *    - start - The codepoint offset of the start of the line.
- *    - textEnd - The codepoint offset just after the last non-newline character.
- *    - end - The codepoint offset of the end of the line. This will be
- *            be the same as the 'start' value of the next offset object,
- *            and this includes the newlines for the line itself, where
- *            'textEnd' excludes newline characters.
- */
-function getSourceLineOffsets(source) {
-  const cached = SOURCE_OFFSETS.get(source);
-  if (cached) {
-    return cached;
-  }
-
-  const { text } = source;
-
-  const lines = text.split(NEWLINE);
-
-  const offsets = [];
-  let offset = 0;
-  for (let i = 0; i < lines.length; i += 2) {
-    const line = lines[i];
-    const start = offset;
-
-    // Calculate the end codepoint offset.
-    let end = offset;
-    for (const c of line) { // eslint-disable-line no-unused-vars
-      end++;
-    }
-    const textEnd = end;
-
-    if (i + 1 < lines.length) {
-      end += lines[i + 1].length;
-    }
-
-    offsets.push(Object.freeze({ start, textEnd, end }));
-    offset = end;
-  }
-  Object.freeze(offsets);
-
-  SOURCE_OFFSETS.set(source, offsets);
-  return offsets;
-}
--- a/devtools/server/actors/utils/moz.build
+++ b/devtools/server/actors/utils/moz.build
@@ -7,19 +7,17 @@
 DevToolsModules(
     'accessibility.js',
     'actor-registry-utils.js',
     'actor-registry.js',
     'audionodes.json',
     'automation-timeline.js',
     'breakpoint-actor-map.js',
     'call-watcher.js',
-    'closest-scripts.js',
     'css-grid-utils.js',
-    'dbg-source.js',
     'event-loop.js',
     'function-call.js',
     'make-debugger.js',
     'map-uri-to-addon-id.js',
     'shapes-utils.js',
     'source-actor-store.js',
     'stack.js',
     'TabSources.js',
deleted file mode 100644
--- a/devtools/server/tests/unit/setBreakpoint-on-column-minified.js
+++ /dev/null
@@ -1,8 +0,0 @@
-"use strict";
-
-function other(){ var a = 1; } function test(){ var a = 1; var b = 2; var c = 3; }
-
-function f() {
-  other();
-  test();
-}
\ No newline at end of file
deleted file mode 100644
--- a/devtools/server/tests/unit/test_setBreakpoint-at-the-beginning-of-a-minified-fn.js
+++ /dev/null
@@ -1,62 +0,0 @@
-"use strict";
-
-var SOURCE_URL = getFileUrl("setBreakpoint-on-column-minified.js");
-
-async function run_test() {
-  do_test_pending();
-  const { createRootActor } = require("xpcshell-test/testactors");
-  DebuggerServer.setRootActor(createRootActor);
-  DebuggerServer.init(() => true);
-  const global = createTestGlobal("test");
-  DebuggerServer.addTestGlobal(global);
-
-  const client = new DebuggerClient(DebuggerServer.connectPipe());
-  await connect(client);
-
-  const { tabs } = await listTabs(client);
-  const tab = findTab(tabs, "test");
-  const [, targetFront] = await attachTarget(client, tab);
-  const [, threadClient] = await attachThread(targetFront);
-  await resume(threadClient);
-
-  const promise = waitForNewSource(threadClient, SOURCE_URL);
-  loadSubScript(SOURCE_URL, global);
-  const { source } = await promise;
-  const sourceClient = threadClient.source(source);
-
-  // Pause inside of the nested function so we can make sure that we don't
-  // add any other breakpoints at other places on this line.
-  const location = { line: 3, column: 47 };
-  let [packet, breakpointClient] = await setBreakpoint(
-    sourceClient,
-    location
-  );
-
-  Assert.ok(!packet.isPending);
-  Assert.equal(false, "actualLocation" in packet);
-
-  packet = await executeOnNextTickAndWaitForPause(function() {
-    Cu.evalInSandbox("f()", global);
-  }, client);
-
-  Assert.equal(packet.type, "paused");
-  const why = packet.why;
-  Assert.equal(why.type, "breakpoint");
-  Assert.equal(why.actors.length, 1);
-  Assert.equal(why.actors[0], breakpointClient.actor);
-
-  const frame = packet.frame;
-  const where = frame.where;
-  Assert.equal(where.source.actor, source.actor);
-  Assert.equal(where.line, location.line);
-  Assert.equal(where.column, 52);
-
-  const variables = frame.environment.bindings.variables;
-  Assert.equal(variables.a.value.type, "undefined");
-  Assert.equal(variables.b.value.type, "undefined");
-  Assert.equal(variables.c.value.type, "undefined");
-
-  await resume(threadClient);
-  await close(client);
-  do_test_finished();
-}
deleted file mode 100644
--- a/devtools/server/tests/unit/test_setBreakpoint-at-the-end-of-a-minified-fn.js
+++ /dev/null
@@ -1,62 +0,0 @@
-"use strict";
-
-var SOURCE_URL = getFileUrl("setBreakpoint-on-column-minified.js");
-
-async function run_test() {
-  do_test_pending();
-  const { createRootActor } = require("xpcshell-test/testactors");
-  DebuggerServer.setRootActor(createRootActor);
-  DebuggerServer.init(() => true);
-  const global = createTestGlobal("test");
-  DebuggerServer.addTestGlobal(global);
-
-  const client = new DebuggerClient(DebuggerServer.connectPipe());
-  await connect(client);
-
-  const { tabs } = await listTabs(client);
-  const tab = findTab(tabs, "test");
-  const [, targetFront] = await attachTarget(client, tab);
-  const [, threadClient] = await attachThread(targetFront);
-  await resume(threadClient);
-
-  const promise = waitForNewSource(threadClient, SOURCE_URL);
-  loadSubScript(SOURCE_URL, global);
-  const { source } = await promise;
-  const sourceClient = threadClient.source(source);
-
-  // Pause inside of the nested function so we can make sure that we don't
-  // add any other breakpoints at other places on this line.
-  const location = { line: 3, column: 81 };
-  let [packet, breakpointClient] = await setBreakpoint(
-    sourceClient,
-    location
-  );
-
-  Assert.ok(!packet.isPending);
-  Assert.equal(false, "actualLocation" in packet);
-
-  packet = await executeOnNextTickAndWaitForPause(function() {
-    Cu.evalInSandbox("f()", global);
-  }, client);
-
-  Assert.equal(packet.type, "paused");
-  const why = packet.why;
-  Assert.equal(why.type, "breakpoint");
-  Assert.equal(why.actors.length, 1);
-  Assert.equal(why.actors[0], breakpointClient.actor);
-
-  const frame = packet.frame;
-  const where = frame.where;
-  Assert.equal(where.source.actor, source.actor);
-  Assert.equal(where.line, location.line);
-  Assert.equal(where.column, 81);
-
-  const variables = frame.environment.bindings.variables;
-  Assert.equal(variables.a.value, 1);
-  Assert.equal(variables.b.value, 2);
-  Assert.equal(variables.c.value, 3);
-
-  await resume(threadClient);
-  await close(client);
-  do_test_finished();
-}
--- a/devtools/server/tests/unit/xpcshell.ini
+++ b/devtools/server/tests/unit/xpcshell.ini
@@ -14,17 +14,16 @@ support-files =
   pre_init_global_actors.js
   pre_init_target_scoped_actors.js
   registertestactors-lazy.js
   sourcemapped.js
   testactors.js
   hello-actor.js
   stepping.js
   setBreakpoint-on-column.js
-  setBreakpoint-on-column-minified.js
   setBreakpoint-on-column-in-gcd-script.js
   setBreakpoint-on-column-with-no-offsets.js
   setBreakpoint-on-column-with-no-offsets-in-gcd-script.js
   setBreakpoint-on-line.js
   setBreakpoint-on-line-in-gcd-script.js
   setBreakpoint-on-line-with-multiple-offsets.js
   setBreakpoint-on-line-with-multiple-statements.js
   setBreakpoint-on-line-with-no-offsets.js
@@ -227,19 +226,17 @@ reason = bug 937197
 [test_client_request.js]
 [test_symbols-01.js]
 [test_symbols-02.js]
 [test_get-executable-lines.js]
 [test_get-executable-lines-source-map.js]
 [test_xpcshell_debugging.js]
 support-files = xpcshell_debugging_script.js
 [test_setBreakpoint-at-the-beginning-of-a-line.js]
-[test_setBreakpoint-at-the-beginning-of-a-minified-fn.js]
 [test_setBreakpoint-at-the-end-of-a-line.js]
-[test_setBreakpoint-at-the-end-of-a-minified-fn.js]
 [test_setBreakpoint-on-column.js]
 [test_setBreakpoint-on-column-in-gcd-script.js]
 [test_setBreakpoint-on-line.js]
 [test_setBreakpoint-on-line-in-gcd-script.js]
 [test_setBreakpoint-on-line-with-multiple-offsets.js]
 [test_setBreakpoint-on-line-with-multiple-statements.js]
 [test_setBreakpoint-on-line-with-no-offsets.js]
 [test_setBreakpoint-on-line-with-no-offsets-in-gcd-script.js]