Bug 1315812 - Mark nsISupportsArray, nsICollection, nsIEnumerator as deprecated. r=froydnj
authorEric Rahm <erahm@mozilla.com>
Thu, 10 Nov 2016 13:15:33 -0800
changeset 322118 f424e29dc77ed2790f3ab6e05940a31c4a85316a
parent 322117 ce03bdac8155517a5fe17def6efb1cc6bdc9900d
child 322119 4e31a2cb26bdc0147dcf5b6cf9e104ab0a48c80d
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersfroydnj
bugs1315812
milestone52.0a1
Bug 1315812 - Mark nsISupportsArray, nsICollection, nsIEnumerator as deprecated. r=froydnj This marks the idl classes as deprecated, removes an unnecessary include that was triggering deprecation warnings and wraps a necessary include in XPCOMInit.cpp that is used for registering the component in deprecation disabling pragmas. MozReview-Commit-ID: BbNU5q8O4Q4
embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
xpcom/build/XPCOM.h
xpcom/build/XPCOMInit.cpp
xpcom/ds/nsICollection.idl
xpcom/ds/nsIEnumerator.idl
xpcom/ds/nsISupportsArray.idl
xpcom/ds/nsSupportsArray.cpp
xpcom/ds/nsSupportsArray.h
xpcom/ds/nsSupportsArrayEnumerator.cpp
xpcom/ds/nsSupportsArrayEnumerator.h
xpcom/glue/tests/gtest/TestArray.cpp
--- a/embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
+++ b/embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
@@ -24,17 +24,16 @@
 #include "nsIEncodedChannel.h"
 #include "nsIUploadChannel.h"
 #include "nsICacheInfoChannel.h"
 #include "nsIFileChannel.h"
 #include "nsEscape.h"
 #include "nsUnicharUtils.h"
 #include "nsIStringEnumerator.h"
 #include "nsCRT.h"
-#include "nsSupportsArray.h"
 #include "nsContentCID.h"
 #include "nsStreamUtils.h"
 
 #include "nsCExternalHandlerService.h"
 
 #include "nsIURL.h"
 #include "nsIFileURL.h"
 #include "nsIWebProgressListener.h"
--- a/xpcom/build/XPCOM.h
+++ b/xpcom/build/XPCOM.h
@@ -58,17 +58,16 @@
 
 // interfaces that inherit directly from nsISupports
 
 #include "nsIArray.h"
 #include "nsIAtom.h"
 #include "nsIAtomService.h"
 #include "nsICategoryManager.h"
 #include "nsIClassInfo.h"
-#include "nsICollection.h"
 #include "nsIComponentManager.h"
 #include "nsIConsoleListener.h"
 #include "nsIConsoleMessage.h"
 #include "nsIConsoleService.h"
 #include "nsIDebug2.h"
 #include "nsIDirectoryEnumerator.h"
 #include "nsIEnvironment.h"
 #include "nsIErrorService.h"
--- a/xpcom/build/XPCOMInit.cpp
+++ b/xpcom/build/XPCOMInit.cpp
@@ -33,17 +33,34 @@
 #include "nsPipe.h"
 #include "nsScriptableBase64Encoder.h"
 
 #include "nsMemoryImpl.h"
 #include "nsDebugImpl.h"
 #include "nsTraceRefcnt.h"
 #include "nsErrorService.h"
 
+// Disable deprecation warnings generated by nsISupportsArray and associated
+// classes.
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#elif defined(_MSC_VER)
+#pragma warning (push)
+#pragma warning (disable : 4996)
+#endif
+
 #include "nsSupportsArray.h"
+
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#elif defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #include "nsArray.h"
 #include "nsINIParserImpl.h"
 #include "nsSupportsPrimitives.h"
 #include "nsConsoleService.h"
 
 #include "nsComponentManager.h"
 #include "nsCategoryManagerUtils.h"
 #include "nsIServiceManager.h"
--- a/xpcom/ds/nsICollection.idl
+++ b/xpcom/ds/nsICollection.idl
@@ -2,17 +2,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISerializable.idl"
 
 interface nsIEnumerator;
 
-[scriptable, uuid(83b6019c-cbc4-11d2-8cca-0060b0fc14a3)]
+[deprecated, scriptable, uuid(83b6019c-cbc4-11d2-8cca-0060b0fc14a3)]
 interface nsICollection : nsISerializable
 {
 
   uint32_t Count();
   nsISupports GetElementAt(in uint32_t index);
   void QueryElementAt(in uint32_t index, in nsIIDRef uuid, 
                       [iid_is(uuid),retval] out nsQIResult result);
   void SetElementAt(in uint32_t index, in nsISupports item);
--- a/xpcom/ds/nsIEnumerator.idl
+++ b/xpcom/ds/nsIEnumerator.idl
@@ -11,17 +11,17 @@
 /*
  * DO NOT USE THIS INTERFACE.  IT IS HORRIBLY BROKEN, USES NS_COMFALSE
  * AND IS BASICALLY IMPOSSIBLE TO USE CORRECTLY THROUGH PROXIES OR
  * XPCONNECT.  IF YOU SEE NEW USES OF THIS INTERFACE IN CODE YOU ARE
  * REVIEWING, YOU SHOULD INSIST ON nsISimpleEnumerator.
  *
  * DON'T MAKE ME COME OVER THERE.
  */
-[scriptable, uuid(ad385286-cbc4-11d2-8cca-0060b0fc14a3)]
+[deprecated, scriptable, uuid(ad385286-cbc4-11d2-8cca-0060b0fc14a3)]
 interface nsIEnumerator : nsISupports {
   /** First will reset the list. will return NS_FAILED if no items
    */
   void first();
 
   /** Next will advance the list. will return failed if already at end
    */
   void next();
@@ -32,17 +32,17 @@ interface nsIEnumerator : nsISupports {
   nsISupports currentItem();
 
   /** return if the collection is at the end.  that is the beginning following 
    *  a call to Prev and it is the end of the list following a call to next
    */
   void isDone();
 };
 
-[uuid(75f158a0-cadd-11d2-8cca-0060b0fc14a3)]
+[deprecated, uuid(75f158a0-cadd-11d2-8cca-0060b0fc14a3)]
 interface nsIBidirectionalEnumerator : nsIEnumerator {
 
   /** Last will reset the list to the end. will return NS_FAILED if no items
    */
   void last();
 
   /** Prev will decrement the list. will return failed if already at beginning
    */
--- a/xpcom/ds/nsISupportsArray.idl
+++ b/xpcom/ds/nsISupportsArray.idl
@@ -25,17 +25,17 @@ class nsISupportsArray;
     0x0d6b,                                          \
     0x11d3,                                          \
     {0x93, 0x31, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
 }
 #define NS_SUPPORTSARRAY_CONTRACTID "@mozilla.org/supports-array;1"
  
 %}
 
-[scriptable, uuid(241addc8-3608-4e73-8083-2fd6fa09eba2)]
+[deprecated, scriptable, uuid(241addc8-3608-4e73-8083-2fd6fa09eba2)]
 interface nsISupportsArray : nsICollection {
 
   [notxpcom] long IndexOf([const] in nsISupports aPossibleElement);
   
   // xpcom-compatible versions
   long GetIndexOf(in nsISupports aPossibleElement);
   
   [notxpcom] boolean InsertElementAt(in nsISupports aElement,
--- a/xpcom/ds/nsSupportsArray.cpp
+++ b/xpcom/ds/nsSupportsArray.cpp
@@ -8,16 +8,26 @@
 #include <string.h>
 
 #include "nsArrayEnumerator.h"
 #include "nsIObjectInputStream.h"
 #include "nsIObjectOutputStream.h"
 #include "nsSupportsArray.h"
 #include "nsSupportsArrayEnumerator.h"
 
+// Disable deprecation warnings generated by nsISupportsArray and associated
+// classes.
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#elif defined(_MSC_VER)
+#pragma warning (push)
+#pragma warning (disable : 4996)
+#endif
+
 nsresult
 nsQueryElementAt::operator()(const nsIID& aIID, void** aResult) const
 {
   nsresult status =
     mCollection ? mCollection->QueryElementAt(mIndex, aIID, aResult) :
                   NS_ERROR_NULL_POINTER;
 
   if (mErrorPtr) {
@@ -240,8 +250,15 @@ nsSupportsArray::IndexOf(uint32_t aStart
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSupportsArray::Enumerate(nsISimpleEnumerator** aResult)
 {
   return NS_NewArrayEnumerator(aResult, this);
 }
+
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#elif defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
--- a/xpcom/ds/nsSupportsArray.h
+++ b/xpcom/ds/nsSupportsArray.h
@@ -3,20 +3,32 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsSupportsArray_h__
 #define nsSupportsArray_h__
 
 #include "nsIArray.h"
-#include "nsISupportsArray.h"
 #include "nsCOMArray.h"
 #include "mozilla/Attributes.h"
 
+
+// Disable deprecation warnings generated by nsISupportsArray and associated
+// classes.
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#elif defined(_MSC_VER)
+#pragma warning (push)
+#pragma warning (disable : 4996)
+#endif
+
+#include "nsISupportsArray.h"
+
 class nsSupportsArray final : public nsISupportsArray,
                               public nsIArray
 {
   ~nsSupportsArray(void); // nonvirtual since we're not subclassed
 
 public:
   nsSupportsArray(void);
 
@@ -81,9 +93,15 @@ public:
 
 private:
   // Copy constructors are not allowed
   explicit nsSupportsArray(const nsISupportsArray& aOther);
 
   nsCOMArray<nsISupports> mArray;
 };
 
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#elif defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif // nsSupportsArray_h__
--- a/xpcom/ds/nsSupportsArrayEnumerator.cpp
+++ b/xpcom/ds/nsSupportsArrayEnumerator.cpp
@@ -1,15 +1,26 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsSupportsArrayEnumerator.h"
+
+// Disable deprecation warnings generated by nsISupportsArray and associated
+// classes.
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#elif defined(_MSC_VER)
+#pragma warning (push)
+#pragma warning (disable : 4996)
+#endif
+
 #include "nsISupportsArray.h"
 
 nsSupportsArrayEnumerator::nsSupportsArrayEnumerator(nsISupportsArray* array)
   : mArray(array)
   , mCursor(0)
 {
   NS_ASSERTION(array, "null array");
 }
@@ -108,8 +119,13 @@ nsSupportsArrayEnumerator::Prev()
   }
   if (mCursor >= 0) {
     return NS_OK;
   } else {
     return NS_ERROR_FAILURE;
   }
 }
 
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#elif defined(_MSC_VER)
+#pragma warning (pop)
+#endif
--- a/xpcom/ds/nsSupportsArrayEnumerator.h
+++ b/xpcom/ds/nsSupportsArrayEnumerator.h
@@ -3,18 +3,29 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsSupportsArrayEnumerator_h___
 #define nsSupportsArrayEnumerator_h___
 
 #include "nsCOMPtr.h"
+#include "mozilla/Attributes.h"
+
+// Disable deprecation warnings generated by nsISupportsArray and associated
+// classes.
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#elif defined(_MSC_VER)
+#pragma warning (push)
+#pragma warning (disable : 4996)
+#endif
+
 #include "nsIEnumerator.h"
-#include "mozilla/Attributes.h"
 
 class nsISupportsArray;
 
 class nsSupportsArrayEnumerator final : public nsIBidirectionalEnumerator
 {
 public:
   NS_DECL_ISUPPORTS
 
@@ -30,10 +41,16 @@ private:
   ~nsSupportsArrayEnumerator();
 
 protected:
   nsCOMPtr<nsISupportsArray> mArray;
   int32_t               mCursor;
 
 };
 
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#elif defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif // __nsSupportsArrayEnumerator_h
 
--- a/xpcom/glue/tests/gtest/TestArray.cpp
+++ b/xpcom/glue/tests/gtest/TestArray.cpp
@@ -1,18 +1,29 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <stdio.h>
 #include <stdlib.h>
+#include "gtest/gtest.h"
+
+// Disable deprecation warnings generated by nsISupportsArray and associated
+// classes.
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#elif defined(_MSC_VER)
+#pragma warning (push)
+#pragma warning (disable : 4996)
+#endif
+
 #include "nsISupportsArray.h"
-#include "gtest/gtest.h"
 
 // {9e70a320-be02-11d1-8031-006008159b5a}
 #define NS_IFOO_IID \
   {0x9e70a320, 0xbe02, 0x11d1,    \
     {0x80, 0x31, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
 
 namespace TestArray {
 
@@ -145,8 +156,14 @@ TEST(Array, main)
     array->Clear();
     FillArray(array, 4);
     CheckArray(array, 4, fillResult, 4);
 
     // test delete
     NS_RELEASE(array);
   }
 }
+
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#elif defined(_MSC_VER)
+#pragma warning (pop)
+#endif