diff --git a/browser/devtools/debugger/debugger-controller.js b/browser/devtools/debugger/debugger-controller.js index 720b74b2a657..93bdedcefdd6 100644 --- a/browser/devtools/debugger/debugger-controller.js +++ b/browser/devtools/debugger/debugger-controller.js @@ -11,6 +11,7 @@ const Cu = Components.utils; const FRAME_STEP_CACHE_DURATION = 100; // ms const DBG_STRINGS_URI = "chrome://browser/locale/devtools/debugger.properties"; +const SCRIPTS_URL_MAX_LENGTH = 64; // chars const SYNTAX_HIGHLIGHT_MAX_FILE_SIZE = 1048576; // 1 MB in bytes Cu.import("resource:///modules/source-editor.jsm"); @@ -1088,7 +1089,12 @@ SourceScripts.prototype = { * The simplified label. */ getScriptLabel: function SS_getScriptLabel(aUrl, aHref) { - return this._labelsCache[aUrl] || (this._labelsCache[aUrl] = this._trimUrl(aUrl)); + let label = this._trimUrl(aUrl); + if (label.length > SCRIPTS_URL_MAX_LENGTH) { + let ellipsis = Services.prefs.getComplexValue("intl.ellipsis", Ci.nsIPrefLocalizedString); + label = label.substring(0, SCRIPTS_URL_MAX_LENGTH) + ellipsis.data; + } + return this._labelsCache[aUrl] || (this._labelsCache[aUrl] = label); }, /** diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-01.js b/browser/devtools/debugger/test/browser_dbg_propertyview-01.js index 6d36ffe6aaef..ea79275b5105 100644 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-01.js +++ b/browser/devtools/debugger/test/browser_dbg_propertyview-01.js @@ -40,6 +40,9 @@ function testScriptLabelShortening() { is(ss.trimUrlQuery("a/b/c.d?test=1&random=4#reference"), "a/b/c.d", "Trimming the url query isn't done properly."); + let ellipsis = Services.prefs.getComplexValue("intl.ellipsis", Ci.nsIPrefLocalizedString); + let nanana = new Array(20).join(NaN); + let urls = [ { href: "http://some.address.com/random/", leaf: "subrandom/" }, { href: "http://some.address.com/random/", leaf: "suprandom/?a=1" }, @@ -62,7 +65,9 @@ function testScriptLabelShortening() { { href: "file://random/", leaf: "script_t2_3.js&b" }, { href: "resource://random/", leaf: "script_t3_1.js#id?a=1&b=2" }, { href: "resource://random/", leaf: "script_t3_2.js?a=1&b=2#id" }, - { href: "resource://random/", leaf: "script_t3_3.js&a=1&b=2#id" } + { href: "resource://random/", leaf: "script_t3_3.js&a=1&b=2#id" }, + + { href: nanana, leaf: "Batman!" + "{trim me, now and forevermore}" } ]; urls.forEach(function(url) { @@ -121,6 +126,9 @@ function testScriptLabelShortening() { ok(gDebugger.DebuggerView.Scripts.containsLabel("script_t3_3.js"), "Script (14) label is incorrect."); + ok(gDebugger.DebuggerView.Scripts.containsLabel(nanana + "Batman!" + ellipsis), + "Script (15) label is incorrect."); + is(vs._scripts.itemCount, urls.filter(function(url) !url.dupe).length, "Didn't get the correct number of scripts in the list."); diff --git a/browser/themes/gnomestripe/devtools/debugger.css b/browser/themes/gnomestripe/devtools/debugger.css index fcd0dc6f4c22..426f5882c56b 100644 --- a/browser/themes/gnomestripe/devtools/debugger.css +++ b/browser/themes/gnomestripe/devtools/debugger.css @@ -17,7 +17,6 @@ } #scripts { - max-width: 350px; min-width: 150px; } diff --git a/browser/themes/pinstripe/devtools/debugger.css b/browser/themes/pinstripe/devtools/debugger.css index c440c7c6e71a..1784637785aa 100644 --- a/browser/themes/pinstripe/devtools/debugger.css +++ b/browser/themes/pinstripe/devtools/debugger.css @@ -19,7 +19,6 @@ } #scripts { - max-width: 350px; min-width: 150px; } diff --git a/browser/themes/winstripe/devtools/debugger.css b/browser/themes/winstripe/devtools/debugger.css index 694c98af4c31..d7e5170be457 100644 --- a/browser/themes/winstripe/devtools/debugger.css +++ b/browser/themes/winstripe/devtools/debugger.css @@ -17,7 +17,6 @@ } #scripts { - max-width: 350px; min-width: 150px; }