зеркало из https://github.com/mozilla/gecko-dev.git
Bug 824887 - Use the current page's original URI rather than creating a new one for copying from the location bar, stop encoding parentheses explicitly. r=dolske
--HG-- extra : rebase_source : ae5ee74cfa5299612590dacd683dff3e2538f355
This commit is contained in:
Родитель
16115798a5
Коммит
ed9caf237a
|
@ -77,16 +77,16 @@ var tests = [
|
|||
|
||||
// Test escaping
|
||||
{
|
||||
loadURL: "http://example.com/()%C3%A9",
|
||||
expectedURL: "example.com/()\xe9",
|
||||
copyExpected: "http://example.com/%28%29%C3%A9"
|
||||
loadURL: "http://example.com/()%28%29%C3%A9",
|
||||
expectedURL: "example.com/()()\xe9",
|
||||
copyExpected: "http://example.com/()%28%29%C3%A9"
|
||||
},
|
||||
{
|
||||
copyVal: "<example.com/(>)\xe9",
|
||||
copyVal: "<example.com/(>)()\xe9",
|
||||
copyExpected: "http://example.com/("
|
||||
},
|
||||
{
|
||||
copyVal: "e<xample.com/(>)\xe9",
|
||||
copyVal: "e<xample.com/(>)()\xe9",
|
||||
copyExpected: "xample.com/("
|
||||
},
|
||||
|
||||
|
|
|
@ -601,11 +601,16 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
let uriFixup = Cc["@mozilla.org/docshell/urifixup;1"].getService(Ci.nsIURIFixup);
|
||||
|
||||
let uri;
|
||||
try {
|
||||
uri = uriFixup.createFixupURI(inputVal, Ci.nsIURIFixup.FIXUP_FLAG_NONE);
|
||||
} catch (e) {}
|
||||
if (!uri)
|
||||
return selectedVal;
|
||||
if (this.getAttribute("pageproxystate") == "valid") {
|
||||
uri = gBrowser.currentURI;
|
||||
} else {
|
||||
// We're dealing with an autocompleted value, create a new URI from that.
|
||||
try {
|
||||
uri = uriFixup.createFixupURI(inputVal, Ci.nsIURIFixup.FIXUP_FLAG_NONE);
|
||||
} catch (e) {}
|
||||
if (!uri)
|
||||
return selectedVal;
|
||||
}
|
||||
|
||||
// Only copy exposable URIs
|
||||
try {
|
||||
|
@ -617,8 +622,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
// ... but only if isn't a javascript: or data: URI, since those
|
||||
// are hard to read when encoded
|
||||
if (!uri.schemeIs("javascript") && !uri.schemeIs("data")) {
|
||||
// Parentheses are known to confuse third-party applications (bug 458565).
|
||||
selectedVal = uri.spec.replace(/[()]/g, c => escape(c));
|
||||
selectedVal = uri.spec;
|
||||
}
|
||||
|
||||
return selectedVal;
|
||||
|
|
Загрузка…
Ссылка в новой задаче