mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 393464 Bookmarks manager doesn't search in tags field (reverting)
This commit is contained in:
parent
056ec0b8dc
commit
d8d65a6e55
@ -91,9 +91,3 @@ interface nsITaggingService : nsISupports
|
||||
*/
|
||||
readonly attribute nsIVariant allTags;
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
#define TAGGING_SERVICE_CID "@mozilla.org/browser/tagging-service;1"
|
||||
|
||||
%}
|
||||
|
@ -69,9 +69,6 @@
|
||||
#include "prtime.h"
|
||||
#include "prprf.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsITaggingService.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsVariant.h"
|
||||
|
||||
#include "mozIStorageService.h"
|
||||
#include "mozIStorageConnection.h"
|
||||
@ -4099,45 +4096,6 @@ nsNavHistory::GroupByHost(nsNavHistoryQueryResultNode *aResultNode,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsNavHistory::URIHasTag(nsIURI* aURI, const nsAString& aTag)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsITaggingService> tagService =
|
||||
do_GetService(TAGGING_SERVICE_CID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIVariant> tagsV;
|
||||
rv = tagService->GetTagsForURI(aURI, getter_AddRefs(tagsV));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// confirm that type is array, and has elements
|
||||
// (data type is different for empty array)
|
||||
PRUint16 dataType;
|
||||
tagsV->GetDataType(&dataType);
|
||||
if (dataType != nsIDataType::VTYPE_ARRAY)
|
||||
return PR_FALSE;
|
||||
|
||||
// get tags as array
|
||||
PRUint16 type;
|
||||
nsIID iid;
|
||||
PRUint32 count;
|
||||
PRUnichar** tags;
|
||||
rv = tagsV->GetAsArray(&type, &iid, &count, (void**)&tags);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for (PRUint32 i = 0; i < count; i++) {
|
||||
nsAutoString tag(tags[i]);
|
||||
PRInt32 position = Compare(tag, aTag, nsCaseInsensitiveStringComparator());
|
||||
if (position == 0) {
|
||||
nsMemory::Free(tags);
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
nsMemory::Free(tags);
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
// nsNavHistory::FilterResultSet
|
||||
//
|
||||
@ -4203,7 +4161,6 @@ nsNavHistory::FilterResultSet(nsNavHistoryQueryResultNode* aParentNode,
|
||||
if (terms.Count() == 0) {
|
||||
allTermsFound = PR_TRUE;
|
||||
} else {
|
||||
|
||||
for (PRInt32 termIndex = 0; termIndex < terms.Count(); termIndex ++) {
|
||||
PRBool termFound = PR_FALSE;
|
||||
// title and URL
|
||||
@ -4213,7 +4170,6 @@ nsNavHistory::FilterResultSet(nsNavHistoryQueryResultNode* aParentNode,
|
||||
CaseInsensitiveFindInReadable(*terms[termIndex],
|
||||
NS_ConvertUTF8toUTF16(aSet[nodeIndex]->mURI))))
|
||||
termFound = PR_TRUE;
|
||||
|
||||
// searchable annotations
|
||||
/*if (! termFound) {
|
||||
for (PRInt32 annotIndex = 0; annotIndex < curAnnotations.Count(); annotIndex ++) {
|
||||
@ -4222,16 +4178,7 @@ nsNavHistory::FilterResultSet(nsNavHistoryQueryResultNode* aParentNode,
|
||||
termFound = PR_TRUE;
|
||||
}
|
||||
}*/
|
||||
|
||||
// search tags
|
||||
if (!termFound) {
|
||||
nsCOMPtr<nsIURI> itemURI;
|
||||
rv = NS_NewURI(getter_AddRefs(itemURI), aSet[nodeIndex]->mURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
termFound = URIHasTag(itemURI, *terms[termIndex]);
|
||||
}
|
||||
|
||||
if (!termFound) {
|
||||
if (! termFound) {
|
||||
allTermsFound = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
|
@ -511,8 +511,6 @@ protected:
|
||||
nsCOMArray<nsNavHistoryResultNode>* aDest,
|
||||
PRBool aIsDomain);
|
||||
|
||||
PRBool URIHasTag(nsIURI* aURI, const nsAString& aTag);
|
||||
|
||||
nsresult FilterResultSet(nsNavHistoryQueryResultNode *aParentNode,
|
||||
const nsCOMArray<nsNavHistoryResultNode>& aSet,
|
||||
nsCOMArray<nsNavHistoryResultNode>* aFiltered,
|
||||
|
@ -63,6 +63,7 @@ var root = bmsvc.bookmarksRoot;
|
||||
|
||||
// main
|
||||
function run_test() {
|
||||
return true;
|
||||
// test searching for tagged bookmarks
|
||||
|
||||
// test folder
|
||||
|
Loading…
Reference in New Issue
Block a user