backout bug 468836, checked in on persistent orange.

This commit is contained in:
Robert Sayre 2008-12-11 02:44:01 -08:00
Родитель 964f6a8a39
Коммит 6373beab66
2 изменённых файлов: 10 добавлений и 25 удалений

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

@ -299,8 +299,9 @@ TaggingService.prototype = {
if (!this.__tagFolders) { if (!this.__tagFolders) {
this.__tagFolders = []; this.__tagFolders = [];
var options = this._history.getNewQueryOptions(); var options = this._history.getNewQueryOptions();
options.resultType = Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY;
options.expandQueries = 0;
var query = this._history.getNewQuery(); var query = this._history.getNewQuery();
query.setFolders([this._bms.tagsFolder], 1);
var tagsResult = this._history.executeQuery(query, options); var tagsResult = this._history.executeQuery(query, options);
var root = tagsResult.root; var root = tagsResult.root;
root.containerOpen = true; root.containerOpen = true;

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

@ -56,10 +56,8 @@ catch(ex) {
// Get tagging service // Get tagging service
try { try {
// Notice we use createInstance because later we will have to terminate the
// service and restart it.
var tagssvc = Cc["@mozilla.org/browser/tagging-service;1"]. var tagssvc = Cc["@mozilla.org/browser/tagging-service;1"].
createInstance().QueryInterface(Ci.nsITaggingService); getService(Ci.nsITaggingService);
} catch(ex) { } catch(ex) {
do_throw("Could not get tagging service\n"); do_throw("Could not get tagging service\n");
} }
@ -134,11 +132,14 @@ function run_test() {
tagssvc.untagURI(uri2, ["tag 1"]); tagssvc.untagURI(uri2, ["tag 1"]);
do_check_eq(tagRoot.childCount, 1); do_check_eq(tagRoot.childCount, 1);
// cleanup
tag1node.containerOpen = false;
// get array of tag folder ids => title // get array of tag folder ids => title
// for testing tagging with mixed folder ids and tags // for testing tagging with mixed folder ids and tags
var options = histsvc.getNewQueryOptions();
var query = histsvc.getNewQuery();
query.setFolders([bmsvc.tagsFolder], 1);
var result = histsvc.executeQuery(query, options);
var tagRoot = result.root;
tagRoot.containerOpen = true;
var tagFolders = []; var tagFolders = [];
var child = tagRoot.getChild(0); var child = tagRoot.getChild(0);
var tagId = child.itemId; var tagId = child.itemId;
@ -157,21 +158,4 @@ function run_test() {
tagssvc.untagURI(uri3, [tagId, "tag 3", "456"]); tagssvc.untagURI(uri3, [tagId, "tag 3", "456"]);
tags = tagssvc.getTagsForURI(uri3, {}); tags = tagssvc.getTagsForURI(uri3, {});
do_check_eq(tags.length, 0); do_check_eq(tags.length, 0);
// Terminate tagging service, fire up a new instance and check that existing
// tags are there. This will ensure that any internal caching system is
// correctly filled at startup and we are not losing previously existing tags.
var uri4 = uri("http://testuri/4");
tagssvc.tagURI(uri4, [tagId, "tag 3", "456"]);
tagssvc = null;
tagssvc = Cc["@mozilla.org/browser/tagging-service;1"].
getService(Ci.nsITaggingService);
var uri4Tags = tagssvc.getTagsForURI(uri4, {});
do_check_eq(uri4Tags.length, 3);
do_check_true(uri4Tags.indexOf(tagTitle) != -1);
do_check_true(uri4Tags.indexOf("tag 3") != -1);
do_check_true(uri4Tags.indexOf("456") != -1);
// cleanup
tagRoot.containerOpen = false;
} }