Bug 1731668 - Move downloads spam prevention work behind a pref. r=mhowell

Differential Revision: https://phabricator.services.mozilla.com/D126296
This commit is contained in:
Micah Tigley 2021-09-22 22:38:17 +00:00
parent 3608e394a5
commit 0743fa1388
3 changed files with 14 additions and 2 deletions

View file

@ -1119,6 +1119,12 @@
value: false
mirror: always
# See bug 1731668
- name: browser.download.enable_spam_prevention
type: bool
value: false
mirror: always
- name: browser.download.sanitize_non_media_extensions
type: bool
value: true

View file

@ -1683,7 +1683,7 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest* request) {
aChannel->GetURI(getter_AddRefs(mSourceUrl));
}
if (StaticPrefs::browser_download_improvements_to_download_panel() &&
if (StaticPrefs::browser_download_enable_spam_prevention() &&
IsDownloadSpam(aChannel)) {
return NS_OK;
}

View file

@ -30,7 +30,13 @@ add_task(async function setup() {
Services.perms.UNKNOWN
);
await SpecialPowers.pushPrefEnv({
set: [["browser.download.improvements_to_download_panel", true]],
set: [
// We enable browser.download.improvements_to_download_panel here since
// the test expects the download to be saved directly to disk and not
// prompted by the UnknownContentType window.
["browser.download.improvements_to_download_panel", true],
["browser.download.enable_spam_prevention", true],
],
});
registerCleanupFunction(async () => {