diff --git a/xpcom/ds/nsISupportsArray.idl b/xpcom/ds/nsISupportsArray.idl index cdf7fbc3fb56..75837d563b99 100644 --- a/xpcom/ds/nsISupportsArray.idl +++ b/xpcom/ds/nsISupportsArray.idl @@ -34,11 +34,9 @@ class nsISupportsArray; interface nsISupportsArray : nsICollection { [notxpcom] long IndexOf([const] in nsISupports aPossibleElement); - [notxpcom] long LastIndexOf([const] in nsISupports aPossibleElement); // xpcom-compatible versions long GetIndexOf(in nsISupports aPossibleElement); - long GetLastIndexOf(in nsISupports aPossibleElement); [notxpcom] boolean InsertElementAt(in nsISupports aElement, in unsigned long aIndex); diff --git a/xpcom/ds/nsSupportsArray.cpp b/xpcom/ds/nsSupportsArray.cpp index 2a94f3e5bcbe..84eb1124ee3d 100644 --- a/xpcom/ds/nsSupportsArray.cpp +++ b/xpcom/ds/nsSupportsArray.cpp @@ -221,21 +221,6 @@ nsSupportsArray::IndexOf(const nsISupports* aPossibleElement) return -1; } -NS_IMETHODIMP_(int32_t) -nsSupportsArray::LastIndexOf(const nsISupports* aPossibleElement) -{ - if (0 < mCount) { - const nsISupports** start = (const nsISupports**)mArray; // work around goofy compiler behavior - const nsISupports** ep = (start + mCount); - while (start <= --ep) { - if (aPossibleElement == *ep) { - return (ep - start); - } - } - } - return -1; -} - NS_IMETHODIMP_(bool) nsSupportsArray::InsertElementAt(nsISupports* aElement, uint32_t aIndex) { diff --git a/xpcom/ds/nsSupportsArray.h b/xpcom/ds/nsSupportsArray.h index e927a63689eb..f9959b12e578 100644 --- a/xpcom/ds/nsSupportsArray.h +++ b/xpcom/ds/nsSupportsArray.h @@ -61,7 +61,6 @@ public: // nsISupportsArray methods: NS_IMETHOD_(int32_t) IndexOf(const nsISupports* aPossibleElement) override; - NS_IMETHOD_(int32_t) LastIndexOf(const nsISupports* aPossibleElement) override; NS_IMETHOD GetIndexOf(nsISupports* aPossibleElement, int32_t* aResult) override { @@ -69,12 +68,6 @@ public: return NS_OK; } - NS_IMETHOD GetLastIndexOf(nsISupports* aPossibleElement, int32_t* aResult) override - { - *aResult = LastIndexOf(aPossibleElement); - return NS_OK; - } - MOZ_MUST_USE NS_IMETHOD_(bool) InsertElementAt(nsISupports* aElement, uint32_t aIndex) override; diff --git a/xpcom/glue/tests/gtest/TestArray.cpp b/xpcom/glue/tests/gtest/TestArray.cpp index 5a07bbfc05d2..18eb2a93f943 100644 --- a/xpcom/glue/tests/gtest/TestArray.cpp +++ b/xpcom/glue/tests/gtest/TestArray.cpp @@ -118,13 +118,10 @@ TEST(Array, main) CheckArray(array, 13, appendResult, 10); - // test IndexOf && LastIndexOf + // test IndexOf int32_t expectedIndex = 0; int32_t index = array->IndexOf(foo); EXPECT_EQ(index, expectedIndex); - expectedIndex = 12; - index = array->LastIndexOf(foo); - EXPECT_EQ(index, expectedIndex); // test ReplaceElementAt array->ReplaceElementAt(foo, 8);