mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Limit form history records (bug 494952, r=thunder)
--HG-- extra : rebase_source : c3e983d30a14efd972eea2651a59be76924da256
This commit is contained in:
parent
5ad22f9709
commit
7cd35a2c36
@ -47,6 +47,7 @@ Cu.import("resource://weave/util.js");
|
||||
Cu.import("resource://weave/engines.js");
|
||||
Cu.import("resource://weave/stores.js");
|
||||
Cu.import("resource://weave/trackers.js");
|
||||
Cu.import("resource://weave/base_records/collection.js");
|
||||
Cu.import("resource://weave/type_records/forms.js");
|
||||
|
||||
function FormEngine() {
|
||||
@ -67,9 +68,15 @@ FormEngine.prototype = {
|
||||
},
|
||||
|
||||
/* Wipe cache when sync finishes */
|
||||
_syncFinish: function FormEngine__syncFinish() {
|
||||
_syncFinish: function FormEngine__syncFinish(error) {
|
||||
this._store.clearFormCache();
|
||||
SyncEngine.prototype._syncFinish.call(this);
|
||||
|
||||
// Only leave 1 month's worth of form history
|
||||
this._tracker.resetScore();
|
||||
let coll = new Collection(this.engineURL, this._recordObj);
|
||||
coll.older = this.lastSync - 2592000; // 60*60*24*30
|
||||
coll.full = 0;
|
||||
coll.delete();
|
||||
},
|
||||
|
||||
_recordLike: function SyncEngine__recordLike(a, b) {
|
||||
@ -111,7 +118,18 @@ FormStore.prototype = {
|
||||
},
|
||||
|
||||
get _formStatement() {
|
||||
let stmnt = this._formDB.createStatement("SELECT * FROM moz_formhistory");
|
||||
// This is essentially:
|
||||
// SELECT * FROM moz_formhistory ORDER BY 1.0 * (lastUsed - minLast) /
|
||||
// (maxLast - minLast) * timesUsed / minTimes DESC LIMIT 200
|
||||
let stmnt = this._formDB.createStatement(
|
||||
"SELECT * FROM moz_formhistory ORDER BY 1.0 * (lastUsed - \
|
||||
(SELECT lastUsed FROM moz_formhistory ORDER BY lastUsed ASC LIMIT 1)) / \
|
||||
((SELECT lastUsed FROM moz_formhistory ORDER BY lastUsed DESC LIMIT 1) - \
|
||||
(SELECT lastUsed FROM moz_formhistory ORDER BY lastUsed ASC LIMIT 1)) * \
|
||||
timesUsed / (SELECT timesUsed FROM moz_formhistory ORDER BY timesUsed DESC LIMIT 1) \
|
||||
DESC LIMIT 200"
|
||||
);
|
||||
|
||||
this.__defineGetter__("_formStatement", function() stmnt);
|
||||
return stmnt;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user