mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 393303 - "Create a blocked string for dirty downloads (virus scan failed)." [p=comrade693+bmo@gmail.com (Shawn Wilsher [sdwilsh]) r=gavin a=blocking-firefox3+]
This commit is contained in:
parent
62e35911b0
commit
12c596dbee
@ -62,6 +62,7 @@ interface nsIDownloadManager : nsISupports {
|
||||
const short DOWNLOAD_QUEUED = 5;
|
||||
const short DOWNLOAD_BLOCKED = 6;
|
||||
const short DOWNLOAD_SCANNING = 7;
|
||||
const short DOWNLOAD_DIRTY = 8;
|
||||
|
||||
const short DOWNLOAD_TYPE_DOWNLOAD = 0;
|
||||
|
||||
|
@ -1372,6 +1372,7 @@ nsDownloadManager::RetryDownload(PRUint32 aID)
|
||||
// if our download is not canceled or failed, we should fail
|
||||
if (dl->mDownloadState != nsIDownloadManager::DOWNLOAD_FAILED &&
|
||||
dl->mDownloadState != nsIDownloadManager::DOWNLOAD_BLOCKED &&
|
||||
dl->mDownloadState != nsIDownloadManager::DOWNLOAD_DIRTY &&
|
||||
dl->mDownloadState != nsIDownloadManager::DOWNLOAD_CANCELED)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -1445,7 +1446,8 @@ nsDownloadManager::CleanUp()
|
||||
DownloadState states[] = { nsIDownloadManager::DOWNLOAD_FINISHED,
|
||||
nsIDownloadManager::DOWNLOAD_FAILED,
|
||||
nsIDownloadManager::DOWNLOAD_CANCELED,
|
||||
nsIDownloadManager::DOWNLOAD_BLOCKED };
|
||||
nsIDownloadManager::DOWNLOAD_BLOCKED,
|
||||
nsIDownloadManager::DOWNLOAD_DIRTY };
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> stmt;
|
||||
nsresult rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
@ -1453,9 +1455,10 @@ nsDownloadManager::CleanUp()
|
||||
"WHERE state = ?1 "
|
||||
"OR state = ?2 "
|
||||
"OR state = ?3 "
|
||||
"OR state = ?4"), getter_AddRefs(stmt));
|
||||
"OR state = ?4 "
|
||||
"OR state = ?5"), getter_AddRefs(stmt));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
for (PRUint32 i = 0; i < 4; ++i) {
|
||||
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(states); ++i) {
|
||||
rv = stmt->BindInt32Parameter(i, states[i]);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
@ -1477,7 +1480,8 @@ nsDownloadManager::GetCanCleanUp(PRBool *aResult)
|
||||
DownloadState states[] = { nsIDownloadManager::DOWNLOAD_FINISHED,
|
||||
nsIDownloadManager::DOWNLOAD_FAILED,
|
||||
nsIDownloadManager::DOWNLOAD_CANCELED,
|
||||
nsIDownloadManager::DOWNLOAD_BLOCKED };
|
||||
nsIDownloadManager::DOWNLOAD_BLOCKED,
|
||||
nsIDownloadManager::DOWNLOAD_DIRTY };
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> stmt;
|
||||
nsresult rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
@ -1486,9 +1490,10 @@ nsDownloadManager::GetCanCleanUp(PRBool *aResult)
|
||||
"WHERE state = ?1 "
|
||||
"OR state = ?2 "
|
||||
"OR state = ?3 "
|
||||
"OR state = ?4"), getter_AddRefs(stmt));
|
||||
"OR state = ?4 "
|
||||
"OR state = ?5"), getter_AddRefs(stmt));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
for (PRUint32 i = 0; i < 4; ++i) {
|
||||
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(states); ++i) {
|
||||
rv = stmt->BindInt32Parameter(i, states[i]);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
@ -1752,6 +1757,7 @@ nsDownload::SetState(DownloadState aState)
|
||||
// dispatch to the observers as well.
|
||||
switch (aState) {
|
||||
case nsIDownloadManager::DOWNLOAD_BLOCKED:
|
||||
case nsIDownloadManager::DOWNLOAD_DIRTY:
|
||||
case nsIDownloadManager::DOWNLOAD_CANCELED:
|
||||
case nsIDownloadManager::DOWNLOAD_FAILED:
|
||||
// Transfers are finished, so break the reference cycle
|
||||
@ -1883,6 +1889,8 @@ nsDownload::SetState(DownloadState aState)
|
||||
case nsIDownloadManager::DOWNLOAD_BLOCKED:
|
||||
mDownloadManager->SendEvent(this, "dl-blocked");
|
||||
break;
|
||||
case nsIDownloadManager::DOWNLOAD_DIRTY:
|
||||
mDownloadManager->SendEvent(this, "dl-dirty");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ nsDownloadScanner::Scan::Run()
|
||||
DownloadState downloadState = 0;
|
||||
switch (mStatus) {
|
||||
case AVSCAN_BAD:
|
||||
downloadState = nsIDownloadManager::DOWNLOAD_BLOCKED;
|
||||
downloadState = nsIDownloadManager::DOWNLOAD_DIRTY;
|
||||
break;
|
||||
default:
|
||||
case AVSCAN_FAILED:
|
||||
|
@ -66,6 +66,7 @@ stateFailed=Failed
|
||||
stateCanceled=Canceled
|
||||
# LOCALIZATION NOTE (stateBlocked): 'Parental Controls' should be capitalized
|
||||
stateBlocked=Blocked by Parental Controls
|
||||
stateDirty=Blocked: Download may contain a virus or spyware
|
||||
|
||||
fileDoesNotExistOpenTitle=Cannot Open %S
|
||||
fileDoesNotExistShowTitle=Cannot Show %S
|
||||
|
@ -70,6 +70,7 @@ DownloadProgressListener.prototype = {
|
||||
case nsIDM.DOWNLOAD_FAILED:
|
||||
case nsIDM.DOWNLOAD_CANCELED:
|
||||
case nsIDM.DOWNLOAD_BLOCKED:
|
||||
case nsIDM.DOWNLOAD_DIRTY:
|
||||
case nsIDM.DOWNLOAD_FINISHED:
|
||||
downloadCompleted(aDownload);
|
||||
if (state == nsIDM.DOWNLOAD_FINISHED)
|
||||
|
@ -89,17 +89,7 @@
|
||||
return state == dl.DOWNLOAD_FINISHED ||
|
||||
state == dl.DOWNLOAD_CANCELED ||
|
||||
state == dl.DOWNLOAD_BLOCKED ||
|
||||
state == dl.DOWNLOAD_FAILED;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
<property name="canceledOrFailed">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var state = parseInt(this.getAttribute("state"));
|
||||
var dl = Components.interfaces.nsIDownloadManager;
|
||||
return state == dl.DOWNLOAD_CANCELED ||
|
||||
state == dl.DOWNLOAD_BLOCKED ||
|
||||
state == dl.DOWNLOAD_DIRTY ||
|
||||
state == dl.DOWNLOAD_FAILED;
|
||||
]]>
|
||||
</getter>
|
||||
@ -319,4 +309,31 @@
|
||||
</xul:hbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="download-dirty" extends="chrome://mozapps/content/downloads/download.xml#download-base">
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:vbox pack="start">
|
||||
<xul:image class="downloadTypeIcon blockedIcon"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox pack="start" flex="1">
|
||||
<xul:label xbl:inherits="value=target,tooltiptext=target"
|
||||
crop="center" class="name"/>
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:label xbl:inherits="value=status,tooltiptext=status" flex="1"
|
||||
crop="right" class="status"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox pack="center">
|
||||
<xul:hbox>
|
||||
<xul:button class="retry mini-button" tooltiptext="&cmd.retry.label;"
|
||||
command="cmd_retry" ondblclick="event.stopPropagation();"/>
|
||||
<xul:button class="info mini-button" tooltiptext="&cmd.info.label;"
|
||||
command="cmd_showInfo" ondblclick="event.stopPropagation();"
|
||||
anonid="info"/>
|
||||
</xul:hbox>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
@ -31,6 +31,10 @@ richlistitem[type="download"][state="7"] {
|
||||
-moz-binding: url('chrome://mozapps/content/downloads/download.xml#download-scanning');
|
||||
}
|
||||
|
||||
richlistitem[type="download"][state="8"] {
|
||||
-moz-binding: url('chrome://mozapps/content/downloads/download.xml#download-dirty');
|
||||
}
|
||||
|
||||
/* Only focus buttons in the selected item*/
|
||||
richlistitem[type="download"]:not([selected="true"]) button {
|
||||
-moz-user-focus: none;
|
||||
|
@ -91,6 +91,7 @@ let gStr = {
|
||||
stateFailed: "stateFailed",
|
||||
stateCanceled: "stateCanceled",
|
||||
stateBlocked: "stateBlocked",
|
||||
stateDirty: "stateDirty",
|
||||
|
||||
units: ["bytes", "kilobyte", "megabyte", "gigabyte"],
|
||||
|
||||
@ -304,6 +305,7 @@ function onDownloadDblClick(aEvent)
|
||||
break;
|
||||
case nsIDM.DOWNLOAD_CANCELED:
|
||||
case nsIDM.DOWNLOAD_BLOCKED:
|
||||
case nsIDM.DOWNLOAD_DIRTY:
|
||||
case nsIDM.DOWNLOAD_FAILED:
|
||||
gDownloadViewController.doCommand("cmd_retry");
|
||||
break;
|
||||
@ -538,7 +540,10 @@ var gContextMenus = [
|
||||
["menuitem_retry", "menuitem_removeFromList", "menuitem_clearList",
|
||||
"menuseparator_copy_location", "menuitem_copyLocation"],
|
||||
// DOWNLOAD_SCANNING
|
||||
["menuitem_copyLocation"]
|
||||
["menuitem_copyLocation"],
|
||||
// DOWNLOAD_DIRTY
|
||||
["menuitem_retry", "menuitem_removeFromList", "menuitem_clearList",
|
||||
"menuseparator_copy_location", "menuitem_copyLocation"]
|
||||
];
|
||||
|
||||
function buildContextMenu(aEvent)
|
||||
@ -831,6 +836,7 @@ function updateStatus(aItem, aDownload) {
|
||||
case nsIDM.DOWNLOAD_FAILED:
|
||||
case nsIDM.DOWNLOAD_CANCELED:
|
||||
case nsIDM.DOWNLOAD_BLOCKED:
|
||||
case nsIDM.DOWNLOAD_DIRTY:
|
||||
let (stateSize = {}) {
|
||||
stateSize[nsIDM.DOWNLOAD_FINISHED] = function() {
|
||||
// Display the file size, but show "Unknown" for negative sizes
|
||||
@ -846,6 +852,7 @@ function updateStatus(aItem, aDownload) {
|
||||
stateSize[nsIDM.DOWNLOAD_FAILED] = function() gStr.stateFailed;
|
||||
stateSize[nsIDM.DOWNLOAD_CANCELED] = function() gStr.stateCanceled;
|
||||
stateSize[nsIDM.DOWNLOAD_BLOCKED] = function() gStr.stateBlocked;
|
||||
stateSize[nsIDM.DOWNLOAD_DIRTY] = function() gStr.stateDirty;
|
||||
|
||||
// Insert 1 is the download size or download state
|
||||
status = replaceInsert(gStr.doneStatus, 1, stateSize[state]());
|
||||
@ -1075,7 +1082,7 @@ function buildDownloadListWithTime(aTime)
|
||||
var stmt = gDownloadListWithTimeQuery;
|
||||
if (!stmt) {
|
||||
stmt = db.createStatement(replaceInsert(gBaseQuery, 1, "startTime >= ?1 " +
|
||||
"AND (state = ?2 OR state = ?3 OR state = ?4 OR state = ?5)"));
|
||||
"AND (state = ?2 OR state = ?3 OR state = ?4 OR state = ?5 OR state = ?6)"));
|
||||
gDownloadListWithTimeQuery = stmt;
|
||||
}
|
||||
|
||||
@ -1085,6 +1092,7 @@ function buildDownloadListWithTime(aTime)
|
||||
stmt.bindInt32Parameter(2, nsIDM.DOWNLOAD_FAILED);
|
||||
stmt.bindInt32Parameter(3, nsIDM.DOWNLOAD_CANCELED);
|
||||
stmt.bindInt32Parameter(4, nsIDM.DOWNLOAD_BLOCKED);
|
||||
stmt.bindInt32Parameter(5, nsIDM.DOWNLOAD_DIRTY);
|
||||
buildDownloadList(stmt, gDownloadsDoneArea);
|
||||
} finally {
|
||||
stmt.reset();
|
||||
|
Loading…
Reference in New Issue
Block a user