зеркало из https://github.com/mozilla/gecko-dev.git
Bug 394667 - "Copying javascript: URL from location bar replaces spaces with %20" [p=dao@mozilla.com (Dão Gottwald) r=gavin a1.9=damons]
This commit is contained in:
Родитель
62d2af2b83
Коммит
75c38db240
|
@ -154,13 +154,21 @@
|
|||
return;
|
||||
var val;
|
||||
if (start == 0 && end == urlbar.textLength) {
|
||||
// if the entire value is selected and it's a valid URI, encode it
|
||||
val = urlbar.value;
|
||||
|
||||
// If the entire value is selected and it's a valid non-javascript,
|
||||
// non-data URI, encode it.
|
||||
var uri;
|
||||
if (urlbar.getAttribute("pageproxystate") == "valid") {
|
||||
var ioService = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
try {
|
||||
val = ioService.newURI(val, null, null).spec;
|
||||
uri = ioService.newURI(val, null, null);
|
||||
} catch (e) {}
|
||||
}
|
||||
if (uri && !uri.schemeIs("javascript") && !uri.schemeIs("data"))
|
||||
val = uri.spec;
|
||||
|
||||
if (aCommand == "cmd_cut")
|
||||
urlbar.value = "";
|
||||
} else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче