summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/src/client/firefox/create.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/debugger/src/client/firefox/create.js')
-rw-r--r--devtools/client/debugger/src/client/firefox/create.js25
1 files changed, 23 insertions, 2 deletions
diff --git a/devtools/client/debugger/src/client/firefox/create.js b/devtools/client/debugger/src/client/firefox/create.js
index 9c610a08dd..c78e0fb273 100644
--- a/devtools/client/debugger/src/client/firefox/create.js
+++ b/devtools/client/debugger/src/client/firefox/create.js
@@ -11,7 +11,11 @@ import {
getSourceCount,
} from "../../selectors/index";
import { features } from "../../utils/prefs";
-import { isUrlExtension } from "../../utils/source";
+import {
+ isUrlExtension,
+ getRawSourceURL,
+ getFormattedSourceId,
+} from "../../utils/source";
import { createLocation } from "../../utils/location";
import { getDisplayURL } from "../../utils/sources-tree/getURL";
@@ -242,6 +246,7 @@ function createSourceObject({
isOriginal = false,
isHTML = false,
}) {
+ const displayURL = getDisplayURL(url, extensionName);
return {
// The ID, computed by:
// * `makeSourceId` for generated,
@@ -254,7 +259,23 @@ function createSourceObject({
// A (slightly tweaked) URL object to represent the source URL.
// The URL object is augmented of a "group" attribute and some other standard attributes
// are modified from their typical value. See getDisplayURL implementation.
- displayURL: getDisplayURL(url, extensionName),
+ displayURL,
+
+ // Short label for this source.
+ //
+ // * For inlined/eval sources without a URL, the name will refer to the internal source ID,
+ // * For pretty printed source, we take care to ignore the internal ":formatted" suffix used in the URL,
+ // * For index files, i.e. sources loaded without a filename, they will be named "(index)".
+ // * Special characters are decoded from the URL string.
+ // (most of this is done by getDisplayURL)
+ shortName: url
+ ? getRawSourceURL(displayURL.filename)
+ : getFormattedSourceId(id),
+
+ // Same as short name, but with the query parameters.
+ longName: url
+ ? getRawSourceURL(displayURL.filename + displayURL.search)
+ : getFormattedSourceId(id),
// Only set for generated sources that are WebExtension sources.
// This is especially useful to display the extension name for content scripts