Bug 803106 part 2. Convert DOMStringList to WebIDL bindings - add WebIDL API and switch. r=bzbarsky
authorPeter Van der Beken <peterv@propagandism.org>
Tue, 09 Jul 2013 13:54:21 -0400
changeset 171289 95fd860273067e84e81e4f88eb4b12e69e8e638b
parent 171288 d4040ae9a5ed02aec1d652f4be6add66b508d2af
child 171290 7a8e0a49b3f67f1d5a4dce0bbacadcd476d2d40e
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersbzbarsky
bugs803106
milestone30.0a1
Bug 803106 part 2. Convert DOMStringList to WebIDL bindings - add WebIDL API and switch. r=bzbarsky
accessible/public/nsIAccessible.idl
accessible/public/nsIAccessibleRetrieval.idl
accessible/src/base/nsAccessibilityService.cpp
accessible/src/base/nsCoreUtils.cpp
accessible/src/base/nsCoreUtils.h
browser/components/places/content/controller.js
content/base/public/nsIDocument.h
content/base/public/nsIMessageManager.idl
content/base/src/DOMStringList.cpp
content/base/src/DOMStringList.h
content/base/src/WebSocket.cpp
content/base/src/nsDocument.cpp
content/base/src/nsDocument.h
content/html/content/src/HTMLPropertiesCollection.cpp
content/html/content/src/HTMLPropertiesCollection.h
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfo.h
dom/base/nsDOMClassInfoClasses.h
dom/bindings/Bindings.conf
dom/events/DataTransfer.cpp
dom/events/DataTransfer.h
dom/indexedDB/IDBDatabase.cpp
dom/indexedDB/IDBDatabase.h
dom/indexedDB/IDBObjectStore.cpp
dom/indexedDB/IDBObjectStore.h
dom/indexedDB/IDBTransaction.cpp
dom/indexedDB/IDBTransaction.h
dom/interfaces/base/domstubs.idl
dom/interfaces/core/moz.build
dom/interfaces/core/nsIDOMDOMStringList.idl
dom/interfaces/core/nsIDOMDocument.idl
dom/interfaces/core/nsIDOMXMLDocument.idl
dom/interfaces/events/nsIDOMDataTransfer.idl
dom/interfaces/html/nsIDOMHTMLDocument.idl
dom/interfaces/offline/nsIDOMOfflineResourceList.idl
dom/interfaces/xul/nsIDOMXULDocument.idl
dom/src/offline/nsDOMOfflineResourceList.cpp
dom/src/offline/nsDOMOfflineResourceList.h
dom/webidl/HTMLPropertiesCollection.webidl
dom/webidl/moz.build
editor/libeditor/base/nsEditor.h
editor/libeditor/base/nsEditorEventListener.cpp
editor/libeditor/html/nsHTMLDataTransfer.cpp
editor/libeditor/html/nsHTMLEditor.h
editor/libeditor/text/nsPlaintextDataTransfer.cpp
editor/libeditor/text/nsPlaintextEditor.h
js/xpconnect/src/dom_quickstubs.qsconf
layout/forms/nsFileControlFrame.cpp
toolkit/devtools/server/actors/script.js
--- a/accessible/public/nsIAccessible.idl
+++ b/accessible/public/nsIAccessible.idl
@@ -3,17 +3,16 @@
  * 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 "nsISupports.idl"
 #include "nsIArray.idl"
 
 interface nsIPersistentProperties;
 interface nsIDOMCSSPrimitiveValue;
-interface nsIDOMDOMStringList;
 interface nsIDOMNode;
 interface nsIAccessibleDocument;
 interface nsIAccessibleRelation;
 
 /**
  * A cross-platform interface that supports platform-specific 
  * accessibility APIs like MSAA and ATK. Contains the sum of what's needed
  * to support IAccessible as well as ATK's generic accessibility objects.
--- a/accessible/public/nsIAccessibleRetrieval.idl
+++ b/accessible/public/nsIAccessibleRetrieval.idl
@@ -5,17 +5,16 @@
 
 #include "nsISupports.idl"
 
 interface nsIDOMNode;
 interface nsIAccessible;
 interface nsIWeakReference;
 interface nsIPresShell;
 interface nsIDOMWindow;
-interface nsIDOMDOMStringList;
 interface nsIAccessiblePivot;
 
 /**
  * An interface for in-process accessibility clients wishing to get an
  * nsIAccessible for a given DOM node.  More documentation at:
  *   http://www.mozilla.org/projects/ui/accessibility
  */
 [scriptable, uuid(17f86615-1a3d-4021-b227-3a2ef5cbffd8)]
@@ -43,18 +42,18 @@ interface nsIAccessibleRetrieval : nsISu
   AString getStringRole(in unsigned long aRole);
 
    /**
     * Returns list which contains accessible states as a strings.
     *
     * @param aStates - accessible states.
     * @param aExtraStates - accessible extra states.
     */
-  nsIDOMDOMStringList getStringStates(in unsigned long aStates,
-                                      in unsigned long aExtraStates);
+  nsISupports getStringStates(in unsigned long aStates,
+                              in unsigned long aExtraStates);
 
   /**
    * Get the type of accessible event as a string.
    *
    * @param aEventType - the accessible event type constant
    * @return - accessible event type presented as human readable string
    */
   AString getStringEventType(in unsigned long aEventType);
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -59,16 +59,17 @@
 #include "nsObjectFrame.h"
 #include "nsSVGPathGeometryFrame.h"
 #include "nsTreeBodyFrame.h"
 #include "nsTreeColumns.h"
 #include "nsTreeUtils.h"
 #include "nsXBLPrototypeBinding.h"
 #include "nsXBLBinding.h"
 #include "mozilla/ArrayUtils.h"
+#include "mozilla/dom/DOMStringList.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
 #include "nsDeckFrame.h"
 
 #ifdef MOZ_XUL
 #include "XULAlertAccessible.h"
 #include "XULColorPickerAccessible.h"
 #include "XULComboboxAccessible.h"
@@ -82,16 +83,17 @@
 #endif
 
 #if defined(XP_WIN) || defined(MOZ_ACCESSIBILITY_ATK)
 #include "nsNPAPIPluginInstance.h"
 #endif
 
 using namespace mozilla;
 using namespace mozilla::a11y;
+using namespace mozilla::dom;
 
 ////////////////////////////////////////////////////////////////////////////////
 // Statics
 ////////////////////////////////////////////////////////////////////////////////
 
 /**
  * Return true if the element must be accessible.
  */
@@ -570,20 +572,19 @@ nsAccessibilityService::GetStringRole(ui
       return NS_OK;
   }
 
 #undef ROLE
 }
 
 NS_IMETHODIMP
 nsAccessibilityService::GetStringStates(uint32_t aState, uint32_t aExtraState,
-                                        nsIDOMDOMStringList **aStringStates)
+                                        nsISupports **aStringStates)
 {
-  nsAccessibleDOMStringList* stringStates = new nsAccessibleDOMStringList();
-  NS_ENSURE_TRUE(stringStates, NS_ERROR_OUT_OF_MEMORY);
+  nsRefPtr<DOMStringList> stringStates = new DOMStringList();
 
   uint64_t state = nsAccUtils::To64State(aState, aExtraState);
 
   // states
   if (state & states::UNAVAILABLE)
     stringStates->Add(NS_LITERAL_STRING("unavailable"));
   if (state & states::SELECTED)
     stringStates->Add(NS_LITERAL_STRING("selected"));
@@ -676,22 +677,20 @@ nsAccessibilityService::GetStringStates(
   if (state & states::ENABLED)
     stringStates->Add(NS_LITERAL_STRING("enabled"));
   if (state & states::SENSITIVE)
     stringStates->Add(NS_LITERAL_STRING("sensitive"));
   if (state & states::EXPANDABLE)
     stringStates->Add(NS_LITERAL_STRING("expandable"));
 
   //unknown states
-  uint32_t stringStatesLength = 0;
-  stringStates->GetLength(&stringStatesLength);
-  if (!stringStatesLength)
+  if (!stringStates->Length())
     stringStates->Add(NS_LITERAL_STRING("unknown"));
 
-  NS_ADDREF(*aStringStates = stringStates);
+  stringStates.forget(aStringStates);
   return NS_OK;
 }
 
 // nsIAccessibleRetrieval::getStringEventType()
 NS_IMETHODIMP
 nsAccessibilityService::GetStringEventType(uint32_t aEventType,
                                            nsAString& aString)
 {
--- a/accessible/src/base/nsCoreUtils.cpp
+++ b/accessible/src/base/nsCoreUtils.cpp
@@ -644,43 +644,8 @@ nsCoreUtils::IsWhitespaceString(const ns
   aString.BeginReading(iterBegin);
   aString.EndReading(iterEnd);
 
   while (iterBegin != iterEnd && IsWhitespace(*iterBegin))
     ++iterBegin;
 
   return iterBegin == iterEnd;
 }
-
-
-////////////////////////////////////////////////////////////////////////////////
-// nsAccessibleDOMStringList
-////////////////////////////////////////////////////////////////////////////////
-
-NS_IMPL_ISUPPORTS1(nsAccessibleDOMStringList, nsIDOMDOMStringList)
-
-NS_IMETHODIMP
-nsAccessibleDOMStringList::Item(uint32_t aIndex, nsAString& aResult)
-{
-  if (aIndex >= mNames.Length())
-    SetDOMStringToNull(aResult);
-  else
-    aResult = mNames.ElementAt(aIndex);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccessibleDOMStringList::GetLength(uint32_t* aLength)
-{
-  *aLength = mNames.Length();
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccessibleDOMStringList::Contains(const nsAString& aString, bool* aResult)
-{
-  *aResult = mNames.Contains(aString);
-
-  return NS_OK;
-}
-
--- a/accessible/src/base/nsCoreUtils.h
+++ b/accessible/src/base/nsCoreUtils.h
@@ -5,17 +5,16 @@
 
 #ifndef nsCoreUtils_h_
 #define nsCoreUtils_h_
 
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsIPresShell.h"
 
-#include "nsIDOMDOMStringList.h"
 #include "nsPoint.h"
 #include "nsTArray.h"
 
 class nsRange;
 class nsIBoxObject;
 class nsIFrame;
 class nsIDocShell;
 class nsITreeColumn;
@@ -309,31 +308,10 @@ public:
    */
   static bool IsWhitespace(char16_t aChar)
   {
     return aChar == ' ' || aChar == '\n' ||
       aChar == '\r' || aChar == '\t' || aChar == 0xa0;
   }
 };
 
-
-/**
- * nsIDOMDOMStringList implementation.
- */
-class nsAccessibleDOMStringList : public nsIDOMDOMStringList
-{
-public:
-  nsAccessibleDOMStringList() {}
-  virtual ~nsAccessibleDOMStringList() {}
-
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIDOMDOMSTRINGLIST
-
-  bool Add(const nsAString& aName) {
-    return mNames.AppendElement(aName) != nullptr;
-  }
-
-private:
-  nsTArray<nsString> mNames;
-};
-
 #endif
 
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -1356,17 +1356,17 @@ let PlacesControllerDragHelper = {
    */
   getSession: function PCDH__getSession() {
     return this.dragService.getCurrentSession();
   },
 
   /**
    * Extract the first accepted flavor from a list of flavors.
    * @param aFlavors
-   *        The flavors list of type nsIDOMDOMStringList.
+   *        The flavors list of type DOMStringList.
    */
   getFirstValidFlavor: function PCDH_getFirstValidFlavor(aFlavors) {
     for (let i = 0; i < aFlavors.length; i++) {
       if (this.GENERIC_VIEW_DROP_TYPES.indexOf(aFlavors[i]) != -1)
         return aFlavors[i];
     }
 
     // If no supported flavor is found, check if data includes text/plain 
--- a/content/base/public/nsIDocument.h
+++ b/content/base/public/nsIDocument.h
@@ -95,16 +95,17 @@ class ImageLoader;
 namespace dom {
 class Attr;
 class CDATASection;
 class Comment;
 struct CustomElementDefinition;
 class DocumentFragment;
 class DocumentType;
 class DOMImplementation;
+class DOMStringList;
 class Element;
 struct ElementRegistrationOptions;
 class EventTarget;
 class FrameRequestCallback;
 class HTMLBodyElement;
 struct LifecycleCallbackArgs;
 class Link;
 class GlobalObject;
@@ -119,18 +120,18 @@ template<typename> class OwningNonNull;
 template<typename> class Sequence;
 
 template<typename, typename> class CallbackObjectHolder;
 typedef CallbackObjectHolder<NodeFilter, nsIDOMNodeFilter> NodeFilterHolder;
 } // namespace dom
 } // namespace mozilla
 
 #define NS_IDOCUMENT_IID \
-{ 0x595492bc, 0xa26d, 0x46a9, \
-  { 0xa9, 0x35, 0x0c, 0x40, 0xdd, 0xc2, 0x77, 0x51 } }
+{ 0x94629cb0, 0xfe8a, 0x4627, \
+  { 0x8e, 0x59, 0xab, 0x1a, 0xaf, 0xdc, 0x99, 0x56 } }
 
 // Flag for AddStyleSheet().
 #define NS_STYLESHEET_FROM_CATALOG                (1 << 0)
 
 // Enum for requesting a particular type of document when creating a doc
 enum DocumentFlavor {
   DocumentFlavorLegacyGuess, // compat with old code until made HTML5-compliant
   DocumentFlavorHTML, // HTMLDocument with HTMLness bit set to true
@@ -2154,17 +2155,17 @@ public:
     WarnOnceAbout(ePrefixedVisibilityAPI);
     return VisibilityState();
   }
   virtual nsIDOMStyleSheetList* StyleSheets() = 0;
   void GetSelectedStyleSheetSet(nsAString& aSheetSet);
   virtual void SetSelectedStyleSheetSet(const nsAString& aSheetSet) = 0;
   virtual void GetLastStyleSheetSet(nsString& aSheetSet) = 0;
   void GetPreferredStyleSheetSet(nsAString& aSheetSet);
-  virtual nsIDOMDOMStringList* StyleSheetSets() = 0;
+  virtual mozilla::dom::DOMStringList* StyleSheetSets() = 0;
   virtual void EnableStyleSheetsForSet(const nsAString& aSheetSet) = 0;
   Element* ElementFromPoint(float aX, float aY);
 
   /**
    * Retrieve the location of the caret position (DOM node and character
    * offset within that node), given a point.
    *
    * @param aX Horizontal point at which to determine the caret position, in
--- a/content/base/public/nsIMessageManager.idl
+++ b/content/base/public/nsIMessageManager.idl
@@ -1,16 +1,15 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "nsISupports.idl"
 
-interface nsIDOMDOMStringList;
 interface nsIDOMWindow;
 interface nsIDocShell;
 interface nsIContent;
 interface nsIPrincipal;
 
 /**
  * Message managers provide a way for chrome-privileged JS code to
  * communicate with each other, even across process boundaries.
--- a/content/base/src/DOMStringList.cpp
+++ b/content/base/src/DOMStringList.cpp
@@ -1,61 +1,33 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "mozilla/dom/DOMStringList.h"
-#include "nsError.h"
-#include "nsDOMClassInfoID.h"
-#include "nsINode.h"
-
-DOMCI_DATA(DOMStringList, mozilla::dom::DOMStringList)
+#include "mozilla/dom/DOMStringListBinding.h"
+#include "nsContentUtils.h"
 
 namespace mozilla {
 namespace dom {
 
-DOMStringList::DOMStringList()
-{
-}
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(DOMStringList)
+
+NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMStringList)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMStringList)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMStringList)
+  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
+  NS_INTERFACE_MAP_ENTRY(nsISupports)
+NS_INTERFACE_MAP_END
 
 DOMStringList::~DOMStringList()
 {
 }
 
-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
-DOMStringList::Item(uint32_t aIndex, nsAString& aResult)
+JSObject*
+DOMStringList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
 {
-  if (aIndex >= mNames.Length()) {
-    SetDOMStringToNull(aResult);
-  } else {
-    aResult = mNames[aIndex];
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-DOMStringList::GetLength(uint32_t *aLength)
-{
-  *aLength = mNames.Length();
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-DOMStringList::Contains(const nsAString& aString, bool *aResult)
-{
-  *aResult = mNames.Contains(aString);
-
-  return NS_OK;
+  return DOMStringListBinding::Wrap(aCx, aScope, this);
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/content/base/src/DOMStringList.h
+++ b/content/base/src/DOMStringList.h
@@ -1,51 +1,106 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-/*
- * Implementation of nsIDOMDOMStringList, used by various DOM stuff.
- */
-
 #ifndef mozilla_dom_DOMStringList_h
 #define mozilla_dom_DOMStringList_h
 
-#include "nsIDOMDOMStringList.h"
+#include "nsISupports.h"
 #include "nsTArray.h"
+#include "nsWrapperCache.h"
 #include "nsString.h"
 
 namespace mozilla {
 namespace dom {
 
-class DOMStringList : public nsIDOMDOMStringList
+class DOMStringList : public nsISupports,
+                      public nsWrapperCache
 {
 public:
-  DOMStringList();
+  DOMStringList()
+  {
+    SetIsDOMBinding();
+  }
   virtual ~DOMStringList();
 
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIDOMDOMSTRINGLIST
+  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMStringList)
+
+  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope);
+  nsISupports* GetParentObject()
+  {
+    return nullptr;
+  }
+
+  void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aResult)
+  {
+    EnsureFresh();
+    if (aIndex < mNames.Length()) {
+      aFound = true;
+      aResult = mNames[aIndex];
+    } else {
+      aFound = false;
+    }
+  }
+
+  void Item(uint32_t aIndex, nsAString& aResult)
+  {
+    EnsureFresh();
+    if (aIndex < mNames.Length()) {
+      aResult = mNames[aIndex];
+    } else {
+      aResult.SetIsVoid(true);
+    }
+  }
+
+  uint32_t Length()
+  {
+    EnsureFresh();
+    return mNames.Length();
+  }
+
+  bool Contains(const nsAString& aString)
+  {
+    EnsureFresh();
+    return mNames.Contains(aString);
+  }
 
   bool Add(const nsAString& aName)
   {
+    // XXXbz mNames should really be a fallible array; otherwise this
+    // return value is meaningless.
     return mNames.AppendElement(aName) != nullptr;
   }
 
   void Clear()
   {
     mNames.Clear();
   }
 
+  nsTArray<nsString>& StringArray()
+  {
+    return mNames;
+  }
+
   void CopyList(nsTArray<nsString>& aNames)
   {
     aNames = mNames;
   }
 
-private:
+protected:
+  // A method that subclasses can override to modify mNames as needed
+  // before we index into it or return its length or whatnot.
+  virtual void EnsureFresh()
+  {
+  }
+
+  // XXXbz we really want this to be a fallible array, but we end up passing it
+  // to consumers who declare themselves as taking and nsTArray.  :(
   nsTArray<nsString> mNames;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif /* mozilla_dom_DOMStringList_h */
--- a/content/base/src/WebSocket.cpp
+++ b/content/base/src/WebSocket.cpp
@@ -31,17 +31,16 @@
 #include "nsIConsoleService.h"
 #include "nsIDOMCloseEvent.h"
 #include "nsICryptoHash.h"
 #include "nsJSUtils.h"
 #include "nsIScriptError.h"
 #include "nsNetUtil.h"
 #include "nsILoadGroup.h"
 #include "mozilla/Preferences.h"
-#include "mozilla/dom/DOMStringList.h"
 #include "xpcpublic.h"
 #include "nsContentPolicyUtils.h"
 #include "nsDOMFile.h"
 #include "nsWrapperCacheInlines.h"
 #include "nsDOMEventTargetHelper.h"
 #include "nsIObserverService.h"
 #include "nsIWebSocketChannel.h"
 #include "GeneratedEvents.h"
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -41,17 +41,16 @@
 #include "nsCxPusher.h"
 
 #include "mozilla/BasicEvents.h"
 #include "nsAsyncDOMEvent.h"
 #include "nsIDOMNodeFilter.h"
 
 #include "nsIDOMStyleSheet.h"
 #include "mozilla/dom/Attr.h"
-#include "nsIDOMDOMStringList.h"
 #include "nsIDOMDOMImplementation.h"
 #include "nsIDOMDocumentXBL.h"
 #include "mozilla/dom/Element.h"
 #include "nsGenericHTMLElement.h"
 #include "mozilla/dom/CDATASection.h"
 #include "mozilla/dom/ProcessingInstruction.h"
 #include "nsDOMString.h"
 #include "nsNodeUtils.h"
@@ -216,16 +215,17 @@
 #include "nsIHttpChannelInternal.h"
 #include "nsISecurityConsoleMessage.h"
 #include "nsCharSeparatedTokenizer.h"
 #include "mozilla/dom/XPathEvaluator.h"
 #include "nsIDocumentEncoder.h"
 #include "nsIStructuredCloneContainer.h"
 #include "nsIMutableArray.h"
 #include "nsContentPermissionHelper.h"
+#include "mozilla/dom/DOMStringList.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 typedef nsTArray<Link*> LinkArray;
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo* gDocumentLeakPRLog;
@@ -1302,115 +1302,61 @@ nsExternalResourceMap::ExternalResource:
   }
 }
 
 // ==================================================================
 // =
 // ==================================================================
 
 // If we ever have an nsIDocumentObserver notification for stylesheet title
-// changes, we could make this inherit from DOMStringList instead of
-// reimplementing nsIDOMDOMStringList.
-class nsDOMStyleSheetSetList MOZ_FINAL : public nsIDOMDOMStringList
+// changes we should update the list from that instead of overriding
+// EnsureFresh.
+class nsDOMStyleSheetSetList MOZ_FINAL : public DOMStringList
 {
 public:
-  NS_DECL_ISUPPORTS
-
-  NS_DECL_NSIDOMDOMSTRINGLIST
-
   nsDOMStyleSheetSetList(nsIDocument* aDocument);
 
   void Disconnect()
   {
     mDocument = nullptr;
   }
 
+  virtual void EnsureFresh() MOZ_OVERRIDE;
+
 protected:
-  // Rebuild our list of style sets
-  nsresult GetSets(nsTArray<nsString>& aStyleSets);
-
   nsIDocument* mDocument;  // Our document; weak ref.  It'll let us know if it
                            // dies.
 };
 
-NS_IMPL_ADDREF(nsDOMStyleSheetSetList)
-NS_IMPL_RELEASE(nsDOMStyleSheetSetList)
-NS_INTERFACE_TABLE_HEAD(nsDOMStyleSheetSetList)
-  NS_INTERFACE_TABLE1(nsDOMStyleSheetSetList, nsIDOMDOMStringList)
-  NS_INTERFACE_TABLE_TO_MAP_SEGUE
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DOMStringList)
-NS_INTERFACE_MAP_END
-
 nsDOMStyleSheetSetList::nsDOMStyleSheetSetList(nsIDocument* aDocument)
   : mDocument(aDocument)
 {
   NS_ASSERTION(mDocument, "Must have document!");
 }
 
-NS_IMETHODIMP
-nsDOMStyleSheetSetList::Item(uint32_t aIndex, nsAString& aResult)
-{
-  nsTArray<nsString> styleSets;
-  nsresult rv = GetSets(styleSets);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (aIndex >= styleSets.Length()) {
-    SetDOMStringToNull(aResult);
-  } else {
-    aResult = styleSets[aIndex];
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMStyleSheetSetList::GetLength(uint32_t *aLength)
-{
-  nsTArray<nsString> styleSets;
-  nsresult rv = GetSets(styleSets);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  *aLength = styleSets.Length();
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMStyleSheetSetList::Contains(const nsAString& aString, bool *aResult)
-{
-  nsTArray<nsString> styleSets;
-  nsresult rv = GetSets(styleSets);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  *aResult = styleSets.Contains(aString);
-
-  return NS_OK;
-}
-
-nsresult
-nsDOMStyleSheetSetList::GetSets(nsTArray<nsString>& aStyleSets)
-{
+void
+nsDOMStyleSheetSetList::EnsureFresh()
+{
+  mNames.Clear();
+
   if (!mDocument) {
-    return NS_OK; // Spec says "no exceptions", and we have no style sets if we
-                  // have no document, for sure
+    return; // Spec says "no exceptions", and we have no style sets if we have
+            // no document, for sure
   }
 
   int32_t count = mDocument->GetNumberOfStyleSheets();
   nsAutoString title;
   for (int32_t index = 0; index < count; index++) {
     nsIStyleSheet* sheet = mDocument->GetStyleSheetAt(index);
     NS_ASSERTION(sheet, "Null sheet in sheet list!");
     sheet->GetTitle(title);
-    if (!title.IsEmpty() && !aStyleSets.Contains(title) &&
-        !aStyleSets.AppendElement(title)) {
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
-  }
-
-  return NS_OK;
+    if (!title.IsEmpty() && !mNames.Contains(title) && !Add(title)) {
+      return;
+    }
+  }
 }
 
 // ==================================================================
 nsIDocument::SelectorCache::SelectorCache()
   : nsExpirationTracker<SelectorCacheKey, 4>(1000) { }
 
 // CacheList takes ownership of aSelectorList.
 void nsIDocument::SelectorCache::CacheList(const nsAString& aSelector,
@@ -6168,23 +6114,23 @@ nsDocument::GetPreferredStyleSheetSet(ns
 
 void
 nsIDocument::GetPreferredStyleSheetSet(nsAString& aSheetSet)
 {
   GetHeaderData(nsGkAtoms::headerDefaultStyle, aSheetSet);
 }
 
 NS_IMETHODIMP
-nsDocument::GetStyleSheetSets(nsIDOMDOMStringList** aList)
+nsDocument::GetStyleSheetSets(nsISupports** aList)
 {
   NS_ADDREF(*aList = StyleSheetSets());
   return NS_OK;
 }
 
-nsIDOMDOMStringList*
+DOMStringList*
 nsDocument::StyleSheetSets()
 {
   if (!mStyleSheetSetList) {
     mStyleSheetSetList = new nsDOMStyleSheetSetList(this);
   }
   return mStyleSheetSetList;
 }
 
--- a/content/base/src/nsDocument.h
+++ b/content/base/src/nsDocument.h
@@ -1190,17 +1190,17 @@ public:
     GetImplementation(mozilla::ErrorResult& rv) MOZ_OVERRIDE;
   virtual JSObject*
     RegisterElement(JSContext* aCx, const nsAString& aName,
                     const mozilla::dom::ElementRegistrationOptions& aOptions,
                     mozilla::ErrorResult& rv) MOZ_OVERRIDE;
   virtual nsIDOMStyleSheetList* StyleSheets() MOZ_OVERRIDE;
   virtual void SetSelectedStyleSheetSet(const nsAString& aSheetSet) MOZ_OVERRIDE;
   virtual void GetLastStyleSheetSet(nsString& aSheetSet) MOZ_OVERRIDE;
-  virtual nsIDOMDOMStringList* StyleSheetSets() MOZ_OVERRIDE;
+  virtual mozilla::dom::DOMStringList* StyleSheetSets() MOZ_OVERRIDE;
   virtual void EnableStyleSheetsForSet(const nsAString& aSheetSet) MOZ_OVERRIDE;
   using nsIDocument::CreateElement;
   using nsIDocument::CreateElementNS;
   virtual already_AddRefed<Element> CreateElement(const nsAString& aTagName,
                                                   const nsAString& aTypeExtension,
                                                   mozilla::ErrorResult& rv) MOZ_OVERRIDE;
   virtual already_AddRefed<Element> CreateElementNS(const nsAString& aNamespaceURI,
                                                     const nsAString& aQualifiedName,
--- a/content/html/content/src/HTMLPropertiesCollection.cpp
+++ b/content/html/content/src/HTMLPropertiesCollection.cpp
@@ -218,17 +218,16 @@ HTMLPropertiesCollection::EnsureFresh()
   mProperties.Sort(comparator);
 
   // Create the names DOMStringList
   uint32_t count = mProperties.Length();
   for (uint32_t i = 0; i < count; ++i) {
     const nsAttrValue* attr = mProperties.ElementAt(i)->GetParsedAttr(nsGkAtoms::itemprop); 
     for (uint32_t i = 0; i < attr->GetAtomCount(); i++) {
       nsDependentAtomString propName(attr->AtomAt(i));
-      // ContainsInternal must not call EnsureFresh
       bool contains = mNames->ContainsInternal(propName);
       if (!contains) {
         mNames->Add(propName);
       }
     }
   }
 }
 
@@ -491,51 +490,32 @@ PropertyNodeList::EnsureFresh()
   }
 }
 
 PropertyStringList::PropertyStringList(HTMLPropertiesCollection* aCollection)
   : DOMStringList()
   , mCollection(aCollection)
 { }
 
-NS_IMPL_CYCLE_COLLECTION_1(PropertyStringList, mCollection)
+NS_IMPL_CYCLE_COLLECTION_INHERITED_1(PropertyStringList, DOMStringList,
+                                     mCollection)
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(PropertyStringList)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(PropertyStringList)
+NS_IMPL_ADDREF_INHERITED(PropertyStringList, DOMStringList)
+NS_IMPL_RELEASE_INHERITED(PropertyStringList, DOMStringList)
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PropertyStringList)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMDOMStringList)
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DOMStringList)
-NS_INTERFACE_MAP_END
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(PropertyStringList)
+NS_INTERFACE_MAP_END_INHERITING(DOMStringList)
 
-NS_IMETHODIMP
-PropertyStringList::Item(uint32_t aIndex, nsAString& aResult)
+void
+PropertyStringList::EnsureFresh()
 {
   mCollection->EnsureFresh();
-  return DOMStringList::Item(aIndex, aResult);
-}
-
-NS_IMETHODIMP
-PropertyStringList::GetLength(uint32_t* aLength)
-{
-  mCollection->EnsureFresh();
-  return DOMStringList::GetLength(aLength);
-}
-
-NS_IMETHODIMP
-PropertyStringList::Contains(const nsAString& aString, bool* aResult)
-{
-  mCollection->EnsureFresh();
-  return DOMStringList::Contains(aString, aResult);
 }
 
 bool
 PropertyStringList::ContainsInternal(const nsAString& aString)
 {
   // This method should not call EnsureFresh, otherwise we may become stuck in an infinite loop.
-  bool result;
-  DOMStringList::Contains(aString, &result);
-  return result;
+  return mNames.Contains(aString);
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/content/html/content/src/HTMLPropertiesCollection.h
+++ b/content/html/content/src/HTMLPropertiesCollection.h
@@ -30,23 +30,24 @@ namespace dom {
 class HTMLPropertiesCollection;
 class PropertyNodeList;
 class Element;
 
 class PropertyStringList : public DOMStringList
 {
 public:
   PropertyStringList(HTMLPropertiesCollection* aCollection);
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_CLASS(PropertyStringList)
-  NS_DECL_NSIDOMDOMSTRINGLIST
+  NS_DECL_ISUPPORTS_INHERITED
+  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PropertyStringList, DOMStringList)
 
   bool ContainsInternal(const nsAString& aString);
 
 protected:
+  virtual void EnsureFresh() MOZ_OVERRIDE;
+
   nsRefPtr<HTMLPropertiesCollection> mCollection;
 };
 
 class HTMLPropertiesCollection : public nsIHTMLCollection,
                                  public nsStubMutationObserver,
                                  public nsWrapperCache
 {
   friend class PropertyNodeList;
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -69,17 +69,16 @@
 #include "nsIDOMWindow.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMJSWindow.h"
 #include "nsIDOMChromeWindow.h"
 #include "nsIDOMConstructor.h"
 
 // DOM core includes
 #include "nsError.h"
-#include "nsIDOMDOMStringList.h"
 #include "nsIDOMUserDataHandler.h"
 #include "nsIDOMXPathNamespace.h"
 #include "nsIDOMXULButtonElement.h"
 #include "nsIDOMXULCheckboxElement.h"
 #include "nsIDOMXULPopupElement.h"
 
 // Event related includes
 #include "nsIDOMEventTarget.h"
@@ -351,19 +350,16 @@ static nsDOMClassInfoData sClassInfoData
 #ifdef MOZ_XUL
   NS_DEFINE_CHROME_XBL_CLASSINFO_DATA(XULTemplateBuilder, nsDOMGenericSH,
                                       DEFAULT_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CHROME_XBL_CLASSINFO_DATA(XULTreeBuilder, nsDOMGenericSH,
                                       DEFAULT_SCRIPTABLE_FLAGS)
 #endif
 
-  NS_DEFINE_CLASSINFO_DATA(DOMStringList, nsStringListSH,
-                           ARRAY_SCRIPTABLE_FLAGS)
-
 #ifdef MOZ_XUL
   NS_DEFINE_CHROME_XBL_CLASSINFO_DATA(TreeColumn, nsDOMGenericSH,
                                       DEFAULT_SCRIPTABLE_FLAGS)
 #endif
 
   NS_DEFINE_CLASSINFO_DATA(CSSMozDocumentRule, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
@@ -1009,20 +1005,16 @@ nsDOMClassInfo::Init()
 
   DOM_CLASSINFO_MAP_BEGIN(XULTreeBuilder, nsIXULTreeBuilder)
     DOM_CLASSINFO_MAP_ENTRY(nsIXULTreeBuilder)
     DOM_CLASSINFO_MAP_ENTRY(nsIXULTemplateBuilder)
     DOM_CLASSINFO_MAP_ENTRY(nsITreeView)
   DOM_CLASSINFO_MAP_END
 #endif
 
-  DOM_CLASSINFO_MAP_BEGIN(DOMStringList, nsIDOMDOMStringList)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMStringList)
-  DOM_CLASSINFO_MAP_END
-
 #ifdef MOZ_XUL
   DOM_CLASSINFO_MAP_BEGIN(TreeColumn, nsITreeColumn)
     DOM_CLASSINFO_MAP_ENTRY(nsITreeColumn)
   DOM_CLASSINFO_MAP_END
 #endif
 
   DOM_CLASSINFO_MAP_BEGIN(CSSMozDocumentRule, nsIDOMCSSMozDocumentRule)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSMozDocumentRule)
@@ -3695,71 +3687,16 @@ nsArraySH::GetProperty(nsIXPConnectWrapp
       rv = NS_SUCCESS_I_DID_SOMETHING;
     }
   }
 
   return rv;
 }
 
 
-// StringList scriptable helper
-
-nsresult
-nsStringListSH::GetStringAt(nsISupports *aNative, int32_t aIndex,
-                            nsAString& aResult)
-{
-  nsCOMPtr<nsIDOMDOMStringList> list(do_QueryInterface(aNative));
-  NS_ENSURE_TRUE(list, NS_ERROR_UNEXPECTED);
-
-  nsresult rv = list->Item(aIndex, aResult);
-#ifdef DEBUG
-  if (DOMStringIsNull(aResult)) {
-    uint32_t length = 0;
-    list->GetLength(&length);
-    NS_ASSERTION(uint32_t(aIndex) >= length, "Item should only return null for out-of-bounds access");
-  }
-#endif
-  return rv;
-}
-
-
-// StringArray helper
-
-NS_IMETHODIMP
-nsStringArraySH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                             JSObject *aObj, jsid aId, jsval *vp,
-                             bool *_retval)
-{
-  JS::Rooted<JSObject*> obj(cx, aObj);
-  JS::Rooted<jsid> id(cx, aId);
-  bool is_number = false;
-  int32_t n = GetArrayIndexFromId(cx, id, &is_number);
-
-  if (!is_number) {
-    return NS_OK;
-  }
-
-  nsAutoString val;
-
-  nsresult rv = GetStringAt(GetNative(wrapper, obj), n, val);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (DOMStringIsNull(val)) {
-    *vp = JSVAL_VOID;
-    return NS_SUCCESS_I_DID_SOMETHING;
-  }
-
-  JS::Rooted<JS::Value> rval(cx);
-  NS_ENSURE_TRUE(xpc::NonVoidStringToJsval(cx, val, &rval),
-                 NS_ERROR_OUT_OF_MEMORY);
-  *vp = rval;
-  return NS_SUCCESS_I_DID_SOMETHING;
-}
-
-
 // StyleSheetList helper
 
 nsISupports*
 nsStyleSheetListSH::GetItemAt(nsISupports *aNative, uint32_t aIndex,
                               nsWrapperCache **aCache, nsresult *rv)
 {
   nsIDOMStyleSheetList* list = static_cast<nsIDOMStyleSheetList*>(aNative);
   nsCOMPtr<nsIDOMStyleSheet> sheet;
--- a/dom/base/nsDOMClassInfo.h
+++ b/dom/base/nsDOMClassInfo.h
@@ -369,64 +369,16 @@ public:
                          JSObject *obj, jsid id, JS::Value *vp, bool *_retval) MOZ_OVERRIDE;
 
 private:
   // Not implemented, nothing should create an instance of this class.
   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData);
 };
 
 
-// String array helper
-
-class nsStringArraySH : public nsGenericArraySH
-{
-protected:
-  nsStringArraySH(nsDOMClassInfoData* aData) : nsGenericArraySH(aData)
-  {
-  }
-
-  virtual ~nsStringArraySH()
-  {
-  }
-
-  virtual nsresult GetStringAt(nsISupports *aNative, int32_t aIndex,
-                               nsAString& aResult) = 0;
-
-public:
-  NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsid id, JS::Value *vp, bool *_retval) MOZ_OVERRIDE;
-};
-
-
-// StringList scriptable helper
-
-class nsStringListSH : public nsStringArraySH
-{
-protected:
-  nsStringListSH(nsDOMClassInfoData* aData) : nsStringArraySH(aData)
-  {
-  }
-
-  virtual ~nsStringListSH()
-  {
-  }
-
-  virtual nsresult GetStringAt(nsISupports *aNative, int32_t aIndex,
-                               nsAString& aResult) MOZ_OVERRIDE;
-
-public:
-  // Inherit GetProperty, Enumerate from nsStringArraySH
-  
-  static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
-  {
-    return new nsStringListSH(aData);
-  }
-};
-
-
 // StyleSheetList helper
 
 class nsStyleSheetListSH : public nsArraySH
 {
 protected:
   nsStyleSheetListSH(nsDOMClassInfoData* aData) : nsArraySH(aData)
   {
   }
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -33,19 +33,16 @@ DOMCI_CLASS(TreeContentView)
 // DOM Chrome Window class, almost identical to Window
 DOMCI_CLASS(ChromeWindow)
 
 #ifdef MOZ_XUL
 DOMCI_CLASS(XULTemplateBuilder)
 DOMCI_CLASS(XULTreeBuilder)
 #endif
 
-// DOMStringList object
-DOMCI_CLASS(DOMStringList)
-
 #ifdef MOZ_XUL
 DOMCI_CLASS(TreeColumn)
 #endif
 
 DOMCI_CLASS(CSSMozDocumentRule)
 DOMCI_CLASS(CSSSupportsRule)
 
 // other SVG classes
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -1867,17 +1867,16 @@ def addExternalIface(iface, nativeType=N
 
 addExternalIface('ApplicationCache', nativeType='nsIDOMOfflineResourceList')
 addExternalIface('ActivityOptions', nativeType='nsIDOMMozActivityOptions',
                  headerFile='nsIDOMActivityOptions.h')
 addExternalIface('Counter')
 addExternalIface('CSSRule')
 addExternalIface('mozIDOMApplication', nativeType='mozIDOMApplication', headerFile='nsIDOMApplicationRegistry.h')
 addExternalIface('CSSRuleList')
-addExternalIface('DOMStringList')
 addExternalIface('RTCDataChannel', nativeType='nsIDOMDataChannel')
 addExternalIface('File')
 addExternalIface('HitRegionOptions', nativeType='nsISupports')
 addExternalIface('imgINotificationObserver', nativeType='imgINotificationObserver')
 addExternalIface('imgIRequest', nativeType='imgIRequest', notflattened=True)
 addExternalIface('LockedFile')
 addExternalIface('MenuBuilder', nativeType='nsIMenuBuilder', notflattened=True)
 addExternalIface('MozBoxObject', nativeType='nsIBoxObject')
--- a/dom/events/DataTransfer.cpp
+++ b/dom/events/DataTransfer.cpp
@@ -319,37 +319,42 @@ DataTransfer::GetFiles(ErrorResult& aRv)
 NS_IMETHODIMP
 DataTransfer::GetFiles(nsIDOMFileList** aFileList)
 {
   ErrorResult rv;
   *aFileList = GetFiles(rv);
   return rv.ErrorCode();
 }
 
-already_AddRefed<nsIDOMDOMStringList>
+already_AddRefed<DOMStringList>
 DataTransfer::Types()
 {
   nsRefPtr<DOMStringList> types = new DOMStringList();
   if (mItems.Length()) {
+    bool addFile = false;
     const nsTArray<TransferItem>& item = mItems[0];
-    for (uint32_t i = 0; i < item.Length(); i++)
-      types->Add(item[i].mFormat);
+    for (uint32_t i = 0; i < item.Length(); i++) {
+      const nsString& format = item[i].mFormat;
+      types->Add(format);
+      if (!addFile) {
+        addFile = format.EqualsASCII(kFileMime) ||
+                  format.EqualsASCII("application/x-moz-file-promise");
+      }
+    }
 
-    bool filePresent, filePromisePresent;
-    types->Contains(NS_LITERAL_STRING(kFileMime), &filePresent);
-    types->Contains(NS_LITERAL_STRING("application/x-moz-file-promise"), &filePromisePresent);
-    if (filePresent || filePromisePresent)
+    if (addFile) {
       types->Add(NS_LITERAL_STRING("Files"));
+    }
   }
 
   return types.forget();
 }
 
 NS_IMETHODIMP
-DataTransfer::GetTypes(nsIDOMDOMStringList** aTypes)
+DataTransfer::GetTypes(nsISupports** aTypes)
 {
   *aTypes = Types().get();
 
   return NS_OK;
 }
 
 void
 DataTransfer::GetData(const nsAString& aFormat, nsAString& aData,
@@ -516,17 +521,17 @@ DataTransfer::GetMozSourceNode(nsIDOMNod
   if (!sourceNode) {
     *aSourceNode = nullptr;
     return NS_OK;
   }
 
   return CallQueryInterface(sourceNode, aSourceNode);
 }
 
-already_AddRefed<nsIDOMDOMStringList>
+already_AddRefed<DOMStringList>
 DataTransfer::MozTypesAt(uint32_t aIndex, ErrorResult& aRv)
 {
   // Only the first item is valid for clipboard events
   if (aIndex > 0 &&
       (mEventType == NS_CUT || mEventType == NS_COPY || mEventType == NS_PASTE)) {
     aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
     return nullptr;
   }
@@ -538,17 +543,17 @@ DataTransfer::MozTypesAt(uint32_t aIndex
     for (uint32_t i = 0; i < item.Length(); i++)
       types->Add(item[i].mFormat);
   }
 
   return types.forget();
 }
 
 NS_IMETHODIMP
-DataTransfer::MozTypesAt(uint32_t aIndex, nsIDOMDOMStringList** aTypes)
+DataTransfer::MozTypesAt(uint32_t aIndex, nsISupports** aTypes)
 {
   ErrorResult rv;
   *aTypes = MozTypesAt(aIndex, rv).get();
   return rv.ErrorCode();
 }
 
 NS_IMETHODIMP
 DataTransfer::MozGetDataAt(const nsAString& aFormat, uint32_t aIndex,
--- a/dom/events/DataTransfer.h
+++ b/dom/events/DataTransfer.h
@@ -23,16 +23,17 @@ class nsEventStateManager;
 class nsINode;
 class nsITransferable;
 class nsISupportsArray;
 class nsILoadContext;
 
 namespace mozilla {
 namespace dom {
 
+class DOMStringList;
 class Element;
 template<typename T> class Optional;
 
 /**
  * TransferItem is used to hold data for a particular format. Each piece of
  * data has a principal set from the caller which added it. This allows a
  * caller that wishes to retrieve the data to only be able to access the data
  * it is allowed to, yet still allow a chrome caller to retrieve any of the
@@ -129,17 +130,17 @@ public:
     if (mEffectAllowed == nsIDragService::DRAGDROP_ACTION_UNINITIALIZED) {
       aEffectAllowed.AssignLiteral("uninitialized");
     } else {
       aEffectAllowed.AssignASCII(sEffects[mEffectAllowed]);
     }
   }
   void SetDragImage(Element& aElement, int32_t aX, int32_t aY,
                     ErrorResult& aRv);
-  already_AddRefed<nsIDOMDOMStringList> Types();
+  already_AddRefed<DOMStringList> Types();
   void GetData(const nsAString& aFormat, nsAString& aData, ErrorResult& aRv);
   void SetData(const nsAString& aFormat, const nsAString& aData,
                ErrorResult& aRv);
   void ClearData(const mozilla::dom::Optional<nsAString>& aFormat,
                  mozilla::ErrorResult& aRv);
   nsDOMFileList* GetFiles(mozilla::ErrorResult& aRv);
   void AddElement(Element& aElement, mozilla::ErrorResult& aRv);
   uint32_t MozItemCount()
@@ -149,18 +150,18 @@ public:
   void GetMozCursor(nsString& aCursor)
   {
     if (mCursorState) {
       aCursor.AssignLiteral("default");
     } else {
       aCursor.AssignLiteral("auto");
     }
   }
-  already_AddRefed<nsIDOMDOMStringList> MozTypesAt(uint32_t aIndex,
-                                                   mozilla::ErrorResult& aRv);
+  already_AddRefed<DOMStringList> MozTypesAt(uint32_t aIndex,
+                                             mozilla::ErrorResult& aRv);
   void MozClearDataAt(const nsAString& aFormat, uint32_t aIndex,
                       mozilla::ErrorResult& aRv);
   void MozSetDataAt(JSContext* aCx, const nsAString& aFormat,
                     JS::Handle<JS::Value> aData, uint32_t aIndex,
                     mozilla::ErrorResult& aRv);
   JS::Value MozGetDataAt(JSContext* aCx, const nsAString& aFormat,
                          uint32_t aIndex, mozilla::ErrorResult& aRv);
   bool MozUserCancelled()
--- a/dom/indexedDB/IDBDatabase.cpp
+++ b/dom/indexedDB/IDBDatabase.cpp
@@ -8,16 +8,17 @@
 
 #include "IDBDatabase.h"
 
 #include "DictionaryHelpers.h"
 #include "mozilla/Mutex.h"
 #include "mozilla/storage.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/DOMStringList.h"
+#include "mozilla/dom/DOMStringListBinding.h"
 #include "mozilla/dom/quota/Client.h"
 #include "mozilla/dom/quota/QuotaManager.h"
 #include "nsJSUtils.h"
 #include "nsProxyRelease.h"
 #include "nsThreadUtils.h"
 
 #include "AsyncConnectionHelper.h"
 #include "DatabaseInfo.h"
@@ -489,40 +490,30 @@ IDBDatabase::WrapObject(JSContext* aCx, 
 uint64_t
 IDBDatabase::Version() const
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
   DatabaseInfo* info = Info();
   return info->version;
 }
 
-already_AddRefed<nsIDOMDOMStringList>
+already_AddRefed<DOMStringList>
 IDBDatabase::GetObjectStoreNames(ErrorResult& aRv) const
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
   DatabaseInfo* info = Info();
 
-  nsAutoTArray<nsString, 10> objectStoreNames;
-  if (!info->GetObjectStoreNames(objectStoreNames)) {
+  nsRefPtr<DOMStringList> list(new DOMStringList());
+  if (!info->GetObjectStoreNames(list->StringArray())) {
     IDB_WARNING("Couldn't get names!");
     aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
     return nullptr;
   }
 
-  nsRefPtr<DOMStringList> list(new DOMStringList());
-  uint32_t count = objectStoreNames.Length();
-  for (uint32_t index = 0; index < count; index++) {
-    if (!list->Add(objectStoreNames[index])) {
-      IDB_WARNING("Failed to add element");
-      aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
-      return nullptr;
-    }
-  }
-
   return list.forget();
 }
 
 already_AddRefed<IDBObjectStore>
 IDBDatabase::CreateObjectStore(
                             JSContext* aCx, const nsAString& aName,
                             const IDBObjectStoreParameters& aOptionalParameters,
                             ErrorResult& aRv)
--- a/dom/indexedDB/IDBDatabase.h
+++ b/dom/indexedDB/IDBDatabase.h
@@ -184,17 +184,17 @@ public:
   {
     NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
     aName.Assign(mName);
   }
 
   uint64_t
   Version() const;
 
-  already_AddRefed<nsIDOMDOMStringList>
+  already_AddRefed<mozilla::dom::DOMStringList>
   GetObjectStoreNames(ErrorResult& aRv) const;
 
   already_AddRefed<IDBObjectStore>
   CreateObjectStore(JSContext* aCx, const nsAString& aName,
                     const IDBObjectStoreParameters& aOptionalParameters,
                     ErrorResult& aRv);
 
   void
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -2632,39 +2632,31 @@ IDBObjectStore::GetKeyPath(JSContext* aC
   if (JSVAL_IS_GCTHING(mCachedKeyPath)) {
     mozilla::HoldJSObjects(this);
     mRooted = true;
   }
 
   return mCachedKeyPath;
 }
 
-already_AddRefed<nsIDOMDOMStringList>
+already_AddRefed<DOMStringList>
 IDBObjectStore::GetIndexNames(ErrorResult& aRv)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
   nsRefPtr<DOMStringList> list(new DOMStringList());
 
-  nsAutoTArray<nsString, 10> names;
+  nsTArray<nsString>& names = list->StringArray();
   uint32_t count = mInfo->indexes.Length();
   names.SetCapacity(count);
 
   for (uint32_t index = 0; index < count; index++) {
     names.InsertElementSorted(mInfo->indexes[index].name);
   }
 
-  for (uint32_t index = 0; index < count; index++) {
-    if (!list->Add(names[index])) {
-      IDB_WARNING("Failed to add element!");
-      aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
-      return nullptr;
-    }
-  }
-
   return list.forget();
 }
 
 already_AddRefed<IDBRequest>
 IDBObjectStore::Get(JSContext* aCx, JS::Handle<JS::Value> aKey,
                     ErrorResult& aRv)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
--- a/dom/indexedDB/IDBObjectStore.h
+++ b/dom/indexedDB/IDBObjectStore.h
@@ -280,17 +280,17 @@ public:
   {
     NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
     aName.Assign(mName);
   }
 
   JS::Value
   GetKeyPath(JSContext* aCx, ErrorResult& aRv);
 
-  already_AddRefed<nsIDOMDOMStringList>
+  already_AddRefed<DOMStringList>
   GetIndexNames(ErrorResult& aRv);
 
   IDBTransaction*
   Transaction() const
   {
     NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
     return mTransaction;
   }
--- a/dom/indexedDB/IDBTransaction.cpp
+++ b/dom/indexedDB/IDBTransaction.cpp
@@ -666,42 +666,28 @@ IDBTransaction::GetError(ErrorResult& aR
   if (IsOpen()) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return nullptr;
   }
 
   return mError;
 }
 
-already_AddRefed<nsIDOMDOMStringList>
+already_AddRefed<DOMStringList>
 IDBTransaction::GetObjectStoreNames(ErrorResult& aRv)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
   nsRefPtr<DOMStringList> list(new DOMStringList());
 
-  nsAutoTArray<nsString, 10> stackArray;
-  nsTArray<nsString>* arrayOfNames;
-
   if (mMode == IDBTransaction::VERSION_CHANGE) {
-    mDatabaseInfo->GetObjectStoreNames(stackArray);
-
-    arrayOfNames = &stackArray;
+    mDatabaseInfo->GetObjectStoreNames(list->StringArray());
   }
   else {
-    arrayOfNames = &mObjectStoreNames;
-  }
-
-  uint32_t count = arrayOfNames->Length();
-  for (uint32_t index = 0; index < count; index++) {
-    if (!list->Add(arrayOfNames->ElementAt(index))) {
-      IDB_WARNING("Failed to add element!");
-      aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
-      return nullptr;
-    }
+    list->StringArray() = mObjectStoreNames;
   }
 
   return list.forget();
 }
 
 already_AddRefed<IDBObjectStore>
 IDBTransaction::ObjectStore(const nsAString& aName, ErrorResult& aRv)
 {
--- a/dom/indexedDB/IDBTransaction.h
+++ b/dom/indexedDB/IDBTransaction.h
@@ -249,17 +249,17 @@ public:
     NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
     aRv = AbortInternal(NS_ERROR_DOM_INDEXEDDB_ABORT_ERR, nullptr);
   }
 
   IMPL_EVENT_HANDLER(abort)
   IMPL_EVENT_HANDLER(complete)
   IMPL_EVENT_HANDLER(error)
 
-  already_AddRefed<nsIDOMDOMStringList>
+  already_AddRefed<DOMStringList>
   GetObjectStoreNames(ErrorResult& aRv);
 
 private:
   nsresult
   AbortInternal(nsresult aAbortCode,
                 already_AddRefed<mozilla::dom::DOMError> aError);
 
   // Should only be called directly through IndexedDBDatabaseChild.
--- a/dom/interfaces/base/domstubs.idl
+++ b/dom/interfaces/base/domstubs.idl
@@ -23,17 +23,16 @@ interface nsIDOMDOMImplementation;
 interface nsIDOMDocument;
 interface nsIDOMDocumentFragment;
 interface nsIDOMDocumentType;
 interface nsIDOMElement;
 interface nsIDOMNode;
 interface nsIDOMNodeList;
 interface nsIDOMProcessingInstruction;
 interface nsIDOMText;
-interface nsIDOMDOMStringList;
 interface nsIDOMClientRect;
 interface nsIDOMClientRectList;
 
 // Needed for raises() in our IDL
 interface DOMException;
 
 // Style Sheets
 interface nsIDOMStyleSheetList;
--- a/dom/interfaces/core/moz.build
+++ b/dom/interfaces/core/moz.build
@@ -9,17 +9,16 @@ XPIDL_SOURCES += [
     'nsIDOMCDATASection.idl',
     'nsIDOMCharacterData.idl',
     'nsIDOMComment.idl',
     'nsIDOMDocument.idl',
     'nsIDOMDocumentFragment.idl',
     'nsIDOMDocumentType.idl',
     'nsIDOMDOMException.idl',
     'nsIDOMDOMImplementation.idl',
-    'nsIDOMDOMStringList.idl',
     'nsIDOMElement.idl',
     'nsIDOMMozNamedAttrMap.idl',
     'nsIDOMNode.idl',
     'nsIDOMNodeList.idl',
     'nsIDOMNSEditableElement.idl',
     'nsIDOMProcessingInstruction.idl',
     'nsIDOMText.idl',
     'nsIDOMUserDataHandler.idl',
deleted file mode 100644
--- a/dom/interfaces/core/nsIDOMDOMStringList.idl
+++ /dev/null
@@ -1,18 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-/**
- * Corresponds to http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407
- */
-
-#include "domstubs.idl"
-
-[scriptable, uuid(0bbae65c-1dde-11d9-8c46-000a95dc234c)]
-interface nsIDOMDOMStringList : nsISupports
-{
-  DOMString          item(in unsigned long index);
-  readonly attribute unsigned long   length;
-  boolean            contains(in DOMString str);
-};
--- a/dom/interfaces/core/nsIDOMDocument.idl
+++ b/dom/interfaces/core/nsIDOMDocument.idl
@@ -27,17 +27,17 @@ interface nsIDOMLocation;
  * cannot exist outside the context of a Document, the nsIDOMDocument 
  * interface also contains the factory methods needed to create these 
  * objects.
  *
  * For more information on this interface please see 
  * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
  */
 
-[scriptable, uuid(aa4b59de-462a-4f61-abd9-4232fef3dacc)]
+[scriptable, uuid(d24d1118-a527-4d5a-9c4e-fb07dfc2fc27)]
 interface nsIDOMDocument : nsIDOMNode
 {
   readonly attribute nsIDOMDocumentType         doctype;
   readonly attribute nsIDOMDOMImplementation    implementation;
   readonly attribute nsIDOMElement              documentElement;
   nsIDOMElement                 createElement([Null(Stringify)] in DOMString tagName)
                                   raises(DOMException);
   nsIDOMDocumentFragment        createDocumentFragment();
@@ -223,17 +223,17 @@ interface nsIDOMDocument : nsIDOMNode
    * this document available to the implementation, in the order they are
    * listed in the styleSheets attribute, adding the title of each style sheet
    * with a title to the list, avoiding duplicates by dropping titles that
    * match (case-sensitively) titles that have already been added to the
    * list.
    *
    * @see <http://dev.w3.org/csswg/cssom/#dom-document-styleSheetSets>
    */
-  readonly attribute nsIDOMDOMStringList styleSheetSets;
+  readonly attribute nsISupports styleSheetSets;
 
   /**
    * Calling this method must change the disabled attribute on each StyleSheet
    * object with a title attribute with a length greater than 0 in the
    * styleSheets attribute, so that all those whose title matches the name
    * argument are enabled, and all others are disabled. Title matches must be
    * case-sensitive. Calling this method with the empty string disables all
    * alternate and preferred style sheets (but does not change the state of
--- a/dom/interfaces/core/nsIDOMXMLDocument.idl
+++ b/dom/interfaces/core/nsIDOMXMLDocument.idl
@@ -1,16 +1,16 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "nsIDOMDocument.idl"
 
-[scriptable, uuid(90903f50-7611-42c1-a13c-dac4e735bee2)]
+[scriptable, uuid(ebf9f390-7cd2-4456-bc53-4869019370ea)]
 interface nsIDOMXMLDocument : nsIDOMDocument
 {
   // DOM Level 3 Load & Save, DocumentLS
   // http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS
   /**
    * Whether to load synchronously or asynchronously.
    * The default is async==true.
    */
--- a/dom/interfaces/events/nsIDOMDataTransfer.idl
+++ b/dom/interfaces/events/nsIDOMDataTransfer.idl
@@ -3,17 +3,17 @@
  * 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 "domstubs.idl"
 
 interface nsIVariant;
 interface nsIDOMFileList;
 
-[scriptable, builtinclass, uuid(4ba241dd-a964-4077-bc30-515a657772e4)]
+[scriptable, builtinclass, uuid(c71180e3-298b-4fbb-9ccb-82c822474741)]
 interface nsIDOMDataTransfer : nsISupports
 {
   /**
    * The actual effect that will be used, and should always be one of the
    * possible values of effectAllowed.
    *
    * For dragstart, drag and dragleave events, the dropEffect is initialized
    * to none. Any value assigned to the dropEffect will be set, but the value
@@ -66,17 +66,17 @@ interface nsIDOMDataTransfer : nsISuppor
    */
   readonly attribute nsIDOMFileList files;
 
   /**
    * Holds a list of the format types of the data that is stored for the first
    * item, in the same order the data was added. An empty list will be
    * returned if no data was added.
    */
-  readonly attribute nsIDOMDOMStringList types;
+  readonly attribute nsISupports types;
 
   /**
    * Remove the data associated with a given format. If format is empty or not
    * specified, the data associated with all formats is removed. If data for
    * the specified format does not exist, or the data transfer contains no
    * data, this method will have no effect.
    */
   void clearData([optional] in DOMString format);
@@ -148,17 +148,17 @@ interface nsIDOMDataTransfer : nsISuppor
    */
   attribute DOMString mozCursor;
 
   /**
    * Holds a list of the format types of the data that is stored for an item
    * at the specified index. If the index is not in the range from 0 to
    * itemCount - 1, an empty string list is returned.
    */
-  nsIDOMDOMStringList mozTypesAt(in unsigned long index);
+  nsISupports mozTypesAt(in unsigned long index);
 
   /**
    * Remove the data associated with the given format for an item at the
    * specified index. The index is in the range from zero to itemCount - 1.
    *
    * If the last format for the item is removed, the entire item is removed,
    * reducing the itemCount by one.
    *
--- a/dom/interfaces/html/nsIDOMHTMLDocument.idl
+++ b/dom/interfaces/html/nsIDOMHTMLDocument.idl
@@ -8,17 +8,17 @@
 /**
  * The nsIDOMHTMLDocument interface is the interface to a [X]HTML
  * document object.
  *
  * @see <http://www.whatwg.org/html/>
  */
 interface nsISelection;
 
-[scriptable, uuid(7147c7ea-393e-454f-8de8-e356861bd9a7)]
+[scriptable, uuid(b73be9dd-bcc8-44df-8b01-3389e277427f)]
 interface nsIDOMHTMLDocument : nsIDOMDocument
 {
            attribute DOMString            domain;
            attribute DOMString            cookie;
 
   readonly attribute nsIDOMHTMLHeadElement head;
            attribute nsIDOMHTMLElement    body;
 
--- a/dom/interfaces/offline/nsIDOMOfflineResourceList.idl
+++ b/dom/interfaces/offline/nsIDOMOfflineResourceList.idl
@@ -1,24 +1,22 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "domstubs.idl"
 
-interface nsIDOMDOMStringList;
-
-[scriptable, uuid(c105fe6f-5603-40b2-b3d0-84cb51fab9f4)]
+[scriptable, uuid(6044702d-e4a9-420c-b711-558b7d6a3b9f)]
 interface nsIDOMOfflineResourceList : nsISupports
 {
   /**
    * Get the list of dynamically-managed entries.
    */
-  readonly attribute nsIDOMDOMStringList mozItems;
+  readonly attribute nsISupports mozItems;
 
   /**
    * Check that an entry exists in the list of dynamically-managed entries.
    *
    * @param uri
    *        The resource to check.
    */
   boolean mozHasItem(in DOMString uri);
--- a/dom/interfaces/xul/nsIDOMXULDocument.idl
+++ b/dom/interfaces/xul/nsIDOMXULDocument.idl
@@ -5,17 +5,17 @@
 
 #include "domstubs.idl"
 #include "nsIDOMDocument.idl"
 
 interface nsIDOMXULCommandDispatcher;
 interface nsIObserver;
 interface nsIBoxObject;
 
-[scriptable, uuid(e057a0ef-4be3-4d60-b45a-6cb9d35d8563)]
+[scriptable, uuid(efdb94fb-642f-4a79-ae20-9a5f7cb7f736)]
 interface nsIDOMXULDocument : nsIDOMDocument
 {
   attribute nsIDOMNode                          popupNode;
 
   /**
    * These attributes correspond to trustedGetPopupNode().rangeOffset and
    * rangeParent. They will help you find where in the DOM the popup is
    * happening. Can be accessed from chrome only, and only during a popup
--- a/dom/src/offline/nsDOMOfflineResourceList.cpp
+++ b/dom/src/offline/nsDOMOfflineResourceList.cpp
@@ -176,51 +176,61 @@ nsDOMOfflineResourceList::Disconnect()
     mListenerManager = nullptr;
   }
 }
 
 //
 // nsDOMOfflineResourceList::nsIDOMOfflineResourceList
 //
 
-NS_IMETHODIMP
-nsDOMOfflineResourceList::GetMozItems(nsIDOMDOMStringList **aItems)
+already_AddRefed<DOMStringList>
+nsDOMOfflineResourceList::GetMozItems(ErrorResult& aRv)
 {
-  if (IS_CHILD_PROCESS()) 
-    return NS_ERROR_NOT_IMPLEMENTED;
-
-  *aItems = nullptr;
+  if (IS_CHILD_PROCESS()) {
+    aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
+    return nullptr;
+  }
 
   nsRefPtr<DOMStringList> items = new DOMStringList();
 
   // If we are not associated with an application cache, return an
   // empty list.
   nsCOMPtr<nsIApplicationCache> appCache = GetDocumentAppCache();
   if (!appCache) {
-    NS_ADDREF(*aItems = items);
-    return NS_OK;
+    return items.forget();
   }
 
-  nsresult rv = Init();
-  NS_ENSURE_SUCCESS(rv, rv);
+  aRv = Init();
+  if (aRv.Failed()) {
+    return nullptr;
+  }
 
   uint32_t length;
   char **keys;
-  rv = appCache->GatherEntries(nsIApplicationCache::ITEM_DYNAMIC,
-                               &length, &keys);
-  NS_ENSURE_SUCCESS(rv, rv);
+  aRv = appCache->GatherEntries(nsIApplicationCache::ITEM_DYNAMIC,
+                                &length, &keys);
+  if (aRv.Failed()) {
+    return nullptr;
+  }
 
   for (uint32_t i = 0; i < length; i++) {
     items->Add(NS_ConvertUTF8toUTF16(keys[i]));
   }
 
   NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(length, keys);
 
-  NS_ADDREF(*aItems = items);
-  return NS_OK;
+  return items.forget();
+}
+
+NS_IMETHODIMP
+nsDOMOfflineResourceList::GetMozItems(nsISupports** aItems)
+{
+  ErrorResult rv;
+  *aItems = GetMozItems(rv).get();
+  return rv.ErrorCode();
 }
 
 NS_IMETHODIMP
 nsDOMOfflineResourceList::MozHasItem(const nsAString& aURI, bool* aExists)
 {
   if (IS_CHILD_PROCESS()) 
     return NS_ERROR_NOT_IMPLEMENTED;
 
--- a/dom/src/offline/nsDOMOfflineResourceList.h
+++ b/dom/src/offline/nsDOMOfflineResourceList.h
@@ -21,20 +21,25 @@
 #include "nsIDOMEventListener.h"
 #include "nsDOMEvent.h"
 #include "nsIObserver.h"
 #include "nsIScriptContext.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsPIDOMWindow.h"
 #include "nsDOMEventTargetHelper.h"
 #include "mozilla/ErrorResult.h"
-#include "nsIDOMDOMStringList.h"
 
 class nsIDOMWindow;
 
+namespace mozilla {
+namespace dom {
+class DOMStringList;
+} // namespace dom
+} // namespace mozilla
+
 class nsDOMOfflineResourceList : public nsDOMEventTargetHelper,
                                  public nsIDOMOfflineResourceList,
                                  public nsIObserver,
                                  public nsIOfflineCacheUpdateObserver,
                                  public nsSupportsWeakReference
 {
   typedef mozilla::ErrorResult ErrorResult;
 
@@ -83,22 +88,17 @@ public:
   IMPL_EVENT_HANDLER(error)
   IMPL_EVENT_HANDLER(noupdate)
   IMPL_EVENT_HANDLER(downloading)
   IMPL_EVENT_HANDLER(progress)
   IMPL_EVENT_HANDLER(cached)
   IMPL_EVENT_HANDLER(updateready)
   IMPL_EVENT_HANDLER(obsolete)
 
-  already_AddRefed<nsIDOMDOMStringList> GetMozItems(ErrorResult& aRv)
-  {
-    nsCOMPtr<nsIDOMDOMStringList> items;
-    aRv = GetMozItems(getter_AddRefs(items));
-    return items.forget();
-  }
+  already_AddRefed<mozilla::dom::DOMStringList> GetMozItems(ErrorResult& aRv);
   bool MozHasItem(const nsAString& aURI, ErrorResult& aRv)
   {
     bool hasItem = false;
     aRv = MozHasItem(aURI, &hasItem);
     return hasItem;
   }
   uint32_t GetMozLength(ErrorResult& aRv)
   {
--- a/dom/webidl/HTMLPropertiesCollection.webidl
+++ b/dom/webidl/HTMLPropertiesCollection.webidl
@@ -5,18 +5,16 @@
  *
  * The origin of this IDL file is
  * http://www.whatwg.org/specs/web-apps/current-work/
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
-interface DOMStringList;
-
 interface HTMLPropertiesCollection : HTMLCollection {
   // inherits length and item()
   getter PropertyNodeList? namedItem(DOMString name); // overrides inherited namedItem()
   readonly attribute DOMStringList names;
 };
 
 typedef sequence<any> PropertyValueArray;
 
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -80,16 +80,17 @@ WEBIDL_FILES = [
     'DOMException.webidl',
     'DOMImplementation.webidl',
     'DOMMMIError.webidl',
     'DOMParser.webidl',
     'DOMRect.webidl',
     'DOMRectList.webidl',
     'DOMRequest.webidl',
     'DOMSettableTokenList.webidl',
+    'DOMStringList.webidl',
     'DOMStringMap.webidl',
     'DOMTokenList.webidl',
     'DOMTransaction.webidl',
     'Downloads.webidl',
     'DragEvent.webidl',
     'DummyBinding.webidl',
     'DynamicsCompressorNode.webidl',
     'Element.webidl',
--- a/editor/libeditor/base/nsEditor.h
+++ b/editor/libeditor/base/nsEditor.h
@@ -67,16 +67,17 @@ class nsRange;
 class nsString;
 class nsTransactionManager;
 
 namespace mozilla {
 class Selection;
 class TextComposition;
 
 namespace dom {
+class DataTransfer;
 class Element;
 class EventTarget;
 }  // namespace dom
 }  // namespace mozilla
 
 namespace mozilla {
 namespace widget {
 struct IMEState;
@@ -803,17 +804,17 @@ public:
   // This method has to be called by nsEditorEventListener::Focus.
   // All actions that have to be done when the editor is focused needs to be
   // added here.
   void OnFocus(nsIDOMEventTarget* aFocusEventTarget);
 
   // Used to insert content from a data transfer into the editable area.
   // This is called for each item in the data transfer, with the index of
   // each item passed as aIndex.
-  virtual nsresult InsertFromDataTransfer(nsIDOMDataTransfer *aDataTransfer,
+  virtual nsresult InsertFromDataTransfer(mozilla::dom::DataTransfer *aDataTransfer,
                                           int32_t aIndex,
                                           nsIDOMDocument *aSourceDoc,
                                           nsIDOMNode *aDestinationNode,
                                           int32_t aDestOffset,
                                           bool aDoDeleteSelection) = 0;
 
   virtual nsresult InsertFromDrop(nsIDOMEvent* aDropEvent) = 0;
 
--- a/editor/libeditor/base/nsEditorEventListener.cpp
+++ b/editor/libeditor/base/nsEditorEventListener.cpp
@@ -15,17 +15,17 @@
 #include "nsEditorEventListener.h"
 #include "nsEventListenerManager.h"     // for nsEventListenerManager
 #include "nsFocusManager.h"             // for nsFocusManager
 #include "nsGkAtoms.h"                  // for nsGkAtoms, nsGkAtoms::input
 #include "nsIClipboard.h"               // for nsIClipboard, etc
 #include "nsIContent.h"                 // for nsIContent
 #include "nsIController.h"              // for nsIController
 #include "nsID.h"
-#include "nsIDOMDOMStringList.h"        // for nsIDOMDOMStringList
+#include "mozilla/dom/DOMStringList.h"
 #include "mozilla/dom/DataTransfer.h"
 #include "nsIDOMDocument.h"             // for nsIDOMDocument
 #include "nsIDOMDragEvent.h"            // for nsIDOMDragEvent
 #include "nsIDOMElement.h"              // for nsIDOMElement
 #include "nsIDOMEvent.h"                // for nsIDOMEvent
 #include "nsIDOMEventTarget.h"          // for nsIDOMEventTarget
 #include "nsIDOMKeyEvent.h"             // for nsIDOMKeyEvent
 #include "nsIDOMMouseEvent.h"           // for nsIDOMMouseEvent
@@ -54,17 +54,17 @@
 #ifdef HANDLE_NATIVE_TEXT_DIRECTION_SWITCH
 #include "nsContentUtils.h"             // for nsContentUtils, etc
 #include "nsIBidiKeyboard.h"            // for nsIBidiKeyboard
 #endif
 
 class nsPresContext;
 
 using namespace mozilla;
-using mozilla::dom::EventTarget;
+using namespace mozilla::dom;
 
 static nsINativeKeyBindings *sNativeEditorBindings = nullptr;
 
 static nsINativeKeyBindings*
 GetEditorKeyBindings()
 {
   static bool noBindings = false;
   if (!sNativeEditorBindings && !noBindings) {
@@ -800,40 +800,33 @@ nsEditorEventListener::Drop(nsIDOMDragEv
 bool
 nsEditorEventListener::CanDrop(nsIDOMDragEvent* aEvent)
 {
   // if the target doc is read-only, we can't drop
   if (mEditor->IsReadonly() || mEditor->IsDisabled()) {
     return false;
   }
 
-  nsCOMPtr<nsIDOMDataTransfer> dataTransfer;
-  aEvent->GetDataTransfer(getter_AddRefs(dataTransfer));
+  nsCOMPtr<nsIDOMDataTransfer> domDataTransfer;
+  aEvent->GetDataTransfer(getter_AddRefs(domDataTransfer));
+  nsCOMPtr<DataTransfer> dataTransfer = do_QueryInterface(domDataTransfer);
   NS_ENSURE_TRUE(dataTransfer, false);
 
-  nsCOMPtr<nsIDOMDOMStringList> types;
-  dataTransfer->GetTypes(getter_AddRefs(types));
-  NS_ENSURE_TRUE(types, false);
+  nsRefPtr<DOMStringList> types = dataTransfer->Types();
 
   // Plaintext editors only support dropping text. Otherwise, HTML and files
   // can be dropped as well.
-  bool typeSupported;
-  types->Contains(NS_LITERAL_STRING(kTextMime), &typeSupported);
-  if (!typeSupported) {
-    types->Contains(NS_LITERAL_STRING(kMozTextInternal), &typeSupported);
-    if (!typeSupported && !mEditor->IsPlaintextEditor()) {
-      types->Contains(NS_LITERAL_STRING(kHTMLMime), &typeSupported);
-      if (!typeSupported) {
-        types->Contains(NS_LITERAL_STRING(kFileMime), &typeSupported);
-      }
-    }
+  if (!types->Contains(NS_LITERAL_STRING(kTextMime)) &&
+      !types->Contains(NS_LITERAL_STRING(kMozTextInternal)) &&
+      (mEditor->IsPlaintextEditor() ||
+       (!types->Contains(NS_LITERAL_STRING(kHTMLMime)) &&
+        !types->Contains(NS_LITERAL_STRING(kFileMime))))) {
+    return false;
   }
 
-  NS_ENSURE_TRUE(typeSupported, false);
-
   // If there is no source node, this is probably an external drag and the
   // drop is allowed. The later checks rely on checking if the drag target
   // is the same as the drag source.
   nsCOMPtr<nsIDOMNode> sourceNode;
   dataTransfer->GetMozSourceNode(getter_AddRefs(sourceNode));
   if (!sourceNode)
     return true;
 
--- a/editor/libeditor/html/nsHTMLDataTransfer.cpp
+++ b/editor/libeditor/html/nsHTMLDataTransfer.cpp
@@ -29,17 +29,17 @@
 #include "nsError.h"
 #include "nsGkAtoms.h"
 #include "nsHTMLEditUtils.h"
 #include "nsHTMLEditor.h"
 #include "nsIClipboard.h"
 #include "nsIContent.h"
 #include "nsIContentFilter.h"
 #include "nsIDOMComment.h"
-#include "nsIDOMDOMStringList.h"
+#include "mozilla/dom/DOMStringList.h"
 #include "mozilla/dom/DataTransfer.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMDocumentFragment.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMHTMLAnchorElement.h"
 #include "nsIDOMHTMLEmbedElement.h"
 #include "nsIDOMHTMLFrameElement.h"
 #include "nsIDOMHTMLIFrameElement.h"
@@ -1226,34 +1226,35 @@ GetStringFromDataTransfer(nsIDOMDataTran
                           int32_t aIndex, nsAString& aOutputString)
 {
   nsCOMPtr<nsIVariant> variant;
   aDataTransfer->MozGetDataAt(aType, aIndex, getter_AddRefs(variant));
   if (variant)
     variant->GetAsAString(aOutputString);
 }
 
-nsresult nsHTMLEditor::InsertFromDataTransfer(nsIDOMDataTransfer *aDataTransfer,
+nsresult nsHTMLEditor::InsertFromDataTransfer(DataTransfer *aDataTransfer,
                                               int32_t aIndex,
                                               nsIDOMDocument *aSourceDoc,
                                               nsIDOMNode *aDestinationNode,
                                               int32_t aDestOffset,
                                               bool aDoDeleteSelection)
 {
-  nsCOMPtr<nsIDOMDOMStringList> types;
-  aDataTransfer->MozTypesAt(aIndex, getter_AddRefs(types));
+  ErrorResult rv;
+  nsRefPtr<DOMStringList> types = aDataTransfer->MozTypesAt(aIndex, rv);
+  if (rv.Failed()) {
+    return rv.ErrorCode();
+  }
 
-  bool hasPrivateHTMLFlavor;
-  types->Contains(NS_LITERAL_STRING(kHTMLContext), &hasPrivateHTMLFlavor);
+  bool hasPrivateHTMLFlavor = types->Contains(NS_LITERAL_STRING(kHTMLContext));
 
   bool isText = IsPlaintextEditor();
   bool isSafe = IsSafeToInsertData(aSourceDoc);
 
-  uint32_t length;
-  types->GetLength(&length);
+  uint32_t length = types->Length();
   for (uint32_t t = 0; t < length; t++) {
     nsAutoString type;
     types->Item(t, type);
 
     if (!isText) {
       if (type.EqualsLiteral(kFileMime) ||
           type.EqualsLiteral(kJPEGImageMime) ||
           type.EqualsLiteral(kJPGImageMime) ||
--- a/editor/libeditor/html/nsHTMLEditor.h
+++ b/editor/libeditor/html/nsHTMLEditor.h
@@ -541,17 +541,17 @@ protected:
   NS_IMETHOD PrepareHTMLTransferable(nsITransferable **transferable, bool havePrivFlavor);
   NS_IMETHOD InsertFromTransferable(nsITransferable *transferable, 
                                     nsIDOMDocument *aSourceDoc,
                                     const nsAString & aContextStr,
                                     const nsAString & aInfoStr,
                                     nsIDOMNode *aDestinationNode,
                                     int32_t aDestinationOffset,
                                     bool aDoDeleteSelection);
-  nsresult InsertFromDataTransfer(nsIDOMDataTransfer *aDataTransfer,
+  nsresult InsertFromDataTransfer(mozilla::dom::DataTransfer *aDataTransfer,
                                   int32_t aIndex,
                                   nsIDOMDocument *aSourceDoc,
                                   nsIDOMNode *aDestinationNode,
                                   int32_t aDestOffset,
                                   bool aDoDeleteSelection);
   bool HavePrivateHTMLFlavor( nsIClipboard *clipboard );
   nsresult   ParseCFHTML(nsCString & aCfhtml, char16_t **aStuffToPaste, char16_t **aCfcontext);
   nsresult   DoContentFilterCallback(const nsAString &aFlavor,
--- a/editor/libeditor/text/nsPlaintextDataTransfer.cpp
+++ b/editor/libeditor/text/nsPlaintextDataTransfer.cpp
@@ -44,16 +44,17 @@
 #include "nsString.h"
 #include "nsXPCOM.h"
 #include "nscore.h"
 
 class nsILoadContext;
 class nsISupports;
 
 using namespace mozilla;
+using namespace mozilla::dom;
 
 NS_IMETHODIMP nsPlaintextEditor::PrepareTransferable(nsITransferable **transferable)
 {
   // Create generic Transferable for getting the data
   nsresult rv = CallCreateInstance("@mozilla.org/widget/transferable;1", transferable);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Get the nsITransferable interface for getting the data from the clipboard
@@ -132,17 +133,17 @@ NS_IMETHODIMP nsPlaintextEditor::InsertT
   // Try to scroll the selection into view if the paste/drop succeeded
 
   if (NS_SUCCEEDED(rv))
     ScrollSelectionIntoView(false);
 
   return rv;
 }
 
-nsresult nsPlaintextEditor::InsertFromDataTransfer(nsIDOMDataTransfer *aDataTransfer,
+nsresult nsPlaintextEditor::InsertFromDataTransfer(DataTransfer *aDataTransfer,
                                                    int32_t aIndex,
                                                    nsIDOMDocument *aSourceDoc,
                                                    nsIDOMNode *aDestinationNode,
                                                    int32_t aDestOffset,
                                                    bool aDoDeleteSelection)
 {
   nsCOMPtr<nsIVariant> data;
   aDataTransfer->MozGetDataAt(NS_LITERAL_STRING("text/plain"), aIndex,
@@ -161,19 +162,20 @@ nsresult nsPlaintextEditor::InsertFromDa
 
 nsresult nsPlaintextEditor::InsertFromDrop(nsIDOMEvent* aDropEvent)
 {
   ForceCompositionEnd();
 
   nsCOMPtr<nsIDOMDragEvent> dragEvent(do_QueryInterface(aDropEvent));
   NS_ENSURE_TRUE(dragEvent, NS_ERROR_FAILURE);
 
-  nsCOMPtr<nsIDOMDataTransfer> dataTransfer;
-  nsresult rv = dragEvent->GetDataTransfer(getter_AddRefs(dataTransfer));
-  NS_ENSURE_SUCCESS(rv, rv);
+  nsCOMPtr<nsIDOMDataTransfer> domDataTransfer;
+  dragEvent->GetDataTransfer(getter_AddRefs(domDataTransfer));
+  nsCOMPtr<DataTransfer> dataTransfer = do_QueryInterface(domDataTransfer);
+  NS_ENSURE_TRUE(dataTransfer, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
   NS_ASSERTION(dragSession, "No drag session");
 
   nsCOMPtr<nsIDOMNode> sourceNode;
   dataTransfer->GetMozSourceNode(getter_AddRefs(sourceNode));
 
   nsCOMPtr<nsIDOMDocument> srcdomdoc;
@@ -190,17 +192,17 @@ nsresult nsPlaintextEditor::InsertFromDr
       return NS_OK;
   }
 
   // Current doc is destination
   nsCOMPtr<nsIDOMDocument> destdomdoc = GetDOMDocument();
   NS_ENSURE_TRUE(destdomdoc, NS_ERROR_NOT_INITIALIZED);
 
   uint32_t numItems = 0;
-  rv = dataTransfer->GetMozItemCount(&numItems);
+  nsresult rv = dataTransfer->GetMozItemCount(&numItems);
   NS_ENSURE_SUCCESS(rv, rv);
   if (numItems < 1) return NS_ERROR_FAILURE;  // nothing to drop?
 
   // Combine any deletion and drop insertion into one transaction
   nsAutoEditBatch beginBatching(this);
 
   bool deleteSelection = false;
 
--- a/editor/libeditor/text/nsPlaintextEditor.h
+++ b/editor/libeditor/text/nsPlaintextEditor.h
@@ -130,17 +130,17 @@ public:
   /* ------------ Utility Routines, not part of public API -------------- */
   NS_IMETHOD TypedText(const nsAString& aString, ETypingAction aAction);
 
   nsresult InsertTextAt(const nsAString &aStringToInsert,
                         nsIDOMNode *aDestinationNode,
                         int32_t aDestOffset,
                         bool aDoDeleteSelection);
 
-  virtual nsresult InsertFromDataTransfer(nsIDOMDataTransfer *aDataTransfer,
+  virtual nsresult InsertFromDataTransfer(mozilla::dom::DataTransfer *aDataTransfer,
                                           int32_t aIndex,
                                           nsIDOMDocument *aSourceDoc,
                                           nsIDOMNode *aDestinationNode,
                                           int32_t aDestOffset,
                                           bool aDoDeleteSelection);
 
   virtual nsresult InsertFromDrop(nsIDOMEvent* aDropEvent);
 
--- a/js/xpconnect/src/dom_quickstubs.qsconf
+++ b/js/xpconnect/src/dom_quickstubs.qsconf
@@ -27,19 +27,16 @@ members = [
     #
     # (And nsIDOMModalContentWindow.returnValue is an attribute of type
     # nsIVariant, which qsgen.py can't handle.)
     #
     # nsLocationSH has ~ALLOW_PROP_MODS_TO_PROTOTYPE, so don't try.
     #'nsIDOMLocation.hostname',
     #'nsIDOMLocation.href',
 
-    # dom/interfaces/core
-    'nsIDOMDOMStringList.*',
-
     # dom/interfaces/storage
     'nsIDOMToString.toString',
     'nsIDOMStorage.setItem',
     'nsIDOMStorage.length',
     'nsIDOMStorage.getItem',
     'nsIDOMStorage.key',
     'nsIDOMStorage.removeItem',
     'nsIDOMStorage.clear',
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -12,18 +12,17 @@
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/DataTransfer.h"
 #include "mozilla/dom/HTMLButtonElement.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsContentUtils.h"
 #include "nsEventStates.h"
-#include "nsIDOMDataTransfer.h"
-#include "nsIDOMDOMStringList.h"
+#include "mozilla/dom/DOMStringList.h"
 #include "nsIDOMDragEvent.h"
 #include "nsIDOMFileList.h"
 #include "nsContentList.h"
 #include "nsIDOMMutationEvent.h"
 #include "nsTextNode.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
@@ -218,28 +217,24 @@ nsFileControlFrame::DnDListener::HandleE
   }
 
   return NS_OK;
 }
 
 /* static */ bool
 nsFileControlFrame::DnDListener::IsValidDropData(nsIDOMDragEvent* aEvent)
 {
-  nsCOMPtr<nsIDOMDataTransfer> dataTransfer;
-  aEvent->GetDataTransfer(getter_AddRefs(dataTransfer));
+  nsCOMPtr<nsIDOMDataTransfer> domDataTransfer;
+  aEvent->GetDataTransfer(getter_AddRefs(domDataTransfer));
+  nsCOMPtr<DataTransfer> dataTransfer = do_QueryInterface(domDataTransfer);
   NS_ENSURE_TRUE(dataTransfer, false);
 
-  nsCOMPtr<nsIDOMDOMStringList> types;
-  dataTransfer->GetTypes(getter_AddRefs(types));
-  NS_ENSURE_TRUE(types, false);
-
   // We only support dropping files onto a file upload control
-  bool typeSupported;
-  types->Contains(NS_LITERAL_STRING("Files"), &typeSupported);
-  return typeSupported;
+  nsRefPtr<DOMStringList> types = dataTransfer->Types();
+  return types->Contains(NS_LITERAL_STRING("Files"));
 }
 
 nscoord
 nsFileControlFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result;
   DISPLAY_MIN_WIDTH(this, result);
 
--- a/toolkit/devtools/server/actors/script.js
+++ b/toolkit/devtools/server/actors/script.js
@@ -3591,21 +3591,21 @@ DebuggerServer.ObjectActorPreviewers.Obj
       url: threadActor.createValueGrip(url),
     };
 
     return true;
   },
 
   function ArrayLike({obj, threadActor}, aGrip, aRawObj) {
     if (!aRawObj ||
+        obj.class != "DOMStringList" &&
         obj.class != "DOMTokenList" &&
         !(aRawObj instanceof Ci.nsIDOMMozNamedAttrMap ||
           aRawObj instanceof Ci.nsIDOMCSSRuleList ||
           aRawObj instanceof Ci.nsIDOMCSSValueList ||
-          aRawObj instanceof Ci.nsIDOMDOMStringList ||
           aRawObj instanceof Ci.nsIDOMFileList ||
           aRawObj instanceof Ci.nsIDOMFontFaceList ||
           aRawObj instanceof Ci.nsIDOMMediaList ||
           aRawObj instanceof Ci.nsIDOMNodeList ||
           aRawObj instanceof Ci.nsIDOMStyleSheetList)) {
       return false;
     }