Bug 1308317 - Part 5: Remove nsSupportsArray::DeleteLastElement. r=froydnj

|DeleteLastElement| is scriptable, but a search of our add-on repo turned up
no hits and there were no references in gecko code. This also allows us to
remove the non-scriptable |RemoveLastElement| which was only called by
|DeleteLastElement|.

MozReview-Commit-ID: 20FXBrosacA
This commit is contained in:
Eric Rahm 2016-10-13 22:04:38 -07:00
parent b8014cf9d8
commit 08e653d2cf
4 changed files with 1 additions and 25 deletions

View File

@ -50,10 +50,8 @@ interface nsISupportsArray : nsICollection {
in unsigned long aIndex);
[notxpcom] boolean RemoveElementAt(in unsigned long aIndex);
[notxpcom] boolean RemoveLastElement([const] in nsISupports aElement);
// xpcom-compatible versions
void DeleteLastElement(in nsISupports aElement);
void DeleteElementAt(in unsigned long aIndex);
void Compact();

View File

@ -320,18 +320,6 @@ nsSupportsArray::RemoveElement(nsISupports* aElement)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP_(bool)
nsSupportsArray::RemoveLastElement(const nsISupports* aElement)
{
int32_t theIndex = LastIndexOf(aElement);
if (theIndex >= 0) {
return RemoveElementAt(theIndex);
}
return false;
}
NS_IMETHODIMP
nsSupportsArray::Clear(void)
{

View File

@ -95,13 +95,6 @@ public:
{
return RemoveElementsAt(aIndex, 1);
}
MOZ_MUST_USE NS_IMETHOD_(bool)
RemoveLastElement(const nsISupports* aElement) override;
MOZ_MUST_USE NS_IMETHOD DeleteLastElement(nsISupports* aElement) override
{
return (RemoveLastElement(aElement) ? NS_OK : NS_ERROR_FAILURE);
}
MOZ_MUST_USE NS_IMETHOD DeleteElementAt(uint32_t aIndex) override
{

View File

@ -138,7 +138,7 @@ TEST(Array, main)
int32_t replaceResult[13] = {3, 0, 1, 2, 3, 4, 3, 5, 3, 7, 8, 9, 3};
CheckArray(array, 13, replaceResult, 9);
// test RemoveElementAt, RemoveElement RemoveLastElement
// test RemoveElementAt, RemoveElement
array->RemoveElementAt(0);
int32_t removeResult[12] = {0, 1, 2, 3, 4, 3, 5, 3, 7, 8, 9, 3};
CheckArray(array, 12, removeResult, 9);
@ -148,9 +148,6 @@ TEST(Array, main)
array->RemoveElement(foo);
int32_t removeResult3[10] = {0, 1, 2, 4, 3, 5, 7, 8, 9, 3};
CheckArray(array, 10, removeResult3, 9);
array->RemoveLastElement(foo);
int32_t removeResult4[9] = {0, 1, 2, 4, 3, 5, 7, 8, 9};
CheckArray(array, 9, removeResult4, 9);
foo = nullptr;