diff --git a/resources/unpacked/devtools/front_end/dirac/dirac.js b/resources/unpacked/devtools/front_end/dirac/dirac.js index 6a8d2a6de4..875bc685a5 100644 --- a/resources/unpacked/devtools/front_end/dirac/dirac.js +++ b/resources/unpacked/devtools/front_end/dirac/dirac.js @@ -14,7 +14,8 @@ Object.assign(window.dirac, (function() { "enable-friendly-locals", "enable-clustered-locals", "inline-custom-formatters", - "welcome-message"]; + "welcome-message", + "clean-urls"]; function hasFeature(feature) { var flag = featureFlags[feature]; @@ -200,6 +201,7 @@ Object.assign(window.dirac, (function() { hasClusteredLocals: hasFeature("enable-clustered-locals"), hasInlineCFs: hasFeature("inline-custom-formatters"), hasWelcomeMessage: hasFeature("welcome-message"), + hasCleanUrls: hasFeature("clean-urls"), hasFeature: hasFeature, codeAsString: codeAsString, stringEscape: stringEscape, diff --git a/resources/unpacked/devtools/front_end/externs.js b/resources/unpacked/devtools/front_end/externs.js index 8881ec4262..cc545c4600 100644 --- a/resources/unpacked/devtools/front_end/externs.js +++ b/resources/unpacked/devtools/front_end/externs.js @@ -358,6 +358,10 @@ var dirac = { hasClusteredLocals: true, /** @type {boolean} */ hasInlineCFs: true, + /** @type {boolean} */ + hasWelcomeMessage: true, + /** @type {boolean} */ + hasCleanUrls: true, /** * @param {string} code * @return {string} diff --git a/resources/unpacked/devtools/front_end/sources/CallStackSidebarPane.js b/resources/unpacked/devtools/front_end/sources/CallStackSidebarPane.js index 0996744742..544e86fe01 100644 --- a/resources/unpacked/devtools/front_end/sources/CallStackSidebarPane.js +++ b/resources/unpacked/devtools/front_end/sources/CallStackSidebarPane.js @@ -469,7 +469,8 @@ WebInspector.CallStackSidebarPane.CallFrame.prototype = { return; var text = uiLocation.linkText(); this.setSubtitle(text.trimMiddle(30)); - this.subtitleElement.title = text; + var fullUrl = uiLocation.toUIString(); + this.subtitleElement.title = fullUrl; }, __proto__: WebInspector.UIList.Item.prototype diff --git a/resources/unpacked/devtools/front_end/workspace/UISourceCode.js b/resources/unpacked/devtools/front_end/workspace/UISourceCode.js index b669bc6057..c906f4304f 100644 --- a/resources/unpacked/devtools/front_end/workspace/UISourceCode.js +++ b/resources/unpacked/devtools/front_end/workspace/UISourceCode.js @@ -133,6 +133,18 @@ WebInspector.UISourceCode.prototype = { var name = this._name; try { name = decodeURI(name); + if (dirac.hasCleanUrls) { + // strip all after ? in the name + const qmarkIndex = name.indexOf("?"); + if (qmarkIndex != -1) { + name = name.substring(0, qmarkIndex); + } + // strip all after # in the name + const hashIndex = name.indexOf("#"); + if (hashIndex != -1) { + name = name.substring(0, hashIndex); + } + } } catch (e) { } return skipTrim ? name : name.trimEnd(100); diff --git a/src/background/dirac/background/tools.cljs b/src/background/dirac/background/tools.cljs index e93d5227bd..098e2d4d77 100644 --- a/src/background/dirac/background/tools.cljs +++ b/src/background/dirac/background/tools.cljs @@ -22,7 +22,8 @@ :enable-friendly-locals :enable-clustered-locals :inline-custom-formatters - :welcome-message]) + :welcome-message + :clean-urls]) (def last-active-tab-query #js {"lastFocusedWindow" true "active" true}) diff --git a/src/options/dirac/options/ui.cljs b/src/options/dirac/options/ui.cljs index 6cd8e2ebfd..aefbfa2fdb 100644 --- a/src/options/dirac/options/ui.cljs +++ b/src/options/dirac/options/ui.cljs @@ -49,7 +49,8 @@ (f/checkbox "Enable Parinfer" data [:options :enable-parinfer]) (f/checkbox "Enable friendly locals" data [:options :enable-friendly-locals]) (f/checkbox "Enable clustered locals" data [:options :enable-clustered-locals]) - (f/checkbox "Inline Custom Formatters in sources" data [:options :inline-custom-formatters])]) + (f/checkbox "Inline Custom Formatters in sources" data [:options :inline-custom-formatters]) + (f/checkbox "Enable clean URLs" data [:options :clean-urls])]) (f/form-buttons (f/button "Reset to Defaults" reset-to-defaults!) (f/button "Save and Exit" save-state-and-exit!)))))) diff --git a/src/shared/dirac/options/model.cljs b/src/shared/dirac/options/model.cljs index b7662e3aee..7206256060 100644 --- a/src/shared/dirac/options/model.cljs +++ b/src/shared/dirac/options/model.cljs @@ -18,7 +18,8 @@ :enable-friendly-locals true :enable-clustered-locals true :inline-custom-formatters true - :welcome-message true}) + :welcome-message true + :clean-urls true}) (defonce cached-options (atom nil)) (defonce chrome-event-channel (make-chrome-event-channel (chan)))