Bug 1446598 part 2. Get rid of nsIDOMComment. r=mystor
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 19 Mar 2018 15:15:39 -0400
changeset 408860 6ff20741ef7359f1d30b868b9044b30917ad15ad
parent 408859 3bdb10035410fe07bd40998f3c61991d0bfed953
child 408861 deb82c55b9280c11f90b4491e0020a12c1249cd4
push id33663
push userapavel@mozilla.com
push dateMon, 19 Mar 2018 22:40:21 +0000
treeherdermozilla-central@bfb7edfd0436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmystor
bugs1446598
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1446598 part 2. Get rid of nsIDOMComment. r=mystor MozReview-Commit-ID: GGXPQnlwuUM
devtools/server/actors/object.js
dom/base/Comment.cpp
dom/base/Comment.h
dom/base/nsDocument.cpp
dom/base/nsDocumentEncoder.cpp
dom/base/nsGenericDOMDataNode.cpp
dom/base/nsGenericDOMDataNode.h
dom/base/nsStyleLinkElement.cpp
dom/base/nsXMLContentSerializer.cpp
dom/base/test/test_bug352728.html
dom/base/test/test_bug352728.xhtml
dom/base/test/unit/test_range.js
dom/interfaces/base/domstubs.idl
dom/interfaces/core/moz.build
dom/interfaces/core/nsIDOMComment.idl
dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
dom/xml/nsXMLContentSink.cpp
editor/libeditor/HTMLEditorDataTransfer.cpp
xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
--- a/devtools/server/actors/object.js
+++ b/devtools/server/actors/object.js
@@ -1866,17 +1866,17 @@ DebuggerServer.ObjectActorPreviewers.Obj
       preview.attributesLength = rawObj.attributes.length;
       for (let attr of rawObj.attributes) {
         preview.attributes[attr.nodeName] = hooks.createValueGrip(attr.value);
       }
     } else if (obj.class == "Attr") {
       preview.value = hooks.createValueGrip(rawObj.value);
     } else if (obj.class == "Text" ||
                obj.class == "CDATASection" ||
-               rawObj instanceof Ci.nsIDOMComment) {
+               obj.class == "Comment") {
       preview.textContent = hooks.createValueGrip(rawObj.textContent);
     }
 
     return true;
   },
 
   function DOMEvent({obj, hooks}, grip, rawObj) {
     if (isWorker || !rawObj || !(rawObj instanceof Ci.nsIDOMEvent)) {
--- a/dom/base/Comment.cpp
+++ b/dom/base/Comment.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
- * Implementations of DOM Core's nsIDOMComment node.
+ * Implementations of DOM Core's Comment node.
  */
 
 #include "nsCOMPtr.h"
 #include "mozilla/dom/Comment.h"
 #include "mozilla/dom/CommentBinding.h"
 #include "mozilla/IntegerPrintfMacros.h"
 
 using namespace mozilla;
@@ -19,17 +19,17 @@ using namespace dom;
 namespace mozilla {
 namespace dom {
 
 Comment::~Comment()
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED(Comment, nsGenericDOMDataNode, nsIDOMNode,
-                            nsIDOMCharacterData, nsIDOMComment)
+                            nsIDOMCharacterData)
 
 bool
 Comment::IsNodeOfType(uint32_t aFlags) const
 {
   return !(aFlags & ~(eCOMMENT | eDATA_NODE));
 }
 
 nsGenericDOMDataNode*
--- a/dom/base/Comment.h
+++ b/dom/base/Comment.h
@@ -3,24 +3,24 @@
 /* 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_Comment_h
 #define mozilla_dom_Comment_h
 
 #include "mozilla/Attributes.h"
-#include "nsIDOMComment.h"
+#include "nsIDOMCharacterData.h"
 #include "nsGenericDOMDataNode.h"
 
 namespace mozilla {
 namespace dom {
 
 class Comment final : public nsGenericDOMDataNode,
-                      public nsIDOMComment
+                      public nsIDOMCharacterData
 {
 private:
   void Init()
   {
     MOZ_ASSERT(mNodeInfo->NodeType() == COMMENT_NODE,
                "Bad NodeType in aNodeInfo");
   }
 
@@ -41,19 +41,16 @@ public:
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMCharacterData
   NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)
   using nsGenericDOMDataNode::SetData; // Prevent hiding overloaded virtual function.
 
-  // nsIDOMComment
-  // Empty interface
-
   // nsINode
   virtual bool IsNodeOfType(uint32_t aFlags) const override;
 
   virtual nsGenericDOMDataNode* CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
                                               bool aCloneText) const override;
 
   virtual nsIDOMNode* AsDOMNode() override { return this; }
 #ifdef DEBUG
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -68,17 +68,16 @@
 #include "mozilla/dom/ProcessingInstruction.h"
 #include "nsDOMString.h"
 #include "nsNodeUtils.h"
 #include "nsLayoutUtils.h" // for GetFrameForPoint
 #include "nsIFrame.h"
 #include "nsITabChild.h"
 
 #include "nsRange.h"
-#include "nsIDOMComment.h"
 #include "mozilla/dom/DocumentType.h"
 #include "mozilla/dom/NodeIterator.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/PromiseNativeHandler.h"
 #include "mozilla/dom/TreeWalker.h"
 
 #include "nsIServiceManager.h"
 #include "mozilla/dom/ServiceWorkerManager.h"
--- a/dom/base/nsDocumentEncoder.cpp
+++ b/dom/base/nsDocumentEncoder.cpp
@@ -16,17 +16,16 @@
 #include "nsISupports.h"
 #include "nsIDocument.h"
 #include "nsIHTMLDocument.h"
 #include "nsCOMPtr.h"
 #include "nsIContentSerializer.h"
 #include "mozilla/Encoding.h"
 #include "nsIOutputStream.h"
 #include "nsIDOMElement.h"
-#include "nsIDOMComment.h"
 #include "nsIDOMProcessingInstruction.h"
 #include "nsIDOMNodeList.h"
 #include "nsRange.h"
 #include "nsIDOMRange.h"
 #include "nsIDOMDocument.h"
 #include "nsGkAtoms.h"
 #include "nsIContent.h"
 #include "nsIScriptContext.h"
--- a/dom/base/nsGenericDOMDataNode.cpp
+++ b/dom/base/nsGenericDOMDataNode.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
- * Base class for DOM Core's nsIDOMComment, DocumentType, Text,
+ * Base class for DOM Core's Comment, DocumentType, Text,
  * CDATASection and nsIDOMProcessingInstruction nodes.
  */
 
 #include "mozilla/DebugOnly.h"
 
 #include "nsGenericDOMDataNode.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/MemoryReporting.h"
--- a/dom/base/nsGenericDOMDataNode.h
+++ b/dom/base/nsGenericDOMDataNode.h
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
- * Base class for DOM Core's nsIDOMComment, DocumentType, Text,
+ * Base class for DOM Core's Comment, DocumentType, Text,
  * CDATASection, and nsIDOMProcessingInstruction nodes.
  */
 
 #ifndef nsGenericDOMDataNode_h___
 #define nsGenericDOMDataNode_h___
 
 #include "mozilla/Attributes.h"
 #include "nsIContent.h"
--- a/dom/base/nsStyleLinkElement.cpp
+++ b/dom/base/nsStyleLinkElement.cpp
@@ -18,17 +18,16 @@
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/FragmentOrElement.h"
 #include "mozilla/dom/HTMLLinkElement.h"
 #include "mozilla/dom/ShadowRoot.h"
 #include "mozilla/dom/SRILogHelper.h"
 #include "mozilla/Preferences.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
-#include "nsIDOMComment.h"
 #include "nsIDOMNode.h"
 #include "nsUnicharUtils.h"
 #include "nsCRT.h"
 #include "nsXPCOMCIDInternal.h"
 #include "nsUnicharInputStream.h"
 #include "nsContentUtils.h"
 #include "nsStyleUtil.h"
 #include "nsQueryObject.h"
--- a/dom/base/nsXMLContentSerializer.cpp
+++ b/dom/base/nsXMLContentSerializer.cpp
@@ -9,17 +9,16 @@
  * nsIDocumentEncoder to convert an XML DOM to an XML string that
  * could be parsed into more or less the original DOM.
  */
 
 #include "nsXMLContentSerializer.h"
 
 #include "nsGkAtoms.h"
 #include "nsIDOMProcessingInstruction.h"
-#include "nsIDOMComment.h"
 #include "nsIContent.h"
 #include "nsIContentInlines.h"
 #include "nsIDocument.h"
 #include "nsIDocumentEncoder.h"
 #include "nsElementTable.h"
 #include "nsNameSpaceManager.h"
 #include "nsTextFragment.h"
 #include "nsString.h"
--- a/dom/base/test/test_bug352728.html
+++ b/dom/base/test/test_bug352728.html
@@ -46,17 +46,17 @@ function testCharacterData(aNode, aText)
 
 function testComment(aText)
 {
   try {
     var comment = document.createComment(aText);
     var types = [ Comment, CharacterData, Node ];
     checkTypes(comment, "comment", types);
 
-    var interfaces = [ "nsIDOMComment", "nsIDOMCharacterData", "nsIDOMNode",
+    var interfaces = [ "nsIDOMCharacterData", "nsIDOMNode",
                        "nsIDOMEventTarget" ];
     checkInterfaces(comment, "comment", interfaces);
 
     testCharacterData(comment, aText);
     is(comment.nodeName, "#comment", "Check nodeName");
     is(comment.nodeType, Node.COMMENT_NODE, "Check nodeType");
   } catch (e) {
     ok(0, "Correct functioning of comment stuff", "something broke: " + e);
--- a/dom/base/test/test_bug352728.xhtml
+++ b/dom/base/test/test_bug352728.xhtml
@@ -70,17 +70,17 @@ function testCharacterData(aNode, aText)
 
 function testComment(aText)
 {
   try {
     var comment = document.createComment(aText);
     var types = [ Comment, CharacterData, Node ];
     checkTypes(comment, "comment", types);
 
-    var interfaces = [ "nsIDOMComment", "nsIDOMCharacterData", "nsIDOMNode",
+    var interfaces = [ "nsIDOMCharacterData", "nsIDOMNode",
                        "nsIDOMEventTarget" ];
     checkInterfaces(comment, "comment", interfaces);
 
     testCharacterData(comment, aText);
     is(comment.nodeName, "#comment", "Check nodeName");
     is(comment.nodeType, Node.COMMENT_NODE, "Check nodeType");
   } catch (e) {
     ok(0, "Correct functioning of comment stuff", "something broke: " + e);
--- a/dom/base/test/unit/test_range.js
+++ b/dom/base/test/unit/test_range.js
@@ -449,17 +449,18 @@ function do_miscellaneous_tests(doc) {
   doc = parser.parseFromString("<!-- foo --><foo/>", "application/xml");
   Assert.ok(doc instanceof Ci.nsIDOMDocument);
   Assert.equal(doc.childNodes.length, 2);
   baseRange = doc.createRange();
   baseRange.setStart(doc.firstChild, 1);
   baseRange.setEnd(doc.firstChild, 2);
   var frag = baseRange.extractContents();
   Assert.equal(frag.childNodes.length, 1);
-  Assert.ok(frag.firstChild instanceof Ci.nsIDOMComment);
+  Assert.ok(ChromeUtils.getClassName(frag.firstChild) == "Comment");
+  Assert.equal(frag.firstChild.nodeType, frag.COMMENT_NODE);
   Assert.equal(frag.firstChild.nodeValue, "f");
 
   /* smaug also requested attribute tests.  Sadly, those are not yet supported
      in ranges - see https://bugzilla.mozilla.org/show_bug.cgi?id=302775.
    */
 }
 
 function run_test() {
--- a/dom/interfaces/base/domstubs.idl
+++ b/dom/interfaces/base/domstubs.idl
@@ -12,17 +12,16 @@ class nsWrapperCache;
 [ptr] native nsWrapperCachePtr(nsWrapperCache);
 
 typedef unsigned long long DOMTimeStamp;
 typedef double DOMHighResTimeStamp;
 typedef unsigned long long nsViewID;
 
 // Core
 interface nsIDOMCharacterData;
-interface nsIDOMComment;
 interface nsIDOMDocument;
 interface nsIDOMDocumentFragment;
 interface nsIDOMElement;
 interface nsIDOMNode;
 interface nsIDOMNodeList;
 interface nsIDOMProcessingInstruction;
 
 // Needed for raises() in our IDL
--- a/dom/interfaces/core/moz.build
+++ b/dom/interfaces/core/moz.build
@@ -4,17 +4,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/.
 
 with Files("**"):
     BUG_COMPONENT = ("Core", "DOM")
 
 XPIDL_SOURCES += [
     'nsIDOMCharacterData.idl',
-    'nsIDOMComment.idl',
     'nsIDOMDocument.idl',
     'nsIDOMDocumentFragment.idl',
     'nsIDOMDOMException.idl',
     'nsIDOMElement.idl',
     'nsIDOMNode.idl',
     'nsIDOMNodeList.idl',
     'nsIDOMNSEditableElement.idl',
     'nsIDOMProcessingInstruction.idl',
deleted file mode 100644
--- a/dom/interfaces/core/nsIDOMComment.idl
+++ /dev/null
@@ -1,20 +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 "nsIDOMCharacterData.idl"
-
-/**
- * The nsIDOMComment interface inherits from nsIDOMCharacterData and represents 
- * the content of a comment, i.e., all the characters between the starting 
- * '<!--' and ending '-->'.
- * 
- * For more information on this interface please see 
- * http://www.w3.org/TR/DOM-Level-2-Core/
- */
-
-[uuid(e7866ff8-b7fc-494f-87c0-fb017d8a4d30)]
-interface nsIDOMComment : nsIDOMCharacterData
-{
-};
--- a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
+++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
@@ -24,17 +24,16 @@
 #include "nsComponentManagerUtils.h"
 #include "nsContentUtils.h"
 #include "nsContentCID.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsDOMAttributeMap.h"
 #include "nsFrameLoader.h"
 #include "nsIComponentRegistrar.h"
 #include "nsIContent.h"
-#include "nsIDOMComment.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMProcessingInstruction.h"
 #include "nsIDOMWindowUtils.h"
 #include "nsIDocShell.h"
 #include "nsIDocument.h"
 #include "nsIDocumentEncoder.h"
--- a/dom/xml/nsXMLContentSink.cpp
+++ b/dom/xml/nsXMLContentSink.cpp
@@ -8,17 +8,16 @@
 #include "nsXMLContentSink.h"
 #include "nsIParser.h"
 #include "nsIDocument.h"
 #include "nsIContent.h"
 #include "nsIURI.h"
 #include "nsNetUtil.h"
 #include "nsIDocShell.h"
 #include "nsIStyleSheetLinkingElement.h"
-#include "nsIDOMComment.h"
 #include "nsHTMLParts.h"
 #include "nsCRT.h"
 #include "mozilla/StyleSheetInlines.h"
 #include "mozilla/css/Loader.h"
 #include "nsGkAtoms.h"
 #include "nsContentUtils.h"
 #include "nsIScriptContext.h"
 #include "nsNameSpaceManager.h"
--- a/editor/libeditor/HTMLEditorDataTransfer.cpp
+++ b/editor/libeditor/HTMLEditorDataTransfer.cpp
@@ -33,17 +33,16 @@
 #include "nsIScriptError.h"
 #include "nsContentUtils.h"
 #include "nsDebug.h"
 #include "nsDependentSubstring.h"
 #include "nsError.h"
 #include "nsGkAtoms.h"
 #include "nsIClipboard.h"
 #include "nsIContent.h"
-#include "nsIDOMComment.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMDocumentFragment.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMNode.h"
 #include "nsIDocument.h"
 #include "nsIFile.h"
 #include "nsIInputStream.h"
 #include "nsIMIMEService.h"
--- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
@@ -3,17 +3,16 @@
  *
  * 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 "ShimInterfaceInfo.h"
 
 #include "nsIDOMCharacterData.h"
-#include "nsIDOMComment.h"
 #include "nsIDOMCustomEvent.h"
 #ifdef MOZ_WEBRTC
 #include "nsIDOMDataChannel.h"
 #endif
 #include "nsIDOMDOMCursor.h"
 #include "nsIDOMDOMException.h"
 #include "nsIDOMDOMRequest.h"
 #include "nsIDOMDocument.h"
@@ -44,17 +43,16 @@
 #include "nsIDOMXULElement.h"
 #include "nsIFrameLoader.h"
 #include "nsIListBoxObject.h"
 #include "nsISelection.h"
 #include "nsITreeBoxObject.h"
 #include "nsIWebBrowserPersistable.h"
 
 #include "mozilla/dom/CharacterDataBinding.h"
-#include "mozilla/dom/CommentBinding.h"
 #include "mozilla/dom/CSSPrimitiveValueBinding.h"
 #include "mozilla/dom/CSSStyleDeclarationBinding.h"
 #include "mozilla/dom/CSSStyleSheetBinding.h"
 #include "mozilla/dom/CSSValueBinding.h"
 #include "mozilla/dom/CSSValueListBinding.h"
 #include "mozilla/dom/CustomEventBinding.h"
 #include "mozilla/dom/DOMCursorBinding.h"
 #include "mozilla/dom/DOMExceptionBinding.h"
@@ -157,17 +155,16 @@ struct ComponentsInterfaceShimEntry {
  *   interface only has an "nsIDOM" prefix prepended to the WebIDL name, you
  *   can use the DEFINE_SHIM macro and pass in the name of the WebIDL
  *   interface.  Otherwise, use DEFINE_SHIM_WITH_CUSTOM_INTERFACE.
  */
 
 const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
 {
   DEFINE_SHIM(CharacterData),
-  DEFINE_SHIM(Comment),
   DEFINE_SHIM(CustomEvent),
   DEFINE_SHIM(DOMCursor),
   DEFINE_SHIM(DOMException),
   DEFINE_SHIM(DOMRequest),
   DEFINE_SHIM(Document),
   DEFINE_SHIM(DocumentFragment),
   DEFINE_SHIM(Element),
   DEFINE_SHIM(Event),