From 096ba418b1a758d609db5ab9cc7f4bd53ad269c3 Mon Sep 17 00:00:00 2001 From: Marco Bonardo Date: Thu, 26 Jul 2018 09:18:56 +0000 Subject: [PATCH] Bug 1477930 - Remove taggingService HasTags synchronous API. r=Standard8 The tagging API is moving to the bookmarking API, this is part of it. This will break the tags root open glyph in the Library, for now we don't have an alternative, we'll re-evaluate in the future in bug 1477934. Differential Revision: https://phabricator.services.mozilla.com/D2318 --HG-- extra : moz-landing-system : lando --- .../components/places/nsITaggingService.idl | 7 ------ .../components/places/nsNavHistoryResult.cpp | 22 ++++++------------- toolkit/components/places/nsTaggingService.js | 5 ----- 3 files changed, 7 insertions(+), 27 deletions(-) diff --git a/toolkit/components/places/nsITaggingService.idl b/toolkit/components/places/nsITaggingService.idl index 9bbbecc424a1..d72cc7206cd4 100644 --- a/toolkit/components/places/nsITaggingService.idl +++ b/toolkit/components/places/nsITaggingService.idl @@ -72,13 +72,6 @@ interface nsITaggingService : nsISupports * Retrieves all tags used to tag URIs in the data-base (sorted by name). */ readonly attribute nsIVariant allTags; - - /** - * Whether any tags exist. - * - * @note This is faster than allTags.length, since doesn't need to sort tags. - */ - readonly attribute boolean hasTags; }; %{C++ diff --git a/toolkit/components/places/nsNavHistoryResult.cpp b/toolkit/components/places/nsNavHistoryResult.cpp index fadaf345ee0f..6823a11cc2b1 100644 --- a/toolkit/components/places/nsNavHistoryResult.cpp +++ b/toolkit/components/places/nsNavHistoryResult.cpp @@ -1878,17 +1878,6 @@ nsNavHistoryQueryResultNode::GetHasChildren(bool* aHasChildren) return NS_OK; } - // For tag containers query we must check if we have any tag - if (resultType == nsINavHistoryQueryOptions::RESULTS_AS_TAGS_ROOT) { - nsCOMPtr tagging = - do_GetService(NS_TAGGINGSERVICE_CONTRACTID); - if (tagging) { - bool hasTags; - *aHasChildren = NS_SUCCEEDED(tagging->GetHasTags(&hasTags)) && hasTags; - } - return NS_OK; - } - // For history containers query we must check if we have any history if (resultType == nsINavHistoryQueryOptions::RESULTS_AS_DATE_QUERY || resultType == nsINavHistoryQueryOptions::RESULTS_AS_DATE_SITE_QUERY || @@ -1899,15 +1888,18 @@ nsNavHistoryQueryResultNode::GetHasChildren(bool* aHasChildren) return NS_OK; } - //XXX: For other containers queries we must: - // 1. If it's open, just check mChildren for containers - // 2. Else null the view (keep it in a var), open container, check mChildren - // for containers, close container, reset the view + // TODO (Bug 1477934): We don't have a good synchronous way to fetch whether + // we have tags or not, to properly reply to the hasChildren request on the + // tags root. Potentially we could pass this information when we create the + // container. + // If the container is open and populated, this is trivial. if (mContentsValid) { *aHasChildren = (mChildren.Count() > 0); return NS_OK; } + + // Fallback to assume we have children. *aHasChildren = true; return NS_OK; } diff --git a/toolkit/components/places/nsTaggingService.js b/toolkit/components/places/nsTaggingService.js index cdc84ee69376..8bfa1a69472d 100644 --- a/toolkit/components/places/nsTaggingService.js +++ b/toolkit/components/places/nsTaggingService.js @@ -325,11 +325,6 @@ TaggingService.prototype = { return this.__tagFolders; }, - // nsITaggingService - get hasTags() { - return this._tagFolders.length > 0; - }, - // nsIObserver observe: function TS_observe(aSubject, aTopic, aData) { if (aTopic == TOPIC_SHUTDOWN) {