Skip to content

Commit

Permalink
devtools: introduce :clean-urls feature
Browse files Browse the repository at this point in the history
  • Loading branch information
darwin committed Jun 2, 2016
1 parent bec9ead commit 84501e1
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 5 deletions.
4 changes: 3 additions & 1 deletion resources/unpacked/devtools/front_end/dirac/dirac.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions resources/unpacked/devtools/front_end/externs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions resources/unpacked/devtools/front_end/workspace/UISourceCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/background/dirac/background/tools.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
3 changes: 2 additions & 1 deletion src/options/dirac/options/ui.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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!))))))
Expand Down
3 changes: 2 additions & 1 deletion src/shared/dirac/options/model.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit 84501e1

Please sign in to comment.