Changeset 1768
- Timestamp:
- 2010-02-20 21:23:50 (5 months ago)
- Files:
-
- trunk/modules/historymanager.jsm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/modules/historymanager.jsm
r1731 r1768 97 97 } 98 98 catch (ex) { 99 Debug.log(" Parsing of history failed: " + json, ex);99 Debug.log("Histories: Parsing of history failed: " + json, ex); 100 100 return []; 101 101 } … … 103 103 _setValues: function(values) { 104 104 if (!this._persisting) { 105 Debug.logString("Set session history for " this._key); 105 106 this._sessionHistory = values; 106 107 } 107 108 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 } 109 117 } 110 118 }, 111 119 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); 118 129 } 119 this._setValues(values); 130 catch (ex) { 131 Debug.log("Histories: Push failed!", ex); 132 } 120 133 }, 121 134 reset: function(value) { 135 Debug.logString("Histories: Reset called"); 122 136 this._setValues([]); 123 137 }
