Bug 1883506 - Remove out-param from nsIMsgDBView.open and .openWithHdrs. r=leftmostcat

Differential Revision: https://phabricator.services.mozilla.com/D204307

--HG--
extra : amend_source : 3c651e60a656322c4b54336ba7334319ea0af130
This commit is contained in:
Geoff Lankow 2024-03-12 02:38:26 -07:00
Родитель 256c3798f5
Коммит d62c2bf3a4
18 изменённых файлов: 36 добавлений и 84 удалений

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

@ -1133,7 +1133,6 @@ DBViewWrapper.prototype = {
? 0
: this._sort.length - 1;
let [sortType, sortOrder, sortCustomCol] = this._getSortDetails(index);
const outCount = {};
// when the underlying folder is a single real folder (virtual or no), we
// tell the view about the underlying folder.
if (this.isSingleFolder) {
@ -1147,13 +1146,7 @@ DBViewWrapper.prototype = {
}
// Open the folder.
dbView.open(
this._underlyingFolders[0],
sortType,
sortOrder,
viewFlags,
outCount
);
dbView.open(this._underlyingFolders[0], sortType, sortOrder, viewFlags);
// If there are any search terms, we need to tell the db view about the
// the display (/virtual) folder so it can store all the view-specific
@ -1172,13 +1165,7 @@ DBViewWrapper.prototype = {
// db view about the display folder. (It gets its own XFVF view, so it
// knows what to do.)
// and for a synthetic folder, displayedFolder is null anyways
dbView.open(
this.displayedFolder,
sortType,
sortOrder,
viewFlags,
outCount
);
dbView.open(this.displayedFolder, sortType, sortOrder, viewFlags);
}
if (sortCustomCol) {
dbView.curCustomColumn = sortCustomCol;

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

@ -218,11 +218,10 @@ interface nsIMsgDBView : nsISupports
void open(in nsIMsgFolder folder,
in nsMsgViewSortTypeValue sortType,
in nsMsgViewSortOrderValue sortOrder,
in nsMsgViewFlagsTypeValue viewFlags,
out long count);
in nsMsgViewFlagsTypeValue viewFlags);
void openWithHdrs(in nsIMsgEnumerator aHeaders, in nsMsgViewSortTypeValue aSortType,
in nsMsgViewSortOrderValue aSortOrder,
in nsMsgViewFlagsTypeValue aViewFlags, out long aCount);
in nsMsgViewFlagsTypeValue aViewFlags);
void close();
void init(in nsIMessenger aMessengerInstance, in nsIMsgWindow aMsgWindow, in nsIMsgDBViewCommandUpdater aCommandUpdater);

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

@ -2115,7 +2115,7 @@ nsMsgDBView::CycleCell(int32_t row, nsTreeColumn* col) {
NS_IMETHODIMP
nsMsgDBView::Open(nsIMsgFolder* folder, nsMsgViewSortTypeValue sortType,
nsMsgViewSortOrderValue sortOrder,
nsMsgViewFlagsTypeValue viewFlags, int32_t* pCount) {
nsMsgViewFlagsTypeValue viewFlags) {
m_viewFlags = viewFlags;
m_sortOrder = sortOrder;
m_sortType = sortType;
@ -2254,7 +2254,7 @@ NS_IMETHODIMP
nsMsgDBView::OpenWithHdrs(nsIMsgEnumerator* aHeaders,
nsMsgViewSortTypeValue aSortType,
nsMsgViewSortOrderValue aSortOrder,
nsMsgViewFlagsTypeValue aViewFlags, int32_t* aCount) {
nsMsgViewFlagsTypeValue aViewFlags) {
NS_ASSERTION(false, "not implemented");
return NS_ERROR_NOT_IMPLEMENTED;
}

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

@ -29,9 +29,8 @@ nsMsgGroupView::~nsMsgGroupView() {}
NS_IMETHODIMP
nsMsgGroupView::Open(nsIMsgFolder* aFolder, nsMsgViewSortTypeValue aSortType,
nsMsgViewSortOrderValue aSortOrder,
nsMsgViewFlagsTypeValue aViewFlags, int32_t* aCount) {
nsresult rv =
nsMsgDBView::Open(aFolder, aSortType, aSortOrder, aViewFlags, aCount);
nsMsgViewFlagsTypeValue aViewFlags) {
nsresult rv = nsMsgDBView::Open(aFolder, aSortType, aSortOrder, aViewFlags);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDBFolderInfo> dbFolderInfo;
@ -41,7 +40,7 @@ nsMsgGroupView::Open(nsIMsgFolder* aFolder, nsMsgViewSortTypeValue aSortType,
rv = m_db->EnumerateMessages(getter_AddRefs(headers));
NS_ENSURE_SUCCESS(rv, rv);
return OpenWithHdrs(headers, aSortType, aSortOrder, aViewFlags, aCount);
return OpenWithHdrs(headers, aSortType, aSortOrder, aViewFlags);
}
void nsMsgGroupView::InternalClose() {
@ -370,8 +369,7 @@ NS_IMETHODIMP
nsMsgGroupView::OpenWithHdrs(nsIMsgEnumerator* aHeaders,
nsMsgViewSortTypeValue aSortType,
nsMsgViewSortOrderValue aSortOrder,
nsMsgViewFlagsTypeValue aViewFlags,
int32_t* aCount) {
nsMsgViewFlagsTypeValue aViewFlags) {
nsresult rv = NS_OK;
m_groupsTable.Clear();
@ -440,7 +438,6 @@ nsMsgGroupView::OpenWithHdrs(nsIMsgEnumerator* aHeaders,
}
}
}
*aCount = m_keys.Length();
return rv;
}
@ -491,7 +488,6 @@ nsMsgGroupView::CopyDBView(nsMsgDBView* aNewMsgDBView,
nsresult nsMsgGroupView::RebuildView(nsMsgViewFlagsTypeValue newFlags) {
nsCOMPtr<nsIMsgEnumerator> headers;
if (NS_SUCCEEDED(GetMessageEnumerator(getter_AddRefs(headers)))) {
int32_t count;
m_dayChanged = false;
AutoTArray<nsMsgKey, 1> preservedSelection;
nsMsgKey curSelectedKey;
@ -511,8 +507,7 @@ nsresult nsMsgGroupView::RebuildView(nsMsgViewFlagsTypeValue newFlags) {
if (mJSTree) mJSTree->RowCountChanged(0, -oldSize);
SetSuppressChangeNotifications(true);
nsresult rv =
OpenWithHdrs(headers, m_sortType, m_sortOrder, newFlags, &count);
nsresult rv = OpenWithHdrs(headers, m_sortType, m_sortOrder, newFlags);
SetSuppressChangeNotifications(false);
if (mTree) mTree->RowCountChanged(0, GetSize());
if (mJSTree) mJSTree->RowCountChanged(0, GetSize());

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

@ -23,12 +23,11 @@ class nsMsgGroupView : public nsMsgDBView {
NS_IMETHOD Open(nsIMsgFolder* folder, nsMsgViewSortTypeValue sortType,
nsMsgViewSortOrderValue sortOrder,
nsMsgViewFlagsTypeValue viewFlags, int32_t* pCount) override;
nsMsgViewFlagsTypeValue viewFlags) override;
NS_IMETHOD OpenWithHdrs(nsIMsgEnumerator* aHeaders,
nsMsgViewSortTypeValue aSortType,
nsMsgViewSortOrderValue aSortOrder,
nsMsgViewFlagsTypeValue aViewFlags,
int32_t* aCount) override;
nsMsgViewFlagsTypeValue aViewFlags) override;
NS_IMETHOD GetViewType(nsMsgViewTypeValue* aViewType) override;
NS_IMETHOD CopyDBView(nsMsgDBView* aNewMsgDBView,
nsIMessenger* aMessengerInstance,

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

@ -27,10 +27,8 @@ NS_IMPL_ISUPPORTS_INHERITED(nsMsgQuickSearchDBView, nsMsgDBView, nsIMsgDBView,
NS_IMETHODIMP nsMsgQuickSearchDBView::Open(nsIMsgFolder* folder,
nsMsgViewSortTypeValue sortType,
nsMsgViewSortOrderValue sortOrder,
nsMsgViewFlagsTypeValue viewFlags,
int32_t* pCount) {
nsresult rv =
nsMsgDBView::Open(folder, sortType, sortOrder, viewFlags, pCount);
nsMsgViewFlagsTypeValue viewFlags) {
nsresult rv = nsMsgDBView::Open(folder, sortType, sortOrder, viewFlags);
NS_ENSURE_SUCCESS(rv, rv);
if (!m_db) return NS_ERROR_NULL_POINTER;
@ -38,7 +36,6 @@ NS_IMETHODIMP nsMsgQuickSearchDBView::Open(nsIMsgFolder* folder,
int32_t count;
rv = InitThreadedView(count);
if (pCount) *pCount = count;
return rv;
}
@ -743,11 +740,10 @@ NS_IMETHODIMP
nsMsgQuickSearchDBView::OpenWithHdrs(nsIMsgEnumerator* aHeaders,
nsMsgViewSortTypeValue aSortType,
nsMsgViewSortOrderValue aSortOrder,
nsMsgViewFlagsTypeValue aViewFlags,
int32_t* aCount) {
nsMsgViewFlagsTypeValue aViewFlags) {
if (aViewFlags & nsMsgViewFlagsType::kGroupBySort)
return nsMsgGroupView::OpenWithHdrs(aHeaders, aSortType, aSortOrder,
aViewFlags, aCount);
aViewFlags);
m_sortType = aSortType;
m_sortOrder = aSortOrder;
@ -765,7 +761,6 @@ nsMsgQuickSearchDBView::OpenWithHdrs(nsIMsgEnumerator* aHeaders,
break;
}
}
*aCount = m_keys.Length();
return rv;
}

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

@ -25,12 +25,11 @@ class nsMsgQuickSearchDBView : public nsMsgThreadedDBView,
virtual const char* GetViewName(void) override { return "QuickSearchView"; }
NS_IMETHOD Open(nsIMsgFolder* folder, nsMsgViewSortTypeValue sortType,
nsMsgViewSortOrderValue sortOrder,
nsMsgViewFlagsTypeValue viewFlags, int32_t* pCount) override;
nsMsgViewFlagsTypeValue viewFlags) override;
NS_IMETHOD OpenWithHdrs(nsIMsgEnumerator* aHeaders,
nsMsgViewSortTypeValue aSortType,
nsMsgViewSortOrderValue aSortOrder,
nsMsgViewFlagsTypeValue aViewFlags,
int32_t* aCount) override;
nsMsgViewFlagsTypeValue aViewFlags) override;
NS_IMETHOD CloneDBView(nsIMessenger* aMessengerInstance,
nsIMsgWindow* aMsgWindow,
nsIMsgDBViewCommandUpdater* aCommandUpdater,

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

@ -41,7 +41,7 @@ NS_IMPL_ISUPPORTS_INHERITED(nsMsgSearchDBView, nsMsgDBView, nsIMsgDBView,
NS_IMETHODIMP
nsMsgSearchDBView::Open(nsIMsgFolder* folder, nsMsgViewSortTypeValue sortType,
nsMsgViewSortOrderValue sortOrder,
nsMsgViewFlagsTypeValue viewFlags, int32_t* pCount) {
nsMsgViewFlagsTypeValue viewFlags) {
// DBViewWrapper.jsm likes to create search views with a sort order
// of byNone, in order to have the order be the order the search results
// are returned. But this doesn't work with threaded view, so make the
@ -51,8 +51,7 @@ nsMsgSearchDBView::Open(nsIMsgFolder* folder, nsMsgViewSortTypeValue sortType,
sortType == nsMsgViewSortType::byNone)
sortType = nsMsgViewSortType::byDate;
nsresult rv =
nsMsgDBView::Open(folder, sortType, sortOrder, viewFlags, pCount);
nsresult rv = nsMsgDBView::Open(folder, sortType, sortOrder, viewFlags);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrefBranch> prefBranch(
@ -62,9 +61,6 @@ nsMsgSearchDBView::Open(nsIMsgFolder* folder, nsMsgViewSortTypeValue sortType,
// Our sort is automatically valid because we have no contents at this point!
m_sortValid = true;
if (pCount) *pCount = 0;
m_folder = nullptr;
return rv;
}
@ -1092,11 +1088,10 @@ NS_IMETHODIMP
nsMsgSearchDBView::OpenWithHdrs(nsIMsgEnumerator* aHeaders,
nsMsgViewSortTypeValue aSortType,
nsMsgViewSortOrderValue aSortOrder,
nsMsgViewFlagsTypeValue aViewFlags,
int32_t* aCount) {
nsMsgViewFlagsTypeValue aViewFlags) {
if (aViewFlags & nsMsgViewFlagsType::kGroupBySort)
return nsMsgGroupView::OpenWithHdrs(aHeaders, aSortType, aSortOrder,
aViewFlags, aCount);
aViewFlags);
m_sortType = aSortType;
m_sortOrder = aSortOrder;
@ -1116,7 +1111,6 @@ nsMsgSearchDBView::OpenWithHdrs(nsIMsgEnumerator* aHeaders,
}
}
*aCount = m_keys.Length();
return rv;
}

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

@ -33,7 +33,7 @@ class nsMsgSearchDBView : public nsMsgGroupView,
virtual const char* GetViewName(void) override { return "SearchView"; }
NS_IMETHOD Open(nsIMsgFolder* folder, nsMsgViewSortTypeValue sortType,
nsMsgViewSortOrderValue sortOrder,
nsMsgViewFlagsTypeValue viewFlags, int32_t* pCount) override;
nsMsgViewFlagsTypeValue viewFlags) override;
NS_IMETHOD CloneDBView(nsIMessenger* aMessengerInstance,
nsIMsgWindow* aMsgWindow,
nsIMsgDBViewCommandUpdater* aCmdUpdater,
@ -56,8 +56,7 @@ class nsMsgSearchDBView : public nsMsgGroupView,
NS_IMETHOD OpenWithHdrs(nsIMsgEnumerator* aHeaders,
nsMsgViewSortTypeValue aSortType,
nsMsgViewSortOrderValue aSortOrder,
nsMsgViewFlagsTypeValue aViewFlags,
int32_t* aCount) override;
nsMsgViewFlagsTypeValue aViewFlags) override;
NS_IMETHOD OnHdrDeleted(nsIMsgDBHdr* aHdrDeleted, nsMsgKey aParentKey,
int32_t aFlags,
nsIDBChangeListener* aInstigator) override;

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

@ -27,9 +27,8 @@ nsMsgThreadedDBView::~nsMsgThreadedDBView() {} /* destructor code */
NS_IMETHODIMP
nsMsgThreadedDBView::Open(nsIMsgFolder* folder, nsMsgViewSortTypeValue sortType,
nsMsgViewSortOrderValue sortOrder,
nsMsgViewFlagsTypeValue viewFlags, int32_t* pCount) {
nsresult rv =
nsMsgDBView::Open(folder, sortType, sortOrder, viewFlags, pCount);
nsMsgViewFlagsTypeValue viewFlags) {
nsresult rv = nsMsgDBView::Open(folder, sortType, sortOrder, viewFlags);
NS_ENSURE_SUCCESS(rv, rv);
if (!m_db) return NS_ERROR_NULL_POINTER;
@ -61,7 +60,6 @@ nsMsgThreadedDBView::Open(nsIMsgFolder* folder, nsMsgViewSortTypeValue sortType,
int32_t count;
rv = InitThreadedView(count);
if (pCount) *pCount = count;
// This is a hack, but we're trying to find a way to correct
// incorrect total and unread msg counts w/o paying a big

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

@ -16,7 +16,7 @@ class nsMsgThreadedDBView : public nsMsgGroupView {
NS_IMETHOD Open(nsIMsgFolder* folder, nsMsgViewSortTypeValue sortType,
nsMsgViewSortOrderValue sortOrder,
nsMsgViewFlagsTypeValue viewFlags, int32_t* pCount) override;
nsMsgViewFlagsTypeValue viewFlags) override;
NS_IMETHOD CloneDBView(nsIMessenger* aMessengerInstance,
nsIMsgWindow* aMsgWindow,
nsIMsgDBViewCommandUpdater* aCommandUpdater,

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

@ -30,11 +30,9 @@ NS_IMETHODIMP
nsMsgXFVirtualFolderDBView::Open(nsIMsgFolder* folder,
nsMsgViewSortTypeValue sortType,
nsMsgViewSortOrderValue sortOrder,
nsMsgViewFlagsTypeValue viewFlags,
int32_t* pCount) {
nsMsgViewFlagsTypeValue viewFlags) {
m_viewFolder = folder;
return nsMsgSearchDBView::Open(folder, sortType, sortOrder, viewFlags,
pCount);
return nsMsgSearchDBView::Open(folder, sortType, sortOrder, viewFlags);
}
void nsMsgXFVirtualFolderDBView::RemovePendingDBListeners() {

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

@ -27,7 +27,7 @@ class nsMsgXFVirtualFolderDBView : public nsMsgSearchDBView {
}
NS_IMETHOD Open(nsIMsgFolder* folder, nsMsgViewSortTypeValue sortType,
nsMsgViewSortOrderValue sortOrder,
nsMsgViewFlagsTypeValue viewFlags, int32_t* pCount) override;
nsMsgViewFlagsTypeValue viewFlags) override;
NS_IMETHOD CloneDBView(nsIMessenger* aMessengerInstance,
nsIMsgWindow* aMsgWindow,
nsIMsgDBViewCommandUpdater* aCmdUpdater,

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

@ -131,13 +131,11 @@ add_setup(async function () {
gDBView = Cc[dbviewContractId].createInstance(Ci.nsIMsgDBView);
gDBView.init(null, null, null);
var outCount = {};
gDBView.open(
gLocalInboxFolder,
Ci.nsMsgViewSortType.byDate,
Ci.nsMsgViewSortOrder.ascending,
view_flag,
outCount
view_flag
);
gTreeView = gDBView.QueryInterface(Ci.nsITreeView);

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

@ -254,18 +254,14 @@ function setup_view(aViewType, aViewFlags, aTestFolder) {
gDBView = Cc[dbviewContractId].createInstance(Ci.nsIMsgDBView);
gDBView.init(null, null, null);
var outCount = {};
gDBView.open(
aViewType != "search" ? aTestFolder : null,
Ci.nsMsgViewSortType.byDate,
aViewType != "search"
? Ci.nsMsgViewSortOrder.ascending
: Ci.nsMsgViewSortOrder.descending,
aViewFlags,
outCount
aViewFlags
);
// outCount is 0 if byCustom; view is built by addColumnHandler()
dump(" View Out Count: " + outCount.value + "\n");
// we need to cram messages into the search via nsIMsgSearchNotify interface
if (

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

@ -86,13 +86,11 @@ add_task(async function test_nsMsgDBView_headValues() {
const dbviewContractId = "@mozilla.org/messenger/msgdbview;1?type=threaded";
const dbView = Cc[dbviewContractId].createInstance(Ci.nsIMsgDBView);
dbView.init(null, null, null);
const outCount = {};
dbView.open(
folder,
Ci.nsMsgViewSortType.byDate,
Ci.nsMsgViewSortOrder.ascending,
0,
outCount
0
);
// Did we add all the messages properly?

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

@ -454,7 +454,7 @@ function makeView(viewType, folder, sortType, flags, virtualFolder) {
if (virtualFolder) {
dbView.viewFolder = virtualFolder;
}
dbView.open(folder, sortType, Ci.nsMsgViewSortOrder.ascending, flags, {});
dbView.open(folder, sortType, Ci.nsMsgViewSortOrder.ascending, flags);
return dbView.QueryInterface(Ci.nsITreeView);
}

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

@ -129,17 +129,14 @@ function setup_view(aViewType, aViewFlags, aTestFolder) {
gDBView = Cc[dbviewContractId].createInstance(Ci.nsIMsgDBView);
gDBView.init(null, null, null);
var outCount = {};
gDBView.open(
aViewType != "search" ? aTestFolder : null,
Ci.nsMsgViewSortType.byDate,
aViewType != "search"
? Ci.nsMsgViewSortOrder.ascending
: Ci.nsMsgViewSortOrder.descending,
aViewFlags,
outCount
aViewFlags
);
dump(" View Out Count: " + outCount.value + "\n");
gTreeView = gDBView.QueryInterface(Ci.nsITreeView);
}