summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/src/utils/sources-tree
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /devtools/client/debugger/src/utils/sources-tree
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/debugger/src/utils/sources-tree')
-rw-r--r--devtools/client/debugger/src/utils/sources-tree/getURL.js17
-rw-r--r--devtools/client/debugger/src/utils/sources-tree/utils.js14
2 files changed, 13 insertions, 18 deletions
diff --git a/devtools/client/debugger/src/utils/sources-tree/getURL.js b/devtools/client/debugger/src/utils/sources-tree/getURL.js
index c01fce5f23..5c9e7db6e5 100644
--- a/devtools/client/debugger/src/utils/sources-tree/getURL.js
+++ b/devtools/client/debugger/src/utils/sources-tree/getURL.js
@@ -56,6 +56,9 @@ const def = {
* This is augmented with custom properties like:
* - `group`, which is mostly the host of the source's URL.
* This is used to sort sources in the Source tree.
+ * - `filename` which may not be quite matching the URL.
+ * When files are loaded from "/", they won't have a real name,
+ * but instead this will report "(index)".
* - `fileExtension`, lowercased file extension of the source
* (if any extension is available)
* - `path` and `pathname` have some special behavior.
@@ -66,8 +69,14 @@ export function getDisplayURL(url, extensionName = null) {
return def;
}
- const { pathname, search, protocol, host } = parse(url);
- const filename = getUnicodeUrlPath(getFilenameFromPath(pathname));
+ let { pathname, search, protocol, host } = parse(url);
+
+ // Decode encoded characters early so that all other code rely on decoded strings
+ pathname = getUnicodeUrlPath(pathname);
+ search = getUnicodeUrlPath(search);
+ host = getUnicodeHostname(host);
+
+ const filename = getFilenameFromPath(pathname);
switch (protocol) {
case "javascript:":
@@ -121,7 +130,7 @@ export function getDisplayURL(url, extensionName = null) {
search,
filename,
fileExtension: getFileExtension("/"),
- group: url,
+ group: getUnicodeUrlPath(url),
};
case "data:":
@@ -165,7 +174,7 @@ export function getDisplayURL(url, extensionName = null) {
search,
filename,
fileExtension: getFileExtension(pathname),
- group: getUnicodeHostname(host),
+ group: host,
};
}
diff --git a/devtools/client/debugger/src/utils/sources-tree/utils.js b/devtools/client/debugger/src/utils/sources-tree/utils.js
index 0a2f41752b..45eba2d817 100644
--- a/devtools/client/debugger/src/utils/sources-tree/utils.js
+++ b/devtools/client/debugger/src/utils/sources-tree/utils.js
@@ -28,17 +28,3 @@ export function getRelativePath(url) {
}
return "";
}
-
-/**
- *
- * @param {String} name: Name (e.g. computed in SourcesTreeItem renderItemName),
- * which might include URI search.
- * @returns {String} result of `decodedURI(name)`, or name if it `name` is malformed.
- */
-export function safeDecodeItemName(name) {
- try {
- return decodeURI(name);
- } catch (e) {
- return name;
- }
-}