Changeset 1768

Show
Ignore:
Timestamp:
2010-02-20 21:23:50 (5 months ago)
Author:
MaierMan
Message:

Add some more debugging

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/modules/historymanager.jsm

    r1731 r1768  
    9797                } 
    9898                catch (ex) { 
    99                         Debug.log("Parsing of history failed: " + json, ex); 
     99                        Debug.log("Histories: Parsing of history failed: " + json, ex); 
    100100                        return []; 
    101101                } 
     
    103103        _setValues: function(values) { 
    104104                if (!this._persisting) { 
     105                        Debug.logString("Set session history for " this._key); 
    105106                        this._sessionHistory = values; 
    106107                } 
    107108                else { 
    108                         prefs.setExt(this._key, stringify(values)); 
     109                        try { 
     110                                prefs.setExt(this._key, stringify(values)); 
     111                                Debug.logString("Set normal history for " this._key); 
     112                        } 
     113                        catch (ex) { 
     114                                Debug.log("Histories: Setting values failed" + values, ex); 
     115                                throw ex; 
     116                        } 
    109117                } 
    110118        }, 
    111119        push: function(value) { 
    112                 value = value.toString(); 
    113                 let values = this.values.filter(function(e) e != value); 
    114                 values.unshift(value); 
    115                 let max = prefs.getExt('history', 5); 
    116                 while (values.length > max) { 
    117                         values.pop(); 
     120                try { 
     121                        value = value.toString(); 
     122                        let values = this.values.filter(function(e) e != value); 
     123                        values.unshift(value); 
     124                        let max = prefs.getExt('history', 5); 
     125                        while (values.length > max) { 
     126                                values.pop(); 
     127                        } 
     128                        this._setValues(values); 
    118129                } 
    119                 this._setValues(values); 
     130                catch (ex) { 
     131                        Debug.log("Histories: Push failed!", ex); 
     132                } 
    120133        }, 
    121134        reset: function(value) { 
     135                Debug.logString("Histories: Reset called"); 
    122136                this._setValues([]); 
    123137        }