mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Backed out changeset 5ea7a34f266c (bug 1660969) for Browser-chrome failures in browser_test_mixed_content_download.js. CLOSED TREE
This commit is contained in:
parent
59f936e87f
commit
19e937dabb
@ -1383,7 +1383,6 @@ DownloadsIndicatorDataCtor.prototype = {
|
||||
switch (download.error.reputationCheckVerdict) {
|
||||
case Downloads.Error.BLOCK_VERDICT_UNCOMMON: // fall-through
|
||||
case Downloads.Error.BLOCK_VERDICT_POTENTIALLY_UNWANTED:
|
||||
case Downloads.Error.BLOCK_VERDICT_INSECURE:
|
||||
// Existing higher level attention indication trumps ATTENTION_WARNING.
|
||||
if (this._attention != DownloadsCommon.ATTENTION_SEVERE) {
|
||||
this.attention = DownloadsCommon.ATTENTION_WARNING;
|
||||
|
@ -628,7 +628,7 @@ DownloadsViewUI.DownloadElementShell.prototype = {
|
||||
case Downloads.Error.BLOCK_VERDICT_UNCOMMON:
|
||||
return [s.blockedUncommon2, [s.unblockTypeUncommon2, s.unblockTip2]];
|
||||
case Downloads.Error.BLOCK_VERDICT_INSECURE:
|
||||
return [s.blockedInsecure, [s.unblockInsecure, s.unblockTip2]];
|
||||
return [s.blockedInsecure, [s.blockedInsecure, s.unblockTip2]];
|
||||
case Downloads.Error.BLOCK_VERDICT_POTENTIALLY_UNWANTED:
|
||||
return [
|
||||
s.blockedPotentiallyUnwanted,
|
||||
|
@ -32,7 +32,7 @@ stateBlockedParentalControls=Blocked by Parental Controls
|
||||
# be longer than the other existing status strings.
|
||||
blockedMalware=This file contains a virus or malware.
|
||||
blockedPotentiallyUnwanted=This file may harm your computer.
|
||||
blockedInsecure=File not downloaded: Potential security risk.
|
||||
blockedInsecure = This file could not be downloaded securely.
|
||||
blockedUncommon2=This file is not commonly downloaded.
|
||||
|
||||
# LOCALIZATION NOTE (fileMovedOrMissing):
|
||||
@ -42,7 +42,7 @@ fileMovedOrMissing=File moved or missing
|
||||
# LOCALIZATION NOTE (unblockHeaderUnblock, unblockHeaderOpen,
|
||||
# unblockTypeMalware, unblockTypePotentiallyUnwanted2,
|
||||
# unblockTypeUncommon2, unblockTip2, unblockButtonOpen,
|
||||
# unblockButtonUnblock, unblockButtonConfirmBlock, unblockInsecure):
|
||||
# unblockButtonUnblock, unblockButtonConfirmBlock):
|
||||
# These strings are displayed in the dialog shown when the user asks a blocked
|
||||
# download to be unblocked. The severity of the threat is expressed in
|
||||
# descending order by the unblockType strings, it is higher for files detected
|
||||
@ -52,7 +52,6 @@ unblockHeaderOpen=Are you sure you want to open this file?
|
||||
unblockTypeMalware=This file contains a virus or other malware that will harm your computer.
|
||||
unblockTypePotentiallyUnwanted2=This file is disguised as a helpful download, but it can make unexpected changes to your programs and settings.
|
||||
unblockTypeUncommon2=This file is not commonly downloaded and may not be safe to open. It may contain a virus or make unexpected changes to your programs and settings.
|
||||
unblockInsecure=The file uses an insecure connection. It may be corrupted or tampered with during the download process.
|
||||
unblockTip2=You can search for an alternate download source or try again later.
|
||||
unblockButtonOpen=Open
|
||||
unblockButtonUnblock=Allow download
|
||||
|
@ -67,9 +67,8 @@ async function resetDownloads() {
|
||||
|
||||
async function shouldNotifyDownloadUI() {
|
||||
// Waits until a Blocked download was added to the Download List
|
||||
// -> returns the blocked Download
|
||||
let list = await Downloads.getList(Downloads.ALL);
|
||||
return new Promise(res => {
|
||||
await new Promise(res => {
|
||||
const view = {
|
||||
onDownloadAdded: aDownload => {
|
||||
let { error } = aDownload;
|
||||
@ -77,7 +76,7 @@ async function shouldNotifyDownloadUI() {
|
||||
error.becauseBlockedByReputationCheck &&
|
||||
error.reputationCheckVerdict == Downloads.Error.BLOCK_VERDICT_INSECURE
|
||||
) {
|
||||
res(aDownload);
|
||||
res(true);
|
||||
list.removeView(view);
|
||||
}
|
||||
},
|
||||
@ -113,7 +112,7 @@ async function runTest(url, link, checkFunction, decscription) {
|
||||
|
||||
await SpecialPowers.popPrefEnv();
|
||||
}
|
||||
// Test Blocking
|
||||
|
||||
add_task(async function() {
|
||||
await runTest(
|
||||
INSECURE_BASE_URL,
|
||||
@ -140,20 +139,3 @@ add_task(async function() {
|
||||
"Secure -> Secure should Download"
|
||||
);
|
||||
});
|
||||
|
||||
// Test Manual Unblocking
|
||||
add_task(async function() {
|
||||
await runTest(
|
||||
SECURE_BASE_URL,
|
||||
"insecure",
|
||||
async () => {
|
||||
let download = await shouldNotifyDownloadUI();
|
||||
await download.unblock();
|
||||
ok(download.error == null, "There should be no error after unblocking");
|
||||
|
||||
await download._succeed();
|
||||
ok(download.succeeded, "Download should succeed to download");
|
||||
},
|
||||
"A Blocked Download Should succeeded to Download after a Manual unblock"
|
||||
);
|
||||
});
|
||||
|
@ -643,23 +643,6 @@ Download.prototype = {
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
this.error?.reputationCheckVerdict == DownloadError.BLOCK_VERDICT_INSECURE
|
||||
) {
|
||||
// In this Error case, the download was actually canceled before it was
|
||||
// passed to the Download UI. So we need to start the download here.
|
||||
this.error = null;
|
||||
this.succeeded = false;
|
||||
this.hasBlockedData = false;
|
||||
this.start().catch(e => {
|
||||
this.error = e;
|
||||
this._notifyChange();
|
||||
});
|
||||
this._notifyChange();
|
||||
this._promiseUnblock = DownloadIntegration.downloadDone(this);
|
||||
return this._promiseUnblock;
|
||||
}
|
||||
|
||||
if (!this.hasBlockedData) {
|
||||
return Promise.reject(
|
||||
new Error("unblock may only be called on Downloads with blocked data.")
|
||||
|
@ -389,14 +389,6 @@ DownloadLegacyTransfer.prototype = {
|
||||
becauseBlockedByReputationCheck: true,
|
||||
reputationCheckVerdict: DownloadError.BLOCK_VERDICT_INSECURE,
|
||||
};
|
||||
// hasBlockedData needs to be true
|
||||
// because the unblock UI is hidden if there is
|
||||
// no data to be unblocked.
|
||||
serialisedDownload.hasBlockedData = true;
|
||||
// We cannot use the legacy saver here, as the original channel
|
||||
// is already closed. A copy saver would create a new channel once
|
||||
// start() is called.
|
||||
serialisedDownload.saver = "copy";
|
||||
}
|
||||
|
||||
Downloads.createDownload(serialisedDownload)
|
||||
|
Loading…
Reference in New Issue
Block a user