Skip to content

Commit e110046

Browse files
committed
temporary fix: issue 901.
Update issue 901 Temporary fixed, but it doesn't fix fundamental problems. We need to backout this commit, when the correct patch will be released.
1 parent 56791c5 commit e110046

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

common/content/io.js

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -330,23 +330,30 @@ const IO = Module("io", {
330330
this._lastRunCommand = ""; // updated whenever the users runs a command with :!
331331
this._scriptNames = [];
332332

333-
this.downloadListener = {
334-
onDownloadStateChange: function (state, download) {
335-
if (download.state == services.get("downloads").DOWNLOAD_FINISHED) {
336-
let url = download.source.spec;
337-
let title = download.displayName;
338-
let file = download.targetFile.path;
339-
let size = download.size;
340-
341-
liberator.echomsg("Download of " + title + " to " + file + " finished");
342-
autocommands.trigger("DownloadPost", { url: url, title: title, file: file, size: size });
343-
}
344-
},
345-
onStateChange: function () {},
346-
onProgressChange: function () {},
347-
onSecurityChange: function () {}
348-
};
349-
services.get("downloads").addListener(this.downloadListener);
333+
// XXX: nsIDownloadManager is deprecated on Firefox 26
334+
// FIXME: need to listen to download state ? -- teramako
335+
// FIXME: need to adapt to Download.jsm instead of nsIDownloadManager
336+
try {
337+
this.downloadListener = {
338+
onDownloadStateChange: function (state, download) {
339+
if (download.state == services.get("downloads").DOWNLOAD_FINISHED) {
340+
let url = download.source.spec;
341+
let title = download.displayName;
342+
let file = download.targetFile.path;
343+
let size = download.size;
344+
345+
liberator.echomsg("Download of " + title + " to " + file + " finished");
346+
autocommands.trigger("DownloadPost", { url: url, title: title, file: file, size: size });
347+
}
348+
},
349+
onStateChange: function () {},
350+
onProgressChange: function () {},
351+
onSecurityChange: function () {}
352+
};
353+
services.get("downloads").addListener(this.downloadListener);
354+
} catch (e) {
355+
Cu.reportError(e);
356+
}
350357
},
351358

352359
destroy: function () {

0 commit comments

Comments
 (0)