Bug 1068671 - folderReadOnly doesn't pertain to bookmarks or results. r=mak

This commit is contained in:
Asaf Romano
2014-10-14 17:03:28 +03:00
parent b108932b40
commit fbed712ada
19 changed files with 210 additions and 417 deletions

View File

@@ -322,13 +322,12 @@ NS_INTERFACE_MAP_END_INHERITING(nsNavHistoryResultNode)
nsNavHistoryContainerResultNode::nsNavHistoryContainerResultNode(
const nsACString& aURI, const nsACString& aTitle,
const nsACString& aIconURI, uint32_t aContainerType, bool aReadOnly,
const nsACString& aIconURI, uint32_t aContainerType,
nsNavHistoryQueryOptions* aOptions) :
nsNavHistoryResultNode(aURI, aTitle, 0, 0, aIconURI),
mResult(nullptr),
mContainerType(aContainerType),
mExpanded(false),
mChildrenReadOnly(aReadOnly),
mOptions(aOptions),
mAsyncCanceledState(NOT_CANCELED)
{
@@ -337,13 +336,12 @@ nsNavHistoryContainerResultNode::nsNavHistoryContainerResultNode(
nsNavHistoryContainerResultNode::nsNavHistoryContainerResultNode(
const nsACString& aURI, const nsACString& aTitle,
PRTime aTime,
const nsACString& aIconURI, uint32_t aContainerType, bool aReadOnly,
const nsACString& aIconURI, uint32_t aContainerType,
nsNavHistoryQueryOptions* aOptions) :
nsNavHistoryResultNode(aURI, aTitle, 0, aTime, aIconURI),
mResult(nullptr),
mContainerType(aContainerType),
mExpanded(false),
mChildrenReadOnly(aReadOnly),
mOptions(aOptions),
mAsyncCanceledState(NOT_CANCELED)
{
@@ -1716,16 +1714,6 @@ nsNavHistoryContainerResultNode::FindNodeByDetails(const nsACString& aURIString,
return NS_OK;
}
/**
* @note Overridden for folders to query the bookmarks service directly.
*/
NS_IMETHODIMP
nsNavHistoryContainerResultNode::GetChildrenReadOnly(bool *aChildrenReadOnly)
{
*aChildrenReadOnly = mChildrenReadOnly;
return NS_OK;
}
/**
* HOW QUERY UPDATING WORKS
*
@@ -1753,7 +1741,7 @@ nsNavHistoryQueryResultNode::nsNavHistoryQueryResultNode(
const nsACString& aQueryURI) :
nsNavHistoryContainerResultNode(aQueryURI, aTitle, aIconURI,
nsNavHistoryResultNode::RESULT_TYPE_QUERY,
true, nullptr),
nullptr),
mLiveUpdate(QUERYUPDATE_COMPLEX_WITH_BOOKMARKS),
mHasSearchTerms(false),
mContentsValid(false),
@@ -1767,7 +1755,7 @@ nsNavHistoryQueryResultNode::nsNavHistoryQueryResultNode(
nsNavHistoryQueryOptions* aOptions) :
nsNavHistoryContainerResultNode(EmptyCString(), aTitle, aIconURI,
nsNavHistoryResultNode::RESULT_TYPE_QUERY,
true, aOptions),
aOptions),
mQueries(aQueries),
mContentsValid(false),
mBatchChanges(0),
@@ -1800,7 +1788,7 @@ nsNavHistoryQueryResultNode::nsNavHistoryQueryResultNode(
nsNavHistoryQueryOptions* aOptions) :
nsNavHistoryContainerResultNode(EmptyCString(), aTitle, aTime, aIconURI,
nsNavHistoryResultNode::RESULT_TYPE_QUERY,
true, aOptions),
aOptions),
mQueries(aQueries),
mContentsValid(false),
mBatchChanges(0),
@@ -2988,7 +2976,7 @@ nsNavHistoryFolderResultNode::nsNavHistoryFolderResultNode(
int64_t aFolderId) :
nsNavHistoryContainerResultNode(EmptyCString(), aTitle, EmptyCString(),
nsNavHistoryResultNode::RESULT_TYPE_FOLDER,
false, aOptions),
aOptions),
mContentsValid(false),
mQueryItemId(-1),
mIsRegisteredFolderObserver(false)
@@ -3090,25 +3078,6 @@ nsNavHistoryFolderResultNode::GetItemId(int64_t* aItemId)
return NS_OK;
}
/**
* Here, we override the getter and ignore the value stored in our object.
* The bookmarks service can tell us whether this folder should be read-only
* or not.
*
* It would be nice to put this code in the folder constructor, but the
* database was complaining. I believe it is because most folders are created
* while enumerating the bookmarks table and having a statement open, and doing
* another statement might make it unhappy in some cases.
*/
NS_IMETHODIMP
nsNavHistoryFolderResultNode::GetChildrenReadOnly(bool *aChildrenReadOnly)
{
nsNavBookmarks* bookmarks = nsNavBookmarks::GetBookmarksService();
NS_ENSURE_TRUE(bookmarks, NS_ERROR_UNEXPECTED);
return bookmarks->GetFolderReadonly(mItemId, aChildrenReadOnly);
}
NS_IMETHODIMP
nsNavHistoryFolderResultNode::GetFolderItemId(int64_t* aItemId)
{