Bug 1427512 - Part 21: Remove nsIDOMStyleSheetList. r=xidorn,jryans,bz draft
authorCameron McCormack <cam@mcc.id.au>
Tue, 02 Jan 2018 15:35:31 +1100
changeset 717722 d5ad69ea64556feed84cbb22e42175ae3fa95b66
parent 717721 b85f48a691c96c018737c196f0343929dfd181ed
child 717723 82e05be9dd3995205ea5543ccb8d4e92b9d1817f
push id94746
push userbmo:cam@mcc.id.au
push dateTue, 09 Jan 2018 10:21:54 +0000
reviewersxidorn, jryans, bz
bugs1427512
milestone59.0a1
Bug 1427512 - Part 21: Remove nsIDOMStyleSheetList. r=xidorn,jryans,bz MozReview-Commit-ID: 8ZSTMoWkeRw
devtools/server/actors/object.js
dom/base/StyleSheetList.cpp
dom/base/StyleSheetList.h
dom/base/nsDocument.cpp
dom/interfaces/base/domstubs.idl
dom/interfaces/core/nsIDOMDocument.idl
dom/interfaces/stylesheets/moz.build
dom/interfaces/stylesheets/nsIDOMStyleSheetList.idl
xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
--- a/devtools/server/actors/object.js
+++ b/devtools/server/actors/object.js
@@ -1763,21 +1763,21 @@ DebuggerServer.ObjectActorPreviewers.Obj
   },
 
   function ArrayLike({obj, hooks}, grip, rawObj) {
     if (isWorker || !rawObj ||
         obj.class != "DOMStringList" &&
         obj.class != "DOMTokenList" &&
         obj.class != "CSSRuleList" &&
         obj.class != "MediaList" &&
+        obj.class != "StyleSheetList" &&
         !(rawObj instanceof Ci.nsIDOMMozNamedAttrMap ||
           rawObj instanceof Ci.nsIDOMCSSValueList ||
           rawObj instanceof Ci.nsIDOMFileList ||
-          rawObj instanceof Ci.nsIDOMNodeList ||
-          rawObj instanceof Ci.nsIDOMStyleSheetList)) {
+          rawObj instanceof Ci.nsIDOMNodeList)) {
       return false;
     }
 
     if (typeof rawObj.length != "number") {
       return false;
     }
 
     grip.preview = {
--- a/dom/base/StyleSheetList.cpp
+++ b/dom/base/StyleSheetList.cpp
@@ -3,53 +3,37 @@
 /* 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/StyleSheetList.h"
 
 #include "mozilla/CSSStyleSheet.h"
 #include "mozilla/dom/StyleSheetListBinding.h"
-#include "nsStubDocumentObserver.h"
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(StyleSheetList)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(StyleSheetList)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsIDOMStyleSheetList)
   NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMStyleSheetList)
+  NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(StyleSheetList)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(StyleSheetList)
 
 /* virtual */ JSObject*
 StyleSheetList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return StyleSheetListBinding::Wrap(aCx, this, aGivenProto);
 }
 
-NS_IMETHODIMP
-StyleSheetList::GetLength(uint32_t* aLength)
-{
-  *aLength = Length();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-StyleSheetList::SlowItem(uint32_t aIndex, nsIDOMStyleSheet** aItem)
-{
-  NS_IF_ADDREF(*aItem = Item(aIndex));
-  return NS_OK;
-}
-
 void
 StyleSheetList::NodeWillBeDestroyed(const nsINode* aNode)
 {
   mDocumentOrShadowRoot = nullptr;
 }
 
 StyleSheetList::StyleSheetList(DocumentOrShadowRoot& aScope)
   : mDocumentOrShadowRoot(&aScope)
--- a/dom/base/StyleSheetList.h
+++ b/dom/base/StyleSheetList.h
@@ -3,36 +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 mozilla_dom_StyleSheetList_h
 #define mozilla_dom_StyleSheetList_h
 
 #include "mozilla/dom/DocumentOrShadowRoot.h"
-#include "nsIDOMStyleSheetList.h"
+#include "nsStubMutationObserver.h"
 #include "nsWrapperCache.h"
-#include "nsStubDocumentObserver.h"
 
 class nsINode;
 
 namespace mozilla {
 class StyleSheet;
 
 namespace dom {
 
-class StyleSheetList final : public nsIDOMStyleSheetList
+class StyleSheetList final : public nsStubMutationObserver
                            , public nsWrapperCache
-                           , public nsStubDocumentObserver
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(StyleSheetList, nsIDOMStyleSheetList)
-
-  NS_DECL_NSIDOMSTYLESHEETLIST
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(StyleSheetList)
 
   NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED
 
   explicit StyleSheetList(DocumentOrShadowRoot& aScope);
 
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override final;
 
   nsINode* GetParentObject() const
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -6356,23 +6356,16 @@ nsDocument::GetElementsByTagNameNS(const
   }
 
   // transfer ref to aReturn
   list.forget(aReturn);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocument::GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets)
-{
-  NS_ADDREF(*aStyleSheets = StyleSheets());
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 nsDocument::GetMozSelectedStyleSheetSet(nsAString& aSheetSet)
 {
   nsIDocument::GetSelectedStyleSheetSet(aSheetSet);
   return NS_OK;
 }
 
 void
 nsIDocument::GetSelectedStyleSheetSet(nsAString& aSheetSet)
--- a/dom/interfaces/base/domstubs.idl
+++ b/dom/interfaces/base/domstubs.idl
@@ -36,17 +36,16 @@ interface nsIDOMClientRectList;
 namespace mozilla {
 namespace dom {
 class DOMException;
 }
 }
 %}
 
 // Style Sheets
-interface nsIDOMStyleSheetList;
 interface nsIDOMStyleSheet;
 
 // Base
 interface nsIDOMWindow;
 interface nsIDOMWindowCollection;
 interface nsIDOMNavigator;
 interface nsIDOMScreen;
 
--- a/dom/interfaces/core/nsIDOMDocument.idl
+++ b/dom/interfaces/core/nsIDOMDocument.idl
@@ -142,20 +142,16 @@ interface nsIDOMDocument : nsIDOMNode
    * space-separated string.
    *
    * @see <http://www.whatwg.org/html/#dom-document-getelementsbyclassname>
    */
   nsIDOMNodeList getElementsByClassName(in DOMString classes);
 
 
   // CSSOM
-  /**
-   * @see <http://dev.w3.org/csswg/cssom/#dom-document-stylesheets>
-   */
-  readonly attribute nsIDOMStyleSheetList   styleSheets;
 
   /**
    * This attribute must return the preferred style sheet set as set by the
    * author. It is determined from the order of style sheet declarations and
    * the Default-Style HTTP headers, as eventually defined elsewhere in the Web
    * Apps 1.0 specification. If there is no preferred style sheet set, this
    * attribute must return the empty string. The case of this attribute must
    * exactly match the case given by the author where the preferred style sheet
--- a/dom/interfaces/stylesheets/moz.build
+++ b/dom/interfaces/stylesheets/moz.build
@@ -4,13 +4,12 @@
 # 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/.
 
 with Files("**"):
     BUG_COMPONENT = ("Core", "DOM: CSS Object Model")
 
 XPIDL_SOURCES += [
     'nsIDOMStyleSheet.idl',
-    'nsIDOMStyleSheetList.idl',
 ]
 
 XPIDL_MODULE = 'dom_stylesheets'
 
deleted file mode 100644
--- a/dom/interfaces/stylesheets/nsIDOMStyleSheetList.idl
+++ /dev/null
@@ -1,22 +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/. */
-
-#include "domstubs.idl"
-
-/**
- * The nsIDOMStyleSheetList interface is a datatype for a style sheet
- * list in the Document Object Model.
- *
- * For more information on this interface please see
- * http://www.w3.org/TR/DOM-Level-2-Style
- */
-
-[uuid(0e424250-ac2a-4fe2-bccd-a45824af090e)]
-interface nsIDOMStyleSheetList : nsISupports
-{
-  readonly attribute unsigned long    length;
-  [binaryname(SlowItem)]
-  nsIDOMStyleSheet         item(in unsigned long index);
-};
--- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
@@ -65,17 +65,16 @@
 #include "nsIDOMProcessingInstruction.h"
 #include "nsIDOMRange.h"
 #include "nsIDOMRect.h"
 #include "nsIDOMScreen.h"
 #include "nsIDOMScrollAreaEvent.h"
 #include "nsIDOMSerializer.h"
 #include "nsIDOMSimpleGestureEvent.h"
 #include "nsIDOMStyleSheet.h"
-#include "nsIDOMStyleSheetList.h"
 #include "nsIDOMSVGElement.h"
 #include "nsIDOMSVGLength.h"
 #include "nsIDOMText.h"
 #include "nsIDOMTimeEvent.h"
 #include "nsIDOMTimeRanges.h"
 #include "nsIDOMTransitionEvent.h"
 #include "nsIDOMTreeWalker.h"
 #include "nsIDOMUIEvent.h"
@@ -311,17 +310,16 @@ const ComponentsInterfaceShimEntry kComp
   DEFINE_SHIM(Range),
   DEFINE_SHIM(Rect),
   DEFINE_SHIM(Screen),
   DEFINE_SHIM(ScrollAreaEvent),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIScrollBoxObject, ScrollBoxObject),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMSerializer, XMLSerializer),
   DEFINE_SHIM(SimpleGestureEvent),
   DEFINE_SHIM(StyleSheet),
-  DEFINE_SHIM(StyleSheetList),
   DEFINE_SHIM(SVGElement),
   DEFINE_SHIM(SVGLength),
   DEFINE_SHIM(Text),
   DEFINE_SHIM(TimeEvent),
   DEFINE_SHIM(TimeRanges),
   DEFINE_SHIM(TransitionEvent),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsITreeBoxObject, TreeBoxObject),
   DEFINE_SHIM(TreeWalker),