Changeset 151

Show
Ignore:
Timestamp:
2007-03-12 06:30:40 (2 years ago)
Author:
MaierMan
Message:

privacycontrol should clean old files as well

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/components/privacycontrol.js

    r86 r151  
    8787 
    8888  log : function(aMsg) { 
    89     if (this._logService instanceof Components.interfaces.nsIConsoleService) { 
    90       this._logService.logStringMessage('dta privacyontrol: ' + aMsg); 
    91     } 
     89                Components.utils.reportError('dta privacyControl: ' + aMsg); 
    9290  }, 
    9391 
     
    130128      .getService(Components.interfaces.nsIPrefService) 
    131129      .getBranch('extensions.dta.'); 
    132  
    133130                ['directory', 'filter', 'renaming'].forEach(function(e) { prefs.clearUserPref(e); }); 
     131 
     132                try { 
     133                        var prof = Components.classes["@mozilla.org/file/directory_service;1"] 
     134                                .getService(Components.interfaces.nsIProperties) 
     135                                .get("ProfD", Components.interfaces.nsIFile); 
     136                        ['dta_history.xml', 'dta_log.txt'].forEach( 
     137                                function (e) { 
     138                                        try { 
     139                                                var file = prof.clone(); 
     140                                                file.append(e); 
     141                                                if (file.exists()) { 
     142                                                        file.remove(); 
     143                                                } 
     144                                        } catch (ex) { 
     145                                                this.log('cannot remove ' + e); 
     146                                        } 
     147                                } 
     148                        ); 
     149                } 
     150                catch (oex) { 
     151                        this.log('failed to clean files'); 
     152                } 
    134153  }, 
    135154