diff --git a/src/utils/sources-tree/addToTree.js b/src/utils/sources-tree/addToTree.js index 1c44d871cb..9fbf4c2989 100644 --- a/src/utils/sources-tree/addToTree.js +++ b/src/utils/sources-tree/addToTree.js @@ -86,14 +86,9 @@ function traverseTree( tree: TreeDirectory, debuggeeHost: ?string ): TreeNode { - const parts = url.path.split("/").filter(p => p !== ""); + const parts = url.path.split("/").filter((p, i) => p !== "" || i < 2); - /* handle absolute paths from webpack bundles */ - if (url.isAbsolutePath) { - parts.unshift(""); - } - - parts.unshift(url.group); + parts[0] = url.group; let path = ""; return parts.reduce((subTree, part, index) => { diff --git a/src/utils/sources-tree/getURL.js b/src/utils/sources-tree/getURL.js index bf4a13ad04..32acc1c709 100644 --- a/src/utils/sources-tree/getURL.js +++ b/src/utils/sources-tree/getURL.js @@ -11,8 +11,7 @@ import type { Source } from "../../types"; export type ParsedURL = { path: string, group: string, - filename: string, - isAbsolutePath: boolean + filename: string }; const urlMap: WeakMap = new WeakMap(); @@ -30,7 +29,7 @@ export function getFilenameFromPath(pathname?: string) { } const NoDomain = "(no domain)"; -const def = { path: "", group: "", filename: "", isAbsolutePath: false }; +const def = { path: "", group: "", filename: "" }; function _getURL(source: Source, defaultDomain: string): ParsedURL { const { url } = source; @@ -61,8 +60,7 @@ function _getURL(source: Source, defaultDomain: string): ParsedURL { ...def, path: pathname, filename, - group: `${protocol}//`, - isAbsolutePath: pathname.startsWith("//") + group: `${protocol}//` }; case "about:": diff --git a/src/utils/sources-tree/tests/getUrl.spec.js b/src/utils/sources-tree/tests/getUrl.spec.js index c89aabaa60..5b1586b882 100644 --- a/src/utils/sources-tree/tests/getUrl.spec.js +++ b/src/utils/sources-tree/tests/getUrl.spec.js @@ -86,15 +86,6 @@ describe("getUrl", () => { expect(urlObject.group).toBe("webpack://"); }); - it("sets absolutepath flag for webpack absolute paths", () => { - const urlObject = getURL( - createMockSource({ - url: "webpack:////src/component.jsx" - }) - ); - expect(urlObject.isAbsolutePath).toBe(true); - }); - it("creates a group name for angular", () => { const urlObject = getURL( createMockSource({ @@ -126,8 +117,7 @@ describe("getUrl", () => { expect(url).toEqual({ filename: "baz.js", group: "example.com", - path: "/foo/bar/baz.js", - isAbsolutePath: false + path: "/foo/bar/baz.js" }); }); @@ -147,8 +137,7 @@ describe("getUrl", () => { expect(url).toEqual({ filename: "baz.js", group: "example.com", - path: "/foo/bar/baz.js", - isAbsolutePath: false + path: "/foo/bar/baz.js" }); }); });