mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-16 15:17:14 +00:00
Bug 897074 - Lower MAX_SEARCH_TOKENS to 10 in FormHistory.jsm. r=dolske
This commit is contained in:
parent
15141707e4
commit
d3408412c7
@ -98,7 +98,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "uuidService",
|
||||
|
||||
const DB_SCHEMA_VERSION = 4;
|
||||
const DAY_IN_MS = 86400000; // 1 day in milliseconds
|
||||
const MAX_SEARCH_TOKENS = 30;
|
||||
const MAX_SEARCH_TOKENS = 10;
|
||||
const NOOP = function noop() {};
|
||||
|
||||
let supportsDeletedTable =
|
||||
|
@ -243,11 +243,10 @@ add_test(function test_token_limit_DB() {
|
||||
do_log_info("Check that the number of tokens used in a search is not capped to " +
|
||||
"MAX_SEARCH_TOKENS when using a previousResult");
|
||||
// This provide more accuracy since performance is less of an issue.
|
||||
let changes = [ ];
|
||||
// Search for a string where the first 30 tokens match the value above but the 31st does not
|
||||
// Search for a string where the first 10 tokens match the previous value but the 11th does not
|
||||
// when re-using a previous result.
|
||||
fac.autoCompleteSearchAsync("field_token_cap",
|
||||
"a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 .",
|
||||
"a b c d e f g h i j .",
|
||||
null, previousResult, {
|
||||
onSearchCompletion : function(aResults) {
|
||||
do_check_eq(aResults.matchCount, 0,
|
||||
@ -262,14 +261,14 @@ add_test(function test_token_limit_DB() {
|
||||
"for performance when querying the DB");
|
||||
let changes = [ ];
|
||||
changes.push({ op : "add", fieldname: "field_token_cap",
|
||||
// value with 36 unique tokens
|
||||
value: "a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 0",
|
||||
// value with 15 unique tokens
|
||||
value: "a b c d e f g h i j k l m n o",
|
||||
timesUsed: 1, firstUsed: 0, lastUsed: 0 });
|
||||
updateFormHistory(changes, () => {
|
||||
// Search for a string where the first 30 tokens match the value above but the 31st does not
|
||||
// (which would prevent the result from being returned if the 31st term was used).
|
||||
// Search for a string where the first 10 tokens match the value above but the 11th does not
|
||||
// (which would prevent the result from being returned if the 11th term was used).
|
||||
fac.autoCompleteSearchAsync("field_token_cap",
|
||||
"a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 .",
|
||||
"a b c d e f g h i j .",
|
||||
null, null, {
|
||||
onSearchCompletion : function(aResults) {
|
||||
do_check_eq(aResults.matchCount, 1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user