Backed out changeset 985e05a4b540 (bug 1533813) for Debugger failure. CLOSED TREE
authorDorel Luca <dluca@mozilla.com>
Tue, 12 Mar 2019 01:40:45 +0200
changeset 521455 02b387ef172ee8e00ba33eb630def6cb0784b05b
parent 521454 5242fa07735cd4f39f3357747d4ac332d90e6df9
child 521456 b9b0378c5e0bd749b7904c2a5ccca74c9683bf42
push id10866
push usernerli@mozilla.com
push dateTue, 12 Mar 2019 18:59:09 +0000
treeherdermozilla-beta@445c24a51727 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1533813
milestone67.0a1
backs out985e05a4b54024ae40be6d94aaf8d9fb3d66f9b2
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 985e05a4b540 (bug 1533813) for Debugger failure. CLOSED TREE
devtools/client/debugger/new/packages/devtools-source-map/src/index.js
devtools/client/debugger/new/packages/devtools-source-map/src/source-map.js
devtools/client/debugger/new/packages/devtools-source-map/src/worker.js
devtools/client/debugger/new/src/actions/breakpoints/breakpointPositions.js
devtools/client/debugger/new/src/actions/pause/tests/pause.spec.js
devtools/client/debugger/new/src/actions/sources/tests/select.spec.js
devtools/client/debugger/new/src/actions/tests/ast.spec.js
devtools/client/debugger/new/src/actions/tests/pending-breakpoints.spec.js
devtools/client/debugger/new/src/actions/tests/project-text-search.spec.js
devtools/client/shared/source-map/index.js
devtools/client/shared/source-map/worker.js
--- a/devtools/client/debugger/new/packages/devtools-source-map/src/index.js
+++ b/devtools/client/debugger/new/packages/devtools-source-map/src/index.js
@@ -72,22 +72,16 @@ export const getAllGeneratedLocations = 
 ): Promise<Array<SourceLocation>> =>
   _getAllGeneratedLocations(location, originalSource);
 
 export const getOriginalLocation = async (
   location: SourceLocation,
   options: locationOptions = {}
 ): Promise<SourceLocation> => _getOriginalLocation(location, options);
 
-export const getOriginalLocations = async (
-  locations: SourceLocation[],
-  options: locationOptions = {}
-): Promise<SourceLocation[]> =>
-  dispatcher.invoke("getOriginalLocations", locations, options);
-
 export const getGeneratedRangesForOriginal = async (
   sourceId: SourceId,
   url: string,
   mergeUnmappedRegions?: boolean
 ): Promise<
   Array<{
     start: {
       line: number,
--- a/devtools/client/debugger/new/packages/devtools-source-map/src/source-map.js
+++ b/devtools/client/debugger/new/packages/devtools-source-map/src/source-map.js
@@ -41,20 +41,16 @@ type Range = {
     column: number
   },
   end: {
     line: number,
     column: number
   }
 };
 
-export type locationOptions = {
-  search?: "LEAST_UPPER_BOUND" | "GREATEST_LOWER_BOUND"
-};
-
 async function getOriginalURLs(
   generatedSource: Source
 ): Promise<SourceMapConsumer> {
   const map = await fetchSourceMap(generatedSource);
   return map && map.sources;
 }
 
 const COMPUTED_SPANS = new WeakSet();
@@ -256,25 +252,19 @@ async function getAllGeneratedLocations(
 
   return positions.map(({ line, column }) => ({
     sourceId: generatedSourceId,
     line,
     column
   }));
 }
 
-function getOriginalLocations(
-  locations: SourceLocation[],
-  options: locationOptions = {}
-) {
-  return Promise.all(
-    locations.map(location => getOriginalLocation(location, options))
-  );
-}
-
+export type locationOptions = {
+  search?: "LEAST_UPPER_BOUND" | "GREATEST_LOWER_BOUND"
+};
 async function getOriginalLocation(
   location: SourceLocation,
   { search }: locationOptions = {}
 ): Promise<SourceLocation> {
   if (!isGeneratedId(location.sourceId)) {
     return location;
   }
 
@@ -551,16 +541,15 @@ function clearSourceMaps() {
 module.exports = {
   getOriginalURLs,
   hasOriginalURL,
   getOriginalRanges,
   getGeneratedRanges,
   getGeneratedLocation,
   getAllGeneratedLocations,
   getOriginalLocation,
-  getOriginalLocations,
   getOriginalSourceText,
   getGeneratedRangesForOriginal,
   getFileGeneratedRange,
   applySourceMap,
   clearSourceMaps,
   hasMappedSource
 };
--- a/devtools/client/debugger/new/packages/devtools-source-map/src/worker.js
+++ b/devtools/client/debugger/new/packages/devtools-source-map/src/worker.js
@@ -6,17 +6,16 @@
 const {
   getOriginalURLs,
   hasOriginalURL,
   getOriginalRanges,
   getGeneratedRanges,
   getGeneratedLocation,
   getAllGeneratedLocations,
   getOriginalLocation,
-  getOriginalLocations,
   getOriginalSourceText,
   getGeneratedRangesForOriginal,
   getFileGeneratedRange,
   hasMappedSource,
   clearSourceMaps,
   applySourceMap
 } = require("./source-map");
 
@@ -33,17 +32,16 @@ self.onmessage = workerHandler({
   setAssetRootURL,
   getOriginalURLs,
   hasOriginalURL,
   getOriginalRanges,
   getGeneratedRanges,
   getGeneratedLocation,
   getAllGeneratedLocations,
   getOriginalLocation,
-  getOriginalLocations,
   getOriginalSourceText,
   getOriginalStackFrames,
   getGeneratedRangesForOriginal,
   getFileGeneratedRange,
   hasMappedSource,
   applySourceMap,
   clearSourceMaps
 });
--- a/devtools/client/debugger/new/src/actions/breakpoints/breakpointPositions.js
+++ b/devtools/client/debugger/new/src/actions/breakpoints/breakpointPositions.js
@@ -1,41 +1,42 @@
 /* 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/>. */
 
 // @flow
 
 import { isOriginalId, originalToGeneratedId } from "devtools-source-map";
-import { uniqBy, zip } from "lodash";
+import { uniqBy } from "lodash";
 
 import {
   getSource,
   getSourceFromId,
   hasBreakpointPositions,
   getBreakpointPositionsForSource
 } from "../../selectors";
 
 import type { MappedLocation, SourceLocation } from "../../types";
 import type { ThunkArgs } from "../../actions/types";
+import { getOriginalLocation } from "../../utils/source-maps";
 import { makeBreakpointId } from "../../utils/breakpoint";
 import typeof SourceMaps from "../../../packages/devtools-source-map/src";
 
 const requests = new Map();
 
 async function mapLocations(
   generatedLocations: SourceLocation[],
   { sourceMaps }: { sourceMaps: SourceMaps }
 ) {
-  const originalLocations = await sourceMaps.getOriginalLocations(
-    generatedLocations
-  );
+  return Promise.all(
+    (generatedLocations: any).map(async (generatedLocation: SourceLocation) => {
+      const location = await getOriginalLocation(generatedLocation, sourceMaps);
 
-  return zip(originalLocations, generatedLocations).map(
-    ([location, generatedLocation]) => ({ location, generatedLocation })
+      return { location, generatedLocation };
+    })
   );
 }
 
 function filterByUniqLocation(positions: MappedLocation[]) {
   return uniqBy(positions, ({ location }) => makeBreakpointId(location));
 }
 
 function convertToList(results, source) {
--- a/devtools/client/debugger/new/src/actions/pause/tests/pause.spec.js
+++ b/devtools/client/debugger/new/src/actions/pause/tests/pause.spec.js
@@ -251,17 +251,16 @@ describe("pause", () => {
       const originalLocation = {
         sourceId: "foo-original",
         line: 3,
         column: 0
       };
 
       const sourceMapsMock = {
         getOriginalLocation: () => Promise.resolve(originalLocation),
-        getOriginalLocations: async items => items,
         getOriginalSourceText: async () => ({
           source: "\n\nfunction fooOriginal() {\n  return -5;\n}",
           contentType: "text/javascript"
         }),
         getGeneratedLocation: async location => location
       };
 
       const store = createStore(mockThreadClient, {}, sourceMapsMock);
@@ -314,17 +313,16 @@ describe("pause", () => {
           displayName: "barZoo",
           location: originalLocation2
         }
       ];
 
       const sourceMapsMock = {
         getOriginalStackFrames: loc => Promise.resolve(originStackFrames),
         getOriginalLocation: () => Promise.resolve(originalLocation),
-        getOriginalLocations: async items => items,
         getOriginalSourceText: async () => ({
           source: "fn fooBar() {}\nfn barZoo() { fooBar() }",
           contentType: "text/rust"
         }),
         getGeneratedRangesForOriginal: async () => []
       };
 
       const store = createStore(mockThreadClient, {}, sourceMapsMock);
--- a/devtools/client/debugger/new/src/actions/sources/tests/select.spec.js
+++ b/devtools/client/debugger/new/src/actions/sources/tests/select.spec.js
@@ -224,17 +224,16 @@ describe("sources", () => {
   });
 
   it("should keep the original the viewing context", async () => {
     const { dispatch, getState } = createStore(
       sourceThreadClient,
       {},
       {
         getOriginalLocation: async location => ({ ...location, line: 12 }),
-        getOriginalLocations: async items => items,
         getGeneratedLocation: async location => ({ ...location, line: 12 }),
         getOriginalSourceText: async () => ({ source: "" }),
         getGeneratedRangesForOriginal: async () => []
       }
     );
 
     const baseSource = makeSource("base.js");
     await dispatch(actions.newSource(baseSource));
@@ -253,17 +252,16 @@ describe("sources", () => {
   });
 
   it("should change the original the viewing context", async () => {
     const { dispatch, getState } = createStore(
       sourceThreadClient,
       {},
       {
         getOriginalLocation: async location => ({ ...location, line: 12 }),
-        getOriginalLocations: async items => items,
         getGeneratedRangesForOriginal: async () => [],
         getOriginalSourceText: async () => ({ source: "" })
       }
     );
 
     await dispatch(actions.newSource(makeSource("base.js")));
     const baseSource = makeOriginalSource("base.js");
 
--- a/devtools/client/debugger/new/src/actions/tests/ast.spec.js
+++ b/devtools/client/debugger/new/src/actions/tests/ast.spec.js
@@ -40,18 +40,17 @@ const threadClient = {
 };
 
 const sourceMaps = {
   getOriginalSourceText: async ({ id }) => ({
     id,
     text: sourceTexts[id],
     contentType: "text/javascript"
   }),
-  getGeneratedRangesForOriginal: async () => [],
-  getOriginalLocations: async items => items
+  getGeneratedRangesForOriginal: async () => []
 };
 
 const sourceTexts = {
   "base.js": "function base(boo) {}",
   "foo.js": "function base(boo) { return this.bazz; } outOfScope",
   "scopes.js": readFixture("scopes.js"),
   "reactComponent.js/originalSource": readFixture("reactComponent.js"),
   "reactFuncComponent.js/originalSource": readFixture("reactFuncComponent.js")
--- a/devtools/client/debugger/new/src/actions/tests/pending-breakpoints.spec.js
+++ b/devtools/client/debugger/new/src/actions/tests/pending-breakpoints.spec.js
@@ -63,18 +63,17 @@ function mockSourceMaps() {
     ...sourceMaps,
     getOriginalSourceText: async source => ({
       id: source.id,
       text: "",
       contentType: "text/javascript"
     }),
     getGeneratedRangesForOriginal: async () => [
       { start: { line: 0, column: 0 }, end: { line: 10, column: 10 } }
-    ],
-    getOriginalLocations: async items => items
+    ]
   };
 }
 
 describe("when adding breakpoints", () => {
   it("a corresponding pending breakpoint should be added", async () => {
     const { dispatch, getState } = createStore(
       mockClient({ "5": [1] }),
       loadInitialState(),
@@ -375,18 +374,17 @@ describe("adding sources", () => {
       getGeneratedLocation: async (location, _source) => ({
         line: location.line,
         column: location.column,
         sourceId: _source.id
       }),
       getOriginalLocation: async location => location,
       getGeneratedRangesForOriginal: async () => [
         { start: { line: 0, column: 0 }, end: { line: 10, column: 10 } }
-      ],
-      getOriginalLocations: async items => items
+      ]
     });
 
     const { getState, dispatch } = store;
 
     expect(selectors.getBreakpointCount(getState())).toEqual(0);
 
     await dispatch(actions.newSource(makeSource("bar.js")));
     await dispatch(actions.newSource(source));
--- a/devtools/client/debugger/new/src/actions/tests/project-text-search.spec.js
+++ b/devtools/client/debugger/new/src/actions/tests/project-text-search.spec.js
@@ -72,18 +72,17 @@ describe("project text search", () => {
     const source2 = makeSource("bar:formatted");
 
     const mockMaps = {
       getOriginalSourceText: async () => ({
         source: "function bla(x, y) {\n const bar = 4; return 2;\n}",
         contentType: "text/javascript"
       }),
       getOriginalURLs: async () => [source2.url],
-      getGeneratedRangesForOriginal: async () => [],
-      getOriginalLocations: async items => items
+      getGeneratedRangesForOriginal: async () => []
     };
 
     const { dispatch, getState } = createStore(threadClient, {}, mockMaps);
     const mockQuery = "bla";
 
     await dispatch(actions.newSource(source1));
     await dispatch(actions.newSource(source2));
 
--- a/devtools/client/shared/source-map/index.js
+++ b/devtools/client/shared/source-map/index.js
@@ -154,18 +154,16 @@ const getOriginalRanges = exports.getOri
 const getGeneratedRanges = exports.getGeneratedRanges = async (location, originalSource) => _getGeneratedRanges(location, originalSource);
 
 const getGeneratedLocation = exports.getGeneratedLocation = async (location, originalSource) => _getGeneratedLocation(location, originalSource);
 
 const getAllGeneratedLocations = exports.getAllGeneratedLocations = async (location, originalSource) => _getAllGeneratedLocations(location, originalSource);
 
 const getOriginalLocation = exports.getOriginalLocation = async (location, options = {}) => _getOriginalLocation(location, options);
 
-const getOriginalLocations = exports.getOriginalLocations = async (locations, options = {}) => dispatcher.invoke("getOriginalLocations", locations, options);
-
 const getGeneratedRangesForOriginal = exports.getGeneratedRangesForOriginal = async (sourceId, url, mergeUnmappedRegions) => dispatcher.invoke("getGeneratedRangesForOriginal", sourceId, url, mergeUnmappedRegions);
 
 const getFileGeneratedRange = exports.getFileGeneratedRange = async originalSource => dispatcher.invoke("getFileGeneratedRange", originalSource);
 
 const getLocationScopes = exports.getLocationScopes = dispatcher.task("getLocationScopes");
 
 const getOriginalSourceText = exports.getOriginalSourceText = async originalSource => dispatcher.invoke("getOriginalSourceText", originalSource);
 
--- a/devtools/client/shared/source-map/worker.js
+++ b/devtools/client/shared/source-map/worker.js
@@ -6906,17 +6906,16 @@ module.exports = __webpack_require__(740
 const {
   getOriginalURLs,
   hasOriginalURL,
   getOriginalRanges,
   getGeneratedRanges,
   getGeneratedLocation,
   getAllGeneratedLocations,
   getOriginalLocation,
-  getOriginalLocations,
   getOriginalSourceText,
   getGeneratedRangesForOriginal,
   getFileGeneratedRange,
   hasMappedSource,
   clearSourceMaps,
   applySourceMap
 } = __webpack_require__(741);
 
@@ -6933,17 +6932,16 @@ self.onmessage = workerHandler({
   setAssetRootURL,
   getOriginalURLs,
   hasOriginalURL,
   getOriginalRanges,
   getGeneratedRanges,
   getGeneratedLocation,
   getAllGeneratedLocations,
   getOriginalLocation,
-  getOriginalLocations,
   getOriginalSourceText,
   getOriginalStackFrames,
   getGeneratedRangesForOriginal,
   getFileGeneratedRange,
   hasMappedSource,
   applySourceMap,
   clearSourceMaps
 });
@@ -7161,20 +7159,16 @@ async function getAllGeneratedLocations(
 
   return positions.map(({ line, column }) => ({
     sourceId: generatedSourceId,
     line,
     column
   }));
 }
 
-function getOriginalLocations(locations, options = {}) {
-  return Promise.all(locations.map(location => getOriginalLocation(location, options)));
-}
-
 async function getOriginalLocation(location, { search } = {}) {
   if (!isGeneratedId(location.sourceId)) {
     return location;
   }
 
   const map = await getSourceMap(location.sourceId);
   if (!map) {
     return location;
@@ -7411,17 +7405,16 @@ function clearSourceMaps() {
 module.exports = {
   getOriginalURLs,
   hasOriginalURL,
   getOriginalRanges,
   getGeneratedRanges,
   getGeneratedLocation,
   getAllGeneratedLocations,
   getOriginalLocation,
-  getOriginalLocations,
   getOriginalSourceText,
   getGeneratedRangesForOriginal,
   getFileGeneratedRange,
   applySourceMap,
   clearSourceMaps,
   hasMappedSource
 };