Backed out changeset 398c202ed56e (bug 1647200) for bc failures on browser_copying.js. CLOSED TREE

This commit is contained in:
Cosmin Sabou 2020-07-01 02:35:37 +03:00
Родитель 16c941758d
Коммит 9ac909be70
2 изменённых файлов: 9 добавлений и 40 удалений

Просмотреть файл

@ -1551,7 +1551,6 @@ class UrlbarInput {
} }
} }
uri = this.makeURIReadable(uri); uri = this.makeURIReadable(uri);
let displaySpec = uri.displaySpec;
// If the entire URL is selected, just use the actual loaded URI, // If the entire URL is selected, just use the actual loaded URI,
// unless we want a decoded URI, or it's a data: or javascript: URI, // unless we want a decoded URI, or it's a data: or javascript: URI,
@ -1562,17 +1561,19 @@ class UrlbarInput {
!uri.schemeIs("data") && !uri.schemeIs("data") &&
!UrlbarPrefs.get("decodeURLsOnCopy") !UrlbarPrefs.get("decodeURLsOnCopy")
) { ) {
return displaySpec; return uri.displaySpec;
} }
// Just the beginning of the URL is selected, or we want a decoded // Just the beginning of the URL is selected, or we want a decoded
// url. First check for a trimmed value. // url. First check for a trimmed value.
let spec = uri.displaySpec;
if ( let trimmedSpec = this._trimValue(spec);
!selectedVal.startsWith(BrowserUtils.trimURLProtocol) && if (spec != trimmedSpec) {
displaySpec != this._trimValue(displaySpec) // Prepend the portion that _trimValue removed from the beginning.
) { // This assumes _trimValue will only truncate the URL at
selectedVal = BrowserUtils.trimURLProtocol + selectedVal; // the beginning or end (or both).
let trimmedSegments = spec.split(trimmedSpec);
selectedVal = trimmedSegments[0] + selectedVal;
} }
return selectedVal; return selectedVal;

Просмотреть файл

@ -237,38 +237,6 @@ var tests = [
copyVal: "<example.com/би>ография", copyVal: "<example.com/би>ография",
copyExpected: "http://example.com/би", copyExpected: "http://example.com/би",
}, },
{
setup() {
// Setup a valid intranet url that resolves but is not yet known.
const proxyService = Cc[
"@mozilla.org/network/protocol-proxy-service;1"
].getService(Ci.nsIProtocolProxyService);
let proxyInfo = proxyService.newProxyInfo(
"http",
"localhost",
8888,
"",
"",
0,
4096,
null
);
const proxyFilter = {
applyFilter(channel, defaultProxyInfo, callback) {
callback.onProxyFilterResult(
channel.URI.host === "mytest" ? proxyInfo : defaultProxyInfo
);
},
};
proxyService.registerChannelFilter(proxyFilter, 0);
registerCleanupFunction(() => {
proxyService.unregisterChannelFilter(proxyFilter);
});
},
loadURL: "http://mytest/",
expectedURL: "mytest",
copyExpected: "http://mytest",
},
]; ];
function nextTest() { function nextTest() {