Bug 558654 - Firefox crashes every ~2min after update to 1.2 [r=mconnor]

Limit the number of initial form entries to 500 ordered by "frecency".
This commit is contained in:
Edward Lee 2010-04-11 12:34:27 -07:00
Родитель 1532b85056
Коммит ea7a2f7ba7
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -50,8 +50,13 @@ Cu.import("resource://weave/type_records/forms.js");
let FormWrapper = {
getAllEntries: function getAllEntries() {
let entries = [];
// Sort by (lastUsed - minLast) / (maxLast - minLast) * timesUsed / maxTimes
let query = this.createStatement(
"SELECT fieldname, value FROM moz_formhistory");
"SELECT fieldname, value 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 500");
while (query.executeStep()) {
entries.push({
name: query.row.fieldname,