diff --git a/content/base/src/nsDOMLists.cpp b/content/base/src/DOMStringList.cpp similarity index 57% rename from content/base/src/nsDOMLists.cpp rename to content/base/src/DOMStringList.cpp index 6c1f942cc289..10a5c10e5248 100644 --- a/content/base/src/nsDOMLists.cpp +++ b/content/base/src/DOMStringList.cpp @@ -3,35 +3,34 @@ * 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/. */ -/* - * Implementation of nsIDOMDOMStringList, used by various DOM stuff. - */ - -#include "nsDOMLists.h" +#include "mozilla/dom/DOMStringList.h" #include "nsError.h" #include "nsDOMClassInfoID.h" #include "nsINode.h" -nsDOMStringList::nsDOMStringList() +DOMCI_DATA(DOMStringList, mozilla::dom::DOMStringList) + +namespace mozilla { +namespace dom { + +DOMStringList::DOMStringList() { } -nsDOMStringList::~nsDOMStringList() +DOMStringList::~DOMStringList() { } -DOMCI_DATA(DOMStringList, nsDOMStringList) - -NS_IMPL_ADDREF(nsDOMStringList) -NS_IMPL_RELEASE(nsDOMStringList) -NS_INTERFACE_TABLE_HEAD(nsDOMStringList) - NS_INTERFACE_TABLE1(nsDOMStringList, nsIDOMDOMStringList) +NS_IMPL_ADDREF(DOMStringList) +NS_IMPL_RELEASE(DOMStringList) +NS_INTERFACE_TABLE_HEAD(DOMStringList) + NS_INTERFACE_TABLE1(DOMStringList, nsIDOMDOMStringList) NS_INTERFACE_TABLE_TO_MAP_SEGUE NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DOMStringList) NS_INTERFACE_MAP_END NS_IMETHODIMP -nsDOMStringList::Item(uint32_t aIndex, nsAString& aResult) +DOMStringList::Item(uint32_t aIndex, nsAString& aResult) { if (aIndex >= mNames.Length()) { SetDOMStringToNull(aResult); @@ -43,7 +42,7 @@ nsDOMStringList::Item(uint32_t aIndex, nsAString& aResult) } NS_IMETHODIMP -nsDOMStringList::GetLength(uint32_t *aLength) +DOMStringList::GetLength(uint32_t *aLength) { *aLength = mNames.Length(); @@ -51,9 +50,12 @@ nsDOMStringList::GetLength(uint32_t *aLength) } NS_IMETHODIMP -nsDOMStringList::Contains(const nsAString& aString, bool *aResult) +DOMStringList::Contains(const nsAString& aString, bool *aResult) { *aResult = mNames.Contains(aString); return NS_OK; } + +} // namespace dom +} // namespace mozilla diff --git a/content/base/src/nsDOMLists.h b/content/base/src/DOMStringList.h similarity index 72% rename from content/base/src/nsDOMLists.h rename to content/base/src/DOMStringList.h index ef18c5060035..b2f9cf70a2ac 100644 --- a/content/base/src/nsDOMLists.h +++ b/content/base/src/DOMStringList.h @@ -7,18 +7,21 @@ * Implementation of nsIDOMDOMStringList, used by various DOM stuff. */ -#ifndef nsDOMLists_h___ -#define nsDOMLists_h___ +#ifndef mozilla_dom_DOMStringList_h +#define mozilla_dom_DOMStringList_h #include "nsIDOMDOMStringList.h" #include "nsTArray.h" #include "nsString.h" -class nsDOMStringList : public nsIDOMDOMStringList +namespace mozilla { +namespace dom { + +class DOMStringList : public nsIDOMDOMStringList { public: - nsDOMStringList(); - virtual ~nsDOMStringList(); + DOMStringList(); + virtual ~DOMStringList(); NS_DECL_ISUPPORTS NS_DECL_NSIDOMDOMSTRINGLIST @@ -42,4 +45,7 @@ private: nsTArray mNames; }; -#endif /* nsDOMLists_h___ */ +} // namespace dom +} // namespace mozilla + +#endif /* mozilla_dom_DOMStringList_h */ diff --git a/content/base/src/WebSocket.cpp b/content/base/src/WebSocket.cpp index feb10e13533e..9e1a83a31c2f 100644 --- a/content/base/src/WebSocket.cpp +++ b/content/base/src/WebSocket.cpp @@ -36,7 +36,7 @@ #include "nsNetUtil.h" #include "nsILoadGroup.h" #include "mozilla/Preferences.h" -#include "nsDOMLists.h" +#include "mozilla/dom/DOMStringList.h" #include "xpcpublic.h" #include "nsContentPolicyUtils.h" #include "nsDOMFile.h" diff --git a/content/base/src/moz.build b/content/base/src/moz.build index 61ed489b81c7..4e97be3c0ac8 100644 --- a/content/base/src/moz.build +++ b/content/base/src/moz.build @@ -62,6 +62,7 @@ EXPORTS.mozilla.dom += [ 'DOMImplementation.h', 'DOMParser.h', 'DOMRect.h', + 'DOMStringList.h', 'EventSource.h', 'Link.h', 'NodeIterator.h', @@ -80,6 +81,7 @@ UNIFIED_SOURCES += [ 'DOMImplementation.cpp', 'DOMParser.cpp', 'DOMRect.cpp', + 'DOMStringList.cpp', 'Element.cpp', 'EventSource.cpp', 'FileIOObject.cpp', @@ -107,7 +109,6 @@ UNIFIED_SOURCES += [ 'nsDOMCaretPosition.cpp', 'nsDOMFile.cpp', 'nsDOMFileReader.cpp', - 'nsDOMLists.cpp', 'nsDOMMutationObserver.cpp', 'nsDOMSerializer.cpp', 'nsDOMSettableTokenList.cpp', diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 1c05a2a2193a..19c4574e8f63 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -1307,7 +1307,7 @@ nsExternalResourceMap::ExternalResource::~ExternalResource() // ================================================================== // If we ever have an nsIDocumentObserver notification for stylesheet title -// changes, we could make this inherit from nsDOMStringList instead of +// changes, we could make this inherit from DOMStringList instead of // reimplementing nsIDOMDOMStringList. class nsDOMStyleSheetSetList MOZ_FINAL : public nsIDOMDOMStringList { diff --git a/content/base/src/nsFrameMessageManager.cpp b/content/base/src/nsFrameMessageManager.cpp index 2e7e6d98b9d2..def59816f903 100644 --- a/content/base/src/nsFrameMessageManager.cpp +++ b/content/base/src/nsFrameMessageManager.cpp @@ -33,7 +33,7 @@ #include "mozilla/dom/StructuredCloneUtils.h" #include "JavaScriptChild.h" #include "JavaScriptParent.h" -#include "nsDOMLists.h" +#include "mozilla/dom/DOMStringList.h" #include "nsPrintfCString.h" #include diff --git a/content/html/content/src/HTMLPropertiesCollection.cpp b/content/html/content/src/HTMLPropertiesCollection.cpp index d315063e0331..dd9ccced74b2 100644 --- a/content/html/content/src/HTMLPropertiesCollection.cpp +++ b/content/html/content/src/HTMLPropertiesCollection.cpp @@ -492,7 +492,7 @@ PropertyNodeList::EnsureFresh() } PropertyStringList::PropertyStringList(HTMLPropertiesCollection* aCollection) - : nsDOMStringList() + : DOMStringList() , mCollection(aCollection) { } @@ -511,21 +511,21 @@ NS_IMETHODIMP PropertyStringList::Item(uint32_t aIndex, nsAString& aResult) { mCollection->EnsureFresh(); - return nsDOMStringList::Item(aIndex, aResult); + return DOMStringList::Item(aIndex, aResult); } NS_IMETHODIMP PropertyStringList::GetLength(uint32_t* aLength) { mCollection->EnsureFresh(); - return nsDOMStringList::GetLength(aLength); + return DOMStringList::GetLength(aLength); } NS_IMETHODIMP PropertyStringList::Contains(const nsAString& aString, bool* aResult) { mCollection->EnsureFresh(); - return nsDOMStringList::Contains(aString, aResult); + return DOMStringList::Contains(aString, aResult); } bool @@ -533,7 +533,7 @@ PropertyStringList::ContainsInternal(const nsAString& aString) { // This method should not call EnsureFresh, otherwise we may become stuck in an infinite loop. bool result; - nsDOMStringList::Contains(aString, &result); + DOMStringList::Contains(aString, &result); return result; } diff --git a/content/html/content/src/HTMLPropertiesCollection.h b/content/html/content/src/HTMLPropertiesCollection.h index df42fd136344..1328efa00924 100644 --- a/content/html/content/src/HTMLPropertiesCollection.h +++ b/content/html/content/src/HTMLPropertiesCollection.h @@ -8,7 +8,7 @@ #define HTMLPropertiesCollection_h_ #include "mozilla/Attributes.h" -#include "nsDOMLists.h" +#include "mozilla/dom/DOMStringList.h" #include "nsCycleCollectionParticipant.h" #include "nsAutoPtr.h" #include "nsCOMArray.h" @@ -31,7 +31,7 @@ class HTMLPropertiesCollection; class PropertyNodeList; class Element; -class PropertyStringList : public nsDOMStringList +class PropertyStringList : public DOMStringList { public: PropertyStringList(HTMLPropertiesCollection* aCollection); @@ -86,7 +86,7 @@ public: aFound = IsSupportedNamedProperty(aName); return aFound ? NamedItem(aName) : nullptr; } - nsDOMStringList* Names() + DOMStringList* Names() { EnsureFresh(); return mNames; diff --git a/dom/events/DataTransfer.cpp b/dom/events/DataTransfer.cpp index 8c0b5536d157..04b88e3aa029 100644 --- a/dom/events/DataTransfer.cpp +++ b/dom/events/DataTransfer.cpp @@ -13,7 +13,7 @@ #include "nsIVariant.h" #include "nsISupportsPrimitives.h" #include "nsIScriptSecurityManager.h" -#include "nsDOMLists.h" +#include "mozilla/dom/DOMStringList.h" #include "nsError.h" #include "nsIDragService.h" #include "nsIClipboard.h" @@ -327,7 +327,7 @@ DataTransfer::GetFiles(nsIDOMFileList** aFileList) already_AddRefed DataTransfer::Types() { - nsRefPtr types = new nsDOMStringList(); + nsRefPtr types = new DOMStringList(); if (mItems.Length()) { const nsTArray& item = mItems[0]; for (uint32_t i = 0; i < item.Length(); i++) @@ -531,7 +531,7 @@ DataTransfer::MozTypesAt(uint32_t aIndex, ErrorResult& aRv) return nullptr; } - nsRefPtr types = new nsDOMStringList(); + nsRefPtr types = new DOMStringList(); if (aIndex < mItems.Length()) { // note that you can retrieve the types regardless of their principal nsTArray& item = mItems[aIndex]; diff --git a/dom/indexedDB/IDBDatabase.cpp b/dom/indexedDB/IDBDatabase.cpp index 099cab84dd83..990c7ba47894 100644 --- a/dom/indexedDB/IDBDatabase.cpp +++ b/dom/indexedDB/IDBDatabase.cpp @@ -12,9 +12,9 @@ #include "mozilla/Mutex.h" #include "mozilla/storage.h" #include "mozilla/dom/ContentParent.h" +#include "mozilla/dom/DOMStringList.h" #include "mozilla/dom/quota/Client.h" #include "mozilla/dom/quota/QuotaManager.h" -#include "nsDOMLists.h" #include "nsJSUtils.h" #include "nsProxyRelease.h" #include "nsThreadUtils.h" @@ -508,7 +508,7 @@ IDBDatabase::GetObjectStoreNames(ErrorResult& aRv) const return nullptr; } - nsRefPtr list(new nsDOMStringList()); + nsRefPtr list(new DOMStringList()); uint32_t count = objectStoreNames.Length(); for (uint32_t index = 0; index < count; index++) { if (!list->Add(objectStoreNames[index])) { diff --git a/dom/indexedDB/IDBObjectStore.cpp b/dom/indexedDB/IDBObjectStore.cpp index e7088582aea5..ba6a555921c2 100644 --- a/dom/indexedDB/IDBObjectStore.cpp +++ b/dom/indexedDB/IDBObjectStore.cpp @@ -24,7 +24,7 @@ #include "nsContentUtils.h" #include "nsDOMClassInfo.h" #include "nsDOMFile.h" -#include "nsDOMLists.h" +#include "mozilla/dom/DOMStringList.h" #include "nsEventDispatcher.h" #include "nsJSUtils.h" #include "nsServiceManagerUtils.h" @@ -2642,7 +2642,7 @@ IDBObjectStore::GetIndexNames(ErrorResult& aRv) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); - nsRefPtr list(new nsDOMStringList()); + nsRefPtr list(new DOMStringList()); nsAutoTArray names; uint32_t count = mInfo->indexes.Length(); diff --git a/dom/indexedDB/IDBTransaction.cpp b/dom/indexedDB/IDBTransaction.cpp index ef5c2416e6b8..6cf4870dbc80 100644 --- a/dom/indexedDB/IDBTransaction.cpp +++ b/dom/indexedDB/IDBTransaction.cpp @@ -14,7 +14,7 @@ #include "mozilla/dom/quota/QuotaManager.h" #include "mozilla/storage.h" #include "nsDOMClassInfoID.h" -#include "nsDOMLists.h" +#include "mozilla/dom/DOMStringList.h" #include "nsEventDispatcher.h" #include "nsPIDOMWindow.h" #include "nsProxyRelease.h" @@ -676,7 +676,7 @@ IDBTransaction::GetObjectStoreNames(ErrorResult& aRv) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); - nsRefPtr list(new nsDOMStringList()); + nsRefPtr list(new DOMStringList()); nsAutoTArray stackArray; nsTArray* arrayOfNames; diff --git a/dom/src/offline/nsDOMOfflineResourceList.cpp b/dom/src/offline/nsDOMOfflineResourceList.cpp index 95577fc820df..a74d25f6baf5 100644 --- a/dom/src/offline/nsDOMOfflineResourceList.cpp +++ b/dom/src/offline/nsDOMOfflineResourceList.cpp @@ -6,7 +6,7 @@ #include "nsDOMOfflineResourceList.h" #include "nsIScriptSecurityManager.h" #include "nsError.h" -#include "nsDOMLists.h" +#include "mozilla/dom/DOMStringList.h" #include "nsIPrefetchService.h" #include "nsCPrefetchService.h" #include "nsNetUtil.h" @@ -189,7 +189,7 @@ nsDOMOfflineResourceList::GetMozItems(nsIDOMDOMStringList **aItems) *aItems = nullptr; - nsRefPtr items = new nsDOMStringList(); + nsRefPtr items = new DOMStringList(); // If we are not associated with an application cache, return an // empty list.