зеркало из https://github.com/mozilla/gecko-dev.git
Bug 777093 - Long script urls still confuse the debugger menulist, r=rcampbell
This commit is contained in:
Родитель
9546b4fd36
Коммит
53d3e8120a
|
@ -11,6 +11,7 @@ const Cu = Components.utils;
|
||||||
|
|
||||||
const FRAME_STEP_CACHE_DURATION = 100; // ms
|
const FRAME_STEP_CACHE_DURATION = 100; // ms
|
||||||
const DBG_STRINGS_URI = "chrome://browser/locale/devtools/debugger.properties";
|
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
|
const SYNTAX_HIGHLIGHT_MAX_FILE_SIZE = 1048576; // 1 MB in bytes
|
||||||
|
|
||||||
Cu.import("resource:///modules/source-editor.jsm");
|
Cu.import("resource:///modules/source-editor.jsm");
|
||||||
|
@ -1088,7 +1089,12 @@ SourceScripts.prototype = {
|
||||||
* The simplified label.
|
* The simplified label.
|
||||||
*/
|
*/
|
||||||
getScriptLabel: function SS_getScriptLabel(aUrl, aHref) {
|
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);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,6 +40,9 @@ function testScriptLabelShortening() {
|
||||||
is(ss.trimUrlQuery("a/b/c.d?test=1&random=4#reference"), "a/b/c.d",
|
is(ss.trimUrlQuery("a/b/c.d?test=1&random=4#reference"), "a/b/c.d",
|
||||||
"Trimming the url query isn't done properly.");
|
"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 = [
|
let urls = [
|
||||||
{ href: "http://some.address.com/random/", leaf: "subrandom/" },
|
{ href: "http://some.address.com/random/", leaf: "subrandom/" },
|
||||||
{ href: "http://some.address.com/random/", leaf: "suprandom/?a=1" },
|
{ 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: "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_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_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) {
|
urls.forEach(function(url) {
|
||||||
|
@ -121,6 +126,9 @@ function testScriptLabelShortening() {
|
||||||
ok(gDebugger.DebuggerView.Scripts.containsLabel("script_t3_3.js"),
|
ok(gDebugger.DebuggerView.Scripts.containsLabel("script_t3_3.js"),
|
||||||
"Script (14) label is incorrect.");
|
"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,
|
is(vs._scripts.itemCount, urls.filter(function(url) !url.dupe).length,
|
||||||
"Didn't get the correct number of scripts in the list.");
|
"Didn't get the correct number of scripts in the list.");
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#scripts {
|
#scripts {
|
||||||
max-width: 350px;
|
|
||||||
min-width: 150px;
|
min-width: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#scripts {
|
#scripts {
|
||||||
max-width: 350px;
|
|
||||||
min-width: 150px;
|
min-width: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#scripts {
|
#scripts {
|
||||||
max-width: 350px;
|
|
||||||
min-width: 150px;
|
min-width: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче