Bug 407575 - Tag system should be case-insensitive. r=sspitzer.
git-svn-id: svn://10.0.0.236/trunk@240986 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
8f40e08cb7
commit
a9d762e4c5
@ -104,11 +104,12 @@ TaggingService.prototype = {
|
||||
* If there's no tag with the given name, null is returned;
|
||||
*/
|
||||
_getTagNode: function TS__getTagIndex(aName) {
|
||||
var nameLower = aName.toLowerCase();
|
||||
var root = this._tagsResult.root;
|
||||
var cc = root.childCount;
|
||||
for (var i=0; i < cc; i++) {
|
||||
var child = root.getChild(i);
|
||||
if (child.title == aName)
|
||||
if (child.title.toLowerCase() == nameLower)
|
||||
return child;
|
||||
}
|
||||
|
||||
@ -173,6 +174,12 @@ TaggingService.prototype = {
|
||||
var tagId = tagNode.itemId;
|
||||
if (!this._isURITaggedInternal(aURI, tagNode.itemId, {}))
|
||||
this._bms.insertBookmark(tagId, aURI, this._bms.DEFAULT_INDEX, null);
|
||||
|
||||
// _getTagNode ignores case sensitivity
|
||||
// rename the tag container so the places view would match the
|
||||
// user-typed values
|
||||
if (tagNode.title != aTags[i])
|
||||
this._bms.setItemTitle(tagNode.itemId, aTags[i]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -94,17 +94,18 @@ function run_test() {
|
||||
|
||||
// the former should be ignored.
|
||||
do_check_eq(tagRoot.childCount, 1);
|
||||
tagssvc.tagURI(uri1, ["tag 1", "tag 2"]);
|
||||
// also tests bug 407575
|
||||
tagssvc.tagURI(uri1, ["tag 1", "tag 2", "Tag 1", "Tag 2"]);
|
||||
do_check_eq(tagRoot.childCount, 2);
|
||||
|
||||
// test getTagsForURI
|
||||
var uri1tags = tagssvc.getTagsForURI(uri1, {});
|
||||
do_check_eq(uri1tags.length, 2);
|
||||
do_check_eq(uri1tags[0], "tag 1");
|
||||
do_check_eq(uri1tags[1], "tag 2");
|
||||
do_check_eq(uri1tags[0], "Tag 1");
|
||||
do_check_eq(uri1tags[1], "Tag 2");
|
||||
var uri2tags = tagssvc.getTagsForURI(uri2, {});
|
||||
do_check_eq(uri2tags.length, 1);
|
||||
do_check_eq(uri2tags[0], "tag 1");
|
||||
do_check_eq(uri2tags[0], "Tag 1");
|
||||
|
||||
// test getURIsForTag
|
||||
var tag1uris = tagssvc.getURIsForTag("tag 1");
|
||||
@ -115,8 +116,8 @@ function run_test() {
|
||||
// test allTags attribute
|
||||
var allTags = tagssvc.allTags;
|
||||
do_check_eq(allTags.length, 2);
|
||||
do_check_eq(allTags[0], "tag 1");
|
||||
do_check_eq(allTags[1], "tag 2");
|
||||
do_check_eq(allTags[0], "Tag 1");
|
||||
do_check_eq(allTags[1], "Tag 2");
|
||||
|
||||
// test untagging
|
||||
tagssvc.untagURI(uri1, ["tag 1"]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user