Make downloading page work nicely, remove update manager components for now

This commit is contained in:
ben%bengoodger.com 2005-06-19 22:42:25 +00:00
parent 87ad4cd4ce
commit 357ce4b4ef
9 changed files with 284 additions and 286 deletions

View File

@ -35,7 +35,9 @@
<!ENTITY license.instructions "If you agree to the terms of this agreement, click I Agree
below to continue installing this update.">
<!ENTITY downloading.intro "The following updates are being/have been installed:">
<!ENTITY downloading.title "Downloading Update">
<!ENTITY downloading.intro "Downloading the update...">
<!ENTITY connecting.label "Connecting to the update server...">
<!ENTITY showCompletedUpdates.label "Show old updates in this list">
<!ENTITY showCompletedUpdates.accesskey "o">

View File

@ -20,17 +20,18 @@ app.update.url=https://aus.mozilla.org/update2/0/%PRODUCT%/%VERSION%/%BUILD_ID%/
app.update.url.manual=http://www.mozilla.org/update
# This value should be empty unless you wish to override app.update.url
app.update.url.override=
closeButtonLabel=Close
statusFormatKBKB=#1 of #2 KB
statusFormatKBMB=#1 KB of #2 MB
statusFormatMBMB=#1 of #2 MB
statusFormatUnknownKB=#1 KB
statusFormatUnknownMB=#1 MB
pausedStatus=%S downloaded so far
remain=remain
unknownFilesize=unknown file size
statusFormat=#1 at #2 KB/sec; #3
statusFormat=#1 at #2 KB/sec; #3 #4
longTimeFormat=#1:#2:#3
shortTimeFormat=#2:#3
downloadingPrefix=Downloading %S...
pausedStatus=Download Paused
pausedName=Paused %S
pausedName=Paused downloading %S

View File

@ -1,28 +1,8 @@
wizard[label=""][description=""] .wizard-header,
wizard[label=""] .wizard-header-label,
wizard[description=""] .wizard-header-description {
display: none;
}
wizard[currentpageid="license"] .wizard-buttons,
wizard[currentpageid="errors"] .wizard-buttons,
wizard[currentpageid="noupdatesfound"] .wizard-buttons,
wizard[currentpageid="checking"] .wizard-buttons {
display: -moz-box;
}
.wizard-buttons {
display: none;
}
.wizard-page-box {
margin: 0px;
}
.content {
margin: 10px 44px 10px 44px;
}
#errorReason {
margin-top: 1px;
margin-bottom: 2px;
@ -47,6 +27,7 @@ link > label {
margin: 0px;
padding: 1px;
cursor: inherit;
text-decoration: underline !important;
}
link:hover:active {
@ -139,23 +120,6 @@ license {
font-weight: bold;
}
#updatesView {
-moz-binding: url("chrome://mozapps/skin/shared/richview.xml#richview");
overflow: auto;
}
update {
-moz-binding: url("chrome://mozapps/content/update/updates.xml#update");
-moz-box-orient: vertical;
background-color: #FFFFFF;
border-bottom: 1px dotted #C0C0C0;
padding: 5px;
}
#updatesView[showcompletedupdates=true] > update {
display: none
}
#incompatibleWarning {
margin-right: 50px;
}
@ -168,10 +132,18 @@ update {
margin: 0px 4px 7px 4px;
}
.update-item-name {
font-weight: bold;
#downloadName {
margin-top: 3px;
}
.update-item-pause {
font-size: smaller;
#downloadStatus {
margin-top: 6px;
}
#downloadThrobber {
margin: 5px 3px 0px 5px;
list-style-image: url("chrome://global/skin/throbber/Throbber-small.png");
}
#downloadThrobber[state="loading"] {
list-style-image: url("chrome://global/skin/throbber/Throbber-small.gif");
}

View File

@ -42,6 +42,8 @@ const XMLNS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/the
const PREF_UPDATE_MANUAL_URL = "app.update.url.manual";
const URI_UPDATES_PROPERTIES = "chrome://mozapps/locale/update/updates.properties";
const STATE_DOWNLOADING = "downloading";
const STATE_PENDING = "pending";
const STATE_APPLYING = "applying";
@ -278,18 +280,203 @@ var gLicensePage = {
}
};
var gDownloadingPage = {
_updatesView: null,
/**
* Formats status messages for a download operation based on the progress
* of the download.
* @constructor
*/
function DownloadStatusFormatter() {
this._startTime = Math.floor((new Date()).getTime() / 1000);
this._elapsed = 0;
_createAndInsertItem: function(update) {
var element = document.createElementNS(XMLNS_XUL, "update");
this._updatesView.appendChild(element);
element.setUpdate(update);
return element;
var sbs = Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService);
var bundle = sbs.createBundle(URI_UPDATES_PROPERTIES);
this._statusFormat = bundle.GetStringFromName("statusFormat");
this._statusFormatKBMB = bundle.GetStringFromName("statusFormatKBMB");
this._statusFormatKBKB = bundle.GetStringFromName("statusFormatKBKB");
this._statusFormatMBMB = bundle.GetStringFromName("statusFormatMBMB");
this._statusFormatUnknownMB = bundle.GetStringFromName("statusFormatUnknownMB");
this._statusFormatUnknownKB = bundle.GetStringFromName("statusFormatUnknownKB");
this._remain = bundle.GetStringFromName("remain");
this._unknownFilesize = bundle.GetStringFromName("unknownFilesize");
this._longTimeFormat = bundle.GetStringFromName("longTimeFormat");
this._shortTimeFormat = bundle.GetStringFromName("shortTimeFormat");
}
DownloadStatusFormatter.prototype = {
/**
* Time when the download started (in seconds since epoch)
*/
_startTime: 0,
/**
* Time elapsed since the start of the download operation (in seconds)
*/
_elapsed: 0,
/**
* Transfer rate of the download
*/
rate: 0,
/**
* Number of Kilobytes downloaded so far in the form:
* 376KB of 9.3MB
*/
progress: "",
/**
* Format a human-readable status message based on the current download
* progress.
* @param currSize
* The current number of bytes transferred
* @param finalSize
* The total number of bytes to be transferred
* @returns A human readable status message, e.g.
* "3.4 of 4.7MB; 01:15 remain"
*/
formatStatus: function(currSize, finalSize) {
var now = Math.floor((new Date()).getTime() / 1000);
// 1) Determine the Download Progress in Kilobytes
var total = parseInt(finalSize/1024 + 0.5);
this.progress = this._formatKBytes(parseInt(currSize/1024 + 0.5), total);
// 2) Determine the Transfer Rate
if (!this.rate || now > (this._startTime + this._elapsed + 2)) {
this._elapsed = now - this._startTime;
this.rate = this._elapsed ? (currSize / 1024) / this._elapsed : 0;
if (this.rate > 100)
this.rate = Math.round(this.rate);
if (this.rate == 0)
this.rate = "??.?";
}
// 3) Determine the Time Remaining
var remainingTime = this._unknownFileSize;
if (this.rate && (finalSize > 0)) {
remainingTime = Math.floor(((finalSize - currSize) / 1024) / this.rate);
remainingTime = this._formatSeconds(remainingTime);
}
var status = this._statusFormat;
status = this._replaceInsert(status, 1, this.progress);
status = this._replaceInsert(status, 2, this.rate);
status = this._replaceInsert(status, 3, remainingTime);
status = this._replaceInsert(status, 4, this._remain);
return status;
},
/**
* Inserts a string into another string at the specified index, e.g. for
* the format string var foo ="#1 #2 #3", |_replaceInsert(foo, 2, "test")|
* returns "#1 test #3";
* @param format
* The format string
* @param index
* The Index to insert into
* @param value
* The value to insert
* @returns The string with the value inserted.
*/
_replaceInsert: function(format, index, value) {
return format.replace(new RegExp("#" + index), value);
},
/**
* Formats progress in the form of kilobytes transfered vs. total to
* transfer.
* @param currentKB
* The current amount of data transfered, in kilobytes.
* @param totalKB
* The total amount of data that must be transfered, in kilobytes.
* @returns A string representation of the progress, formatted according to:
*
* KB totalKB returns
* x, < 1MB y < 1MB x of y KB
* x, < 1MB y >= 1MB x KB of y MB
* x, >= 1MB y >= 1MB x of y MB
*/
_formatKBytes: function(currentKB, totalKB) {
var progressHasMB = parseInt(currentKB / 1024) > 0;
var totalHasMB = parseInt(totalKB / 1024) > 0;
var format = "";
if (!progressHasMB && !totalHasMB) {
if (!totalKB) {
format = this._statusFormatUnknownKB;
format = this._replaceInsert(format, 1, currentKB);
} else {
format = this._statusFormatKBKB;
format = this._replaceInsert(format, 1, currentKB);
format = this._replaceInsert(format, 2, totalKB);
}
}
else if (progressHasMB && totalHasMB) {
format = this._statusFormatMBMB;
format = this._replaceInsert(format, 1, (currentKB / 1024).toFixed(1));
format = this._replaceInsert(format, 2, (totalKB / 1024).toFixed(1));
}
else if (totalHasMB && !progressHasMB) {
format = this._statusFormatKBMB;
format = this._replaceInsert(format, 1, currentKB);
format = this._replaceInsert(format, 2, (totalKB / 1024).toFixed(1));
}
else if (progressHasMB && !totalHasMB) {
format = this._statusFormatUnknownMB;
format = this._replaceInsert(format, 1, (currentKB / 1024).toFixed(1));
}
return format;
},
/**
* Formats a time in seconds into something human readable.
* @param seconds
* The time to format
* @returns A human readable string representing the date.
*/
_formatSeconds: function(seconds) {
// Determine number of hours/minutes/seconds
var hours = (seconds - (seconds % 3600)) / 3600;
seconds -= hours * 3600;
var minutes = (seconds - (seconds % 60)) / 60;
seconds -= minutes * 60;
// Pad single digit values
if (hours < 10)
hours = "0" + hours;
if (minutes < 10)
minutes = "0" + minutes;
if (seconds < 10)
seconds = "0" + seconds;
// Insert hours, minutes, and seconds into result string.
var result = parseInt(hours) ? this._longTimeFormat : this._shortTimeFormat;
result = this._replaceInsert(result, 1, hours);
result = this._replaceInsert(result, 2, minutes);
result = this._replaceInsert(result, 3, seconds);
return result;
}
};
var gDownloadingPage = {
_downloadName : null,
_downloadStatus : null,
_downloadProgress : null,
_downloadThrobber : null,
_pauseButton : null,
_statusFormatter : null,
onPageShow: function() {
this._updatesView = document.getElementById("updatesView");
this._downloadName = document.getElementById("downloadName");
this._downloadStatus = document.getElementById("downloadStatus");
this._downloadProgress = document.getElementById("downloadProgress");
this._downloadThrobber = document.getElementById("downloadThrobber");
this._pauseButton = document.getElementById("pauseButton");
if (gUpdates.update) {
// Add this UI as a listener for active downloads
var updates =
@ -301,37 +488,47 @@ var gDownloadingPage = {
else
updates.addDownloadListener(this);
}
var um = Components.classes["@mozilla.org/updates/update-manager;1"]
.getService(Components.interfaces.nsIUpdateManager);
var activeUpdate = um.activeUpdate;
if (activeUpdate) {
var element = this._createAndInsertItem(activeUpdate);
element.id = "activeDownloadItem";
}
this._updatesView.addEventListener("update-pause", this.onPause, false);
// Build the UI for previously installed updates
for (var i = 0; i < um.updateCount; ++i) {
var update = um.getUpdateAt(i);
this._createAndInsertItem(update);
}
gUpdates.headerVisible = false;
document.documentElement.getButton("back").disabled = true;
document.documentElement.getButton("next").disabled = true;
var cancelButton = document.documentElement.getButton("cancel");
cancelButton.label = gUpdates.updateStrings.getString("closeButtonLabel");
cancelButton.focus();
gUpdates.headerVisible = true;
},
_setStatus: function(status) {
while (this._downloadStatus.hasChildNodes())
this._downloadStatus.removeChild(this._downloadStatus.firstChild);
this._downloadStatus.appendChild(document.createTextNode(status));
},
_paused: false,
_oldStatus: "",
_oldName: "",
_oldMode: "",
onPause: function() {
var updates =
Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService);
if (this._paused)
if (this._paused) {
updates.downloadUpdate(gUpdates.update, false);
else
this._downloadName.value = gUpdates.updateStrings.getFormattedString("downloadingPrefix", [gUpdates.update.name]);
this._setStatus(this._oldStatus);
this._downloadProgress.mode = this._oldMode;
this._pauseButton.label = gUpdates.updateStrings.getString("pauseButtonPause");
}
else {
updates.pauseDownload();
this._oldStatus = this._downloadStatus.textContent;
this._oldMode = this._downloadProgress.mode;
this._downloadName.value = gUpdates.updateStrings.getFormattedString("pausedName", [gUpdates.update.name]);
this._setStatus(gUpdates.updateStrings.getFormattedString("pausedStatus",
[this._statusFormatter.progress]));
this._downloadProgress.mode = "normal";
this._pauseButton.label = gUpdates.updateStrings.getString("pauseButtonResume");
}
this._paused = !this._paused;
document.getElementById("activeDownloadItem").paused = this._paused;
},
onClose: function() {
@ -339,8 +536,8 @@ var gDownloadingPage = {
// fed progress and state notifications after the UI we're updating has
// gone away.
var updates =
Components.classes["@mozilla.org/updates/update-service;1"]
.getService(Components.interfaces.nsIApplicationUpdateService);
Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService);
updates.removeDownloadListener(this);
var um =
@ -349,24 +546,28 @@ var gDownloadingPage = {
um.activeUpdate = gUpdates.update;
},
showCompletedUpdatesChanged: function(checkbox) {
this._updatesView.setAttribute("showcompletedupdates", checkbox.checked);
},
onStartRequest: function(request, context) {
request.QueryInterface(nsIIncrementalDownload);
LOG("gDownloadingPage.onStartRequest: " + request.URI.spec);
this._statusFormatter = new DownloadStatusFormatter();
this._downloadThrobber.setAttribute("state", "loading");
},
onProgress: function(request, context, progress, maxProgress) {
request.QueryInterface(nsIIncrementalDownload);
// LOG("gDownloadingPage.onProgress: " + request.URI.spec + ", " + progress + "/" + maxProgress);
var active = document.getElementById("activeDownloadItem");
active.startDownload();
active.state = STATE_DOWNLOADING;
active.progress = gUpdates.update.selectedPatch.progress;
active.status = gUpdates.update.selectedPatch.status;
gUpdates.update.selectedPatch.status =
this._statusFormatter.formatStatus(progress, maxProgress);
this._downloadProgress.mode = "normal";
this._downloadProgress.value = gUpdates.update.selectedPatch.progress;
this._pauseButton.disabled = false;
var name = gUpdates.updateStrings.getFormattedString("downloadingPrefix", [gUpdates.update.name]);
this._downloadName.value = name;
this._setStatus(gUpdates.update.selectedPatch.status);
},
onStatus: function(request, context, status, statusText) {
@ -378,15 +579,11 @@ var gDownloadingPage = {
request.QueryInterface(nsIIncrementalDownload);
LOG("gDownloadingPage.onStopRequest: " + request.URI.spec + ", status = " + status);
// Flip the progressmeter back to "undetermined" mode in case we need to
// download a new (complete) update patch.
var active = document.getElementById("activeDownloadItem");
active.state = gUpdates.update.selectedPatch.state;
this._downloadThrobber.removeAttribute("state");
const NS_BINDING_ABORTED = 0x804b0002;
switch (status) {
case Components.results.NS_ERROR_UNEXPECTED:
LOG("DLP:STATE = " + gUpdates.update.selectedPatch.state);
if (gUpdates.update.selectedPatch.state == STATE_FAILED)
this.showVerificationError();
else {
@ -395,7 +592,8 @@ var gDownloadingPage = {
// Reset the progress meter to "undertermined" mode so that we don't
// show old progress for the new download of the "complete" patch.
active.stopDownload();
this._downloadProgress.mode = "undetermined";
this._pauseButton.disabled = true;
return;
}
break;
@ -406,7 +604,6 @@ var gDownloadingPage = {
return;
}
LOG("Removing Listener");
var updates =
Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService);

View File

@ -145,7 +145,7 @@
var key = val ? "pauseButtonResume" : "pauseButtonPause";
if (val) {
this.setAttribute("old-status", this.status);
this.status = this._strings.getString("pausedStatus");
//this.status = this._strings.getString("pausedStatus");
this.setAttribute("old-name", this.name);
this.name = this._strings.getFormattedString("pausedName", [this.name]);
LOG("GOAT = " + this._strings.getFormattedString("pausedName", [this.name]));

View File

@ -132,17 +132,21 @@
</wizardpage>
<wizardpage id="downloading" pageid="downloading" next="finished"
onpageshow="gDownloadingPage.onPageShow();" flex="1">
onpageshow="gDownloadingPage.onPageShow();"
label="&downloading.title;">
<label id="downloadingIntro">&downloading.intro;</label>
<view id="updatesView" flex="1"
datasources="rdf:null" persist="last-selected"/>
<hbox id="downloadingFooter">
<checkbox id="showCompletedUpdates"
label="&showCompletedUpdates.label;" accesskey="&showCompletedUpdates.accesskey;"
oncommand="gDownloadingPage.showCompletedUpdatesChanged(event.target);"/>
<separator flex="1"/>
<button label="&close.label;" accesskey="&close.accesskey;" oncommand="close();"/>
<hbox pack="start">
<label id="downloadName" crop="right" flex="1">&downloading.intro;</label>
<link id="detailsLink">
<label>&details.link;</label>
</link>
</hbox>
<progressmeter id="downloadProgress" mode="undetermined"/>
<hbox align="start">
<image id="downloadThrobber"/>
<description id="downloadStatus" flex="1">&connecting.label;</description>
<button id="pauseButton" oncommand="gDownloadingPage.onPause();"
label="&pause.label;" accesskey="&pause.accesskey;"/>
</hbox>
</wizardpage>

View File

@ -1157,181 +1157,6 @@ Checker.prototype = {
}
};
/**
* Formats status messages for a download operation based on the progress
* of the download.
* @constructor
*/
function DownloadStatusFormatter() {
this._downloadStartTime = (new Date()).getTime();
this._elapsed = 0;
var sbs = Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService);
var bundle = sbs.createBundle(URI_UPDATES_PROPERTIES);
this._statusFormat = bundle.GetStringFromName("statusFormat");
this._statusFormatKBMB = bundle.GetStringFromName("statusFormatKBMB");
this._statusFormatKBKB = bundle.GetStringFromName("statusFormatKBKB");
this._statusFormatMBMB = bundle.GetStringFromName("statusFormatMBMB");
this._statusFormatUnknownMB = bundle.GetStringFromName("statusFormatUnknownMB");
this._statusFormatUnknownKB = bundle.GetStringFromName("statusFormatUnknownKB");
this._remain = bundle.GetStringFromName("remain");
this._unknownFilesize = bundle.GetStringFromName("unknownFilesize");
this._longTimeFormat = bundle.GetStringFromName("longTimeFormat");
this._shortTimeFormat = bundle.GetStringFromName("shortTimeFormat");
}
DownloadStatusFormatter.prototype = {
/**
* Time when the download started (in seconds since epoch)
*/
_downloadStartTime: 0,
/**
* Time elapsed since the start of the download operation (in seconds)
*/
_elapsed: 0,
/**
* Format a human-readable status message based on the current download
* progress.
* @param currSize
* The current number of bytes transferred
* @param finalSize
* The total number of bytes to be transferred
* @returns A human readable status message, e.g.
* "3.4 of 4.7MB; 1.15 remain"
*/
formatStatus: function(currSize, finalSize) {
var now = (new Date()).getTime();
// 1) Determine the Download Progress in Kilobytes
var KBTotal = parseInt(finalSize/1024 + 0.5);
var KBProgress = this._formatKBytes(parseInt(currSize/1024 + 0.5), KBTotal);
LOG("KBP = " + KBProgress);
// 2) Determine the Transfer Rate
this._elapsed = now - (this._startTime / 1000);
var rate = this._elapsed ? (currSize * 1024) / this.elapsed : 0
var KBRate = "??.?";
if (rate) {
var KBRate = parseInt((rate / 1024) * 10 + 0.5);
var fraction = KBRate % 10;
KBRate = parseInt((KBRate - remainder) / 10);
if (KBRate < 100)
KBRate += "." + fraction;
}
// 3) Determine the Time Remaining
var remainingTime = this._unknownFileSize;
if (rate && (finalSize > 0)) {
remainingTime = (finalSize - currSize) / rate;
remainingTime = parseInt(remainingTime + 0.5);
remainingTime = this._formatSeconds(remainingTime);
}
var status = this._statusFormat;
status = this._replaceInsert(status, 1, KBProgress);
status = this._replaceInsert(status, 2, KBRate);
status = this._replaceInsert(status, 3, remainingTime);
return status;
},
/**
* Inserts a string into another string at the specified index, e.g. for
* the format string var foo ="#1 #2 #3", |_replaceInsert(foo, 2, "test")|
* returns "#1 test #3";
* @param format
* The format string
* @param index
* The Index to insert into
* @param value
* The value to insert
* @returns The string with the value inserted.
*/
_replaceInsert: function(format, index, value) {
return format.replace(new RegExp("#" + index), value);
},
/**
* Formats progress in the form of kilobytes transfered vs. total to
* transfer.
* @param currentKB
* The current amount of data transfered, in kilobytes.
* @param totalKB
* The total amount of data that must be transfered, in kilobytes.
* @returns A string representation of the progress, formatted according to:
*
* KB totalKB returns
* x, < 1MB y < 1MB x of y KB
* x, < 1MB y >= 1MB x KB of y MB
* x, >= 1MB y >= 1MB x of y MB
*/
_formatKBytes: function(currentKB, totalKB) {
var progressHasMB = parseInt(currentKB / 1024) > 0;
var totalHasMB = parseInt(totalKB / 1024) > 0;
var format = "";
if (!progressHasMB && !totalHasMB) {
if (!totalKB) {
format = this._statusFormatUnknownKB;
format = this._replaceInsert(format, 1, currentKB);
} else {
format = this._statusFormatKBKB;
format = this._replaceInsert(format, 1, currentKB);
format = this._replaceInsert(format, 2, totalKB);
}
}
else if (progressHasMB && totalHasMB) {
format = this._statusFormatMBMB;
format = this._replaceInsert(format, 1, (currentKB / 1024).toFixed(1));
format = this._replaceInsert(format, 2, (totalKB / 1024).toFixed(1));
}
else if (totalHasMB && !progressHasMB) {
format = this._statusFormatKBMB;
format = this._replaceInsert(format, 1, currentKB);
format = this._replaceInsert(format, 2, (totalKB / 1024).toFixed(1));
}
else if (progressHasMB && !totalHasMB) {
format = this._statusFormatUnknownMB;
format = this._replaceInsert(format, 1, (currentKB / 1024).toFixed(1));
}
return format;
},
/**
* Formats a time in seconds into something human readable.
* @param seconds
* The time to format
* @returns A human readable string representing the date.
*/
_formatSeconds: function(seconds) {
// Round the number of seconds to remove fractions.
seconds = parseInt(seconds + .5);
var hours = parseInt(seconds/3600);
seconds -= hours * 3600;
var minutes = parseInt(seconds/60);
seconds -= minutes * 60;
var result = hours ? this._longTimeFormat : this._shortTimeFormat;
if (hours < 10)
hours = "0" + hours;
if (minutes < 10)
minutes = "0" + minutes;
if (seconds < 10)
seconds = "0" + seconds;
// Insert hours, minutes, and seconds into result string.
result = this._replaceInsert(result, 1, hours);
result = this._replaceInsert(result, 2, minutes);
result = this._replaceInsert(result, 3, seconds);
return result;
}
};
/**
* Manages the download of updates
* @param background
@ -1424,6 +1249,9 @@ Downloader.prototype = {
* this point.
*/
_verifyDownload: function() {
if (!this._request)
return false;
var fileStream = Components.classes["@mozilla.org/network/file-input-stream;1"].
createInstance(nsIFileInputStream);
fileStream.init(this._request.destination, MODE_RDONLY, PERMS_FILE, 0);
@ -1621,18 +1449,14 @@ Downloader.prototype = {
*
*/
removeDownloadListener: function(listener) {
LOG("LISTENERS0 = " + this._listeners.length);
for (var i = 0; i < this._listeners.length; ++i) {
if (this._listeners[i] == listener) {
this._listeners.splice(i, 1);
return;
}
}
LOG("LISTENERS1 = " + this._listeners.length);
},
_statusFormatter: null,
/**
*
*/
@ -1640,8 +1464,6 @@ Downloader.prototype = {
request.QueryInterface(nsIIncrementalDownload);
LOG("Downloader.onStartRequest: " + request.URI.spec);
this._statusFormatter = new DownloadStatusFormatter();
var listenerCount = this._listeners.length;
for (var i = 0; i < listenerCount; ++i)
this._listeners[i].onStartRequest(request, context);
@ -1655,7 +1477,6 @@ Downloader.prototype = {
// LOG("Downloader.onProgress: " + request.URI.spec + ", " + progress + "/" + maxProgress);
this._patch.progress = Math.round(100 * (progress/maxProgress));
this._patch.status = this._statusFormatter.formatStatus(progress, maxProgress);
var listenerCount = this._listeners.length;
for (var i = 0; i < listenerCount; ++i) {

View File

@ -106,3 +106,4 @@ classic.jar:
skin/classic/global/tree/twisty-clsd.png (tree/twisty-clsd.png)
skin/classic/global/tree/twisty-open.png (tree/twisty-open.png)
skin/classic/global/throbber/Throbber-small.gif (throbber/Throbber-small.gif)
skin/classic/global/throbber/Throbber-small.png (throbber/Throbber-small.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B