mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 746648 - Too large script labels in various pages. r=past
This commit is contained in:
parent
f01e8419b2
commit
b89a55a23a
@ -866,14 +866,17 @@ SourceScripts.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trims the query part of a url string, if necessary.
|
* Trims the id selector or query part of a url string, if necessary.
|
||||||
*
|
*
|
||||||
* @param string aUrl
|
* @param string aUrl
|
||||||
* The script url.
|
* The script url.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
_trimUrlQuery: function SS__trimUrlQuery(aUrl) {
|
_trimUrlQuery: function SS__trimUrlQuery(aUrl) {
|
||||||
let q = aUrl.indexOf('?');
|
let q = aUrl.indexOf('#');
|
||||||
|
if (q === -1) q = aUrl.indexOf('?');
|
||||||
|
if (q === -1) q = aUrl.indexOf('&');
|
||||||
|
|
||||||
if (q > -1) {
|
if (q > -1) {
|
||||||
return aUrl.slice(0, q);
|
return aUrl.slice(0, q);
|
||||||
}
|
}
|
||||||
|
@ -41,32 +41,31 @@ function testScriptLabelShortening() {
|
|||||||
"Trimming the url query isn't done properly.");
|
"Trimming the url query isn't done properly.");
|
||||||
|
|
||||||
let urls = [
|
let urls = [
|
||||||
{ href: "ici://some.address.com/random/", leaf: "subrandom/" },
|
{ href: "ichi://some.address.com/random/", leaf: "subrandom/" },
|
||||||
{ href: "ni://another.address.org/random/subrandom/", leaf: "page.html" },
|
{ href: "ni://another.address.org/random/subrandom/", leaf: "page.html" },
|
||||||
{ href: "san://interesting.address.gro/random/", leaf: "script.js" },
|
{ href: "san://interesting.address.gro/random/", leaf: "script.js" },
|
||||||
{ href: "si://interesting.address.moc/random/", leaf: "script.js" },
|
{ href: "shi://interesting.address.moc/random/", leaf: "script.js" },
|
||||||
{ href: "si://interesting.address.moc/random/", leaf: "x/script.js" },
|
{ href: "shi://interesting.address.moc/random/", leaf: "x/script.js" },
|
||||||
{ href: "si://interesting.address.moc/random/", leaf: "x/y/script.js?a=1" },
|
{ href: "shi://interesting.address.moc/random/", leaf: "x/y/script.js?a=1" },
|
||||||
{ href: "si://interesting.address.moc/random/x/", leaf: "y/script.js?a=1&b=2" },
|
{ href: "shi://interesting.address.moc/random/x/", leaf: "y/script.js?a=1&b=2", dupe: true },
|
||||||
{ href: "si://interesting.address.moc/random/x/y/", leaf: "script.js?a=1&b=2&c=3" }
|
{ href: "shi://interesting.address.moc/random/x/y/", leaf: "script.js?a=1&b=2&c=3", dupe: true },
|
||||||
|
{ href: "go://random/", leaf: "script_t1.js&a=1&b=2&c=3" },
|
||||||
|
{ href: "roku://random/", leaf: "script_t2.js#id" },
|
||||||
|
{ href: "nana://random/", leaf: "script_t3.js#id?a=1&b=2" }
|
||||||
];
|
];
|
||||||
|
|
||||||
urls.forEach(function(url) {
|
urls.forEach(function(url) {
|
||||||
executeSoon(function() {
|
executeSoon(function() {
|
||||||
let loc = url.href + url.leaf;
|
let loc = url.href + url.leaf;
|
||||||
vs.addScript(ss._getScriptLabel(loc, url.href), { url: loc });
|
vs.addScript(ss._getScriptLabel(loc, url.href), { url: loc }, true);
|
||||||
vs.commitScripts();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
executeSoon(function() {
|
executeSoon(function() {
|
||||||
for (let i = 0; i < vs._scripts.itemCount; i++) {
|
urls.forEach(function(url) {
|
||||||
let lab = vs._scripts.getItemAtIndex(i).getAttribute("label");
|
let loc = url.href + url.leaf;
|
||||||
let loc = urls[i].href + urls[i].leaf;
|
ok(url.dupe || vs.contains(loc), "Script url is incorrect: " + loc);
|
||||||
|
});
|
||||||
info("label: " + i + " " + lab);
|
|
||||||
ok(vs.contains(loc), "Script url is incorrect: " + loc);
|
|
||||||
}
|
|
||||||
|
|
||||||
ok(gDebugger.DebuggerView.Scripts.containsLabel("subrandom/"),
|
ok(gDebugger.DebuggerView.Scripts.containsLabel("subrandom/"),
|
||||||
"Script (0) label is incorrect.");
|
"Script (0) label is incorrect.");
|
||||||
@ -74,15 +73,21 @@ function testScriptLabelShortening() {
|
|||||||
"Script (1) label is incorrect.");
|
"Script (1) label is incorrect.");
|
||||||
ok(gDebugger.DebuggerView.Scripts.containsLabel("script.js"),
|
ok(gDebugger.DebuggerView.Scripts.containsLabel("script.js"),
|
||||||
"Script (2) label is incorrect.");
|
"Script (2) label is incorrect.");
|
||||||
ok(gDebugger.DebuggerView.Scripts.containsLabel("si://interesting.address.moc/random/script.js"),
|
ok(gDebugger.DebuggerView.Scripts.containsLabel("shi://interesting.address.moc/random/script.js"),
|
||||||
"Script (3) label is incorrect.");
|
"Script (3) label is incorrect.");
|
||||||
ok(gDebugger.DebuggerView.Scripts.containsLabel("x/script.js"),
|
ok(gDebugger.DebuggerView.Scripts.containsLabel("x/script.js"),
|
||||||
"Script (4) label is incorrect.");
|
"Script (4) label is incorrect.");
|
||||||
ok(gDebugger.DebuggerView.Scripts.containsLabel("x/y/script.js"),
|
ok(gDebugger.DebuggerView.Scripts.containsLabel("x/y/script.js"),
|
||||||
"Script (5) label is incorrect.");
|
"Script (5) label is incorrect.");
|
||||||
|
ok(gDebugger.DebuggerView.Scripts.containsLabel("script_t1.js"),
|
||||||
|
"Script (6) label is incorrect.");
|
||||||
|
ok(gDebugger.DebuggerView.Scripts.containsLabel("script_t2.js"),
|
||||||
|
"Script (7) label is incorrect.");
|
||||||
|
ok(gDebugger.DebuggerView.Scripts.containsLabel("script_t3.js"),
|
||||||
|
"Script (8) label is incorrect.");
|
||||||
|
|
||||||
is(vs._scripts.itemCount, 6,
|
is(vs._scripts.itemCount, 9,
|
||||||
"Got too many script items in the list!");
|
"Didn't get the correct number of scripts in the list.");
|
||||||
|
|
||||||
closeDebuggerAndFinish(gTab);
|
closeDebuggerAndFinish(gTab);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user