Backed out changeset 8fea79dcd428 (bug 1708125) for causing xpcshell failures in test_DownloadCore.js.

CLOSED TREE
This commit is contained in:
Brindusan Cristian 2021-05-31 15:28:19 +03:00
Родитель 6ac5d624e0
Коммит 2a324428d6
10 изменённых файлов: 67 добавлений и 7 удалений

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

@ -202,6 +202,14 @@
<string>https</string>
</array>
</dict>
<dict>
<key>CFBundleURLName</key>
<string>ftp URL</string>
<key>CFBundleURLSchemes</key>
<array>
<string>ftp</string>
</array>
</dict>
<dict>
<key>CFBundleURLName</key>
<string>file URL</string>

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

@ -1130,6 +1130,6 @@ function checkProtocol(img) {
var url = img[COL_IMAGE_ADDRESS];
return (
/^data:image\//i.test(url) ||
/^(https?|file|about|chrome|resource):/.test(url)
/^(https?|ftp|file|about|chrome|resource):/.test(url)
);
}

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

@ -219,6 +219,7 @@ const kProtocolsWithIcons = [
"about:",
"http:",
"https:",
"ftp:",
];
function iconHelper(url) {
if (typeof url == "string") {

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

@ -5,7 +5,7 @@
testEngine_setup();
add_task(async function test_protocol_trimming() {
for (let prot of ["http", "https"]) {
for (let prot of ["http", "https", "ftp"]) {
let visit = {
// Include the protocol in the query string to ensure we get matches (see bug 1059395)
uri: Services.io.newURI(

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

@ -147,6 +147,52 @@ add_task(async function test_untrimmed_www_path() {
await cleanupPlaces();
});
add_task(async function test_untrimmed_ftp() {
info("Searching for untrimmed ftp:// entry");
await PlacesTestUtils.addVisits({
uri: Services.io.newURI("ftp://mozilla.org/test/"),
});
let context = createContext("mo", { isPrivate: false });
await check_results({
context,
autofilled: "mozilla.org/",
completed: "ftp://mozilla.org/",
matches: [
makeVisitResult(context, {
uri: "ftp://mozilla.org/",
title: "ftp://mozilla.org",
heuristic: true,
}),
makeVisitResult(context, {
uri: "ftp://mozilla.org/test/",
title: "test visit for ftp://mozilla.org/test/",
}),
],
});
await cleanupPlaces();
});
add_task(async function test_untrimmed_ftp_path() {
info("Searching for untrimmed ftp:// entry with path");
await PlacesTestUtils.addVisits({
uri: Services.io.newURI("ftp://mozilla.org/test/"),
});
let context = createContext("mozilla.org/t", { isPrivate: false });
await check_results({
context,
autofilled: "mozilla.org/test/",
completed: "ftp://mozilla.org/test/",
matches: [
makeVisitResult(context, {
uri: "ftp://mozilla.org/test/",
title: "ftp://mozilla.org/test/",
heuristic: true,
}),
],
});
await cleanupPlaces();
});
add_task(async function test_escaped_chars() {
info("Searching for URL with characters that are normally escaped");
await PlacesTestUtils.addVisits({

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

@ -89,7 +89,7 @@ const {
FIXUP_FLAG_FIX_SCHEME_TYPOS,
} = Ci.nsIURIFixup;
const COMMON_PROTOCOLS = ["http", "https", "file"];
const COMMON_PROTOCOLS = ["http", "https", "ftp", "file"];
// Regex used to identify user:password tokens in url strings.
// This is not a strict valid characters check, because we try to fixup this

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

@ -2513,6 +2513,7 @@ class Document : public nsINode,
return !NodePrincipal()->SchemeIs("http") &&
!NodePrincipal()->SchemeIs("https") &&
!NodePrincipal()->SchemeIs("ftp") &&
!NodePrincipal()->SchemeIs("file");
}

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

@ -257,7 +257,8 @@ bool ReferrerInfo::IsReferrerSchemeAllowed(nsIURI* aReferrer) {
return false;
}
return scheme.EqualsIgnoreCase("https") || scheme.EqualsIgnoreCase("http");
return scheme.EqualsIgnoreCase("https") || scheme.EqualsIgnoreCase("http") ||
scheme.EqualsIgnoreCase("ftp");
}
/* static */
@ -1198,7 +1199,7 @@ nsresult ReferrerInfo::ComputeReferrer(nsIHttpChannel* aChannel) {
return NS_OK;
}
// Enforce Referrer allowlist, only http, https scheme are allowed
// Enforce Referrer allowlist, only http, https, ftp scheme are allowed
if (!IsReferrerSchemeAllowed(mOriginalReferrer)) {
return NS_OK;
}

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

@ -154,7 +154,7 @@ class ReferrerInfo : public nsIReferrerInfo {
/**
* Check whether the given referrer's scheme is allowed to be computed and
* sent. The allowlist schemes are: http, https.
* sent. The allowlist schemes are: http, https, ftp.
*/
static bool IsReferrerSchemeAllowed(nsIURI* aReferrer);
@ -368,7 +368,7 @@ class ReferrerInfo : public nsIReferrerInfo {
bool IsPolicyOverrided() { return mOverridePolicyByDefault; }
/*
* Get origin string from a given valid referrer URI (http, https)
* Get origin string from a given valid referrer URI (http, https, ftp)
*
* @aReferrer - the full referrer URI
* @aResult - the resulting aReferrer in string format.

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

@ -14,6 +14,9 @@
12=Performing a TLS handshake to %1$S…
13=The TLS handshake finished for %1$S…
27=Beginning FTP transaction…
28=Finished FTP transaction
RepostFormData=This web page is being redirected to a new location. Would you like to resend the form data you have typed to the new location?
# Directory listing strings