@@ -330,23 +330,30 @@ const IO = Module("io", {
330
330
this . _lastRunCommand = "" ; // updated whenever the users runs a command with :!
331
331
this . _scriptNames = [ ] ;
332
332
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
+ }
350
357
} ,
351
358
352
359
destroy : function ( ) {
0 commit comments