Bug 376786 - Annotation-based queries are broken. r=dietrich.

This commit is contained in:
mozilla.mano@sent.com 2007-04-09 17:24:37 -07:00
Родитель 9708501644
Коммит afdaddfc42
2 изменённых файлов: 19 добавлений и 1 удалений

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

@ -3242,7 +3242,7 @@ nsNavHistory::QueryToSelectClause(nsNavHistoryQuery* aQuery, // const
if (aQuery->AnnotationIsNot())
aClause->AppendLiteral("NOT ");
aClause->AppendLiteral("EXISTS (SELECT id FROM moz_annos anno JOIN moz_anno_attributes annoname ON anno.anno_attribute_id = annoname.id WHERE anno.place_id = h.id AND annoname.name = ");
aClause->AppendLiteral("EXISTS (SELECT h.id FROM moz_annos anno JOIN moz_anno_attributes annoname ON anno.anno_attribute_id = annoname.id WHERE anno.place_id = h.id AND annoname.name = ");
aClause->Append(paramString);
aClause->AppendLiteral(") ");
// annotation-based queries don't get the common conditions, so you get

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

@ -134,6 +134,24 @@ function run_test() {
result = histsvc.executeQuery(query, options);
result.root.containerOpen = true;
do_check_eq(result.root.childCount, 2);
// test annotation-based queries
var annos = Cc["@mozilla.org/browser/annotation-service;1"].
getService(Ci.nsIAnnotationService);
annos.setAnnotationInt32(uri("http://mozilla.com/"), "testAnno", 0, 0,
Ci.nsIAnnotationService.EXPIRE_NEVER);
query.annotation = "testAnno";
result = histsvc.executeQuery(query, options);
result.root.containerOpen = true;
do_check_eq(result.root.childCount, 1);
do_check_eq(result.root.getChild(0).uri, "http://mozilla.com/");
// test annotationIsNot
query.annotationIsNot = true;
result = histsvc.executeQuery(query, options);
result.root.containerOpen = true;
do_check_eq(result.root.childCount, 1);
do_check_eq(result.root.getChild(0).uri, "http://google.com/");
// by default, browser.history_expire_days is 9
do_check_true(!histsvc.historyDisabled);