Backed out changeset 73abb8b1b4b5 (bug 1708125) for xpcshell failures in browser/components/urlbar/tests/unit/test_avoid_stripping_to_empty_tokens.js. CLOSED TREE

This commit is contained in:
Dorel Luca 2021-05-07 12:15:35 +03:00
Родитель bf24e6a36f
Коммит 0a5ef97272
9 изменённых файлов: 46 добавлений и 6 удалений

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

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

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

@ -1130,6 +1130,6 @@ function checkProtocol(img) {
var url = img[COL_IMAGE_ADDRESS]; var url = img[COL_IMAGE_ADDRESS];
return ( return (
/^data:image\//i.test(url) || /^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:", "about:",
"http:", "http:",
"https:", "https:",
"ftp:",
]; ];
function iconHelper(url) { function iconHelper(url) {
if (typeof url == "string") { if (typeof url == "string") {

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

@ -89,7 +89,7 @@ const {
FIXUP_FLAG_FIX_SCHEME_TYPOS, FIXUP_FLAG_FIX_SCHEME_TYPOS,
} = Ci.nsIURIFixup; } = 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. // Regex used to identify user:password tokens in url strings.
// This is not a strict valid characters check, because we try to fixup this // 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") && return !NodePrincipal()->SchemeIs("http") &&
!NodePrincipal()->SchemeIs("https") && !NodePrincipal()->SchemeIs("https") &&
!NodePrincipal()->SchemeIs("ftp") &&
!NodePrincipal()->SchemeIs("file"); !NodePrincipal()->SchemeIs("file");
} }

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

@ -257,7 +257,8 @@ bool ReferrerInfo::IsReferrerSchemeAllowed(nsIURI* aReferrer) {
return false; return false;
} }
return scheme.EqualsIgnoreCase("https") || scheme.EqualsIgnoreCase("http"); return scheme.EqualsIgnoreCase("https") || scheme.EqualsIgnoreCase("http") ||
scheme.EqualsIgnoreCase("ftp");
} }
/* static */ /* static */
@ -1198,7 +1199,7 @@ nsresult ReferrerInfo::ComputeReferrer(nsIHttpChannel* aChannel) {
return NS_OK; 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)) { if (!IsReferrerSchemeAllowed(mOriginalReferrer)) {
return NS_OK; return NS_OK;
} }

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

@ -154,7 +154,7 @@ class ReferrerInfo : public nsIReferrerInfo {
/** /**
* Check whether the given referrer's scheme is allowed to be computed and * 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); static bool IsReferrerSchemeAllowed(nsIURI* aReferrer);
@ -368,7 +368,7 @@ class ReferrerInfo : public nsIReferrerInfo {
bool IsPolicyOverrided() { return mOverridePolicyByDefault; } 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 * @aReferrer - the full referrer URI
* @aResult - the resulting aReferrer in string format. * @aResult - the resulting aReferrer in string format.

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

@ -14,6 +14,9 @@
12=Performing a TLS handshake to %1$S… 12=Performing a TLS handshake to %1$S…
13=The TLS handshake finished for %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? 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 # Directory listing strings

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

@ -201,6 +201,32 @@ function run_test() {
info.domain = ""; info.domain = "";
info.username = ""; info.username = "";
info.password = ""; info.password = "";
// 5: FTP
var uri2 = NetUtil.newURI("ftp://" + host);
var ftpchan = NetUtil.newChannel({
uri: uri2,
loadUsingSystemPrincipal: true,
});
prompt1 = new Prompt1();
prompt1.rv = expectedRV;
prompt1.scheme = "ftp";
wrapper = adapter.createAdapter(prompt1);
var rv = wrapper.promptAuth(ftpchan, 0, info);
Assert.equal(rv, prompt1.rv);
Assert.equal(prompt1.called, CALLED_PROMPTUP);
if (rv) {
Assert.equal(info.domain, "");
Assert.equal(info.username, prompt1.user);
Assert.equal(info.password, prompt1.pw);
}
info.domain = "";
info.username = "";
info.password = "";
} }
do_tests(true); do_tests(true);
do_tests(false); do_tests(false);