Merge inbound to mozilla-central. a=merge
authorCsoregi Natalia <ncsoregi@mozilla.com>
Wed, 30 May 2018 12:25:03 +0300
changeset 420404 5866d6685849311f057e7e229b9ace63a2641c29
parent 420355 c094fc31b95f079c5cec2f3e88cb9fec0bdd7ca5 (current diff)
parent 420403 26548ddbd8d4c978f86ea904add515598131d6c9 (diff)
child 420413 9910c68edd10dbc0861fcacfcc86e8d0bafd6ced
child 420467 a2fd9b7493a1d028685856220f246242a1a1b316
push id34071
push userncsoregi@mozilla.com
push dateWed, 30 May 2018 09:25:30 +0000
treeherdermozilla-central@5866d6685849 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone62.0a1
first release with
nightly linux32
5866d6685849 / 62.0a1 / 20180530100110 / files
nightly linux64
5866d6685849 / 62.0a1 / 20180530100110 / files
nightly mac
5866d6685849 / 62.0a1 / 20180530100110 / files
nightly win32
5866d6685849 / 62.0a1 / 20180530100110 / files
nightly win64
5866d6685849 / 62.0a1 / 20180530100110 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge inbound to mozilla-central. a=merge
devtools/client/debugger/test/mochitest/browser_dbg_on-pause-highlight.js
docshell/base/nsDocShell.cpp
dom/interfaces/core/nsIDOMNode.idl
layout/generic/nsFrame.cpp
layout/tables/nsTableWrapperFrame.cpp
widget/cocoa/nsChildView.mm
--- a/accessible/base/AccEvent.cpp
+++ b/accessible/base/AccEvent.cpp
@@ -194,80 +194,79 @@ AccVCChangeEvent::
 }
 
 already_AddRefed<nsIAccessibleEvent>
 a11y::MakeXPCEvent(AccEvent* aEvent)
 {
   DocAccessible* doc = aEvent->Document();
   Accessible* acc = aEvent->GetAccessible();
   nsINode* node = acc->GetNode();
-  nsIDOMNode* domNode = node ? node->AsDOMNode() : nullptr;
   bool fromUser = aEvent->IsFromUserInput();
   uint32_t type = aEvent->GetEventType();
   uint32_t eventGroup = aEvent->GetEventGroups();
   nsCOMPtr<nsIAccessibleEvent> xpEvent;
 
   if (eventGroup & (1 << AccEvent::eStateChangeEvent)) {
     AccStateChangeEvent* sc = downcast_accEvent(aEvent);
     bool extra = false;
     uint32_t state = nsAccUtils::To32States(sc->GetState(), &extra);
     xpEvent = new xpcAccStateChangeEvent(type, ToXPC(acc), ToXPCDocument(doc),
-                                         domNode, fromUser,
+                                         node, fromUser,
                                          state, extra, sc->IsStateEnabled());
     return xpEvent.forget();
   }
 
   if (eventGroup & (1 << AccEvent::eTextChangeEvent)) {
     AccTextChangeEvent* tc = downcast_accEvent(aEvent);
     nsString text;
     tc->GetModifiedText(text);
     xpEvent = new xpcAccTextChangeEvent(type, ToXPC(acc), ToXPCDocument(doc),
-                                        domNode, fromUser,
+                                        node, fromUser,
                                         tc->GetStartOffset(), tc->GetLength(),
                                         tc->IsTextInserted(), text);
     return xpEvent.forget();
   }
 
   if (eventGroup & (1 << AccEvent::eHideEvent)) {
     AccHideEvent* hideEvent = downcast_accEvent(aEvent);
     xpEvent = new xpcAccHideEvent(type, ToXPC(acc), ToXPCDocument(doc),
-                                  domNode, fromUser,
+                                  node, fromUser,
                                   ToXPC(hideEvent->TargetParent()),
                                   ToXPC(hideEvent->TargetNextSibling()),
                                   ToXPC(hideEvent->TargetPrevSibling()));
     return xpEvent.forget();
   }
 
   if (eventGroup & (1 << AccEvent::eCaretMoveEvent)) {
     AccCaretMoveEvent* cm = downcast_accEvent(aEvent);
     xpEvent = new xpcAccCaretMoveEvent(type, ToXPC(acc), ToXPCDocument(doc),
-                                       domNode, fromUser,
+                                       node, fromUser,
                                        cm->GetCaretOffset());
     return xpEvent.forget();
   }
 
   if (eventGroup & (1 << AccEvent::eVirtualCursorChangeEvent)) {
     AccVCChangeEvent* vcc = downcast_accEvent(aEvent);
     xpEvent = new xpcAccVirtualCursorChangeEvent(type,
                                                  ToXPC(acc), ToXPCDocument(doc),
-                                                 domNode, fromUser,
+                                                 node, fromUser,
                                                  ToXPC(vcc->OldAccessible()),
                                                  vcc->OldStartOffset(),
                                                  vcc->OldEndOffset(),
                                                  vcc->Reason());
     return xpEvent.forget();
   }
 
   if (eventGroup & (1 << AccEvent::eObjectAttrChangedEvent)) {
     AccObjectAttrChangedEvent* oac = downcast_accEvent(aEvent);
     nsString attribute;
     oac->GetAttribute()->ToString(attribute);
     xpEvent = new xpcAccObjectAttributeChangedEvent(type,
                                                     ToXPC(acc),
-                                                    ToXPCDocument(doc), domNode,
+                                                    ToXPCDocument(doc), node,
                                                     fromUser,
                                                     attribute);
     return xpEvent.forget();
   }
 
-  xpEvent = new xpcAccEvent(type, ToXPC(acc), ToXPCDocument(doc), domNode, fromUser);
+  xpEvent = new xpcAccEvent(type, ToXPC(acc), ToXPCDocument(doc), node, fromUser);
   return xpEvent.forget();
   }
--- a/accessible/base/nsAccessibilityService.cpp
+++ b/accessible/base/nsAccessibilityService.cpp
@@ -1656,27 +1656,26 @@ nsAccessibilityService::RemoveNativeRoot
   ApplicationAccessible* applicationAcc = ApplicationAcc();
 
   if (applicationAcc)
     applicationAcc->RemoveChild(aAccessible);
 #endif
 }
 
 bool
-nsAccessibilityService::HasAccessible(nsIDOMNode* aDOMNode)
+nsAccessibilityService::HasAccessible(nsINode* aDOMNode)
 {
-  nsCOMPtr<nsINode> node(do_QueryInterface(aDOMNode));
-  if (!node)
+  if (!aDOMNode)
     return false;
 
-  DocAccessible* document = GetDocAccessible(node->OwnerDoc());
+  DocAccessible* document = GetDocAccessible(aDOMNode->OwnerDoc());
   if (!document)
     return false;
 
-  return document->HasAccessible(node);
+  return document->HasAccessible(aDOMNode);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessibilityService private (DON'T put methods here)
 
 void
 nsAccessibilityService::SetConsumers(uint32_t aConsumers, bool aNotify) {
   if (gConsumers & aConsumers) {
--- a/accessible/base/nsAccessibilityService.h
+++ b/accessible/base/nsAccessibilityService.h
@@ -116,17 +116,17 @@ public:
 
   /**
    * Adds/remove ATK root accessible for gtk+ native window to/from children
    * of the application accessible.
    */
   Accessible* AddNativeRootAccessible(void* aAtkAccessible);
   void RemoveNativeRootAccessible(Accessible* aRootAccessible);
 
-  bool HasAccessible(nsIDOMNode* aDOMNode);
+  bool HasAccessible(nsINode* aDOMNode);
 
   /**
    * Get a string equivalent for an accessible role value.
    */
   void GetStringRole(uint32_t aRole, nsAString& aString);
 
   /**
    * Get a string equivalent for an accessible state/extra state.
--- a/accessible/interfaces/nsIAccessibilityService.idl
+++ b/accessible/interfaces/nsIAccessibilityService.idl
@@ -1,21 +1,22 @@
 /* -*- 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 "nsISupports.idl"
 
-interface nsIDOMNode;
 interface nsIAccessible;
 interface nsIWeakReference;
 interface nsIPresShell;
 interface nsIAccessiblePivot;
 
+webidl Node;
+
 /**
  * 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, builtinclass, uuid(2188e3a0-c88e-11e7-8f1a-0800200c9a66)]
 interface nsIAccessibilityService : nsISupports
 {
@@ -26,17 +27,17 @@ interface nsIAccessibilityService : nsIS
 
   /**
    * Return an nsIAccessible for a DOM node in pres shell 0.
    * Create a new accessible of the appropriate type if necessary,
    * or use one from the accessibility cache if it already exists.
    * @param aNode The DOM node to get an accessible for.
    * @return The nsIAccessible for the given DOM node.
    */
-  nsIAccessible getAccessibleFor(in nsIDOMNode aNode);
+  nsIAccessible getAccessibleFor(in Node aNode);
 
    /**
     * Returns accessible role as a string.
     *
     * @param aRole - the accessible role constants.
     */
   AString getStringRole(in unsigned long aRole);
 
@@ -68,17 +69,17 @@ interface nsIAccessibilityService : nsIS
   /**
    * Return an accessible for the given DOM node from the cache.
    * @note  the method is intended for testing purposes
    *
    * @param aNode  [in] the DOM node to get an accessible for
    *
    * @return       cached accessible for the given DOM node if any
    */
-  nsIAccessible getAccessibleFromCache(in nsIDOMNode aNode);
+  nsIAccessible getAccessibleFromCache(in Node aNode);
 
   /**
    * Create a new pivot for tracking a position and traversing a subtree.
    *
    * @param aRoot [in] the accessible root for the pivot
    * @return a new pivot
    */
   nsIAccessiblePivot createAccessiblePivot(in nsIAccessible aRoot);
--- a/accessible/interfaces/nsIAccessible.idl
+++ b/accessible/interfaces/nsIAccessible.idl
@@ -2,20 +2,21 @@
 /* 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"
 #include "nsIArray.idl"
 
 interface nsIPersistentProperties;
-interface nsIDOMNode;
 interface nsIAccessibleDocument;
 interface nsIAccessibleRelation;
 
+webidl Node;
+
 %{C++
 namespace mozilla {
 namespace a11y {
 class Accessible;
 }
 }
 %}
 
@@ -71,17 +72,17 @@ interface nsIAccessible : nsISupports
    * The 0-based index of this accessible in its parent's list of children,
    * or -1 if this accessible does not have a parent.
    */
   readonly attribute long indexInParent;
 
   /**
    * The DOM node this nsIAccessible is associated with.
    */
-  readonly attribute nsIDOMNode DOMNode;
+  readonly attribute Node DOMNode;
 
   /**
     * For remote accessibles the id of the related DOM node.
     */
   readonly attribute DOMString id;
 
   /**
    * The document accessible that this access node resides in.
--- a/accessible/interfaces/nsIAccessibleEvent.idl
+++ b/accessible/interfaces/nsIAccessibleEvent.idl
@@ -2,17 +2,18 @@
 /* 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 nsIAccessible;
 interface nsIAccessibleDocument;
-interface nsIDOMNode;
+
+webidl Node;
 
 %{C++
 #define NS_ACCESSIBLE_EVENT_TOPIC "accessible-event"
 %}
 
 /**
  * An interface for accessibility events listened to
  * by in-process accessibility clients, which can be used
@@ -437,19 +438,19 @@ interface nsIAccessibleEvent : nsISuppor
   /**
    * The nsIAccessibleDocument that the event target nsIAccessible
    * resides in. This can be used to get the DOM window,
    * the DOM document and the window handler, among other things.
    */
   readonly attribute nsIAccessibleDocument accessibleDocument;
 
   /**
-   * The nsIDOMNode associated with the event
+   * The Node associated with the event
    * May return null if accessible for event has been shut down
    */
-  readonly attribute nsIDOMNode DOMNode;
+  readonly attribute Node DOMNode;
 
   /**
    * Returns true if the event was caused by explicit user input,
    * as opposed to purely originating from a timer or mouse movement
    */
   readonly attribute boolean isFromUserInput;
 };
--- a/accessible/ipc/DocAccessibleParent.cpp
+++ b/accessible/ipc/DocAccessibleParent.cpp
@@ -89,17 +89,17 @@ DocAccessibleParent::RecvShowEvent(const
 
   if (!nsCoreUtils::AccEventObserversExist()) {
     return IPC_OK();
   }
 
   uint32_t type = nsIAccessibleEvent::EVENT_SHOW;
   xpcAccessibleGeneric* xpcAcc = GetXPCAccessible(target);
   xpcAccessibleDocument* doc = GetAccService()->GetXPCDocument(this);
-  nsIDOMNode* node = nullptr;
+  nsINode* node = nullptr;
   RefPtr<xpcAccEvent> event = new xpcAccEvent(type, xpcAcc, doc, node,
                                               aFromUser);
   nsCoreUtils::DispatchAccEvent(Move(event));
 
   return IPC_OK();
 }
 
 uint32_t
@@ -180,17 +180,17 @@ DocAccessibleParent::RecvHideEvent(const
     uint32_t type = nsIAccessibleEvent::EVENT_HIDE;
     xpcAccessibleGeneric* xpcAcc = GetXPCAccessible(root);
     xpcAccessibleGeneric* xpcParent = GetXPCAccessible(parent);
     ProxyAccessible* next = root->NextSibling();
     xpcAccessibleGeneric* xpcNext = next ? GetXPCAccessible(next) : nullptr;
     ProxyAccessible* prev = root->PrevSibling();
     xpcAccessibleGeneric* xpcPrev = prev ? GetXPCAccessible(prev) : nullptr;
     xpcAccessibleDocument* doc = GetAccService()->GetXPCDocument(this);
-    nsIDOMNode* node = nullptr;
+    nsINode* node = nullptr;
     event = new xpcAccHideEvent(type, xpcAcc, doc, node, aFromUser, xpcParent,
                                 xpcNext, xpcPrev);
   }
 
   parent->RemoveChild(root);
   root->Shutdown();
 
   MOZ_ASSERT(CheckDocTree());
@@ -218,17 +218,17 @@ DocAccessibleParent::RecvEvent(const uin
   ProxyEvent(proxy, aEventType);
 
   if (!nsCoreUtils::AccEventObserversExist()) {
     return IPC_OK();
   }
 
   xpcAccessibleGeneric* xpcAcc = GetXPCAccessible(proxy);
   xpcAccessibleDocument* doc = GetAccService()->GetXPCDocument(this);
-  nsIDOMNode* node = nullptr;
+  nsINode* node = nullptr;
   bool fromUser = true; // XXX fix me
   RefPtr<xpcAccEvent> event = new xpcAccEvent(aEventType, xpcAcc, doc, node,
                                               fromUser);
   nsCoreUtils::DispatchAccEvent(Move(event));
 
   return IPC_OK();
 }
 
@@ -254,17 +254,17 @@ DocAccessibleParent::RecvStateChangeEven
   }
 
   xpcAccessibleGeneric* xpcAcc = GetXPCAccessible(target);
   xpcAccessibleDocument* doc = GetAccService()->GetXPCDocument(this);
   uint32_t type = nsIAccessibleEvent::EVENT_STATE_CHANGE;
   bool extra;
   uint32_t state = nsAccUtils::To32States(aState, &extra);
   bool fromUser = true; // XXX fix this
-  nsIDOMNode* node = nullptr; // XXX can we do better?
+  nsINode* node = nullptr; // XXX can we do better?
   RefPtr<xpcAccStateChangeEvent> event =
     new xpcAccStateChangeEvent(type, xpcAcc, doc, node, fromUser, state, extra,
                                aEnabled);
   nsCoreUtils::DispatchAccEvent(Move(event));
 
   return IPC_OK();
 }
 
@@ -292,17 +292,17 @@ DocAccessibleParent::RecvCaretMoveEvent(
 #endif
 
   if (!nsCoreUtils::AccEventObserversExist()) {
     return IPC_OK();
   }
 
   xpcAccessibleGeneric* xpcAcc = GetXPCAccessible(proxy);
   xpcAccessibleDocument* doc = GetAccService()->GetXPCDocument(this);
-  nsIDOMNode* node = nullptr;
+  nsINode* node = nullptr;
   bool fromUser = true; // XXX fix me
   uint32_t type = nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED;
   RefPtr<xpcAccCaretMoveEvent> event =
     new xpcAccCaretMoveEvent(type, xpcAcc, doc, node, fromUser, aOffset);
   nsCoreUtils::DispatchAccEvent(Move(event));
 
   return IPC_OK();
 }
@@ -330,17 +330,17 @@ DocAccessibleParent::RecvTextChangeEvent
   if (!nsCoreUtils::AccEventObserversExist()) {
     return IPC_OK();
   }
 
   xpcAccessibleGeneric* xpcAcc = GetXPCAccessible(target);
   xpcAccessibleDocument* doc = GetAccService()->GetXPCDocument(this);
   uint32_t type = aIsInsert ? nsIAccessibleEvent::EVENT_TEXT_INSERTED :
                               nsIAccessibleEvent::EVENT_TEXT_REMOVED;
-  nsIDOMNode* node = nullptr;
+  nsINode* node = nullptr;
   RefPtr<xpcAccTextChangeEvent> event =
     new xpcAccTextChangeEvent(type, xpcAcc, doc, node, aFromUser, aStart, aLen,
                               aIsInsert, aStr);
   nsCoreUtils::DispatchAccEvent(Move(event));
 
   return IPC_OK();
 }
 
@@ -740,17 +740,17 @@ DocAccessibleParent::RecvFocusEvent(cons
   ProxyFocusEvent(proxy, aCaretRect);
 
   if (!nsCoreUtils::AccEventObserversExist()) {
     return IPC_OK();
   }
 
   xpcAccessibleGeneric* xpcAcc = GetXPCAccessible(proxy);
   xpcAccessibleDocument* doc = GetAccService()->GetXPCDocument(this);
-  nsIDOMNode* node = nullptr;
+  nsINode* node = nullptr;
   bool fromUser = true; // XXX fix me
   RefPtr<xpcAccEvent> event = new xpcAccEvent(nsIAccessibleEvent::EVENT_FOCUS,
                                               xpcAcc, doc, node, fromUser);
   nsCoreUtils::DispatchAccEvent(Move(event));
 
   return IPC_OK();
 }
 
--- a/accessible/tests/mochitest/.eslintrc.js
+++ b/accessible/tests/mochitest/.eslintrc.js
@@ -1,16 +1,14 @@
 "use strict";
 
 module.exports = {
   "extends": [
     "plugin:mozilla/mochitest-test"
   ],
   "rules": {
-    "mozilla/reject-importGlobalProperties": "error",
-
     // XXX These are rules that are enabled in the recommended configuration, but
     // disabled here due to failures when initially implemented. They should be
     // removed (and hence enabled) at some stage.
     "no-nested-ternary": "off",
     "no-undef": "off",
   }
 };
--- a/accessible/tests/mochitest/common.js
+++ b/accessible/tests/mochitest/common.js
@@ -39,21 +39,38 @@ const nsIAccessiblePivot = Ci.nsIAccessi
 const nsIAccessibleSelectable = Ci.nsIAccessibleSelectable;
 const nsIAccessibleTable = Ci.nsIAccessibleTable;
 const nsIAccessibleTableCell = Ci.nsIAccessibleTableCell;
 const nsIAccessibleTraversalRule = Ci.nsIAccessibleTraversalRule;
 const nsIAccessibleValue = Ci.nsIAccessibleValue;
 
 const nsIObserverService = Ci.nsIObserverService;
 
-const nsIDOMNode = Ci.nsIDOMNode;
 const nsIDOMWindow = Ci.nsIDOMWindow;
 
 const nsIPropertyElement = Ci.nsIPropertyElement;
 
+// Testing "'Node' in this" doesn't do the right thing because there are cases
+// when our "this" is not the global even though we're at toplevel.  In those
+// cases, the import could fail because our global is a Window and we in fact
+// have a Node all along.
+//
+// We could get the global via the (function() { return this; })() trick, but
+// that might break any time if people switch us to strict mode.  So let's just
+// test the thing we care about directly: does bareword Node exist?
+let needToImportNode = false;
+try {
+    Node;
+} catch (e) {
+    needToImportNode = true;
+}
+if (needToImportNode) {
+    Cu.importGlobalProperties(["Node"]);
+}
+
 // //////////////////////////////////////////////////////////////////////////////
 // OS detect
 
 const MAC = (navigator.platform.includes("Mac"));
 const LINUX = (navigator.platform.includes("Linux"));
 const SOLARIS = (navigator.platform.includes("SunOS"));
 const WIN = (navigator.platform.includes("Win"));
 
@@ -203,17 +220,17 @@ function isWithin(aExpected, aGot, aWith
 
 /**
  * Return the DOM node by identifier (may be accessible, DOM node or ID).
  */
 function getNode(aAccOrNodeOrID, aDocument) {
   if (!aAccOrNodeOrID)
     return null;
 
-  if (aAccOrNodeOrID instanceof nsIDOMNode)
+  if (Node.isInstance(aAccOrNodeOrID))
     return aAccOrNodeOrID;
 
   if (aAccOrNodeOrID instanceof nsIAccessible)
     return aAccOrNodeOrID.DOMNode;
 
   var node = (aDocument || document).getElementById(aAccOrNodeOrID);
   if (!node) {
     ok(false, "Can't get DOM element for " + aAccOrNodeOrID);
@@ -251,17 +268,17 @@ function getAccessible(aAccOrElmOrID, aI
   if (!aAccOrElmOrID)
     return null;
 
   var elm = null;
 
   if (aAccOrElmOrID instanceof nsIAccessible) {
     try { elm = aAccOrElmOrID.DOMNode; } catch (e) { }
 
-  } else if (aAccOrElmOrID instanceof nsIDOMNode) {
+  } else if (Node.isInstance(aAccOrElmOrID)) {
     elm = aAccOrElmOrID;
 
   } else {
     elm = document.getElementById(aAccOrElmOrID);
     if (!elm) {
       ok(false, "Can't get DOM element for " + aAccOrElmOrID);
       return null;
     }
@@ -786,17 +803,17 @@ function prettyName(aIdentifier) {
 
     if (acc)
       msg += ", address: " + getObjAddress(acc);
     msg += "]";
 
     return msg;
   }
 
-  if (aIdentifier instanceof nsIDOMNode)
+  if (Node.isInstance(aIdentifier))
     return "[ " + getNodePrettyName(aIdentifier) + " ]";
 
   if (aIdentifier && typeof aIdentifier === "object" ) {
     var treeObj = normalizeAccTreeObj(aIdentifier);
     if ("role" in treeObj) {
       function stringifyTree(aObj) {
         var text = roleToString(aObj.role) + ": [ ";
         if ("children" in aObj) {
@@ -868,21 +885,21 @@ function setTestPluginEnabledState(aNewE
 // //////////////////////////////////////////////////////////////////////////////
 
 // //////////////////////////////////////////////////////////////////////////////
 // Accessible general
 
 function getNodePrettyName(aNode) {
   try {
     var tag = "";
-    if (aNode.nodeType == nsIDOMNode.DOCUMENT_NODE) {
+    if (aNode.nodeType == Node.DOCUMENT_NODE) {
       tag = "document";
     } else {
       tag = aNode.localName;
-      if (aNode.nodeType == nsIDOMNode.ELEMENT_NODE && aNode.hasAttribute("id"))
+      if (aNode.nodeType == Node.ELEMENT_NODE && aNode.hasAttribute("id"))
         tag += "@id=\"" + aNode.getAttribute("id") + "\"";
     }
 
     return "'" + tag + " node', address: " + getObjAddress(aNode);
   } catch (e) {
     return "' no node info '";
   }
 }
--- a/accessible/tests/mochitest/events.js
+++ b/accessible/tests/mochitest/events.js
@@ -89,17 +89,17 @@ function waitForEvent(aEventType, aTarge
       if (typeof aTargetOrFunc == "function")
         target = aTargetOrFunc.call();
 
       if (target) {
         if (target instanceof nsIAccessible &&
             target != aEvent.accessible)
           return;
 
-        if (target instanceof nsIDOMNode &&
+        if (Node.isInstance(target) &&
             target != aEvent.DOMNode)
           return;
       }
 
       unregisterA11yEventListener(aEventType, this);
 
       window.setTimeout(
         function() {
--- a/accessible/tests/mochitest/events/test_focus_name.html
+++ b/accessible/tests/mochitest/events/test_focus_name.html
@@ -28,31 +28,31 @@
         is(target.description, aDescription,
            "Wrong description for " + prettyName(target));
       };
     }
 
     var gFocusHandler = {
       handleEvent: function gFocusHandler_handleEvent(aEvent) {
         var elm = aEvent.target;
-        if (elm.nodeType != nsIDOMNode.ELEMENT_NODE)
+        if (elm.nodeType != Node.ELEMENT_NODE)
           return;
 
         gTooltipElm.style.display = "block";
 
         elm.setAttribute("aria-describedby", "tooltip");
       }
     };
 
     var gBlurHandler = {
       handleEvent: function gBlurHandler_handleEvent(aEvent) {
         gTooltipElm.style.display = "none";
 
         var elm = aEvent.target;
-        if (elm.nodeType == nsIDOMNode.ELEMENT_NODE)
+        if (elm.nodeType == Node.ELEMENT_NODE)
           elm.removeAttribute("aria-describedby");
       }
     };
 
     /**
      * Do tests.
      */
 
--- a/accessible/xpcom/xpcAccessibilityService.cpp
+++ b/accessible/xpcom/xpcAccessibilityService.cpp
@@ -103,38 +103,33 @@ xpcAccessibilityService::GetApplicationA
 {
   NS_ENSURE_ARG_POINTER(aAccessibleApplication);
 
   NS_IF_ADDREF(*aAccessibleApplication = XPCApplicationAcc());
   return NS_OK;
 }
 
 NS_IMETHODIMP
-xpcAccessibilityService::GetAccessibleFor(nsIDOMNode *aNode,
+xpcAccessibilityService::GetAccessibleFor(nsINode *aNode,
                                           nsIAccessible **aAccessible)
 {
   NS_ENSURE_ARG_POINTER(aAccessible);
   *aAccessible = nullptr;
   if (!aNode) {
     return NS_OK;
   }
 
-  nsCOMPtr<nsINode> node(do_QueryInterface(aNode));
-  if (!node) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
   nsAccessibilityService* accService = GetAccService();
   if (!accService) {
     return NS_ERROR_SERVICE_NOT_AVAILABLE;
   }
 
-  DocAccessible* document = accService->GetDocAccessible(node->OwnerDoc());
+  DocAccessible* document = accService->GetDocAccessible(aNode->OwnerDoc());
   if (document) {
-    NS_IF_ADDREF(*aAccessible = ToXPC(document->GetAccessible(node)));
+    NS_IF_ADDREF(*aAccessible = ToXPC(document->GetAccessible(aNode)));
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 xpcAccessibilityService::GetStringRole(uint32_t aRole, nsAString& aString)
 {
@@ -182,44 +177,39 @@ xpcAccessibilityService::GetStringRelati
     return NS_ERROR_SERVICE_NOT_AVAILABLE;
   }
 
   accService->GetStringRelationType(aRelationType, aString);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-xpcAccessibilityService::GetAccessibleFromCache(nsIDOMNode* aNode,
+xpcAccessibilityService::GetAccessibleFromCache(nsINode* aNode,
                                                 nsIAccessible** aAccessible)
 {
   NS_ENSURE_ARG_POINTER(aAccessible);
   *aAccessible = nullptr;
   if (!aNode) {
     return NS_OK;
   }
 
-  nsCOMPtr<nsINode> node(do_QueryInterface(aNode));
-  if (!node) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
   nsAccessibilityService* accService = GetAccService();
   if (!accService) {
     return NS_ERROR_SERVICE_NOT_AVAILABLE;
   }
 
   // Search for an accessible in each of our per document accessible object
   // caches. If we don't find it, and the given node is itself a document, check
   // our cache of document accessibles (document cache). Note usually shutdown
   // document accessibles are not stored in the document cache, however an
   // "unofficially" shutdown document (i.e. not from DocManager) can still
   // exist in the document cache.
-  Accessible* accessible = accService->FindAccessibleInCache(node);
+  Accessible* accessible = accService->FindAccessibleInCache(aNode);
   if (!accessible) {
-    nsCOMPtr<nsIDocument> document(do_QueryInterface(node));
+    nsCOMPtr<nsIDocument> document(do_QueryInterface(aNode));
     if (document) {
       accessible = mozilla::a11y::GetExistingDocAccessible(document);
     }
   }
 
   NS_IF_ADDREF(*aAccessible = ToXPC(accessible));
   return NS_OK;
 }
--- a/accessible/xpcom/xpcAccessible.cpp
+++ b/accessible/xpcom/xpcAccessible.cpp
@@ -172,27 +172,26 @@ xpcAccessible::GetIndexInParent(int32_t*
   } else if (IntlGeneric().IsProxy()) {
     *aIndexInParent = IntlGeneric().AsProxy()->IndexInParent();
   }
 
   return *aIndexInParent != -1 ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
-xpcAccessible::GetDOMNode(nsIDOMNode** aDOMNode)
+xpcAccessible::GetDOMNode(nsINode** aDOMNode)
 {
   NS_ENSURE_ARG_POINTER(aDOMNode);
   *aDOMNode = nullptr;
 
   if (!Intl())
     return NS_ERROR_FAILURE;
 
-  nsINode* node = Intl()->GetNode();
-  if (node)
-    CallQueryInterface(node, aDOMNode);
+  nsCOMPtr<nsINode> node = Intl()->GetNode();
+  node.forget(aDOMNode);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 xpcAccessible::GetId(nsAString& aID)
 {
   ProxyAccessible* proxy = IntlGeneric().AsProxy();
--- a/accessible/xpcom/xpcAccessible.h
+++ b/accessible/xpcom/xpcAccessible.h
@@ -32,17 +32,17 @@ public:
   NS_IMETHOD GetFirstChild(nsIAccessible** aFirstChild) final;
   NS_IMETHOD GetLastChild(nsIAccessible** aLastChild) final;
   NS_IMETHOD GetChildCount(int32_t* aChildCount) final;
   NS_IMETHOD GetChildAt(int32_t aChildIndex, nsIAccessible** aChild)
     final;
   NS_IMETHOD GetChildren(nsIArray** aChildren) final;
   NS_IMETHOD GetIndexInParent(int32_t* aIndexInParent) final;
 
-  NS_IMETHOD GetDOMNode(nsIDOMNode** aDOMNode) final;
+  NS_IMETHOD GetDOMNode(nsINode** aDOMNode) final;
   NS_IMETHOD GetId(nsAString& aID) final;
   NS_IMETHOD GetDocument(nsIAccessibleDocument** aDocument) final;
   NS_IMETHOD GetRootDocument(nsIAccessibleDocument** aRootDocument)
     final;
 
   NS_IMETHOD GetRole(uint32_t* aRole) final;
   NS_IMETHOD GetState(uint32_t* aState, uint32_t* aExtraState)
     final;
--- a/accessible/xul/XULListboxAccessible.cpp
+++ b/accessible/xul/XULListboxAccessible.cpp
@@ -496,25 +496,21 @@ XULListboxAccessible::ContainerWidget() 
   if (IsAutoCompletePopup()) {
     // This works for XUL autocompletes. It doesn't work for HTML forms
     // autocomplete because of potential crossprocess calls (when autocomplete
     // lives in content process while popup lives in chrome process). If that's
     // a problem then rethink Widgets interface.
     nsCOMPtr<nsIDOMXULMenuListElement> menuListElm =
       do_QueryInterface(mContent->GetParent());
     if (menuListElm) {
-      nsCOMPtr<nsIDOMNode> inputElm;
+      RefPtr<mozilla::dom::Element> inputElm;
       menuListElm->GetInputField(getter_AddRefs(inputElm));
       if (inputElm) {
-        nsCOMPtr<nsINode> inputNode = do_QueryInterface(inputElm);
-        if (inputNode) {
-          Accessible* input =
-            mDoc->GetAccessible(inputNode);
+          Accessible* input = mDoc->GetAccessible(inputElm);
           return input ? input->ContainerWidget() : nullptr;
-        }
       }
     }
   }
   return nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULListitemAccessible
--- a/accessible/xul/XULTabAccessible.cpp
+++ b/accessible/xul/XULTabAccessible.cpp
@@ -109,24 +109,22 @@ XULTabAccessible::RelationByType(Relatio
     return rel;
 
   // Expose 'LABEL_FOR' relation on tab accessible for tabpanel accessible.
   nsCOMPtr<nsIDOMXULRelatedElement> tabsElm =
     do_QueryInterface(mContent->GetParent());
   if (!tabsElm)
     return rel;
 
-  nsCOMPtr<nsIDOMNode> domNode(do_QueryInterface(GetNode()));
-  nsCOMPtr<nsIDOMNode> tabpanelNode;
-  tabsElm->GetRelatedElement(domNode, getter_AddRefs(tabpanelNode));
-  if (!tabpanelNode)
+  RefPtr<mozilla::dom::Element> tabpanelElement;
+  tabsElm->GetRelatedElement(GetNode(), getter_AddRefs(tabpanelElement));
+  if (!tabpanelElement)
     return rel;
 
-  nsCOMPtr<nsIContent> tabpanelContent(do_QueryInterface(tabpanelNode));
-  rel.AppendTarget(mDoc, tabpanelContent);
+  rel.AppendTarget(mDoc, tabpanelElement);
   return rel;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTabsAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
@@ -196,18 +194,16 @@ XULTabpanelAccessible::RelationByType(Re
     return rel;
 
   // Expose 'LABELLED_BY' relation on tabpanel accessible for tab accessible.
   nsCOMPtr<nsIDOMXULRelatedElement> tabpanelsElm =
     do_QueryInterface(mContent->GetParent());
   if (!tabpanelsElm)
     return rel;
 
-  nsCOMPtr<nsIDOMNode> domNode(do_QueryInterface(GetNode()));
-  nsCOMPtr<nsIDOMNode> tabNode;
-  tabpanelsElm->GetRelatedElement(domNode, getter_AddRefs(tabNode));
-  if (!tabNode)
+  RefPtr<mozilla::dom::Element> tabElement;
+  tabpanelsElm->GetRelatedElement(GetNode(), getter_AddRefs(tabElement));
+  if (!tabElement)
     return rel;
 
-  nsCOMPtr<nsIContent> tabContent(do_QueryInterface(tabNode));
-  rel.AppendTarget(mDoc, tabContent);
+  rel.AppendTarget(mDoc, tabElement);
   return rel;
 }
--- a/accessible/xul/XULTreeAccessible.cpp
+++ b/accessible/xul/XULTreeAccessible.cpp
@@ -492,25 +492,21 @@ XULTreeAccessible::ContainerWidget() con
   if (IsAutoCompletePopup()) {
     // This works for XUL autocompletes. It doesn't work for HTML forms
     // autocomplete because of potential crossprocess calls (when autocomplete
     // lives in content process while popup lives in chrome process). If that's
     // a problem then rethink Widgets interface.
     nsCOMPtr<nsIDOMXULMenuListElement> menuListElm =
       do_QueryInterface(mContent->GetParent());
     if (menuListElm) {
-      nsCOMPtr<nsIDOMNode> inputElm;
+      RefPtr<mozilla::dom::Element> inputElm;
       menuListElm->GetInputField(getter_AddRefs(inputElm));
       if (inputElm) {
-        nsCOMPtr<nsINode> inputNode = do_QueryInterface(inputElm);
-        if (inputNode) {
-          Accessible* input =
-            mDoc->GetAccessible(inputNode);
-          return input ? input->ContainerWidget() : nullptr;
-        }
+        Accessible* input = mDoc->GetAccessible(inputElm);
+        return input ? input->ContainerWidget() : nullptr;
       }
     }
   }
   return nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeAccessible: public implementation
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6866,36 +6866,36 @@ var IndexedDBPromptHelper = {
   },
 
   observe:
   function IndexedDBPromptHelper_observe(subject, topic, data) {
     if (topic != this._permissionsPrompt) {
       throw new Error("Unexpected topic!");
     }
 
-    var requestor = subject.QueryInterface(Ci.nsIInterfaceRequestor);
-
-    var browser = requestor.getInterface(Ci.nsIDOMNode);
+    var request = subject.QueryInterface(Ci.nsIIDBPermissionsRequest);
+
+    var browser = request.browserElement;
     if (browser.ownerGlobal != window) {
       // Only listen for notifications for browsers in our chrome window.
       return;
     }
 
     // Get the host name if available or the file path otherwise.
     var host = browser.currentURI.asciiHost || browser.currentURI.pathQueryRef;
 
     var message;
     var responseTopic;
     if (topic == this._permissionsPrompt) {
       message = gNavigatorBundle.getFormattedString("offlineApps.available2",
                                                     [ host ]);
       responseTopic = this._permissionsResponse;
     }
 
-    var observer = requestor.getInterface(Ci.nsIObserver);
+    var observer = request.responseObserver;
 
     var mainAction = {
       label: gNavigatorBundle.getString("offlineApps.allowStoring.label"),
       accessKey: gNavigatorBundle.getString("offlineApps.allowStoring.accesskey"),
       callback() {
         observer.observe(null, responseTopic,
                          Ci.nsIPermissionManager.ALLOW_ACTION);
       }
--- a/browser/components/translation/TranslationDocument.jsm
+++ b/browser/components/translation/TranslationDocument.jsm
@@ -1,18 +1,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/. */
 
 "use strict";
 
 var EXPORTED_SYMBOLS = [ "TranslationDocument" ];
 
-const TEXT_NODE = Ci.nsIDOMNode.TEXT_NODE;
-
 ChromeUtils.import("resource://services-common/async.js");
 Cu.importGlobalProperties(["DOMParser"]);
 
 /**
  * This class represents a document that is being translated,
  * and it is responsible for parsing the document,
  * generating the data structures translation (the list of
  * translation items and roots), and managing the original
@@ -136,17 +134,17 @@ this.TranslationDocument.prototype = {
       return text;
     }
 
     let str = "";
     item.original = [];
     let wasLastItemPlaceholder = false;
 
     for (let child of item.nodeRef.childNodes) {
-      if (child.nodeType == TEXT_NODE) {
+      if (child.nodeType == child.TEXT_NODE) {
         let x = child.nodeValue.trim();
         if (x != "") {
           item.original.push(x);
           str += x;
           wasLastItemPlaceholder = false;
         }
         continue;
       }
@@ -404,17 +402,17 @@ function regenerateTextFromOriginalHelpe
  * TranslationItem that was associated with this node, and then we
  * walk down it repeating the process.
  *
  * For text nodes we simply add it as a string.
  */
 function parseResultNode(item, node) {
   item.translation = [];
   for (let child of node.childNodes) {
-    if (child.nodeType == TEXT_NODE) {
+    if (child.nodeType == child.TEXT_NODE) {
       item.translation.push(child.nodeValue);
     } else if (child.localName == "br") {
       item.translation.push(TranslationItem_NodePlaceholder);
     } else {
       let translationItemChild = item.getChildById(child.id);
 
       if (translationItemChild) {
         item.translation.push(translationItemChild);
@@ -553,17 +551,17 @@ function swapTextForItem(item, target) {
     //   1 - start pointer at item 1
     //   2 - item 1 is already in position
     //   3 - replace textnode 2 with " Welt."
     //
     // which completely avoids any node reordering, and requires only one
     // text change instead of two (while also leaving the page closer to
     // its original state).
     while (curNode &&
-           curNode.nodeType == TEXT_NODE &&
+           curNode.nodeType == curNode.TEXT_NODE &&
            curNode.nodeValue.trim() == "") {
       curNode = curNode.nextSibling;
     }
 
     // Now let's walk through all items in the `target` array of the
     // TranslationItem. This means either the TranslationItem.original or
     // TranslationItem.translation array.
     for (let targetItem of curItem[target]) {
@@ -603,26 +601,26 @@ function swapTextForItem(item, target) {
         // If the current item is a placeholder node, we need to move
         // our pointer "past" it, jumping from one side of a block of
         // elements + empty text nodes to the other side. Even if
         // non-placeholder elements exists inside the jumped block,
         // they will be pulled correctly later in the process when the
         // targetItem for those nodes are handled.
 
         while (curNode &&
-               (curNode.nodeType != TEXT_NODE ||
+               (curNode.nodeType != curNode.TEXT_NODE ||
                 curNode.nodeValue.trim() == "")) {
           curNode = curNode.nextSibling;
         }
 
       } else {
         // Finally, if it's a text item, we just need to find the next
         // text node to use. Text nodes don't need to be reordered, so
         // the first one found can be used.
-        while (curNode && curNode.nodeType != TEXT_NODE) {
+        while (curNode && curNode.nodeType != curNode.TEXT_NODE) {
           curNode = curNode.nextSibling;
         }
 
         // If none was found and we reached the end of the child nodes,
         // let's create a new one.
         if (!curNode) {
           // We don't know if the original content had a space or not,
           // so the best bet is to create the text node with " " which
@@ -649,25 +647,25 @@ function swapTextForItem(item, target) {
     // And remove any garbage "" nodes left after clearing.
     domNode.normalize();
   }
 }
 
 function getNextSiblingSkippingEmptyTextNodes(startSibling) {
   let item = startSibling.nextSibling;
   while (item &&
-         item.nodeType == TEXT_NODE &&
+         item.nodeType == item.TEXT_NODE &&
          item.nodeValue.trim() == "") {
     item = item.nextSibling;
   }
   return item;
 }
 
 function clearRemainingNonEmptyTextNodesFromElement(startSibling) {
   let item = startSibling;
   while (item) {
-    if (item.nodeType == TEXT_NODE &&
+    if (item.nodeType == item.TEXT_NODE &&
         item.nodeValue != "") {
       item.nodeValue = "";
     }
     item = item.nextSibling;
   }
 }
--- a/browser/extensions/formautofill/FormAutofillHeuristics.jsm
+++ b/browser/extensions/formautofill/FormAutofillHeuristics.jsm
@@ -321,27 +321,27 @@ var LabelUtils = {
       return this._labelStrings.get(element);
     }
     let strings = [];
     let _extractLabelStrings = (el) => {
       if (this.EXCLUDED_TAGS.includes(el.tagName)) {
         return;
       }
 
-      if (el.nodeType == Ci.nsIDOMNode.TEXT_NODE || el.childNodes.length == 0) {
+      if (el.nodeType == el.TEXT_NODE || el.childNodes.length == 0) {
         let trimmedText = el.textContent.trim();
         if (trimmedText) {
           strings.push(trimmedText);
         }
         return;
       }
 
       for (let node of el.childNodes) {
         let nodeType = node.nodeType;
-        if (nodeType != Ci.nsIDOMNode.ELEMENT_NODE && nodeType != Ci.nsIDOMNode.TEXT_NODE) {
+        if (nodeType != node.ELEMENT_NODE && nodeType != node.TEXT_NODE) {
           continue;
         }
         _extractLabelStrings(node);
       }
     };
     _extractLabelStrings(element);
     this._labelStrings.set(element, strings);
     return strings;
--- a/browser/modules/ContextMenu.jsm
+++ b/browser/modules/ContextMenu.jsm
@@ -331,17 +331,17 @@ class ContextMenu {
 
   // Gather all descendent text under given document node.
   _gatherTextUnder(root) {
     let text = "";
     let node = root.firstChild;
     let depth = 1;
     while (node && depth > 0) {
       // See if this node is text.
-      if (node.nodeType == Ci.nsIDOMNode.TEXT_NODE) {
+      if (node.nodeType == node.TEXT_NODE) {
         // Add this text to our collection.
         text += " " + node.data;
       } else if (node instanceof this.content.HTMLImageElement) {
         // If it has an "alt" attribute, add that.
         let altText = node.getAttribute( "alt" );
         if ( altText && altText != "" ) {
           text += " " + altText;
         }
@@ -530,17 +530,17 @@ class ContextMenu {
       referrerPolicy = referrerAttrValue;
     }
 
     let disableSetDesktopBg = null;
 
     // Media related cache info parent needs for saving
     let contentType = null;
     let contentDisposition = null;
-    if (aEvent.composedTarget.nodeType == Ci.nsIDOMNode.ELEMENT_NODE &&
+    if (aEvent.composedTarget.nodeType == aEvent.composedTarget.ELEMENT_NODE &&
         aEvent.composedTarget instanceof Ci.nsIImageLoadingContent &&
         aEvent.composedTarget.currentURI) {
       disableSetDesktopBg = this._disableSetDesktopBackground(aEvent.composedTarget);
 
       try {
         let imageCache = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools)
                                                          .getImgCacheForDocument(doc);
         // The image cache's notion of where this image is located is
@@ -706,17 +706,17 @@ class ContextMenu {
     context.mozInputSource = aEvent.mozInputSource;
 
     const node = aEvent.composedTarget;
 
     const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 
     context.shouldDisplay = true;
 
-    if (node.nodeType == Ci.nsIDOMNode.DOCUMENT_NODE ||
+    if (node.nodeType == node.DOCUMENT_NODE ||
         // Don't display for XUL element unless <label class="text-link">
         (node.namespaceURI == XUL_NS && !this._isXULTextLinkLabel(node))) {
       context.shouldDisplay = false;
       return;
     }
 
     // Initialize context to be sent to nsContextMenu
     // Keep this consistent with the similar code in nsContextMenu's setContext
@@ -786,26 +786,26 @@ class ContextMenu {
    * Sets up the parts of the context menu for when when nodes have no children.
    *
    * @param {Integer} editFlags The edit flags for the node. See SpellCheckHelper
    *                            for the details.
    */
   _setContextForNodesNoChildren(editFlags) {
     const context = this.context;
 
-    if (context.target.nodeType == Ci.nsIDOMNode.TEXT_NODE) {
+    if (context.target.nodeType == context.target.TEXT_NODE) {
       // For text nodes, look at the parent node to determine the spellcheck attribute.
       context.canSpellCheck = context.target.parentNode &&
                               this._isSpellCheckEnabled(context.target);
       return;
     }
 
     // We only deal with TEXT_NODE and ELEMENT_NODE in this function, so return
     // early if we don't have one.
-    if (context.target.nodeType != Ci.nsIDOMNode.ELEMENT_NODE) {
+    if (context.target.nodeType != context.target.ELEMENT_NODE) {
       return;
     }
 
     // See if the user clicked on an image. This check mirrors
     // nsDocumentViewer::GetInImage. Make sure to update both if this is
     // changed.
     if (context.target instanceof Ci.nsIImageLoadingContent &&
         context.target.currentRequestFinalURI) {
@@ -926,17 +926,17 @@ class ContextMenu {
   _setContextForNodesWithChildren(editFlags) {
     const context = this.context;
 
     // Second, bubble out, looking for items of interest that can have childen.
     // Always pick the innermost link, background image, etc.
     let elem = context.target;
 
     while (elem) {
-      if (elem.nodeType == Ci.nsIDOMNode.ELEMENT_NODE) {
+      if (elem.nodeType == elem.ELEMENT_NODE) {
         // Link?
         const XLINK_NS = "http://www.w3.org/1999/xlink";
 
         if (!context.onLink &&
             // Be consistent with what hrefAndLinkNodeForClickEvent
             // does in browser.js
             (this._isXULTextLinkLabel(elem) ||
             (elem instanceof this.content.HTMLAnchorElement && elem.href) ||
@@ -992,17 +992,17 @@ class ContextMenu {
       }
 
       elem = elem.parentNode;
     }
 
     // See if the user clicked on MathML
     const MathML_NS = "http://www.w3.org/1998/Math/MathML";
 
-    if ((context.target.nodeType == Ci.nsIDOMNode.TEXT_NODE &&
+    if ((context.target.nodeType == context.target.TEXT_NODE &&
          context.target.parentNode.namespaceURI == MathML_NS) ||
          (context.target.namespaceURI == MathML_NS)) {
       context.onMathML = true;
     }
 
     // See if the user clicked in a frame.
     const docDefaultView = context.target.ownerGlobal;
 
--- a/build/build-clang/clang-win64.json
+++ b/build/build-clang/clang-win64.json
@@ -10,11 +10,12 @@
     "compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/trunk",
     "libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/trunk",
     "python_path": "c:/mozilla-build/python/python.exe",
     "cc": "cl.exe",
     "cxx": "cl.exe",
     "ml": "ml64.exe",
     "patches": [
       "r332092.patch",
+      "r332095.patch",
       "loosen-msvc-detection.patch"
     ]
 }
new file mode 100644
--- /dev/null
+++ b/build/build-clang/r332095.patch
@@ -0,0 +1,21 @@
+r332095 | dmajor | 2018-05-11 10:31:14 -0400 (Fri, 11 May 2018) | 9 lines
+
+[winasan] Update GetInstructionSize for Win10 1803
+
+In Windows version 1803, the first instruction of ntdll!strchr is:
+8a01 mov al,byte ptr [rcx]
+
+This is the only needed change for this version as far as I can tell.
+
+Differential Revision: https://reviews.llvm.org/D46458
+
+--- a/compiler-rt/lib/interception/interception_win.cc
++++ b/compiler-rt/lib/interception/interception_win.cc
+@@ -453,6 +453,7 @@
+   }
+
+   switch (*(u16*)(address)) {
++    case 0x018A:  // 8A 01 : mov al, byte ptr [ecx]
+     case 0xFF8B:  // 8B FF : mov edi, edi
+     case 0xEC8B:  // 8B EC : mov ebp, esp
+     case 0xc889:  // 89 C8 : mov eax, ecx
--- a/build/mozconfig.no-compile
+++ b/build/mozconfig.no-compile
@@ -6,16 +6,17 @@ unset SCCACHE_VERBOSE_STATS
 # In case it wasn't
 NO_CACHE=1
 
 # Override any toolchain defines we've inherited from other mozconfigs.
 unset CC
 unset CXX
 unset HOST_CC
 unset HOST_CXX
+unset LINKER
 unset RUSTC
 unset CARGO
 unset RUSTDOC
 unset MAKECAB
 unset TOOLCHAIN_PREFIX
 unset BINDGEN_CFLAGS
 unset LLVM_CONFIG
 unset WIN64_LINK
--- a/devtools/client/debugger/debugger-view.js
+++ b/devtools/client/debugger/debugger-view.js
@@ -844,17 +844,17 @@ var DebuggerView = {
  * FilteredSources, FilteredFunctions etc., inheriting the generic WidgetMethods.
  */
 function ResultsPanelContainer() {
 }
 
 ResultsPanelContainer.prototype = extend(WidgetMethods, {
   /**
    * Sets the anchor node for this container panel.
-   * @param nsIDOMNode aNode
+   * @param Node aNode
    */
   set anchor(aNode) {
     this._anchor = aNode;
 
     // If the anchor node is not null, create a panel to attach to the anchor
     // when showing the popup.
     if (aNode) {
       if (!this._panel) {
@@ -877,17 +877,17 @@ ResultsPanelContainer.prototype = extend
       this._panel.remove();
       this._panel = null;
       this.widget = null;
     }
   },
 
   /**
    * Gets the anchor node for this container panel.
-   * @return nsIDOMNode
+   * @return Node
    */
   get anchor() {
     return this._anchor;
   },
 
   /**
    * Sets the container panel hidden or visible. It's hidden by default.
    * @param boolean aFlag
--- a/devtools/client/debugger/test/mochitest/browser2.ini
+++ b/devtools/client/debugger/test/mochitest/browser2.ini
@@ -133,19 +133,16 @@ support-files =
   !/devtools/client/shared/test/telemetry-test-helpers.js
 
 [browser_dbg_no-dangling-breakpoints.js]
 uses-unsafe-cpows = true
 skip-if = e10s && debug
 [browser_dbg_no-page-sources.js]
 uses-unsafe-cpows = true
 skip-if = e10s && debug
-[browser_dbg_on-pause-highlight.js]
-uses-unsafe-cpows = true
-skip-if = e10s && debug
 [browser_dbg_on-pause-raise.js]
 uses-unsafe-cpows = true
 skip-if = e10s && debug || os == "linux" # Bug 888811 & bug 891176
 [browser_dbg_optimized-out-vars.js]
 uses-unsafe-cpows = true
 skip-if = e10s && debug
 [browser_dbg_panel-size.js]
 uses-unsafe-cpows = true
deleted file mode 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg_on-pause-highlight.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests that debugger's tab is highlighted when it is paused and not the
- * currently selected tool.
- */
-
-const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
-
-var gTab, gPanel, gDebugger;
-var gToolbox, gToolboxTab;
-
-function test() {
-  let options = {
-    source: TAB_URL,
-    line: 1
-  };
-  initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
-    gTab = aTab;
-    gPanel = aPanel;
-    gDebugger = gPanel.panelWin;
-    gToolbox = gPanel._toolbox;
-    gToolboxTab = gToolbox.doc.getElementById("toolbox-tab-jsdebugger");
-
-    testPause();
-  });
-}
-
-function testPause() {
-  is(gDebugger.gThreadClient.paused, false,
-    "Should be running after starting test.");
-
-  gDebugger.gThreadClient.addOneTimeListener("paused", () => {
-    gToolbox.selectTool("webconsole").then(() => {
-      ok(gToolboxTab.classList.contains("highlighted"),
-        "The highlighted class is present");
-      ok(!gToolboxTab.classList.contains("selected"),
-        "The tab is not selected");
-    }).then(() => gToolbox.selectTool("jsdebugger")).then(() => {
-      ok(gToolboxTab.classList.contains("highlighted"),
-        "The highlighted class is present");
-      ok(gToolboxTab.classList.contains("selected"),
-        "...and the tab is selected, so the glow will not be present.");
-    }).then(testResume);
-  });
-
-  EventUtils.sendMouseEvent({ type: "mousedown" },
-    gDebugger.document.getElementById("resume"),
-    gDebugger);
-
-  // Evaluate a script to fully pause the debugger
-  once(gDebugger.gClient, "willInterrupt").then(() => {
-    evalInTab(gTab, "1+1;");
-  });
-}
-
-function testResume() {
-  gDebugger.gThreadClient.addOneTimeListener("resumed", () => {
-    gToolbox.selectTool("webconsole").then(() => {
-      ok(!gToolboxTab.classList.contains("highlighted"),
-        "The highlighted class is not present now after the resume");
-      ok(!gToolboxTab.classList.contains("selected"),
-        "The tab is not selected");
-    }).then(() => closeDebuggerAndFinish(gPanel));
-  });
-
-  EventUtils.sendMouseEvent({ type: "mousedown" },
-    gDebugger.document.getElementById("resume"),
-    gDebugger);
-}
-
-registerCleanupFunction(function () {
-  gTab = null;
-  gPanel = null;
-  gDebugger = null;
-  gToolbox = null;
-  gToolboxTab = null;
-});
--- a/devtools/client/debugger/views/global-search-view.js
+++ b/devtools/client/debugger/views/global-search-view.js
@@ -313,27 +313,27 @@ GlobalSearchView.prototype = extend(Widg
     );
 
     this.DebuggerView.editor.setSelection(anchor, head);
   },
 
   /**
    * Scrolls a match into view if not already visible.
    *
-   * @param nsIDOMNode aMatch
+   * @param Node aMatch
    *        The match to scroll into view.
    */
   _scrollMatchIntoViewIfNeeded: function (aMatch) {
     this.widget.ensureElementIsVisible(aMatch);
   },
 
   /**
    * Starts a bounce animation for a match.
    *
-   * @param nsIDOMNode aMatch
+   * @param Node aMatch
    *        The match to start a bounce animation for.
    */
   _bounceMatch: function (aMatch) {
     Services.tm.dispatchToMainThread({ run: () => {
       aMatch.addEventListener("transitionend", function () {
         aMatch.removeAttribute("focused");
       }, {once: true});
       aMatch.setAttribute("focused", "");
@@ -449,26 +449,26 @@ SourceResults.prototype = {
    * @param boolean aFlag
    */
   set expanded(aFlag) {
     this[aFlag ? "expand" : "collapse"]();
   },
 
   /**
    * Gets the element associated with this item.
-   * @return nsIDOMNode
+   * @return Node
    */
   get target() {
     return this._target;
   },
 
   /**
    * Customization function for creating this item's UI.
    *
-   * @param nsIDOMNode aElementNode
+   * @param Node aElementNode
    *        The element associated with the displayed item.
    * @param object aCallbacks
    *        An object containing all the necessary callback functions:
    *          - onHeaderClick
    *          - onMatchClick
    */
   createView: function (aElementNode, aCallbacks) {
     this._target = aElementNode;
@@ -563,26 +563,26 @@ LineResults.prototype = {
    * Gets the number of word results in this store.
    */
   get matchCount() {
     return this._matchCount;
   },
 
   /**
    * Gets the element associated with this item.
-   * @return nsIDOMNode
+   * @return Node
    */
   get target() {
     return this._target;
   },
 
   /**
    * Customization function for creating this item's UI.
    *
-   * @param nsIDOMNode aElementNode
+   * @param Node aElementNode
    *        The element associated with the displayed item.
    * @param object aCallbacks
    *        An object containing all the necessary callback functions:
    *          - onMatchClick
    *          - onLineClick
    */
   createView: function (aElementNode, aCallbacks) {
     this._target = aElementNode;
@@ -631,41 +631,41 @@ LineResults.prototype = {
     searchResult.appendChild(lineNumberNode);
     searchResult.appendChild(lineContentsNode);
 
     aElementNode.appendChild(searchResult);
   },
 
   /**
    * Handles a match while creating the view.
-   * @param nsIDOMNode aNode
+   * @param Node aNode
    * @param object aMatchChunk
    */
   _entangleMatch: function (aNode, aMatchChunk) {
     LineResults._itemsByElement.set(aNode, {
       instance: this,
       lineData: aMatchChunk
     });
   },
 
   /**
    * Handles a line while creating the view.
-   * @param nsIDOMNode aNode
-   * @param nsIDOMNode aFirstMatch
+   * @param Node aNode
+   * @param Node aFirstMatch
    */
   _entangleLine: function (aNode, aFirstMatch) {
     LineResults._itemsByElement.set(aNode, {
       instance: this,
       firstMatch: aFirstMatch,
       ignored: true
     });
   },
 
   /**
-   * An nsIDOMNode label with an ellipsis value.
+   * A Node label with an ellipsis value.
    */
   _ellipsis: (function () {
     let label = document.createElement("label");
     label.className = "plain dbg-results-line-contents-string";
     label.setAttribute("value", ELLIPSIS);
     return label;
   })(),
 
@@ -682,48 +682,48 @@ GlobalResults.prototype[Symbol.iterator]
 SourceResults.prototype[Symbol.iterator] =
 LineResults.prototype[Symbol.iterator] = function* () {
   yield* this._store;
 };
 
 /**
  * Gets the item associated with the specified element.
  *
- * @param nsIDOMNode aElement
+ * @param Node aElement
  *        The element used to identify the item.
  * @return object
  *         The matched item, or null if nothing is found.
  */
 SourceResults.getItemForElement =
 LineResults.getItemForElement = function (aElement) {
   return WidgetMethods.getItemForElement.call(this, aElement, { noSiblings: true });
 };
 
 /**
  * Gets the element associated with a particular item at a specified index.
  *
  * @param number aIndex
  *        The index used to identify the item.
- * @return nsIDOMNode
+ * @return Node
  *         The matched element, or null if nothing is found.
  */
 SourceResults.getElementAtIndex =
 LineResults.getElementAtIndex = function (aIndex) {
   for (let [element, item] of this._itemsByElement) {
     if (!item.ignored && !aIndex--) {
       return element;
     }
   }
   return null;
 };
 
 /**
  * Gets the index of an item associated with the specified element.
  *
- * @param nsIDOMNode aElement
+ * @param Node aElement
  *        The element to get the index for.
  * @return number
  *         The index of the matched element, or -1 if nothing is found.
  */
 SourceResults.indexOfElement =
 LineResults.indexOfElement = function (aElement) {
   let count = 0;
   for (let [element, item] of this._itemsByElement) {
--- a/devtools/client/debugger/views/stack-frames-classic-view.js
+++ b/devtools/client/debugger/views/stack-frames-classic-view.js
@@ -77,17 +77,17 @@ StackFramesClassicListView.prototype = e
    * @param string aTitle
    *        The frame title to be displayed in the list.
    * @param string aUrl
    *        The frame source url.
    * @param string aLine
    *        The frame line number.
    * @param number aDepth
    *        The frame depth in the stack.
-   * @return nsIDOMNode
+   * @return Node
    *         The stack frame view.
    */
   _createFrameView: function (aTitle, aUrl, aLine, aDepth) {
     let container = document.createElement("hbox");
     container.id = "classic-stackframe-" + aDepth;
     container.className = "dbg-classic-stackframe";
     container.setAttribute("flex", "1");
 
--- a/devtools/client/debugger/views/stack-frames-view.js
+++ b/devtools/client/debugger/views/stack-frames-view.js
@@ -174,17 +174,17 @@ StackFramesView.prototype = extend(Widge
    * @param string aUrl
    *        The frame source url.
    * @param string aLine
    *        The frame line number.
    * @param number aDepth
    *        The frame depth in the stack.
    * @param boolean aIsBlackBoxed
    *        Whether or not the frame is black boxed.
-   * @return nsIDOMNode
+   * @return Node
    *         The stack frame view.
    */
   _createFrameView: function (aTitle, aUrl, aLine, aDepth, aIsBlackBoxed) {
     let container = document.createElement("hbox");
     container.id = "stackframe-" + aDepth;
     container.className = "dbg-stackframe";
 
     let frameDetails = SourceUtils.trimUrlLength(
--- a/devtools/client/framework/attach-thread.js
+++ b/devtools/client/framework/attach-thread.js
@@ -8,23 +8,25 @@ const Services = require("Services");
 const defer = require("devtools/shared/defer");
 
 const {LocalizationHelper} = require("devtools/shared/l10n");
 const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
 
 function handleThreadState(toolbox, event, packet) {
   // Suppress interrupted events by default because the thread is
   // paused/resumed a lot for various actions.
-  if (event !== "paused" || packet.why.type !== "interrupted") {
-    // TODO: Bug 1225492, we continue emitting events on the target
-    // like we used to, but we should emit these only on the
-    // threadClient now.
-    toolbox.target.emit("thread-" + event);
+  if (event === "paused" && packet.why.type === "interrupted") {
+    return;
   }
 
+  // TODO: Bug 1225492, we continue emitting events on the target
+  // like we used to, but we should emit these only on the
+  // threadClient now.
+  toolbox.target.emit("thread-" + event);
+
   if (event === "paused") {
     toolbox.highlightTool("jsdebugger");
 
     if (packet.why.type === "debuggerStatement" ||
        packet.why.type === "breakpoint" ||
        packet.why.type === "exception") {
       toolbox.raise();
       toolbox.selectTool("jsdebugger", packet.why.type);
--- a/devtools/client/inspector/animation/test/browser.ini
+++ b/devtools/client/inspector/animation/test/browser.ini
@@ -33,16 +33,17 @@ support-files =
 [browser_animation_css-transition-with-playstate-idle.js]
 [browser_animation_current-time-label.js]
 [browser_animation_current-time-scrubber.js]
 [browser_animation_current-time-scrubber_each-different-creation-time-animations.js]
 [browser_animation_empty_on_invalid_nodes.js]
 [browser_animation_inspector_exists.js]
 [browser_animation_keyframes-graph_computed-value-path.js]
 [browser_animation_keyframes-graph_computed-value-path_easing-hint.js]
+skip-if = (os == "win") || (os == "linux") #1461899
 [browser_animation_keyframes-graph_keyframe-marker.js]
 [browser_animation_keyframes-progress-bar.js]
 [browser_animation_keyframes-progress-bar_after-resuming.js]
 [browser_animation_logic_auto-stop.js]
 [browser_animation_logic_avoid-updating-during-hiding.js]
 [browser_animation_logic_created-time.js]
 [browser_animation_logic_mutations.js]
 [browser_animation_logic_mutations_fast.js]
--- a/devtools/client/inspector/test/browser_inspector_breadcrumbs.js
+++ b/devtools/client/inspector/test/browser_inspector_breadcrumbs.js
@@ -104,17 +104,17 @@ async function testComments(inspector, c
   button.click();
   await onBreadcrumbsUpdated;
 
   is(breadcrumbs.currentIndex, checkedButtonIndex, "New button is selected");
   ok(breadcrumbs.outer.hasAttribute("aria-activedescendant"),
     "Active descendant must be set");
 
   let comment = [...inspector.markup._containers].find(([node]) =>
-    node.nodeType === Ci.nsIDOMNode.COMMENT_NODE)[0];
+    node.nodeType === Node.COMMENT_NODE)[0];
 
   let onInspectorUpdated = inspector.once("inspector-updated");
   inspector.selection.setNodeFront(comment);
   await onInspectorUpdated;
 
   is(breadcrumbs.currentIndex, -1,
     "When comment is selected no breadcrumb should be checked");
   ok(!breadcrumbs.outer.hasAttribute("aria-activedescendant"),
--- a/devtools/client/inspector/test/browser_inspector_highlighter-comments.js
+++ b/devtools/client/inspector/test/browser_inspector_highlighter-comments.js
@@ -62,27 +62,27 @@ add_task(async function() {
     info(`Hovering node ${selector} in the markup view`);
     let container = await getContainerForSelector(selector, inspector);
     return hoverContainer(container);
   }
 
   function hoverComment() {
     info("Hovering the comment node in the markup view");
     for (let [node, container] of markupView._containers) {
-      if (node.nodeType === Ci.nsIDOMNode.COMMENT_NODE) {
+      if (node.nodeType === Node.COMMENT_NODE) {
         return hoverContainer(container);
       }
     }
     return null;
   }
 
   function hoverTextNode(text) {
     info(`Hovering the text node "${text}" in the markup view`);
     let container = [...markupView._containers].filter(([nodeFront]) => {
-      return nodeFront.nodeType === Ci.nsIDOMNode.TEXT_NODE &&
+      return nodeFront.nodeType === Node.TEXT_NODE &&
              nodeFront._form.nodeValue.trim() === text.trim();
     })[0][1];
     return hoverContainer(container);
   }
 
   async function assertHighlighterShownOn(selector) {
     ok((await testActor.assertHighlightedNode(selector)),
        "Highlighter is shown on the right node: " + selector);
--- a/devtools/client/inspector/test/browser_inspector_keyboard-shortcuts-copy-outerhtml.js
+++ b/devtools/client/inspector/test/browser_inspector_keyboard-shortcuts-copy-outerhtml.js
@@ -7,22 +7,22 @@ http://creativecommons.org/publicdomain/
 
 const TEST_URL = URL_ROOT + "doc_inspector_outerhtml.html";
 
 add_task(async function() {
   let { inspector } = await openInspectorForURL(TEST_URL);
   let root = inspector.markup._elt;
 
   info("Test copy outerHTML for COMMENT node");
-  let comment = getElementByType(inspector, Ci.nsIDOMNode.COMMENT_NODE);
+  let comment = getElementByType(inspector, Node.COMMENT_NODE);
   await setSelectionNodeFront(comment, inspector);
   await checkClipboard("<!-- Comment -->", root);
 
   info("Test copy outerHTML for DOCTYPE node");
-  let doctype = getElementByType(inspector, Ci.nsIDOMNode.DOCUMENT_TYPE_NODE);
+  let doctype = getElementByType(inspector, Node.DOCUMENT_TYPE_NODE);
   await setSelectionNodeFront(doctype, inspector);
   await checkClipboard("<!DOCTYPE html>", root);
 
   info("Test copy outerHTML for ELEMENT node");
   await selectAndHighlightNode("div", inspector);
   await checkClipboard("<div><p>Test copy OuterHTML</p></div>", root);
 });
 
--- a/devtools/client/netmonitor/src/components/RequestListContent.js
+++ b/devtools/client/netmonitor/src/components/RequestListContent.js
@@ -144,17 +144,17 @@ class RequestListContent extends Compone
 
     return (lastChildRect.height + lastChildRect.top) <= contentRect.bottom;
   }
 
   /**
    * The predicate used when deciding whether a popup should be shown
    * over a request item or not.
    *
-   * @param nsIDOMNode target
+   * @param Node target
    *        The element node currently being hovered.
    * @param object tooltip
    *        The current tooltip instance.
    * @return {Promise}
    */
   async onHover(target, tooltip) {
     let itemEl = target.closest(".request-list-item");
     if (!itemEl) {
--- a/devtools/client/performance/modules/marker-dom-utils.js
+++ b/devtools/client/performance/modules/marker-dom-utils.js
@@ -17,29 +17,29 @@ const { getSourceNames } = require("devt
  */
 exports.MarkerDOMUtils = {
   /**
    * Builds all the fields possible for the given marker. Returns an
    * array of elements to be appended to a parent element.
    *
    * @param document doc
    * @param object marker
-   * @return array<nsIDOMNode>
+   * @return array<Node>
    */
   buildFields: function(doc, marker) {
     let fields = MarkerBlueprintUtils.getMarkerFields(marker);
     return fields.map(({ label, value }) => this.buildNameValueLabel(doc, label, value));
   },
 
   /**
    * Builds the label representing the marker's type.
    *
    * @param document doc
    * @param object marker
-   * @return nsIDOMNode
+   * @return Node
    */
   buildTitle: function(doc, marker) {
     let blueprint = MarkerBlueprintUtils.getBlueprintFor(marker);
 
     let hbox = doc.createElement("hbox");
     hbox.setAttribute("align", "center");
 
     let bullet = doc.createElement("hbox");
@@ -56,17 +56,17 @@ exports.MarkerDOMUtils = {
     return hbox;
   },
 
   /**
    * Builds the label representing the marker's duration.
    *
    * @param document doc
    * @param object marker
-   * @return nsIDOMNode
+   * @return Node
    */
   buildDuration: function(doc, marker) {
     let label = L10N.getStr("marker.field.duration");
     let start = L10N.getFormatStrWithNumbers("timeline.tick", marker.start);
     let end = L10N.getFormatStrWithNumbers("timeline.tick", marker.end);
     let duration = L10N.getFormatStrWithNumbers("timeline.tick",
                                                 marker.end - marker.start);
 
@@ -79,17 +79,17 @@ exports.MarkerDOMUtils = {
 
   /**
    * Builds labels for name:value pairs.
    * E.g. "Start: 100ms", "Duration: 200ms", ...
    *
    * @param document doc
    * @param string field
    * @param string value
-   * @return nsIDOMNode
+   * @return Node
    */
   buildNameValueLabel: function(doc, field, value) {
     let hbox = doc.createElement("hbox");
     hbox.className = "marker-details-labelcontainer";
 
     let nameLabel = doc.createElement("label");
     nameLabel.className = "plain marker-details-name-label";
     nameLabel.setAttribute("value", field);
@@ -210,17 +210,17 @@ exports.MarkerDOMUtils = {
   },
 
   /**
    * Builds any custom fields specific to the marker.
    *
    * @param document doc
    * @param object marker
    * @param object options
-   * @return array<nsIDOMNode>
+   * @return array<Node>
    */
   buildCustom: function(doc, marker, options) {
     let elements = [];
 
     if (options.allocations && shouldShowAllocationsTrigger(marker)) {
       let hbox = doc.createElement("hbox");
       hbox.className = "marker-details-customcontainer";
 
--- a/devtools/client/performance/modules/widgets/graphs.js
+++ b/devtools/client/performance/modules/widgets/graphs.js
@@ -43,17 +43,17 @@ const MARKERS_GROUP_VERTICAL_PADDING = 4
 /**
  * For optimization graph
  */
 const OPTIMIZATIONS_GRAPH_RESOLUTION = 100;
 
 /**
  * A base class for performance graphs to inherit from.
  *
- * @param nsIDOMNode parent
+ * @param Node parent
  *        The parent node holding the overview.
  * @param string metric
  *        The unit of measurement for this graph.
  */
 function PerformanceGraph(parent, metric) {
   LineGraphWidget.call(this, parent, { metric });
   this.setTheme();
 }
@@ -95,17 +95,17 @@ PerformanceGraph.prototype = extend(Line
     this.averageLineColor = colorUtils.setAlpha(mainColor, 0.7);
     this.minimumLineColor = colorUtils.setAlpha(mainColor, 0.9);
   }
 });
 
 /**
  * Constructor for the framerate graph. Inherits from PerformanceGraph.
  *
- * @param nsIDOMNode parent
+ * @param Node parent
  *        The parent node holding the overview.
  */
 function FramerateGraph(parent) {
   PerformanceGraph.call(this, parent, ProfilerGlobal.L10N.getStr("graphs.fps"));
 }
 
 FramerateGraph.prototype = extend(PerformanceGraph.prototype, {
   mainColor: FRAMERATE_GRAPH_COLOR_NAME,
@@ -113,17 +113,17 @@ FramerateGraph.prototype = extend(Perfor
     this.dataDuration = duration;
     return this.setDataFromTimestamps(ticks, resolution, duration);
   }
 });
 
 /**
  * Constructor for the memory graph. Inherits from PerformanceGraph.
  *
- * @param nsIDOMNode parent
+ * @param Node parent
  *        The parent node holding the overview.
  */
 function MemoryGraph(parent) {
   PerformanceGraph.call(this, parent, ProfilerGlobal.L10N.getStr("graphs.memory"));
 }
 
 MemoryGraph.prototype = extend(PerformanceGraph.prototype, {
   mainColor: MEMORY_GRAPH_COLOR_NAME,
@@ -423,17 +423,17 @@ GraphsController.prototype = {
     this._enabledGraphs = enabled;
     return this._enabledGraphs;
   },
 };
 
 /**
  * A base class for performance graphs to inherit from.
  *
- * @param nsIDOMNode parent
+ * @param Node parent
  *        The parent node holding the overview.
  * @param string metric
  *        The unit of measurement for this graph.
  */
 function OptimizationsGraph(parent) {
   MountainGraphWidget.call(this, parent);
   this.setTheme();
 }
--- a/devtools/client/performance/modules/widgets/marker-details.js
+++ b/devtools/client/performance/modules/widgets/marker-details.js
@@ -8,19 +8,19 @@
  */
 
 const EventEmitter = require("devtools/shared/event-emitter");
 const { MarkerDOMUtils } = require("devtools/client/performance/modules/marker-dom-utils");
 
 /**
  * A detailed view for one single marker.
  *
- * @param nsIDOMNode parent
+ * @param Node parent
  *        The parent node holding the view.
- * @param nsIDOMNode splitter
+ * @param Node splitter
  *        The splitter node that the resize event is bound to.
  */
 function MarkerDetails(parent, splitter) {
   EventEmitter.decorate(this);
 
   this._document = parent.ownerDocument;
   this._parent = parent;
   this._splitter = splitter;
--- a/devtools/client/performance/modules/widgets/markers-overview.js
+++ b/devtools/client/performance/modules/widgets/markers-overview.js
@@ -32,17 +32,17 @@ const OVERVIEW_HEADER_TEXT_FONT_FAMILY =
 const OVERVIEW_HEADER_TEXT_PADDING_LEFT = 6; // px
 const OVERVIEW_HEADER_TEXT_PADDING_TOP = 1; // px
 const OVERVIEW_MARKER_WIDTH_MIN = 4; // px
 const OVERVIEW_GROUP_VERTICAL_PADDING = 5; // px
 
 /**
  * An overview for the markers data.
  *
- * @param nsIDOMNode parent
+ * @param Node parent
  *        The parent node holding the overview.
  * @param Array<String> filter
  *        List of names of marker types that should not be shown.
  */
 function MarkersOverview(parent, filter = [], ...args) {
   AbstractCanvasGraph.apply(this, [parent, "markers-overview", ...args]);
   this.setTheme();
   this.setFilter(filter);
--- a/devtools/client/performance/modules/widgets/tree-view.js
+++ b/devtools/client/performance/modules/widgets/tree-view.js
@@ -172,19 +172,19 @@ function CallView({
   this.showOptimizationHint = showOptimizationHint;
 
   this._onUrlClick = this._onUrlClick.bind(this);
 }
 
 CallView.prototype = extend(AbstractTreeItem.prototype, {
   /**
    * Creates the view for this tree node.
-   * @param nsIDOMNode document
-   * @param nsIDOMNode arrowNode
-   * @return nsIDOMNode
+   * @param Node document
+   * @param Node arrowNode
+   * @return Node
    */
   _displaySelf: function(document, arrowNode) {
     let frameInfo = this.getDisplayedData();
     let cells = [];
 
     for (let type of CELL_TYPES) {
       if (this.visibleCells[type]) {
         // Inline for speed, but pass in the formatted value via
--- a/devtools/client/shared/autocomplete-popup.js
+++ b/devtools/client/shared/autocomplete-popup.js
@@ -110,17 +110,17 @@ AutocompletePopup.prototype = {
     if (this.onClickCallback) {
       this.onClickCallback(e);
     }
   },
 
   /**
    * Open the autocomplete popup panel.
    *
-   * @param {nsIDOMNode} anchor
+   * @param {Node} anchor
    *        Optional node to anchor the panel to.
    * @param {Number} xOffset
    *        Horizontal offset in pixels from the left of the node to the left
    *        of the popup.
    * @param {Number} yOffset
    *        Vertical offset in pixels from the top of the node to the starting
    *        of the popup.
    * @param {Number} index
--- a/devtools/client/shared/widgets/AbstractTreeItem.jsm
+++ b/devtools/client/shared/widgets/AbstractTreeItem.jsm
@@ -15,17 +15,17 @@ this.EXPORTED_SYMBOLS = ["AbstractTreeIt
 
 /**
  * A very generic and low-level tree view implementation. It is not intended
  * to be used alone, but as a base class that you can extend to build your
  * own custom implementation.
  *
  * Language:
  *   - An "item" is an instance of an AbstractTreeItem.
- *   - An "element" or "node" is an nsIDOMNode.
+ *   - An "element" or "node" is a Node.
  *
  * The following events are emitted by this tree, always from the root item,
  * with the first argument pointing to the affected child item:
  *   - "expand": when an item is expanded in the tree
  *   - "collapse": when an item is collapsed in the tree
  *   - "focus": when an item is selected in the tree
  *
  * For example, you can extend this abstract class like this:
@@ -73,17 +73,17 @@ this.EXPORTED_SYMBOLS = ["AbstractTreeIt
  *     label: "bar",
  *     children: [{
  *       label: "baz",
  *       children: []
  *     }]
  *   }]
  * };
  * let root = new MyCustomTreeItem(dataSrc, { parent: null });
- * root.attachTo(nsIDOMNode);
+ * root.attachTo(Node);
  * root.expand();
  *
  * The following tree view will be generated (after expanding all nodes):
  * ▼ root
  *   ▶ foo
  *   ▼ bar
  *     ▶ baz
  *
@@ -139,19 +139,19 @@ AbstractTreeItem.prototype = {
    */
   autoExpandDepth: 0,
 
   /**
    * Creates the view for this tree item. Implement this method in the
    * inheriting classes to create the child node displayed in the tree.
    * Use `this.level` and the provided `arrowNode` as you see fit.
    *
-   * @param nsIDOMNode document
-   * @param nsIDOMNode arrowNode
-   * @return nsIDOMNode
+   * @param Node document
+   * @param Node arrowNode
+   * @return Node
    */
   _displaySelf: function(document, arrowNode) {
     throw new Error(
       "The `_displaySelf` method needs to be implemented by inheriting classes.");
   },
 
   /**
    * Populates this tree item with child items, whenever it's expanded.
@@ -201,17 +201,17 @@ AbstractTreeItem.prototype = {
    * Gets the element displaying this tree item.
    */
   get target() {
     return this._targetNode;
   },
 
   /**
    * Gets the element containing all tree items.
-   * @return nsIDOMNode
+   * @return Node
    */
   get container() {
     return this._containerNode;
   },
 
   /**
    * Returns whether or not this item is populated in the tree.
    * Collapsed items can still be populated.
@@ -238,22 +238,22 @@ AbstractTreeItem.prototype = {
     let win = this.document.defaultView;
     let utils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
     return utils.getBoundsWithoutFlushing(this._containerNode);
   },
 
   /**
    * Creates and appends this tree item to the specified parent element.
    *
-   * @param nsIDOMNode containerNode
+   * @param Node containerNode
    *        The parent element for this tree item (and every other tree item).
-   * @param nsIDOMNode fragmentNode [optional]
+   * @param Node fragmentNode [optional]
    *        An optional document fragment temporarily holding this tree item in
    *        the current batch. Defaults to the `containerNode`.
-   * @param nsIDOMNode beforeNode [optional]
+   * @param Node beforeNode [optional]
    *        An optional child element which should succeed this tree item.
    */
   attachTo: function(containerNode, fragmentNode = containerNode, beforeNode = null) {
     this._containerNode = containerNode;
     this._constructTargetNode();
 
     if (beforeNode) {
       fragmentNode.insertBefore(this._targetNode, beforeNode);
@@ -460,17 +460,17 @@ AbstractTreeItem.prototype = {
   },
 
   /**
    * Gets the element displaying an item in the tree at the specified offset
    * relative to this item.
    *
    * @param number delta
    *        The offset from this item to the target item.
-   * @return nsIDOMNode
+   * @return Node
    *         The element displaying the target item at the specified offset.
    */
   _getSiblingAtDelta: function(delta) {
     let childNodes = this._containerNode.childNodes;
     let indexOfSelf = Array.indexOf(childNodes, this._targetNode);
     if (indexOfSelf + delta >= 0) {
       return childNodes[indexOfSelf + delta];
     }
@@ -517,27 +517,27 @@ AbstractTreeItem.prototype = {
 
   /**
    * Focuses the next item in this tree.
    */
   _focusNextNode: function() {
     let nextElement = this._getSiblingAtDelta(1);
     if (nextElement) {
       nextElement.focus();
-    } // nsIDOMNode
+    } // Node
   },
 
   /**
    * Focuses the previous item in this tree.
    */
   _focusPrevNode: function() {
     let prevElement = this._getSiblingAtDelta(-1);
     if (prevElement) {
       prevElement.focus();
-    } // nsIDOMNode
+    } // Node
   },
 
   /**
    * Focuses the parent item in this tree.
    *
    * The parent item is not always the previous item, because any tree item
    * may have multiple children.
    */
--- a/devtools/client/shared/widgets/BarGraphWidget.js
+++ b/devtools/client/shared/widgets/BarGraphWidget.js
@@ -58,17 +58,17 @@ const GRAPH_LEGEND_MOUSEOVER_DEBOUNCE = 
  *     { delta: x1, values: [y11, y12, ... y1n] },
  *     { delta: x2, values: [y21, y22, ... y2n] },
  *     ...
  *     { delta: xm, values: [ym1, ym2, ... ymn] }
  *   ]
  * where each item in the array represents a "bar", for which every value
  * represents a "block" inside that "bar", plotted at the "delta" position.
  *
- * @param nsIDOMNode parent
+ * @param Node parent
  *        The parent node holding the graph.
  */
 this.BarGraphWidget = function(parent, ...args) {
   AbstractCanvasGraph.apply(this, [parent, "bar-graph", ...args]);
 
   this.once("ready", () => {
     this._onLegendMouseOver = this._onLegendMouseOver.bind(this);
     this._onLegendMouseOut = this._onLegendMouseOut.bind(this);
--- a/devtools/client/shared/widgets/BreadcrumbsWidget.jsm
+++ b/devtools/client/shared/widgets/BreadcrumbsWidget.jsm
@@ -14,17 +14,17 @@ const EventEmitter = require("devtools/s
 this.EXPORTED_SYMBOLS = ["BreadcrumbsWidget"];
 
 /**
  * A breadcrumb-like list of items.
  *
  * Note: this widget should be used in tandem with the WidgetMethods in
  * view-helpers.js.
  *
- * @param nsIDOMNode aNode
+ * @param Node aNode
  *        The element associated with the widget.
  * @param Object aOptions
  *        - smoothScroll: specifies if smooth scrolling on selection is enabled.
  */
 this.BreadcrumbsWidget = function BreadcrumbsWidget(aNode, aOptions = {}) {
   this.document = aNode.ownerDocument;
   this.window = this.document.defaultView;
   this._parent = aNode;
@@ -57,43 +57,43 @@ this.BreadcrumbsWidget = function Breadc
 };
 
 BreadcrumbsWidget.prototype = {
   /**
    * Inserts an item in this container at the specified index.
    *
    * @param number aIndex
    *        The position in the container intended for this item.
-   * @param nsIDOMNode aContents
+   * @param Node aContents
    *        The node displayed in the container.
-   * @return nsIDOMNode
+   * @return Node
    *         The element associated with the displayed item.
    */
   insertItemAt: function(aIndex, aContents) {
     let list = this._list;
     let breadcrumb = new Breadcrumb(this, aContents);
     return list.insertBefore(breadcrumb._target, list.childNodes[aIndex]);
   },
 
   /**
    * Returns the child node in this container situated at the specified index.
    *
    * @param number aIndex
    *        The position in the container intended for this item.
-   * @return nsIDOMNode
+   * @return Node
    *         The element associated with the displayed item.
    */
   getItemAtIndex: function(aIndex) {
     return this._list.childNodes[aIndex];
   },
 
   /**
    * Removes the specified child node from this container.
    *
-   * @param nsIDOMNode aChild
+   * @param Node aChild
    *        The element associated with the displayed item.
    */
   removeChild: function(aChild) {
     this._list.removeChild(aChild);
 
     if (this._selectedItem == aChild) {
       this._selectedItem = null;
     }
@@ -109,25 +109,25 @@ BreadcrumbsWidget.prototype = {
       list.firstChild.remove();
     }
 
     this._selectedItem = null;
   },
 
   /**
    * Gets the currently selected child node in this container.
-   * @return nsIDOMNode
+   * @return Node
    */
   get selectedItem() {
     return this._selectedItem;
   },
 
   /**
    * Sets the currently selected child node in this container.
-   * @param nsIDOMNode aChild
+   * @param Node aChild
    */
   set selectedItem(aChild) {
     let childNodes = this._list.childNodes;
 
     if (!aChild) {
       this._selectedItem = null;
     }
     for (let node of childNodes) {
@@ -156,17 +156,17 @@ BreadcrumbsWidget.prototype = {
       return this._list.scrollWidth;
     }
     return this._parent.getAttribute(aName);
   },
 
   /**
    * Ensures the specified element is visible.
    *
-   * @param nsIDOMNode aElement
+   * @param Node aElement
    *        The element to make visible.
    */
   ensureElementIsVisible: function(aElement) {
     if (!aElement) {
       return;
     }
 
     // Repeated calls to ensureElementIsVisible would interfere with each other
@@ -209,17 +209,17 @@ BreadcrumbsWidget.prototype = {
   _selectedItem: null
 };
 
 /**
  * A Breadcrumb constructor for the BreadcrumbsWidget.
  *
  * @param BreadcrumbsWidget aWidget
  *        The widget to contain this breadcrumb.
- * @param nsIDOMNode aContents
+ * @param Node aContents
  *        The node displayed in the container.
  */
 function Breadcrumb(aWidget, aContents) {
   this.document = aWidget.document;
   this.window = aWidget.window;
   this.ownerView = aWidget;
 
   this._target = this.document.createElement("hbox");
@@ -227,17 +227,17 @@ function Breadcrumb(aWidget, aContents) 
   this._target.setAttribute("align", "center");
   this.contents = aContents;
 }
 
 Breadcrumb.prototype = {
   /**
    * Sets the contents displayed in this item's view.
    *
-   * @param string | nsIDOMNode aContents
+   * @param string | Node aContents
    *        The string or node displayed in the container.
    */
   set contents(aContents) {
     // If there are already some contents displayed, replace them.
     if (this._target.hasChildNodes()) {
       this._target.replaceChild(aContents, this._target.firstChild);
       return;
     }
--- a/devtools/client/shared/widgets/Chart.js
+++ b/devtools/client/shared/widgets/Chart.js
@@ -24,45 +24,45 @@ var Chart = {
   Pie: createPieChart,
   Table: createTableChart,
   PieTable: createPieTableChart
 };
 
 /**
  * A simple pie chart proxy for the underlying view.
  * Each item in the `slices` property represents a [data, node] pair containing
- * the data used to create the slice and the nsIDOMNode displaying it.
+ * the data used to create the slice and the Node displaying it.
  *
- * @param nsIDOMNode node
+ * @param Node node
  *        The node representing the view for this chart.
  */
 function PieChart(node) {
   this.node = node;
   this.slices = new WeakMap();
   EventEmitter.decorate(this);
 }
 
 /**
  * A simple table chart proxy for the underlying view.
  * Each item in the `rows` property represents a [data, node] pair containing
- * the data used to create the row and the nsIDOMNode displaying it.
+ * the data used to create the row and the Node displaying it.
  *
- * @param nsIDOMNode node
+ * @param Node node
  *        The node representing the view for this chart.
  */
 function TableChart(node) {
   this.node = node;
   this.rows = new WeakMap();
   EventEmitter.decorate(this);
 }
 
 /**
  * A simple pie+table chart proxy for the underlying view.
  *
- * @param nsIDOMNode node
+ * @param Node node
  *        The node representing the view for this chart.
  * @param PieChart pie
  *        The pie chart proxy.
  * @param TableChart table
  *        The table chart proxy.
  */
 function PieTableChart(node, pie, table) {
   this.node = node;
@@ -444,23 +444,23 @@ function loadingTableChartData() {
   return [{ size: "", label: L10N.getStr("tableChart.loading") }];
 }
 
 function emptyTableChartData() {
   return [{ size: "", label: L10N.getStr("tableChart.unavailable") }];
 }
 
 /**
- * Delegates DOM events emitted by an nsIDOMNode to an EventEmitter proxy.
+ * Delegates DOM events emitted by a Node to an EventEmitter proxy.
  *
  * @param EventEmitter emitter
  *        The event emitter proxy instance.
  * @param array events
  *        An array of events, e.g. ["mouseover", "mouseout"].
- * @param nsIDOMNode node
+ * @param Node node
  *        The element firing the DOM events.
  * @param any args
  *        The arguments passed when emitting events through the proxy.
  */
 function delegate(emitter, events, node, args) {
   for (let event of events) {
     node.addEventListener(event, emitter.emit.bind(emitter, event, args));
   }
--- a/devtools/client/shared/widgets/FastListWidget.js
+++ b/devtools/client/shared/widgets/FastListWidget.js
@@ -9,17 +9,17 @@ const EventEmitter = require("devtools/s
 const { ViewHelpers } = require("devtools/client/shared/widgets/view-helpers");
 
 /**
  * A list menu widget that attempts to be very fast.
  *
  * Note: this widget should be used in tandem with the WidgetMethods in
  * view-helpers.js.
  *
- * @param nsIDOMNode aNode
+ * @param Node aNode
  *        The element associated with the widget.
  */
 const FastListWidget = module.exports = function FastListWidget(node) {
   this.document = node.ownerDocument;
   this.window = this.document.defaultView;
   this._parent = node;
   this._fragment = this.document.createDocumentFragment();
 
@@ -50,21 +50,21 @@ const FastListWidget = module.exports = 
 
 FastListWidget.prototype = {
   /**
    * Inserts an item in this container at the specified index, optionally
    * grouping by name.
    *
    * @param number aIndex
    *        The position in the container intended for this item.
-   * @param nsIDOMNode aContents
+   * @param Node aContents
    *        The node to be displayed in the container.
    * @param Object aAttachment [optional]
    *        Extra data for the user.
-   * @return nsIDOMNode
+   * @return Node
    *         The element associated with the displayed item.
    */
   insertItemAt: function(index, contents, attachment = {}) {
     let element = this._templateElement.cloneNode();
     element.appendChild(contents);
 
     if (index >= 0) {
       throw new Error("FastListWidget only supports appending items.");
@@ -106,25 +106,25 @@ FastListWidget.prototype = {
    * Remove the given item.
    */
   removeChild: function(child) {
     throw new Error("Not yet implemented");
   },
 
   /**
    * Gets the currently selected child node in this container.
-   * @return nsIDOMNode
+   * @return Node
    */
   get selectedItem() {
     return this._selectedItem;
   },
 
   /**
    * Sets the currently selected child node in this container.
-   * @param nsIDOMNode child
+   * @param Node child
    */
   set selectedItem(child) {
     let menuArray = this._orderedMenuElementsArray;
 
     if (!child) {
       this._selectedItem = null;
     }
     for (let node of menuArray) {
@@ -139,17 +139,17 @@ FastListWidget.prototype = {
     this.ensureElementIsVisible(this.selectedItem);
   },
 
   /**
    * Returns the child node in this container situated at the specified index.
    *
    * @param number index
    *        The position in the container intended for this item.
-   * @return nsIDOMNode
+   * @return Node
    *         The element associated with the displayed item.
    */
   getItemAtIndex: function(index) {
     return this._orderedMenuElementsArray[index];
   },
 
   /**
    * Adds a new attribute or changes an existing attribute on this container.
@@ -179,17 +179,17 @@ FastListWidget.prototype = {
     if (name == "emptyText") {
       this._removeEmptyText();
     }
   },
 
   /**
    * Ensures the specified element is visible.
    *
-   * @param nsIDOMNode element
+   * @param Node element
    *        The element to make visible.
    */
   ensureElementIsVisible: function(element) {
     if (!element) {
       return;
     }
 
     // Ensure the element is visible but not scrolled horizontally.
--- a/devtools/client/shared/widgets/FilterWidget.js
+++ b/devtools/client/shared/widgets/FilterWidget.js
@@ -101,17 +101,17 @@ const SPECIAL_VALUES = new Set(["none", 
  * filters.
  *
  * Normally, it takes a CSS filter value as input, parses it
  * and creates the required elements / bindings.
  *
  * You can, however, use add/remove/update methods manually.
  * See each method's comments for more details
  *
- * @param {nsIDOMNode} el
+ * @param {Node} el
  *        The widget container.
  * @param {String} value
  *        CSS filter value
  * @param {Function} cssIsValid
  *        Test whether css name / value is valid.
  */
 function CSSFilterEditorWidget(el, value = "", cssIsValid) {
   this.doc = el.ownerDocument;
--- a/devtools/client/shared/widgets/FlameGraph.js
+++ b/devtools/client/shared/widgets/FlameGraph.js
@@ -118,17 +118,17 @@ const COLOR_PALLETTE = Array.from(Array(
  *       color: "string",
  *       blocks: [...]
  *     }
  *   ]
  *
  * Use `FlameGraphUtils` to convert profiler data (or any other data source)
  * into a drawable format.
  *
- * @param nsIDOMNode parent
+ * @param Node parent
  *        The parent node holding the graph.
  * @param number sharpness [optional]
  *        Defaults to the current device pixel ratio.
  */
 function FlameGraph(parent, sharpness) {
   EventEmitter.decorate(this);
 
   this._parent = parent;
--- a/devtools/client/shared/widgets/Graphs.js
+++ b/devtools/client/shared/widgets/Graphs.js
@@ -77,17 +77,17 @@ this.GraphAreaResizer = function() {
  *     "start" and an "end" value, but distinct from the "selection". It is
  *     simply used to highlight important regions in the data.
  *
  * Instances of this class are EventEmitters with the following events:
  *   - "ready": when the container iframe and canvas are created.
  *   - "selecting": when the selection is set or changed.
  *   - "deselecting": when the selection is dropped.
  *
- * @param nsIDOMNode parent
+ * @param Node parent
  *        The parent node holding the graph.
  * @param string name
  *        The graph type, used for setting the correct class names.
  *        Currently supported: "line-graph" only.
  * @param number sharpness [optional]
  *        Defaults to the current device pixel ratio.
  */
 this.AbstractCanvasGraph = function(parent, name, sharpness) {
@@ -1224,17 +1224,17 @@ AbstractCanvasGraph.prototype = {
 // Helper functions.
 
 /**
  * Creates an iframe element with the provided source URL, appends it to
  * the specified node and invokes the callback once the content is loaded.
  *
  * @param string url
  *        The desired source URL for the iframe.
- * @param nsIDOMNode parent
+ * @param Node parent
  *        The desired parent node for the iframe.
  * @param function callback
  *        Invoked once the content is loaded, with the iframe as an argument.
  */
 AbstractCanvasGraph.createIframe = function(url, parent, callback) {
   let iframe = parent.ownerDocument.createElementNS(HTML_NS, "iframe");
 
   iframe.addEventListener("DOMContentLoaded", function() {
--- a/devtools/client/shared/widgets/LineGraphWidget.js
+++ b/devtools/client/shared/widgets/LineGraphWidget.js
@@ -47,17 +47,17 @@ const GRAPH_REGION_STRIPES_COLOR = "rgba
  *   [
  *     { delta: x1, value: y1 },
  *     { delta: x2, value: y2 },
  *     ...
  *     { delta: xn, value: yn }
  *   ]
  * where each item in the array represents a point in the graph.
  *
- * @param nsIDOMNode parent
+ * @param Node parent
  *        The parent node holding the graph.
  * @param object options [optional]
  *  `metric`: The metric displayed in the graph, e.g. "fps" or "bananas".
  *  `min`: Boolean whether to show the min tooltip/gutter/line (default: true)
  *  `max`: Boolean whether to show the max tooltip/gutter/line (default: true)
  *  `avg`: Boolean whether to show the avg tooltip/gutter/line (default: true)
  */
 this.LineGraphWidget = function(parent, options = {}, ...args) {
@@ -334,43 +334,43 @@ LineGraphWidget.prototype = extend(Abstr
 
     this._maxGutterLine.hidden = this._showMax === false;
     this._avgGutterLine.hidden = this._showAvg === false;
     this._minGutterLine.hidden = this._showMin === false;
   },
 
   /**
    * Creates the gutter node when constructing this graph.
-   * @return nsIDOMNode
+   * @return Node
    */
   _createGutter: function() {
     let gutter = this._document.createElementNS(HTML_NS, "div");
     gutter.className = "line-graph-widget-gutter";
     gutter.setAttribute("hidden", true);
     this._container.appendChild(gutter);
 
     return gutter;
   },
 
   /**
    * Creates the gutter line nodes when constructing this graph.
-   * @return nsIDOMNode
+   * @return Node
    */
   _createGutterLine: function(type) {
     let line = this._document.createElementNS(HTML_NS, "div");
     line.className = "line-graph-widget-gutter-line";
     line.setAttribute("type", type);
     this._gutter.appendChild(line);
 
     return line;
   },
 
   /**
    * Creates the tooltip nodes when constructing this graph.
-   * @return nsIDOMNode
+   * @return Node
    */
   _createTooltip: function(type, arrow, info, metric) {
     let tooltip = this._document.createElementNS(HTML_NS, "div");
     tooltip.className = "line-graph-widget-tooltip";
     tooltip.setAttribute("type", type);
     tooltip.setAttribute("arrow", arrow);
     tooltip.setAttribute("hidden", true);
 
--- a/devtools/client/shared/widgets/MountainGraphWidget.js
+++ b/devtools/client/shared/widgets/MountainGraphWidget.js
@@ -45,17 +45,17 @@ const GRAPH_REGION_STRIPES_COLOR = "rgba
  *   [
  *     { delta: x1, values: [y11, y12, ... y1n] },
  *     { delta: x2, values: [y21, y22, ... y2n] },
  *     ...
  *     { delta: xm, values: [ym1, ym2, ... ymn] }
  *   ]
  * where the [ymn] values is assumed to aready be normalized from [0..1].
  *
- * @param nsIDOMNode parent
+ * @param Node parent
  *        The parent node holding the graph.
  */
 this.MountainGraphWidget = function(parent, ...args) {
   AbstractCanvasGraph.apply(this, [parent, "mountain-graph", ...args]);
 };
 
 MountainGraphWidget.prototype = extend(AbstractCanvasGraph.prototype, {
   backgroundColor: GRAPH_BACKGROUND_COLOR,
--- a/devtools/client/shared/widgets/SideMenuWidget.jsm
+++ b/devtools/client/shared/widgets/SideMenuWidget.jsm
@@ -20,17 +20,17 @@ this.EXPORTED_SYMBOLS = ["SideMenuWidget
 var L10N = new LocalizationHelper(SHARED_STRINGS_URI);
 
 /**
  * A simple side menu, with the ability of grouping menu items.
  *
  * Note: this widget should be used in tandem with the WidgetMethods in
  * view-helpers.js.
  *
- * @param nsIDOMNode aNode
+ * @param Node aNode
  *        The element associated with the widget.
  * @param Object aOptions
  *        - contextMenu: optional element or element ID that serves as a context menu.
  *        - showArrows: specifies if items should display horizontal arrows.
  *        - showItemCheckboxes: specifies if items should display checkboxes.
  *        - showGroupCheckboxes: specifies if groups should display checkboxes.
  */
 this.SideMenuWidget = function SideMenuWidget(aNode, aOptions = {}) {
@@ -85,24 +85,24 @@ SideMenuWidget.prototype = {
   groupSortPredicate: (a, b) => a.localeCompare(b),
 
   /**
    * Inserts an item in this container at the specified index, optionally
    * grouping by name.
    *
    * @param number aIndex
    *        The position in the container intended for this item.
-   * @param nsIDOMNode aContents
+   * @param Node aContents
    *        The node displayed in the container.
    * @param object aAttachment [optional]
    *        Some attached primitive/object. Custom options supported:
    *          - group: a string specifying the group to place this item into
    *          - checkboxState: the checked state of the checkbox, if shown
    *          - checkboxTooltip: the tooltip text for the checkbox, if shown
-   * @return nsIDOMNode
+   * @return Node
    *         The element associated with the displayed item.
    */
   insertItemAt: function(aIndex, aContents, aAttachment = {}) {
     let group = this._getMenuGroupForName(aAttachment.group);
     let item = this._getMenuItemForGroup(group, aContents, aAttachment);
     let element = item.insertSelfAt(aIndex);
 
     return element;
@@ -138,27 +138,27 @@ SideMenuWidget.prototype = {
     this.emit("scroll-to-bottom");
   },
 
   /**
    * Returns the child node in this container situated at the specified index.
    *
    * @param number aIndex
    *        The position in the container intended for this item.
-   * @return nsIDOMNode
+   * @return Node
    *         The element associated with the displayed item.
    */
   getItemAtIndex: function(aIndex) {
     return this._orderedMenuElementsArray[aIndex];
   },
 
   /**
    * Removes the specified child node from this container.
    *
-   * @param nsIDOMNode aChild
+   * @param Node aChild
    *        The element associated with the displayed item.
    */
   removeChild: function(aChild) {
     this._getNodeForContents(aChild).remove();
 
     this._orderedMenuElementsArray.splice(
       this._orderedMenuElementsArray.indexOf(aChild), 1);
 
@@ -184,25 +184,25 @@ SideMenuWidget.prototype = {
     this._groupsByName.clear();
     this._orderedGroupElementsArray.length = 0;
     this._orderedMenuElementsArray.length = 0;
     this._itemsByElement.clear();
   },
 
   /**
    * Gets the currently selected child node in this container.
-   * @return nsIDOMNode
+   * @return Node
    */
   get selectedItem() {
     return this._selectedItem;
   },
 
   /**
    * Sets the currently selected child node in this container.
-   * @param nsIDOMNode aChild
+   * @param Node aChild
    */
   set selectedItem(aChild) {
     let menuArray = this._orderedMenuElementsArray;
 
     if (!aChild) {
       this._selectedItem = null;
     }
     for (let node of menuArray) {
@@ -213,17 +213,17 @@ SideMenuWidget.prototype = {
         this._getNodeForContents(node).classList.remove("selected");
       }
     }
   },
 
   /**
    * Ensures the specified element is visible.
    *
-   * @param nsIDOMNode aElement
+   * @param Node aElement
    *        The element to make visible.
    */
   ensureElementIsVisible: function(aElement) {
     if (!aElement) {
       return;
     }
 
     // Ensure the element is visible but not scrolled horizontally.
@@ -283,17 +283,17 @@ SideMenuWidget.prototype = {
     if (aName == "emptyText") {
       this._removeEmptyText();
     }
   },
 
   /**
    * Set the checkbox state for the item associated with the given node.
    *
-   * @param nsIDOMNode aNode
+   * @param Node aNode
    *        The dom node for an item we want to check.
    * @param boolean aCheckState
    *        True to check, false to uncheck.
    */
   checkItem: function(aNode, aCheckState) {
     const widgetItem = this._itemsByElement.get(aNode);
     if (!widgetItem) {
       throw new Error("No item for " + aNode);
@@ -366,17 +366,17 @@ SideMenuWidget.prototype = {
   },
 
   /**
    * Gets a menu item to be displayed inside a group.
    * @see SideMenuWidget.prototype._getMenuGroupForName
    *
    * @param SideMenuGroup aGroup
    *        The group to contain the menu item.
-   * @param nsIDOMNode aContents
+   * @param Node aContents
    *        The node displayed in the container.
    * @param object aAttachment [optional]
    *        Some attached primitive/object.
    */
   _getMenuItemForGroup: function(aGroup, aContents, aAttachment) {
     return new SideMenuItem(aGroup, aContents, aAttachment, {
       showArrow: this._showArrows,
       showCheckbox: this._showItemCheckboxes
@@ -384,19 +384,19 @@ SideMenuWidget.prototype = {
   },
 
   /**
    * Returns the .side-menu-widget-item node corresponding to a SideMenuItem.
    * To optimize the markup, some redundant elemenst are skipped when creating
    * these child items, in which case we need to be careful on which nodes
    * .selected class names are added, or which nodes are removed.
    *
-   * @param nsIDOMNode aChild
+   * @param Node aChild
    *        An element which is the target node of a SideMenuItem.
-   * @return nsIDOMNode
+   * @return Node
    *         The wrapper node if there is one, or the same child otherwise.
    */
   _getNodeForContents: function(aChild) {
     if (aChild.hasAttribute("merged-item-contents")) {
       return aChild;
     }
     return aChild.parentNode;
   },
@@ -554,17 +554,17 @@ SideMenuGroup.prototype = {
   _list: null
 };
 
 /**
  * A SideMenuItem constructor for the BreadcrumbsWidget.
  *
  * @param SideMenuGroup aGroup
  *        The group to contain this menu item.
- * @param nsIDOMNode aContents
+ * @param Node aContents
  *        The node displayed in the container.
  * @param object aAttachment [optional]
  *        The attachment object.
  * @param object aOptions [optional]
  *        An object containing the following properties:
  *          - showArrow: specifies if a horizontal arrow should be displayed.
  *          - showCheckbox: specifies if a checkbox should be displayed.
  */
@@ -616,17 +616,17 @@ SideMenuItem.prototype = {
     return this.ownerView._itemsByElement;
   },
 
   /**
    * Inserts this item in the parent group at the specified index.
    *
    * @param number aIndex
    *        The position in the container intended for this item.
-   * @return nsIDOMNode
+   * @return Node
    *         The element associated with the displayed item.
    */
   insertSelfAt: function(aIndex) {
     let ownerList = this.ownerView._list;
     let menuArray = this._orderedMenuElementsArray;
 
     if (aIndex >= 0) {
       ownerList.insertBefore(this._container, ownerList.childNodes[aIndex]);
@@ -653,17 +653,17 @@ SideMenuItem.prototype = {
     // Don't set or remove the "checked" attribute, assign the property instead.
     // Otherwise, the "CheckboxStateChange" event will not be fired. XUL!!
     this._checkbox.checked = !!aCheckState;
   },
 
   /**
    * Sets the contents displayed in this item's view.
    *
-   * @param string | nsIDOMNode aContents
+   * @param string | Node aContents
    *        The string or node displayed in the container.
    */
   set contents(aContents) {
     // If there are already some contents displayed, replace them.
     if (this._target.hasChildNodes()) {
       this._target.replaceChild(aContents, this._target.firstChild);
       return;
     }
@@ -679,17 +679,17 @@ SideMenuItem.prototype = {
   _checkbox: null,
   _arrow: null
 };
 
 /**
  * Creates a checkbox to a specified parent node. Emits a "check" event
  * whenever the checkbox is checked or unchecked by the user.
  *
- * @param nsIDOMNode aParentNode
+ * @param Node aParentNode
  *        The parent node to contain this checkbox.
  * @param object aOptions
  *        An object containing some or all of the following properties:
  *          - description: defaults to "item" if unspecified
  *          - checkboxState: true for checked, false for unchecked
  *          - checkboxTooltip: the tooltip text of the checkbox
  */
 function makeCheckbox(aParentNode, aOptions) {
--- a/devtools/client/shared/widgets/SimpleListWidget.jsm
+++ b/devtools/client/shared/widgets/SimpleListWidget.jsm
@@ -11,17 +11,17 @@ const { ViewHelpers } = require("devtool
 this.EXPORTED_SYMBOLS = ["SimpleListWidget"];
 
 /**
  * A very simple vertical list view.
  *
  * Note: this widget should be used in tandem with the WidgetMethods in
  * view-helpers.js.
  *
- * @param nsIDOMNode aNode
+ * @param Node aNode
  *        The element associated with the widget.
  */
 function SimpleListWidget(aNode) {
   this.document = aNode.ownerDocument;
   this.window = this.document.defaultView;
   this._parent = aNode;
 
   // Create an internal list container.
@@ -39,44 +39,44 @@ function SimpleListWidget(aNode) {
 this.SimpleListWidget = SimpleListWidget;
 
 SimpleListWidget.prototype = {
   /**
    * Inserts an item in this container at the specified index.
    *
    * @param number aIndex
    *        The position in the container intended for this item.
-   * @param nsIDOMNode aContents
+   * @param Node aContents
    *        The node displayed in the container.
-   * @return nsIDOMNode
+   * @return Node
    *         The element associated with the displayed item.
    */
   insertItemAt: function(aIndex, aContents) {
     aContents.classList.add("simple-list-widget-item");
 
     let list = this._list;
     return list.insertBefore(aContents, list.childNodes[aIndex]);
   },
 
   /**
    * Returns the child node in this container situated at the specified index.
    *
    * @param number aIndex
    *        The position in the container intended for this item.
-   * @return nsIDOMNode
+   * @return Node
    *         The element associated with the displayed item.
    */
   getItemAtIndex: function(aIndex) {
     return this._list.childNodes[aIndex];
   },
 
   /**
    * Immediately removes the specified child node from this container.
    *
-   * @param nsIDOMNode aChild
+   * @param Node aChild
    *        The element associated with the displayed item.
    */
   removeChild: function(aChild) {
     this._list.removeChild(aChild);
 
     if (this._selectedItem == aChild) {
       this._selectedItem = null;
     }
@@ -95,25 +95,25 @@ SimpleListWidget.prototype = {
 
     parent.scrollTop = 0;
     parent.scrollLeft = 0;
     this._selectedItem = null;
   },
 
   /**
    * Gets the currently selected child node in this container.
-   * @return nsIDOMNode
+   * @return Node
    */
   get selectedItem() {
     return this._selectedItem;
   },
 
   /**
    * Sets the currently selected child node in this container.
-   * @param nsIDOMNode aChild
+   * @param Node aChild
    */
   set selectedItem(aChild) {
     let childNodes = this._list.childNodes;
 
     if (!aChild) {
       this._selectedItem = null;
     }
     for (let node of childNodes) {
@@ -156,17 +156,17 @@ SimpleListWidget.prototype = {
     if (aName == "emptyText") {
       this._removeEmptyText();
     }
   },
 
   /**
    * Ensures the specified element is visible.
    *
-   * @param nsIDOMNode aElement
+   * @param Node aElement
    *        The element to make visible.
    */
   ensureElementIsVisible: function(aElement) {
     if (!aElement) {
       return;
     }
 
     // Ensure the element is visible but not scrolled horizontally.
--- a/devtools/client/shared/widgets/TableWidget.js
+++ b/devtools/client/shared/widgets/TableWidget.js
@@ -38,17 +38,17 @@ Object.defineProperty(this, "EVENTS", {
   enumerable: true,
   writable: false
 });
 
 /**
  * A table widget with various features like resizble/toggleable columns,
  * sorting, keyboard navigation etc.
  *
- * @param {nsIDOMNode} node
+ * @param {Node} node
  *        The container element for the table widget.
  * @param {object} options
  *        - initialColumns: map of key vs display name for initial columns of
  *                          the table. See @setupColumns for more info.
  *        - uniqueId: the column which will be the unique identifier of each
  *                    entry in the table. Default: name.
  *        - wrapTextInElements: Don't ever use 'value' attribute on labels.
  *                              Default: false.
--- a/devtools/client/shared/widgets/TreeWidget.js
+++ b/devtools/client/shared/widgets/TreeWidget.js
@@ -8,17 +8,17 @@
 const HTML_NS = "http://www.w3.org/1999/xhtml";
 
 const EventEmitter = require("devtools/shared/event-emitter");
 const {KeyCodes} = require("devtools/client/shared/keycodes");
 
 /**
  * A tree widget with keyboard navigation and collapsable structure.
  *
- * @param {nsIDOMNode} node
+ * @param {Node} node
  *        The container element for the tree widget.
  * @param {Object} options
  *        - emptyText {string}: text to display when no entries in the table.
  *        - defaultType {string}: The default type of the tree items. For ex.
  *          'js'
  *        - sorted {boolean}: Defaults to true. If true, tree items are kept in
  *          lexical order. If false, items will be kept in insertion order.
  *        - contextMenuId {string}: ID of context menu to be displayed on
--- a/devtools/client/shared/widgets/VariablesView.jsm
+++ b/devtools/client/shared/widgets/VariablesView.jsm
@@ -49,17 +49,17 @@ this.EXPORTED_SYMBOLS = ["VariablesView"
  * Iterable via "for (let [id, scope] of instance) { }".
  * Requires the devtools common.css and debugger.css skin stylesheets.
  *
  * To allow replacing variable or property values in this view, provide an
  * "eval" function property. To allow replacing variable or property names,
  * provide a "switch" function. To handle deleting variables or properties,
  * provide a "delete" function.
  *
- * @param nsIDOMNode aParentNode
+ * @param Node aParentNode
  *        The parent node to hold this view.
  * @param object aFlags [optional]
  *        An object contaning initialization options for this view.
  *        e.g. { lazyEmpty: true, searchEnabled: true ... }
  */
 this.VariablesView = function VariablesView(aParentNode, aFlags = {}) {
   this._store = []; // Can't use a Map because Scope names needn't be unique.
   this._itemsByElement = new WeakMap();
@@ -627,17 +627,17 @@ VariablesView.prototype = {
   getScopeAtIndex: function(aIndex) {
     return this._store[aIndex];
   },
 
   /**
    * Recursively searches this container for the scope, variable or property
    * displayed by the specified node.
    *
-   * @param nsIDOMNode aNode
+   * @param Node aNode
    *        The node to search for.
    * @return Scope | Variable | Property
    *         The matched scope, variable or property, or null if nothing is found.
    */
   getItemForNode: function(aNode) {
     return this._itemsByElement.get(aNode);
   },
 
@@ -974,25 +974,25 @@ VariablesView.prototype = {
       this._parent.setAttribute("actions-first", "");
     } else {
       this._parent.removeAttribute("actions-first");
     }
   },
 
   /**
    * Gets the parent node holding this view.
-   * @return nsIDOMNode
+   * @return Node
    */
   get boxObject() {
     return this._list.boxObject;
   },
 
   /**
    * Gets the parent node holding this view.
-   * @return nsIDOMNode
+   * @return Node
    */
   get parentNode() {
     return this._parent;
   },
 
   /**
    * Gets the owner document holding this view.
    * @return nsIHTMLDocument
@@ -1376,17 +1376,17 @@ Scope.prototype = {
   get: function(aName) {
     return this._store.get(aName);
   },
 
   /**
    * Recursively searches for the variable or property in this container
    * displayed by the specified node.
    *
-   * @param nsIDOMNode aNode
+   * @param Node aNode
    *        The node to search for.
    * @return Variable | Property
    *         The matched variable or property, or null if nothing is found.
    */
   find: function(aNode) {
     for (let [, variable] of this._store) {
       let match;
       if (variable._target == aNode) {
@@ -1743,17 +1743,17 @@ Scope.prototype = {
    * @return string
    */
   get displayValueClassName() {
     return this._valueClassName;
   },
 
   /**
    * Gets the element associated with this item.
-   * @return nsIDOMNode
+   * @return Node
    */
   get target() {
     return this._target;
   },
 
   /**
    * Initializes this scope's id, view and binds event listeners.
    *
@@ -2044,17 +2044,17 @@ Scope.prototype = {
         parentView = topView;
       }
       return parentView;
     })());
   },
 
   /**
    * Gets the parent node holding this scope.
-   * @return nsIDOMNode
+   * @return Node
    */
   get parentNode() {
     return this.ownerView._list;
   },
 
   /**
    * Gets the owner document holding this scope.
    * @return nsIHTMLDocument
--- a/devtools/client/shared/widgets/view-helpers.js
+++ b/devtools/client/shared/widgets/view-helpers.js
@@ -90,17 +90,17 @@ exports.clearConditionalTimeout = clearC
 
 /**
  * Helpers for creating and messaging between UI components.
  */
 const ViewHelpers = exports.ViewHelpers = {
   /**
    * Convenience method, dispatching a custom event.
    *
-   * @param nsIDOMNode target
+   * @param Node target
    *        A custom target element to dispatch the event from.
    * @param string type
    *        The name of the event.
    * @param any detail
    *        The data passed when initializing the event.
    * @return boolean
    *         True if the event was cancelled or a registered handler
    *         called preventDefault.
@@ -118,34 +118,34 @@ const ViewHelpers = exports.ViewHelpers 
     return dispatcher.dispatchEvent(event);
   },
 
   /**
    * Helper delegating some of the DOM attribute methods of a node to a widget.
    *
    * @param object widget
    *        The widget to assign the methods to.
-   * @param nsIDOMNode node
+   * @param Node node
    *        A node to delegate the methods to.
    */
   delegateWidgetAttributeMethods: function(widget, node) {
     widget.getAttribute =
       widget.getAttribute || node.getAttribute.bind(node);
     widget.setAttribute =
       widget.setAttribute || node.setAttribute.bind(node);
     widget.removeAttribute =
       widget.removeAttribute || node.removeAttribute.bind(node);
   },
 
   /**
    * Helper delegating some of the DOM event methods of a node to a widget.
    *
    * @param object widget
    *        The widget to assign the methods to.
-   * @param nsIDOMNode node
+   * @param Node node
    *        A node to delegate the methods to.
    */
   delegateWidgetEventMethods: function(widget, node) {
     widget.addEventListener =
       widget.addEventListener || node.addEventListener.bind(node);
     widget.removeEventListener =
       widget.removeEventListener || node.removeEventListener.bind(node);
   },
@@ -210,17 +210,17 @@ const ViewHelpers = exports.ViewHelpers 
    * the side (right or left depending on the locale) or at the bottom.
    *
    * @param object flags
    *        An object containing some of the following properties:
    *        - visible: true if the pane should be shown, false to hide
    *        - animated: true to display an animation on toggle
    *        - delayed: true to wait a few cycles before toggle
    *        - callback: a function to invoke when the toggle finishes
-   * @param nsIDOMNode pane
+   * @param Node pane
    *        The element representing the pane to toggle.
    */
   togglePane: function(flags, pane) {
     // Make sure a pane is actually available first.
     if (!pane) {
       return;
     }
 
@@ -308,28 +308,28 @@ const ViewHelpers = exports.ViewHelpers 
       doToggle();
     }
   }
 };
 
 /**
  * A generic Item is used to describe children present in a Widget.
  *
- * This is basically a very thin wrapper around an nsIDOMNode, with a few
+ * This is basically a very thin wrapper around a Node, with a few
  * characteristics, like a `value` and an `attachment`.
  *
  * The characteristics are optional, and their meaning is entirely up to you.
  * - The `value` should be a string, passed as an argument.
  * - The `attachment` is any kind of primitive or object, passed as an argument.
  *
  * Iterable via "for (let childItem of parentItem) { }".
  *
  * @param object ownerView
  *        The owner view creating this item.
- * @param nsIDOMNode element
+ * @param Node element
  *        A prebuilt node to be wrapped.
  * @param string value
  *        A string identifying the node.
  * @param any attachment
  *        Some attached primitive/object.
  */
 function Item(ownerView, element, value, attachment) {
   this.ownerView = ownerView;
@@ -348,18 +348,18 @@ Item.prototype = {
   },
   get prebuiltNode() {
     return this._prebuiltNode;
   },
 
   /**
    * Immediately appends a child item to this item.
    *
-   * @param nsIDOMNode element
-   *        An nsIDOMNode representing the child element to append.
+   * @param Node element
+   *        A Node representing the child element to append.
    * @param object options [optional]
    *        Additional options or flags supported by this operation:
    *          - attachment: some attached primitive/object for the item
    *          - attributes: a batch of attributes set to the displayed element
    *          - finalize: function invoked when the child item is removed
    * @return Item
    *         The item associated with the displayed element.
    */
@@ -397,17 +397,17 @@ Item.prototype = {
     this._untangleItem(item);
   },
 
   /**
    * Entangles an item (model) with a displayed node element (view).
    *
    * @param Item item
    *        The item describing a target element.
-   * @param nsIDOMNode element
+   * @param Node element
    *        The element displaying the item.
    */
   _entangleItem: function(item, element) {
     this._itemsByElement.set(element, item);
     item._target = element;
   },
 
   /**
@@ -474,52 +474,52 @@ Item.prototype = {
  *   });
  *
  * See https://gist.github.com/victorporof/5749386 for more details.
  * The devtools/shared/widgets/SimpleListWidget.jsm is an implementation
  * example.
  *
  * Language:
  *   - An "item" is an instance of an Item.
- *   - An "element" or "node" is a nsIDOMNode.
+ *   - An "element" or "node" is a Node.
  *
  * The supplied widget can be any object implementing the following
  * methods:
- *   - function:nsIDOMNode insertItemAt(aIndex:number, aNode:nsIDOMNode,
+ *   - function:Node insertItemAt(aIndex:number, aNode:Node,
  *                                      aValue:string)
- *   - function:nsIDOMNode getItemAtIndex(aIndex:number)
- *   - function removeChild(aChild:nsIDOMNode)
+ *   - function:Node getItemAtIndex(aIndex:number)
+ *   - function removeChild(aChild:Node)
  *   - function removeAllItems()
- *   - get:nsIDOMNode selectedItem()
- *   - set selectedItem(aChild:nsIDOMNode)
+ *   - get:Node selectedItem()
+ *   - set selectedItem(aChild:Node)
  *   - function getAttribute(aName:string)
  *   - function setAttribute(aName:string, aValue:string)
  *   - function removeAttribute(aName:string)
  *   - function addEventListener(aName:string, aCallback:function,
  *                               aBubbleFlag:boolean)
  *   - function removeEventListener(aName:string, aCallback:function,
  *                                  aBubbleFlag:boolean)
  *
  * Optional methods that can be implemented by the widget:
- *   - function ensureElementIsVisible(aChild:nsIDOMNode)
+ *   - function ensureElementIsVisible(aChild:Node)
  *
  * Optional attributes that may be handled (when calling
  * get/set/removeAttribute):
  *   - "emptyText": label temporarily added when there are no items present
  *   - "headerText": label permanently added as a header
  *
  * For automagical keyboard and mouse accessibility, the widget should be an
  * event emitter with the following events:
  *   - "keyDown" -> (aName:string, aEvent:KeyboardEvent)
  *   - "mousePress" -> (aName:string, aEvent:MouseEvent)
  */
 const WidgetMethods = exports.WidgetMethods = {
   /**
    * Sets the element node or widget associated with this container.
-   * @param nsIDOMNode | object widget
+   * @param Node | object widget
    */
   set widget(widget) {
     this._widget = widget;
 
     // Can't use a WeakMap for _itemsByValue because keys are strings, and
     // can't use one for _itemsByElement either, since it needs to be iterable.
     this._itemsByValue = new Map();
     this._itemsByElement = new Map();
@@ -529,17 +529,17 @@ const WidgetMethods = exports.WidgetMeth
     if (ViewHelpers.isEventEmitter(widget)) {
       widget.on("keyDown", this._onWidgetKeyDown.bind(this));
       widget.on("mousePress", this._onWidgetMousePress.bind(this));
     }
   },
 
   /**
    * Gets the element node or widget associated with this container.
-   * @return nsIDOMNode | object
+   * @return Node | object
    */
   get widget() {
     return this._widget;
   },
 
   /**
    * Prepares an item to be added to this container. This allows, for example,
    * for a large number of items to be batched up before being sorted & added.
@@ -550,17 +550,17 @@ const WidgetMethods = exports.WidgetMeth
    * multiple items.
    *
    * By default, this container assumes that all the items should be displayed
    * sorted by their value. This can be overridden with the "index" flag,
    * specifying on which position should an item be appended. The "staged" and
    * "index" flags are mutually exclusive, meaning that all staged items
    * will always be appended.
    *
-   * @param nsIDOMNode element
+   * @param Node element
    *        A prebuilt node to be wrapped.
    * @param string value
    *        A string identifying the node.
    * @param object options [optional]
    *        Additional options or flags supported by this operation:
    *          - attachment: some attached primitive/object for the item
    *          - staged: true to stage the item to be appended later
    *          - index: specifies on which position should the item be appended
@@ -1164,17 +1164,17 @@ const WidgetMethods = exports.WidgetMeth
       return commandDispatcher;
     }
     return null;
   },
 
   /**
    * Gets the currently focused element in this container.
    *
-   * @return nsIDOMNode
+   * @return Node
    *         The focused element, or null if nothing is found.
    */
   get _focusedElement() {
     let commandDispatcher = this._commandDispatcher;
     if (commandDispatcher) {
       return commandDispatcher.focusedElement;
     }
     return null;
@@ -1202,17 +1202,17 @@ const WidgetMethods = exports.WidgetMeth
    */
   getItemByValue: function(value) {
     return this._itemsByValue.get(value);
   },
 
   /**
    * Gets the item in the container associated with the specified element.
    *
-   * @param nsIDOMNode element
+   * @param Node element
    *        The element used to identify the item.
    * @param object flags [optional]
    *        Additional options for showing the source. Supported options:
    *          - noSiblings: if siblings shouldn't be taken into consideration
    *                        when searching for the associated item.
    * @return Item
    *         The matched item, or null if nothing is found.
    */
@@ -1283,17 +1283,17 @@ const WidgetMethods = exports.WidgetMeth
    */
   indexOfItem: function(item) {
     return this._indexOfElement(item._target);
   },
 
   /**
    * Finds the index of an element in the container.
    *
-   * @param nsIDOMNode element
+   * @param Node element
    *        The element get the index for.
    * @return number
    *         The index of the matched element, or -1 if nothing is found.
    */
   _indexOfElement: function(element) {
     for (let i = 0; i < this._itemsByElement.size; i++) {
       if (this._widget.getItemAtIndex(i) == element) {
         return i;
@@ -1445,17 +1445,17 @@ const WidgetMethods = exports.WidgetMeth
     return item;
   },
 
   /**
    * Entangles an item (model) with a displayed node element (view).
    *
    * @param Item item
    *        The item describing a target element.
-   * @param nsIDOMNode element
+   * @param Node element
    *        The element displaying the item.
    */
   _entangleItem: function(item, element) {
     this._itemsByValue.set(item._value, item);
     this._itemsByElement.set(element, item);
     item._target = element;
   },
 
--- a/devtools/client/webconsole/utils.js
+++ b/devtools/client/webconsole/utils.js
@@ -85,19 +85,19 @@ var WebConsoleUtils = {
     }
 
     return temp;
   },
 
   /**
    * Copies certain style attributes from one element to another.
    *
-   * @param nsIDOMNode from
+   * @param Node from
    *        The target node.
-   * @param nsIDOMNode to
+   * @param Node to
    *        The destination node.
    */
   copyTextStyles: function(from, to) {
     let win = from.ownerDocument.defaultView;
     let style = win.getComputedStyle(from);
     to.style.fontFamily = style.fontFamily;
     to.style.fontSize = style.fontSize;
     to.style.fontWeight = style.fontWeight;
--- a/devtools/server/actors/highlighters/geometry-editor.js
+++ b/devtools/server/actors/highlighters/geometry-editor.js
@@ -114,17 +114,17 @@ function getOffsetParent(node) {
     dimension: {width, height}
   };
 }
 
 /**
  * Get the list of geometry properties that are actually set on the provided
  * node.
  *
- * @param {nsIDOMNode} node The node to analyze.
+ * @param {Node} node The node to analyze.
  * @return {Map} A map indexed by property name and where the value is an
  * object having the cssRule property.
  */
 function getDefinedGeometryProperties(node) {
   let props = new Map();
   if (!node) {
     return props;
   }
--- a/devtools/server/actors/highlighters/shapes.js
+++ b/devtools/server/actors/highlighters/shapes.js
@@ -2552,17 +2552,17 @@ class ShapesHighlighter extends AutoRefr
     }
 
     return ratio;
   }
 }
 
 /**
  * Get the "raw" (i.e. non-computed) shape definition on the given node.
- * @param {nsIDOMNode} node the node to analyze
+ * @param {Node} node the node to analyze
  * @param {String} property the CSS property for which a value should be retrieved.
  * @returns {String} the value of the given CSS property on the given node.
  */
 function getDefinedShapeProperties(node, property) {
   let prop = "";
   if (!node) {
     return prop;
   }
--- a/devtools/server/actors/highlighters/utils/markup.js
+++ b/devtools/server/actors/highlighters/utils/markup.js
@@ -1,15 +1,15 @@
 /* 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/. */
 
 "use strict";
 
-const { Ci, Cu, Cr } = require("chrome");
+const { Cu, Cr } = require("chrome");
 const { getCurrentZoom, getWindowDimensions, getViewportDimensions,
   getRootBindingParent, loadSheet } = require("devtools/shared/layout/utils");
 const EventEmitter = require("devtools/shared/event-emitter");
 const InspectorUtils = require("InspectorUtils");
 
 const lazyContainer = {};
 
 loader.lazyRequireGetter(lazyContainer, "CssLogic",
@@ -99,17 +99,17 @@ exports.isXUL = isXUL;
 
 /**
  * Returns true if a DOM node is "valid", where "valid" means that the node isn't a dead
  * object wrapper, is still attached to a document, and is of a given type.
  * @param {DOMNode} node
  * @param {Number} nodeType Optional, defaults to ELEMENT_NODE
  * @return {Boolean}
  */
-function isNodeValid(node, nodeType = Ci.nsIDOMNode.ELEMENT_NODE) {
+function isNodeValid(node, nodeType = Node.ELEMENT_NODE) {
   // Is it still alive?
   if (!node || Cu.isDeadWrapper(node)) {
     return false;
   }
 
   // Is it of the right type?
   if (node.nodeType !== nodeType) {
     return false;
--- a/devtools/server/actors/inspector/node.js
+++ b/devtools/server/actors/inspector/node.js
@@ -1,15 +1,15 @@
 /* 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/. */
 
 "use strict";
 
-const {Ci, Cu} = require("chrome");
+const {Cu} = require("chrome");
 
 const protocol = require("devtools/shared/protocol");
 const {nodeSpec, nodeListSpec} = require("devtools/shared/specs/node");
 
 const InspectorUtils = require("InspectorUtils");
 
 loader.lazyRequireGetter(this, "colorUtils", "devtools/shared/css/color", true);
 
@@ -172,23 +172,23 @@ const NodeActor = protocol.ActorClassWit
     return this.rawNode.nodeName === "_moz_generated_content_before";
   },
 
   get isAfterPseudoElement() {
     return this.rawNode.nodeName === "_moz_generated_content_after";
   },
 
   get isShadowRoot() {
-    let isFragment = this.rawNode.nodeType === Ci.nsIDOMNode.DOCUMENT_FRAGMENT_NODE;
+    let isFragment = this.rawNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
     return isFragment && !!this.rawNode.host;
   },
 
   get isShadowHost() {
     let shadowRoot = this.rawNode.shadowRoot;
-    return shadowRoot && shadowRoot.nodeType === Ci.nsIDOMNode.DOCUMENT_FRAGMENT_NODE;
+    return shadowRoot && shadowRoot.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
   },
 
   get isDirectShadowHostChild() {
     // Pseudo elements are always part of the anonymous tree.
     if (this.isBeforePseudoElement || this.isAfterPseudoElement) {
       return false;
     }
 
@@ -202,17 +202,17 @@ const NodeActor = protocol.ActorClassWit
     // For pseudo elements, childNodes.length returns 1, but the walker
     // will return 0.
     if (this.isBeforePseudoElement || this.isAfterPseudoElement) {
       return 0;
     }
 
     let rawNode = this.rawNode;
     let numChildren = rawNode.childNodes.length;
-    let hasAnonChildren = rawNode.nodeType === Ci.nsIDOMNode.ELEMENT_NODE &&
+    let hasAnonChildren = rawNode.nodeType === Node.ELEMENT_NODE &&
                           rawNode.ownerDocument.getAnonymousNodes(rawNode);
 
     let hasContentDocument = rawNode.contentDocument;
     let hasSVGDocument = rawNode.getSVGDocument && rawNode.getSVGDocument();
     if (numChildren === 0 && (hasContentDocument || hasSVGDocument)) {
       // This might be an iframe with virtual children.
       numChildren = 1;
     }
@@ -234,17 +234,17 @@ const NodeActor = protocol.ActorClassWit
   },
 
   /**
    * Returns the computed display style property value of the node.
    */
   get displayType() {
     // Consider all non-element nodes as displayed.
     if (InspectorActorUtils.isNodeDead(this) ||
-        this.rawNode.nodeType !== Ci.nsIDOMNode.ELEMENT_NODE ||
+        this.rawNode.nodeType !== Node.ELEMENT_NODE ||
         this.isAfterPseudoElement ||
         this.isBeforePseudoElement) {
       return null;
     }
 
     let style = this.computedStyle;
     if (!style) {
       return null;
@@ -301,17 +301,17 @@ const NodeActor = protocol.ActorClassWit
     }
 
     return [...this.rawNode.attributes].map(attr => {
       return {namespace: attr.namespace, name: attr.name, value: attr.value };
     });
   },
 
   writePseudoClassLocks: function() {
-    if (this.rawNode.nodeType !== Ci.nsIDOMNode.ELEMENT_NODE) {
+    if (this.rawNode.nodeType !== Node.ELEMENT_NODE) {
       return undefined;
     }
     let ret = undefined;
     for (let pseudo of PSEUDO_CLASSES) {
       if (InspectorUtils.hasPseudoClassLock(this.rawNode, pseudo)) {
         ret = ret || [];
         ret.push(pseudo);
       }
--- a/devtools/server/actors/inspector/utils.js
+++ b/devtools/server/actors/inspector/utils.js
@@ -1,15 +1,15 @@
 /* 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/. */
 
 "use strict";
 
-const {Ci, Cu} = require("chrome");
+const {Cu} = require("chrome");
 
 loader.lazyRequireGetter(this, "AsyncUtils", "devtools/shared/async-utils");
 loader.lazyRequireGetter(this, "flags", "devtools/shared/flags");
 loader.lazyRequireGetter(this, "DevToolsUtils", "devtools/shared/DevToolsUtils");
 loader.lazyRequireGetter(this, "nodeFilterConstants", "devtools/shared/dom-node-filter-constants");
 
 loader.lazyRequireGetter(this, "isNativeAnonymous", "devtools/shared/layout/utils", true);
 loader.lazyRequireGetter(this, "isXBLAnonymous", "devtools/shared/layout/utils", true);
@@ -36,17 +36,17 @@ const getNodeDisplayName = function(rawN
   return (rawNode.prefix ? rawNode.prefix + ":" : "") + rawNode.localName;
 };
 
 function nodeDocument(node) {
   if (Cu.isDeadWrapper(node)) {
     return null;
   }
   return node.ownerDocument ||
-         (node.nodeType == Ci.nsIDOMNode.DOCUMENT_NODE ? node : null);
+         (node.nodeType == Node.DOCUMENT_NODE ? node : null);
 }
 
 function isNodeDead(node) {
   return !node || !node.rawNode || Cu.isDeadWrapper(node.rawNode);
 }
 
 function isInXULDocument(el) {
   let doc = nodeDocument(el);
@@ -101,17 +101,17 @@ function allAnonymousContentTreeWalkerFi
 }
 
 /**
  * Is the given node a text node composed of whitespace only?
  * @param {DOMNode} node
  * @return {Boolean}
  */
 function isWhitespaceTextNode(node) {
-  return node.nodeType == Ci.nsIDOMNode.TEXT_NODE && !/[^\s]/.exec(node.nodeValue);
+  return node.nodeType == Node.TEXT_NODE && !/[^\s]/.exec(node.nodeValue);
 }
 
 /**
  * Does the given node have non-0 width and height?
  * @param {DOMNode} node
  * @return {Boolean}
  */
 function nodeHasSize(node) {
--- a/devtools/server/actors/inspector/walker.js
+++ b/devtools/server/actors/inspector/walker.js
@@ -298,17 +298,17 @@ var WalkerActor = protocol.ActorClassWit
 
     actor = new NodeActor(this, node);
 
     // Add the node actor as a child of this walker actor, assigning
     // it an actorID.
     this.manage(actor);
     this._refMap.set(node, actor);
 
-    if (node.nodeType === Ci.nsIDOMNode.DOCUMENT_NODE) {
+    if (node.nodeType === Node.DOCUMENT_NODE) {
       actor.watchDocument(node, this.onMutations);
     }
 
     if (actor.isShadowRoot) {
       actor.watchDocument(node.ownerDocument, this.onMutations);
       actor.watchSlotchange(this.onSlotchange);
     }
 
@@ -450,32 +450,32 @@ var WalkerActor = protocol.ActorClassWit
    * content small enough to be inlined, return that child's NodeActor.
    *
    * @param NodeActor node
    */
   inlineTextChild: function(node) {
     // Quick checks to prevent creating a new walker if possible.
     if (node.isBeforePseudoElement ||
         node.isAfterPseudoElement ||
-        node.rawNode.nodeType != Ci.nsIDOMNode.ELEMENT_NODE ||
+        node.rawNode.nodeType != Node.ELEMENT_NODE ||
         node.rawNode.children.length > 0) {
       return undefined;
     }
 
     let walker = node.isDirectShadowHostChild ? this.getNonAnonymousWalker(node.rawNode)
                                               : this.getDocumentWalker(node.rawNode);
     let firstChild = walker.firstChild();
 
     // Bail out if:
     // - more than one child
     // - unique child is not a text node
     // - unique child is a text node, but is too long to be inlined
     if (!firstChild ||
         walker.nextSibling() ||
-        firstChild.nodeType !== Ci.nsIDOMNode.TEXT_NODE ||
+        firstChild.nodeType !== Node.TEXT_NODE ||
         firstChild.nodeValue.length > gValueSummaryLength
         ) {
       return undefined;
     }
 
     return this._ref(firstChild);
   },
 
@@ -1094,17 +1094,17 @@ var WalkerActor = protocol.ActorClassWit
     this.queueMutation({
       target: node.actorID,
       type: "pseudoClassLock",
       pseudoClassLocks: node.writePseudoClassLocks()
     });
   },
 
   _addPseudoClassLock: function(node, pseudo, enabled) {
-    if (node.rawNode.nodeType !== Ci.nsIDOMNode.ELEMENT_NODE) {
+    if (node.rawNode.nodeType !== Node.ELEMENT_NODE) {
       return false;
     }
     InspectorUtils.addPseudoClassLock(node.rawNode, pseudo, enabled);
     this._activePseudoClassLocks.add(node);
     this._queuePseudoClassMutation(node);
     return true;
   },
 
@@ -1163,17 +1163,17 @@ var WalkerActor = protocol.ActorClassWit
     let cur;
     while ((cur = walker.parentNode())) {
       let curNode = this._ref(cur);
       this._removePseudoClassLock(curNode, pseudo);
     }
   },
 
   _removePseudoClassLock: function(node, pseudo) {
-    if (node.rawNode.nodeType != Ci.nsIDOMNode.ELEMENT_NODE) {
+    if (node.rawNode.nodeType != Node.ELEMENT_NODE) {
       return false;
     }
     InspectorUtils.removePseudoClassLock(node.rawNode, pseudo);
     if (!node.writePseudoClassLocks()) {
       this._activePseudoClassLocks.delete(node);
     }
 
     this._queuePseudoClassMutation(node);
@@ -1380,17 +1380,17 @@ var WalkerActor = protocol.ActorClassWit
    * Test whether a node is a document or a document element.
    *
    * @param {NodeActor} node The node to remove.
    * @return {boolean} True if the node is a document or a document element.
    */
   isDocumentOrDocumentElementNode: function(node) {
     return ((node.rawNode.ownerDocument &&
       node.rawNode.ownerDocument.documentElement === this.rawNode) ||
-      node.rawNode.nodeType === Ci.nsIDOMNode.DOCUMENT_NODE);
+      node.rawNode.nodeType === Node.DOCUMENT_NODE);
   },
 
   /**
    * Removes a node from its parent node.
    *
    * @param {NodeActor} node The node to remove.
    * @returns The node's nextSibling before it was removed.
    */
@@ -1832,32 +1832,32 @@ var WalkerActor = protocol.ActorClassWit
 
     // Need to force a release of this node, because those nodes can't
     // be accessed anymore.
     this.releaseNode(documentActor, { force: true });
   },
 
   /**
    * Check if a node is attached to the DOM tree of the current page.
-   * @param {nsIDomNode} rawNode
+   * @param {Node} rawNode
    * @return {Boolean} false if the node is removed from the tree or within a
    * document fragment
    */
   _isInDOMTree: function(rawNode) {
     let walker = this.getDocumentWalker(rawNode);
     let current = walker.currentNode;
 
     // Reaching the top of tree
     while (walker.parentNode()) {
       current = walker.currentNode;
     }
 
     // The top of the tree is a fragment or is not rootDoc, hence rawNode isn't
     // attached
-    if (current.nodeType === Ci.nsIDOMNode.DOCUMENT_FRAGMENT_NODE ||
+    if (current.nodeType === Node.DOCUMENT_FRAGMENT_NODE ||
         current !== this.rootDoc) {
       return false;
     }
 
     // Otherwise the top of the tree is rootDoc, hence rawNode is in rootDoc
     return true;
   },
 
--- a/devtools/server/actors/object/previewers.js
+++ b/devtools/server/actors/object/previewers.js
@@ -597,17 +597,17 @@ previewers.Object = [
       entries.push([prop, hooks.createValueGrip(value)]);
     }
 
     return true;
   },
 
   function DOMNode({obj, hooks}, grip, rawObj) {
     if (isWorker || obj.class == "Object" || !rawObj ||
-        !(rawObj instanceof Ci.nsIDOMNode)) {
+        !Node.isInstance(rawObj)) {
       return false;
     }
 
     let preview = grip.preview = {
       kind: "DOMNode",
       nodeType: rawObj.nodeType,
       nodeName: rawObj.nodeName,
       isConnected: rawObj.isConnected === true,
--- a/devtools/server/actors/styles.js
+++ b/devtools/server/actors/styles.js
@@ -1,15 +1,14 @@
 /* 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/. */
 
 "use strict";
 
-const {Ci} = require("chrome");
 const Services = require("Services");
 const protocol = require("devtools/shared/protocol");
 const {LongStringActor} = require("devtools/server/actors/string");
 const InspectorUtils = require("InspectorUtils");
 
 // This will also add the "stylesheet" actor type for protocol.js to recognize
 
 const {pageStyleSpec, styleRuleSpec, ELEMENT_STYLE} = require("devtools/shared/specs/styles");
@@ -646,17 +645,17 @@ var PageStyleActor = protocol.ActorClass
    * @param {CSSStyleRule} filterRule the rule to filter for
    * @return {Array} array of zero or one elements; if one, the element
    *                 is the entry as returned by _getAllElementRules.
    */
   findEntryMatchingRule: function(node, filterRule) {
     const options = {matchedSelectors: true, inherited: true};
     let entries = [];
     let parent = this.walker.parentNode(node);
-    while (parent && parent.rawNode.nodeType != Ci.nsIDOMNode.DOCUMENT_NODE) {
+    while (parent && parent.rawNode.nodeType != Node.DOCUMENT_NODE) {
       entries = entries.concat(this._getAllElementRules(parent, parent,
                                                         options));
       parent = this.walker.parentNode(parent);
     }
 
     return entries.filter(entry => entry.rule.rawRule === filterRule);
   },
 
@@ -680,17 +679,17 @@ var PageStyleActor = protocol.ActorClass
    *   rule is fetched.
    * @returns Object containing the list of rule entries, rule actors and
    *   stylesheet actors that applies to the given node and its associated
    *   rules.
    */
   getAppliedProps: function(node, entries, options) {
     if (options.inherited) {
       let parent = this.walker.parentNode(node);
-      while (parent && parent.rawNode.nodeType != Ci.nsIDOMNode.DOCUMENT_NODE) {
+      while (parent && parent.rawNode.nodeType != Node.DOCUMENT_NODE) {
         entries = entries.concat(this._getAllElementRules(parent, parent,
                                                           options));
         parent = this.walker.parentNode(parent);
       }
     }
 
     if (options.matchedSelectors) {
       for (let entry of entries) {
--- a/devtools/server/actors/webconsole/utils.js
+++ b/devtools/server/actors/webconsole/utils.js
@@ -299,17 +299,17 @@ exports.WebConsoleCommands = WebConsoleC
   *   http://getfirebug.com/wiki/index.php/Command_Line_API
  */
 
 /**
  * Find a node by ID.
  *
  * @param string id
  *        The ID of the element you want.
- * @return nsIDOMNode or null
+ * @return Node or null
  *         The result of calling document.querySelector(selector).
  */
 WebConsoleCommands._registerOriginal("$", function(owner, selector) {
   try {
     return owner.window.document.querySelector(selector);
   } catch (err) {
     // Throw an error like `err` but that belongs to `owner.window`.
     throw new owner.window.DOMException(err.message, err.name);
@@ -354,19 +354,19 @@ WebConsoleCommands._registerOriginal("$_
   }
 });
 
 /**
  * Runs an xPath query and returns all matched nodes.
  *
  * @param string xPath
  *        xPath search query to execute.
- * @param [optional] nsIDOMNode context
+ * @param [optional] Node context
  *        Context to run the xPath query on. Uses window.document if not set.
- * @return array of nsIDOMNode
+ * @return array of Node
  */
 WebConsoleCommands._registerOriginal("$x", function(owner, xPath, context) {
   let nodes = new owner.window.Array();
 
   // Not waiving Xrays, since we want the original Document.evaluate function,
   // instead of anything that's been redefined.
   let doc = owner.window.document;
   context = context || doc;
--- a/devtools/server/tests/mochitest/test_inspector-changevalue.html
+++ b/devtools/server/tests/mochitest/test_inspector-changevalue.html
@@ -37,17 +37,17 @@ addTest(function setup() {
 addTest(function testChangeValue() {
   let contentNode = gInspectee.querySelector("#a").firstChild;
   let nodeFront;
   promiseDone(gWalker.querySelector(gWalker.rootNode, "#a").then(front => {
     // Get the text child
     return gWalker.children(front, { maxNodes: 1 });
   }).then(children => {
     nodeFront = children.nodes[0];
-    is(nodeFront.nodeType, Ci.nsIDOMNode.TEXT_NODE);
+    is(nodeFront.nodeType, Node.TEXT_NODE);
     return nodeFront.setNodeValue("newvalue");
   }).then(() => {
     // We're only going to test that the change hit the document.
     // There are other tests that make sure changes are propagated
     // to the client.
     is(contentNode.nodeValue, "newvalue", "Node should have a new value.");
   }).then(runNextTest));
 });
--- a/devtools/server/tests/mochitest/test_inspector-remove.html
+++ b/devtools/server/tests/mochitest/test_inspector-remove.html
@@ -23,17 +23,17 @@ let gClient = null;
 let gInspectee = null;
 
 function assertOwnership() {
   return assertOwnershipTrees(gWalker);
 }
 
 function ignoreNode(node) {
   // Duplicate the walker logic to skip blank nodes...
-  return node.nodeType === Ci.nsIDOMNode.TEXT_NODE &&
+  return node.nodeType === Node.TEXT_NODE &&
     !/[^\s]/.test(node.nodeValue);
 }
 
 addTest(function setup() {
   let url = document.getElementById("inspectorContent").href;
   attachURL(url, function(err, client, tab, doc) {
     gInspectee = doc;
     let {InspectorFront} = require("devtools/shared/fronts/inspector");
--- a/devtools/shared/builtin-modules.js
+++ b/devtools/shared/builtin-modules.js
@@ -34,16 +34,17 @@ const {
   CSSRule,
   DOMParser,
   Element,
   Event,
   FileReader,
   FormData,
   indexedDB,
   InspectorUtils,
+  Node,
   TextDecoder,
   TextEncoder,
   URL,
   XMLHttpRequest,
 } = Cu.Sandbox(CC("@mozilla.org/systemprincipal;1", "nsIPrincipal")(), {
   wantGlobalProperties: [
     "atob",
     "btoa",
@@ -51,19 +52,20 @@ const {
     "CSS",
     "CSSRule",
     "DOMParser",
     "Element",
     "Event",
     "FileReader",
     "FormData",
     "indexedDB",
+    "InspectorUtils",
+    "Node",
     "TextDecoder",
     "TextEncoder",
-    "InspectorUtils",
     "URL",
     "XMLHttpRequest",
   ]
 });
 
 /**
  * Defines a getter on a specified object that will be created upon first use.
  *
@@ -276,17 +278,17 @@ exports.globals = {
   loader: {
     lazyGetter: defineLazyGetter,
     lazyImporter: defineLazyModuleGetter,
     lazyServiceGetter: defineLazyServiceGetter,
     lazyRequireGetter: lazyRequireGetter,
     // Defined by Loader.jsm
     id: null
   },
-  Node: Ci.nsIDOMNode,
+  Node,
   reportError: Cu.reportError,
   StructuredCloneHolder,
   TextDecoder,
   TextEncoder,
   URL,
   XMLHttpRequest,
 };
 // DevTools loader copy globals property descriptors on each module global
--- a/devtools/shared/fronts/node.js
+++ b/devtools/shared/fronts/node.js
@@ -221,17 +221,17 @@ const NodeFront = FrontClassWithSpec(nod
       this._form.nodeValue = change.newValue;
     } else if (change.type === "pseudoClassLock") {
       this._form.pseudoClassLocks = change.pseudoClassLocks;
     } else if (change.type === "events") {
       this._form.hasEventListeners = change.hasEventListeners;
     }
   },
 
-  // Some accessors to make NodeFront feel more like an nsIDOMNode
+  // Some accessors to make NodeFront feel more like a Node
 
   get id() {
     return this.getAttribute("id");
   },
 
   get nodeType() {
     return this._form.nodeType;
   },
@@ -448,17 +448,17 @@ const NodeFront = FrontClassWithSpec(nod
    * This will, one day, be removed. External code should
    * not need to know if the target is remote or not.
    */
   isLocalToBeDeprecated: function() {
     return !!this.conn._transport._serverConnection;
   },
 
   /**
-   * Get an nsIDOMNode for the given node front.  This only works locally,
+   * Get a Node for the given node front.  This only works locally,
    * and is only intended as a stopgap during the transition to the remote
    * protocol.  If you depend on this you're likely to break soon.
    */
   rawNode: function(rawNode) {
     if (!this.isLocalToBeDeprecated()) {
       console.warn("Tried to use rawNode on a remote connection.");
       return null;
     }
--- a/devtools/shared/layout/utils.js
+++ b/devtools/shared/layout/utils.js
@@ -669,17 +669,17 @@ exports.getViewportDimensions = getViewp
  * Return the default view for a given node, where node can be:
  * - a DOM node
  * - the document node
  * - the window itself
  * @param {DOMNode|DOMWindow|DOMDocument} node The node to get the window for.
  * @return {DOMWindow}
  */
 function getWindowFor(node) {
-  if (node instanceof Ci.nsIDOMNode) {
+  if (Node.isInstance(node)) {
     if (node.nodeType === node.DOCUMENT_NODE) {
       return node.defaultView;
     }
     return node.ownerDocument.defaultView;
   } else if (node instanceof Ci.nsIDOMWindow) {
     return node;
   }
   return null;
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -76,17 +76,16 @@
 #include "nsIContentSecurityPolicy.h"
 #include "nsIContentViewer.h"
 #include "nsIController.h"
 #include "nsICookieService.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIDocument.h"
 #include "nsIDocumentLoaderFactory.h"
-#include "nsIDOMNode.h"
 #include "nsIDOMStorage.h"
 #include "nsIDOMWindow.h"
 #include "nsIEditingSession.h"
 #include "nsIExternalProtocolService.h"
 #include "nsIFormPOSTActionChannel.h"
 #include "nsIFrame.h"
 #include "nsIGlobalHistory2.h"
 #include "nsIGlobalObject.h"
@@ -13380,20 +13379,19 @@ nsDocShell::OnLinkClick(nsIContent* aCon
   }
 
   nsresult rv = NS_ERROR_FAILURE;
   nsAutoString target;
 
   nsCOMPtr<nsIWebBrowserChrome3> browserChrome3 = do_GetInterface(mTreeOwner);
   bool noOpenerImplied = false;
   if (browserChrome3) {
-    nsCOMPtr<nsIDOMNode> linkNode = do_QueryInterface(aContent);
     nsAutoString oldTarget(aTargetSpec);
     rv = browserChrome3->OnBeforeLinkTraversal(oldTarget, aURI,
-                                               linkNode, mIsAppTab, target);
+                                               aContent, mIsAppTab, target);
     if (!oldTarget.Equals(target)) {
       noOpenerImplied = true;
     }
   }
 
   if (NS_FAILED(rv)) {
     target = aTargetSpec;
   }
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -75,17 +75,16 @@ typedef uint32_t ScreenOrientationIntern
 } // namespace dom
 } // namespace mozilla
 
 class nsICommandManager;
 class nsIContentViewer;
 class nsIController;
 class nsIDocShellTreeOwner;
 class nsIDocument;
-class nsIDOMNode;
 class nsIGlobalHistory2;
 class nsIHttpChannel;
 class nsIMutableArray;
 class nsIPrompt;
 class nsIScrollableFrame;
 class nsISecureBrowserUI;
 class nsISHistory;
 class nsIStringBundle;
--- a/docshell/base/nsDocShellTreeOwner.cpp
+++ b/docshell/base/nsDocShellTreeOwner.cpp
@@ -20,17 +20,17 @@
 #include "nsReadableUtils.h"
 #include "nsUnicharUtils.h"
 #include "nsISimpleEnumerator.h"
 #include "mozilla/LookAndFeel.h"
 
 // Interfaces needed to be included
 #include "nsPresContext.h"
 #include "nsITooltipListener.h"
-#include "nsIDOMNode.h"
+#include "nsINode.h"
 #include "Link.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/MouseEvent.h"
 #include "mozilla/dom/SVGTitleElement.h"
 #include "nsIFormControl.h"
 #include "nsIImageLoadingContent.h"
 #include "nsIWebNavigation.h"
 #include "nsIPresShell.h"
--- a/docshell/base/nsDocShellTreeOwner.h
+++ b/docshell/base/nsDocShellTreeOwner.h
@@ -194,12 +194,12 @@ private:
 
   // The node hovered over that fired the timer. This may turn into the node
   // that triggered the tooltip, but only if the timer ever gets around to
   // firing. This is a strong reference, because the tooltip content can be
   // destroyed while we're waiting for the tooltip to pup up, and we need to
   // detect that. It's set only when the tooltip timer is created and launched.
   // The timer must either fire or be cancelled (or possibly released?), and we
   // release this reference in each of those cases. So we don't leak.
-  nsCOMPtr<nsIDOMNode> mPossibleTooltipNode;
+  nsCOMPtr<nsINode> mPossibleTooltipNode;
 };
 
 #endif /* nsDocShellTreeOwner_h__ */
--- a/docshell/base/nsIContentViewer.idl
+++ b/docshell/base/nsIContentViewer.idl
@@ -1,20 +1,19 @@
 /* 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 nsIDocShell;
-interface nsIDOMNode;
 interface nsISHEntry;
 interface nsIPrintSettings;
 webidl Document;
-
+webidl Node;
 
 %{ C++
 #include "nsTArray.h"
 #include "nsRect.h"
 
 class nsIWidget;
 class nsIPresShell;
 class nsPresContext;
@@ -229,17 +228,17 @@ interface nsIContentViewer : nsISupports
   [noscript,notxpcom,nostdcall] nsViewPtr findContainerView();
   /**
    * Set collector for navigation timing data (load, unload events).
    */
   [noscript,notxpcom,nostdcall] void setNavigationTiming(in nsDOMNavigationTimingPtr aTiming);
   /*
   Scrolls to a given DOM content node. 
   */
-  void scrollToNode(in nsIDOMNode node);
+  void scrollToNode(in Node node);
 
   /** The amount by which to scale all text. Default is 1.0. */
   attribute float textZoom;
 
   /** The actual text zoom in effect, as modified by the system font scale. */
   readonly attribute float effectiveTextZoom;
 
   /** The amount by which to scale all lengths. Default is 1.0. */
--- a/docshell/base/nsIContentViewerEdit.idl
+++ b/docshell/base/nsIContentViewerEdit.idl
@@ -1,17 +1,17 @@
 /* -*- Mode: IDL; tab-width: 4; 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 nsIDOMNode;
+webidl Node;
 
 [scriptable, uuid(35BE2D7E-F29B-48EC-BF7E-80A30A724DE3)]
 interface nsIContentViewerEdit : nsISupports
 {
 	void clearSelection();
 	void selectAll();
 
 	void copySelection();
@@ -27,10 +27,10 @@ interface nsIContentViewerEdit : nsISupp
 	void copyImage(in long aCopyFlags);
 	readonly attribute boolean inImage;
 
 	AString getContents(in string aMimeType, in boolean aSelectionOnly);
 	readonly attribute boolean canGetContents;
 
 	// Set the node that will be the subject of the editing commands above.
 	// Usually this will be the node that was context-clicked.
-	void setCommandNode(in nsIDOMNode aNode);
+	void setCommandNode(in Node aNode);
 };
--- a/docshell/base/nsITooltipTextProvider.idl
+++ b/docshell/base/nsITooltipTextProvider.idl
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 4; 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 nsIDOMNode;
+webidl Node;
 
 /**
  * An interface implemented by a tooltip text provider service. This
  * service is called to discover what tooltip text is associated
  * with the node that the pointer is positioned over.
  *
  * Embedders may implement and register their own tooltip text provider
  * service if they wish to provide different tooltip text. 
@@ -19,26 +19,26 @@ interface nsIDOMNode;
  * attribute of the node or a containing parent.
  *
  * @note
  * The tooltip text provider service is registered with the contract
  * defined in NS_TOOLTIPTEXTPROVIDER_CONTRACTID.
  *
  * @see nsITooltipListener
  * @see nsIComponentManager
- * @see nsIDOMNode
+ * @see Node
  */
 [scriptable, uuid(b128a1e6-44f3-4331-8fbe-5af360ff21ee)]
 interface nsITooltipTextProvider : nsISupports
 {
     /**
      * Called to obtain the tooltip text for a node.
      *
      * @arg aNode      The node to obtain the text from.
      * @arg aText      The tooltip text.
      * @arg aDirection The text direction (ltr or rtl) to use
      *
      * @return <CODE>PR_TRUE</CODE> if tooltip text is associated
      *         with the node and was returned in the aText argument;
      *         <CODE>PR_FALSE</CODE> otherwise.
      */
-    boolean getNodeText(in nsIDOMNode aNode, out wstring aText, out wstring aDirection);
+    boolean getNodeText(in Node aNode, out wstring aText, out wstring aDirection);
 };
--- a/dom/base/Attr.cpp
+++ b/dom/base/Attr.cpp
@@ -94,18 +94,17 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_
 
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(Attr)
   return tmp->HasKnownLiveWrapper();
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
 
 // QueryInterface implementation for Attr
 NS_INTERFACE_TABLE_HEAD(Attr)
   NS_WRAPPERCACHE_INTERFACE_TABLE_ENTRY
-  NS_INTERFACE_TABLE(Attr, nsINode, nsIAttribute, nsIDOMNode,
-                     EventTarget)
+  NS_INTERFACE_TABLE(Attr, nsINode, nsIAttribute, EventTarget)
   NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(Attr)
   NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
                                  new nsNodeSupportsWeakRefTearoff(this))
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(Attr)
 NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE(Attr,
                                                    nsNodeUtils::LastRelease(this))
--- a/dom/base/Attr.h
+++ b/dom/base/Attr.h
@@ -8,32 +8,30 @@
  * Implementation of DOM Core's Attr node.
  */
 
 #ifndef mozilla_dom_Attr_h
 #define mozilla_dom_Attr_h
 
 #include "mozilla/Attributes.h"
 #include "nsIAttribute.h"
-#include "nsIDOMNode.h"
 #include "nsString.h"
 #include "nsCOMPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsStubMutationObserver.h"
 
 class nsIDocument;
 
 namespace mozilla {
 class EventChainPreVisitor;
 namespace dom {
 
 // Attribute helper class used to wrap up an attribute with a dom
 // object that implements the DOM Attr interface.
-class Attr final : public nsIAttribute,
-                   public nsIDOMNode
+class Attr final : public nsIAttribute
 {
   virtual ~Attr() {}
 
 public:
   Attr(nsDOMAttributeMap* aAttrMap,
        already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
        const nsAString& aValue);
 
@@ -74,18 +72,16 @@ public:
   virtual already_AddRefed<nsIURI> GetBaseURI(bool aTryUseXHRDocBaseURI = false) const override;
 
   static void Initialize();
   static void Shutdown();
 
   NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Attr,
                                                                    nsIAttribute)
 
-  virtual nsIDOMNode* AsDOMNode() override { return this; }
-
   // WebIDL
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   void GetName(nsAString& aName);
   void GetValue(nsAString& aValue);
 
   void SetValue(const nsAString& aValue, nsIPrincipal* aTriggeringPrincipal, ErrorResult& aRv);
   void SetValue(const nsAString& aValue, ErrorResult& aRv);
--- a/dom/base/Comment.cpp
+++ b/dom/base/Comment.cpp
@@ -18,18 +18,16 @@ using namespace dom;
 
 namespace mozilla {
 namespace dom {
 
 Comment::~Comment()
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED(Comment, CharacterData, nsIDOMNode)
-
 already_AddRefed<CharacterData>
 Comment::CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo, bool aCloneText) const
 {
   RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo;
   RefPtr<Comment> it = new Comment(ni.forget());
   if (aCloneText) {
     it->mText = mText;
   }
--- a/dom/base/Comment.h
+++ b/dom/base/Comment.h
@@ -4,23 +4,21 @@
  * 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 "mozilla/dom/CharacterData.h"
-#include "nsIDOMNode.h"
 
 namespace mozilla {
 namespace dom {
 
-class Comment final : public CharacterData,
-                      public nsIDOMNode
+class Comment final : public CharacterData
 {
 private:
   void Init()
   {
     MOZ_ASSERT(mNodeInfo->NodeType() == COMMENT_NODE,
                "Bad NodeType in aNodeInfo");
   }
 
@@ -37,23 +35,22 @@ public:
     : CharacterData(aNodeInfoManager->GetCommentNodeInfo())
   {
     Init();
   }
 
   NS_IMPL_FROMNODE_HELPER(Comment, IsComment())
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(Comment, CharacterData)
 
   virtual already_AddRefed<CharacterData>
     CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
                   bool aCloneText) const override;
 
-  virtual nsIDOMNode* AsDOMNode() override { return this; }
 #ifdef DEBUG
   virtual void List(FILE* out, int32_t aIndent) const override;
   virtual void DumpContent(FILE* out = stdout, int32_t aIndent = 0,
                            bool aDumpAll = true) const override
   {
     return;
   }
 #endif
--- a/dom/base/DocumentFragment.cpp
+++ b/dom/base/DocumentFragment.cpp
@@ -114,17 +114,16 @@ DocumentFragment::Constructor(const Glob
 NS_IMPL_CYCLE_COLLECTION_INHERITED(DocumentFragment, FragmentOrElement, mHost)
 
 // QueryInterface implementation for DocumentFragment
 NS_INTERFACE_MAP_BEGIN(DocumentFragment)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(DocumentFragment)
   NS_INTERFACE_MAP_ENTRY(nsIContent)
   NS_INTERFACE_MAP_ENTRY(nsINode)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
   NS_INTERFACE_MAP_ENTRY(mozilla::dom::EventTarget)
   NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
                                  new nsNodeSupportsWeakRefTearoff(this))
   // DOM bindings depend on the identity pointer being the
   // same as nsINode (which nsIContent inherits).
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
 NS_INTERFACE_MAP_END
 
--- a/dom/base/DocumentFragment.h
+++ b/dom/base/DocumentFragment.h
@@ -5,30 +5,28 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_DocumentFragment_h__
 #define mozilla_dom_DocumentFragment_h__
 
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/BorrowedAttrInfo.h"
 #include "mozilla/dom/FragmentOrElement.h"
-#include "nsIDOMNode.h"
 #include "nsStringFwd.h"
 
 class nsAtom;
 class nsIDocument;
 class nsIContent;
 
 namespace mozilla {
 namespace dom {
 
 class Element;
 
-class DocumentFragment : public FragmentOrElement,
-                         public nsIDOMNode
+class DocumentFragment : public FragmentOrElement
 {
 private:
   void Init()
   {
     MOZ_ASSERT(mNodeInfo->NodeType() == DOCUMENT_FRAGMENT_NODE &&
                mNodeInfo->Equals(nsGkAtoms::documentFragmentNodeName,
                                  kNameSpaceID_None),
                "Bad NodeType in aNodeInfo");
@@ -60,18 +58,16 @@ public:
   {
     Init();
   }
 
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   virtual bool IsNodeOfType(uint32_t aFlags) const override;
 
-  virtual nsIDOMNode* AsDOMNode() override { return this; }
-
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent,
                               bool aCompileEventHandlers) override
   {
     NS_ASSERTION(false, "Trying to bind a fragment to a tree");
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
--- a/dom/base/DocumentType.cpp
+++ b/dom/base/DocumentType.cpp
@@ -57,18 +57,16 @@ DocumentType::DocumentType(already_AddRe
 {
   MOZ_ASSERT(mNodeInfo->NodeType() == DOCUMENT_TYPE_NODE,
              "Bad NodeType in aNodeInfo");
   MOZ_ASSERT(!IsCharacterData());
 }
 
 DocumentType::~DocumentType() = default;
 
-NS_IMPL_ISUPPORTS_INHERITED(DocumentType, CharacterData, nsIDOMNode)
-
 bool
 DocumentType::IsNodeOfType(uint32_t aFlags) const
 {
   return false;
 }
 
 const nsTextFragment*
 DocumentType::GetText()
--- a/dom/base/DocumentType.h
+++ b/dom/base/DocumentType.h
@@ -9,42 +9,37 @@
  */
 
 #ifndef DocumentType_h
 #define DocumentType_h
 
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/CharacterData.h"
 #include "nsCOMPtr.h"
-#include "nsIDOMNode.h"
 #include "nsIContent.h"
 #include "nsString.h"
 
 namespace mozilla {
 namespace dom {
 
 // XXX DocumentType is currently implemented by inheriting the generic
 // CharacterData object, even though DocumentType is not character
 // data. This is done simply for convenience and should be changed if
 // this restricts what should be done for character data.
 
-class DocumentType final : public CharacterData,
-                           public nsIDOMNode
+class DocumentType final : public CharacterData
 {
 public:
   DocumentType(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
                const nsAString& aPublicId,
                const nsAString& aSystemId,
                const nsAString& aInternalSubset);
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
-
-  // nsIDOMNode
-  // Forwarded by base class
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(DocumentType, CharacterData)
 
   // nsINode
   virtual bool IsNodeOfType(uint32_t aFlags) const override;
   virtual void GetNodeValueInternal(nsAString& aNodeValue) override
   {
     SetDOMStringToNull(aNodeValue);
   }
   virtual void SetNodeValueInternal(const nsAString& aNodeValue,
@@ -54,18 +49,16 @@ public:
 
   // nsIContent overrides
   virtual const nsTextFragment* GetText() override;
 
   virtual already_AddRefed<CharacterData>
     CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
                   bool aCloneText) const override;
 
-  virtual nsIDOMNode* AsDOMNode() override { return this; }
-
   // WebIDL API
   void GetName(nsAString& aName) const;
   void GetPublicId(nsAString& aPublicId) const;
   void GetSystemId(nsAString& aSystemId) const;
   void GetInternalSubset(nsAString& aInternalSubset) const;
 
 protected:
   virtual ~DocumentType();
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -177,18 +177,18 @@ using mozilla::gfx::Matrix4x4;
 template<int a, int b> struct Check##type##Size \
 { \
   static_assert(sizeof(void*) != 8 || a == b, "DOM size changed"); \
 }; \
 Check##type##Size<sizeof(type), opt_size + EXTRA_DOM_ELEMENT_BYTES> g##type##CES;
 
 // Note that mozjemalloc uses a 16 byte quantum, so 128 is a bin/bucket size.
 ASSERT_ELEMENT_SIZE(Element, 120);
-ASSERT_ELEMENT_SIZE(HTMLDivElement, 128);
-ASSERT_ELEMENT_SIZE(HTMLSpanElement, 128);
+ASSERT_ELEMENT_SIZE(HTMLDivElement, 120);
+ASSERT_ELEMENT_SIZE(HTMLSpanElement, 120);
 
 #undef ASSERT_ELEMENT_SIZE
 #undef EXTRA_DOM_ELEMENT_BYTES
 
 nsAtom*
 nsIContent::DoGetID() const
 {
   MOZ_ASSERT(HasID(), "Unexpected call");
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -1321,17 +1321,17 @@ FragmentOrElement::FireNodeInserted(nsID
 {
   uint32_t count = aNodes.Length();
   for (uint32_t i = 0; i < count; ++i) {
     nsIContent* childContent = aNodes[i];
 
     if (nsContentUtils::HasMutationListeners(childContent,
           NS_EVENT_BITS_MUTATION_NODEINSERTED, aParent)) {
       InternalMutationEvent mutation(true, eLegacyNodeInserted);
-      mutation.mRelatedNode = do_QueryInterface(aParent);
+      mutation.mRelatedNode = aParent;
 
       mozAutoSubtreeModified subtree(aDoc, aParent);
       (new AsyncEventDispatcher(childContent, mutation))->RunDOMEventWhenSafe();
     }
   }
 }
 
 //----------------------------------------------------------------------
@@ -2237,19 +2237,19 @@ FragmentOrElement::GetMarkup(bool aInclu
       flags &= ~nsIDocumentEncoder::OutputIgnoreMozDirty;
     }
   }
 
   DebugOnly<nsresult> rv = docEncoder->NativeInit(doc, contentType, flags);
   MOZ_ASSERT(NS_SUCCEEDED(rv));
 
   if (aIncludeSelf) {
-    docEncoder->SetNativeNode(this);
+    docEncoder->SetNode(this);
   } else {
-    docEncoder->SetNativeContainerNode(this);
+    docEncoder->SetContainerNode(this);
   }
   rv = docEncoder->EncodeToString(aMarkup);
   MOZ_ASSERT(NS_SUCCEEDED(rv));
   if (tryToCacheEncoder) {
     doc->SetCachedEncoder(docEncoder.forget());
   }
 }
 
--- a/dom/base/FragmentOrElement.h
+++ b/dom/base/FragmentOrElement.h
@@ -1,17 +1,17 @@
 /* -*- 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 all element classes as well as nsDocumentFragment.  This
- * provides an implementation of nsIDOMNode, implements nsIContent, provides
+ * provides an implementation of nsINode, implements nsIContent, provides
  * utility methods for subclasses, and so forth.
  */
 
 #ifndef FragmentOrElement_h___
 #define FragmentOrElement_h___
 
 #include "mozilla/Attributes.h"
 #include "mozilla/MemoryReporting.h"
@@ -66,17 +66,17 @@ public:
 private:
   ~nsNodeSupportsWeakRefTearoff() {}
 
   nsCOMPtr<nsINode> mNode;
 };
 
 /**
  * A generic base class for DOM elements and document fragments,
- * implementing many nsIContent, nsIDOMNode and Element methods.
+ * implementing many nsIContent, nsINode and Element methods.
  */
 namespace mozilla {
 namespace dom {
 
 class ShadowRoot;
 
 class FragmentOrElement : public nsIContent
 {
--- a/dom/base/IDTracker.cpp
+++ b/dom/base/IDTracker.cpp
@@ -7,17 +7,16 @@
 #include "IDTracker.h"
 
 #include "mozilla/Encoding.h"
 #include "nsContentUtils.h"
 #include "nsIURI.h"
 #include "nsBindingManager.h"
 #include "nsEscape.h"
 #include "nsXBLPrototypeBinding.h"
-#include "nsIDOMNode.h"
 #include "nsCycleCollectionParticipant.h"
 
 namespace mozilla {
 namespace dom {
 
 void
 IDTracker::Reset(nsIContent* aFromContent, nsIURI* aURI,
                  bool aWatch, bool aReferenceImage)
--- a/dom/base/Link.cpp
+++ b/dom/base/Link.cpp
@@ -145,17 +145,16 @@ Link::TryDNSPrefetchOrPreconnectOrPrefet
 
   if ((linkTypes & nsStyleLinkElement::ePREFETCH) ||
       (linkTypes & nsStyleLinkElement::eNEXT) ||
       (linkTypes & nsStyleLinkElement::ePRELOAD)){
     nsCOMPtr<nsIPrefetchService> prefetchService(do_GetService(NS_PREFETCHSERVICE_CONTRACTID));
     if (prefetchService) {
       nsCOMPtr<nsIURI> uri(GetURI());
       if (uri) {
-        nsCOMPtr<nsIDOMNode> domNode = GetAsDOMNode(mElement);
         if (linkTypes & nsStyleLinkElement::ePRELOAD) {
           nsAttrValue asAttr;
           nsContentPolicyType policyType;
           nsAutoString mimeType;
           nsAutoString media;
           GetContentPolicyMimeTypeMedia(asAttr, policyType, mimeType, media);
 
           if (policyType == nsIContentPolicy::TYPE_INVALID) {
@@ -165,21 +164,21 @@ Link::TryDNSPrefetchOrPreconnectOrPrefet
 
           if (!HTMLLinkElement::CheckPreloadAttrs(asAttr, mimeType, media,
                                                   mElement->OwnerDoc())) {
             policyType = nsIContentPolicy::TYPE_INVALID;
           }
 
           prefetchService->PreloadURI(uri,
                                       mElement->OwnerDoc()->GetDocumentURI(),
-                                      domNode, policyType);
+                                      mElement, policyType);
         } else {
           prefetchService->PrefetchURI(uri,
                                        mElement->OwnerDoc()->GetDocumentURI(),
-                                       domNode, linkTypes & nsStyleLinkElement::ePREFETCH);
+                                       mElement, linkTypes & nsStyleLinkElement::ePREFETCH);
         }
         return;
       }
     }
   }
 
   if (linkTypes & nsStyleLinkElement::ePRECONNECT) {
     nsCOMPtr<nsIURI> uri(GetURI());
@@ -227,44 +226,42 @@ Link::UpdatePreload(nsAtom* aName, const
     return;
   }
 
   nsCOMPtr<nsIURI> uri(GetURI());
   if (!uri) {
     return;
   }
 
-  nsCOMPtr<nsIDOMNode> domNode = GetAsDOMNode(mElement);
-
   nsAttrValue asAttr;
   nsContentPolicyType asPolicyType;
   nsAutoString mimeType;
   nsAutoString media;
   GetContentPolicyMimeTypeMedia(asAttr, asPolicyType, mimeType, media);
 
   if (asPolicyType == nsIContentPolicy::TYPE_INVALID) {
     // Ignore preload with a wrong or empty as attribute, but be sure to cancel
     // the old one.
-    prefetchService->CancelPrefetchPreloadURI(uri, domNode);
+    prefetchService->CancelPrefetchPreloadURI(uri, mElement);
     return;
   }
 
   nsContentPolicyType policyType = asPolicyType;
   if (!HTMLLinkElement::CheckPreloadAttrs(asAttr, mimeType, media,
                                           mElement->OwnerDoc())) {
     policyType = nsIContentPolicy::TYPE_INVALID;
   }
 
   if (aName == nsGkAtoms::crossorigin) {
     CORSMode corsMode = Element::AttrValueToCORSMode(aValue);
     CORSMode oldCorsMode = Element::AttrValueToCORSMode(aOldValue);
     if (corsMode != oldCorsMode) {
-      prefetchService->CancelPrefetchPreloadURI(uri, domNode);
+      prefetchService->CancelPrefetchPreloadURI(uri, mElement);
       prefetchService->PreloadURI(uri, mElement->OwnerDoc()->GetDocumentURI(),
-                                  domNode, policyType);
+                                  mElement, policyType);
     }
     return;
   }
 
   nsContentPolicyType oldPolicyType;
 
   if (aName == nsGkAtoms::as) {
     if (aOldValue) {
@@ -305,39 +302,38 @@ Link::UpdatePreload(nsAtom* aName, const
       oldPolicyType = asPolicyType;
     } else {
       oldPolicyType = nsIContentPolicy::TYPE_INVALID;
     }
   }
 
   if ((policyType != oldPolicyType) &&
       (oldPolicyType != nsIContentPolicy::TYPE_INVALID)) {
-    prefetchService->CancelPrefetchPreloadURI(uri, domNode);
+    prefetchService->CancelPrefetchPreloadURI(uri, mElement);
 
   }
 
   // Trigger a new preload if the policy type has changed.
   // Also trigger load if the new policy type is invalid, this will only
   // trigger an error event.
   if ((policyType != oldPolicyType) ||
       (policyType == nsIContentPolicy::TYPE_INVALID)) {
     prefetchService->PreloadURI(uri, mElement->OwnerDoc()->GetDocumentURI(),
-                                domNode, policyType);
+                                mElement, policyType);
   }
 }
 
 void
 Link::CancelPrefetchOrPreload()
 {
   nsCOMPtr<nsIPrefetchService> prefetchService(do_GetService(NS_PREFETCHSERVICE_CONTRACTID));
   if (prefetchService) {
     nsCOMPtr<nsIURI> uri(GetURI());
     if (uri) {
-      nsCOMPtr<nsIDOMNode> domNode = GetAsDOMNode(mElement);
-      prefetchService->CancelPrefetchPreloadURI(uri, domNode);
+      prefetchService->CancelPrefetchPreloadURI(uri, mElement);
     }
   }
 }
 
 void
 Link::SetLinkState(nsLinkState aState)
 {
   NS_ASSERTION(mRegistered,
--- a/dom/base/NodeInfo.h
+++ b/dom/base/NodeInfo.h
@@ -115,18 +115,18 @@ public:
    * returns kNameSpaceID_None.
    */
   int32_t NamespaceID() const
   {
     return mInner.mNamespaceID;
   }
 
   /*
-   * Get the nodetype for the node. Returns the values specified in nsIDOMNode
-   * for nsIDOMNode.nodeType
+   * Get the nodetype for the node. Returns the values specified in Node
+   * for Node.nodeType
    */
   uint16_t NodeType() const
   {
     return mInner.mNodeType;
   }
 
   /*
    * Get the extra name, used by PIs and DocTypes, for the node.
@@ -297,17 +297,17 @@ protected:
             mName ? mName->hash() : mozilla::HashString(*mNameString));
       }
       return mHash.value();
     }
 
     nsAtom* const MOZ_OWNING_REF mName;
     nsAtom* MOZ_OWNING_REF mPrefix;
     int32_t             mNamespaceID;
-    uint16_t            mNodeType; // As defined by nsIDOMNode.nodeType
+    uint16_t            mNodeType; // As defined by Node.nodeType
     const nsAString* const mNameString;
     nsAtom* MOZ_OWNING_REF mExtraName; // Only used by PIs and DocTypes
     mutable mozilla::Maybe<const uint32_t> mHash;
   };
 
   // nsNodeInfoManager needs to pass mInner to the hash table.
   friend class ::nsNodeInfoManager;
 
--- a/dom/base/NodeIterator.cpp
+++ b/dom/base/NodeIterator.cpp
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * Implementation of DOM Traversal's NodeIterator
  */
 
 #include "mozilla/dom/NodeIterator.h"
 
-#include "nsIDOMNode.h"
 #include "nsError.h"
 
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsContentUtils.h"
 #include "nsCOMPtr.h"
 #include "mozilla/dom/NodeFilterBinding.h"
 #include "mozilla/dom/NodeIteratorBinding.h"
--- a/dom/base/NodeIterator.h
+++ b/dom/base/NodeIterator.h
@@ -11,17 +11,16 @@
 #ifndef mozilla_dom_NodeIterator_h
 #define mozilla_dom_NodeIterator_h
 
 #include "nsTraversal.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsStubMutationObserver.h"
 
 class nsINode;
-class nsIDOMNode;
 
 namespace mozilla {
 namespace dom {
 
 class NodeIterator final : public nsStubMutationObserver,
                            public nsTraversal
 {
 public:
--- a/dom/base/Selection.cpp
+++ b/dom/base/Selection.cpp
@@ -18,17 +18,16 @@
 
 #include "nsCOMPtr.h"
 #include "nsString.h"
 #include "nsFrameSelection.h"
 #include "nsISelectionListener.h"
 #include "nsContentCID.h"
 #include "nsDeviceContext.h"
 #include "nsIContent.h"
-#include "nsIDOMNode.h"
 #include "nsRange.h"
 #include "nsITableCellLayout.h"
 #include "nsTArray.h"
 #include "nsTableWrapperFrame.h"
 #include "nsTableCellFrame.h"
 #include "nsIScrollableFrame.h"
 #include "nsCCUncollectableMarker.h"
 #include "nsIContentIterator.h"
--- a/dom/base/TreeWalker.cpp
+++ b/dom/base/TreeWalker.cpp
@@ -6,17 +6,16 @@
 
 /*
  * Implementation of DOM Traversal's TreeWalker
  */
 
 #include "mozilla/dom/TreeWalker.h"
 
 #include "nsIContent.h"
-#include "nsIDOMNode.h"
 #include "nsError.h"
 #include "nsINode.h"
 #include "nsContentUtils.h"
 #include "mozilla/dom/NodeFilterBinding.h"
 #include "mozilla/dom/TreeWalkerBinding.h"
 
 namespace mozilla {
 namespace dom {
--- a/dom/base/TreeWalker.h
+++ b/dom/base/TreeWalker.h
@@ -13,17 +13,16 @@
 
 #include "nsISupports.h"
 #include "nsTraversal.h"
 #include "nsCOMPtr.h"
 #include "nsTArray.h"
 #include "nsCycleCollectionParticipant.h"
 
 class nsINode;
-class nsIDOMNode;
 
 namespace mozilla {
 namespace dom {
 
 class TreeWalker final : public nsISupports, public nsTraversal
 {
     virtual ~TreeWalker();
 
--- a/dom/base/nsAttrAndChildArray.cpp
+++ b/dom/base/nsAttrAndChildArray.cpp
@@ -23,24 +23,24 @@
 #include "nsContentUtils.h" // nsAutoScriptBlocker
 
 using mozilla::CheckedUint32;
 
 /*
 CACHE_POINTER_SHIFT indicates how many steps to downshift the |this| pointer.
 It should be small enough to not cause collisions between adjecent arrays, and
 large enough to make sure that all indexes are used. The size below is based
-on the size of the smallest possible element (currently 24[*] bytes) which is
-the smallest distance between two nsAttrAndChildArray. 24/(2^_5_) is 0.75.
-This means that two adjacent nsAttrAndChildArrays will overlap one in 4 times.
+on the size of the smallest possible element (currently 20[*] bytes) which is
+the smallest distance between two nsAttrAndChildArray. 20/(2^_5_) is 0.625.
+This means that two adjacent nsAttrAndChildArrays will overlap one in 2.7 times.
 However not all elements will have enough children to get cached. And any
 allocator that doesn't return addresses aligned to 64 bytes will ensure that
 any index will get used.
 
-[*] sizeof(Element) + 4 bytes for nsIDOMNode vtable pointer.
+[*] sizeof(Element).  Except is that really 20 bytes?  Seems dubious!
 */
 
 #define CACHE_POINTER_SHIFT 5
 #define CACHE_NUM_SLOTS 128
 #define CACHE_CHILD_LIMIT 10
 
 #define CACHE_GET_INDEX(_array) \
   ((NS_PTR_TO_INT32(_array) >> CACHE_POINTER_SHIFT) & \
--- a/dom/base/nsContentAreaDragDrop.cpp
+++ b/dom/base/nsContentAreaDragDrop.cpp
@@ -10,17 +10,16 @@
 #include "nsContentAreaDragDrop.h"
 
 // Helper Classes
 #include "nsString.h"
 
 // Interfaces needed to be included
 #include "nsCopySupport.h"
 #include "nsISelectionController.h"
-#include "nsIDOMNode.h"
 #include "nsPIDOMWindow.h"
 #include "nsIFormControl.h"
 #include "nsITransferable.h"
 #include "nsComponentManagerUtils.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 #include "nsServiceManagerUtils.h"
 #include "nsNetUtil.h"
--- a/dom/base/nsContentIterator.cpp
+++ b/dom/base/nsContentIterator.cpp
@@ -1011,17 +1011,17 @@ nsContentSubtreeIterator::InitWithRange(
     if (!child || startOffset == endOffset) {
       // Text node, empty container, or collapsed
       MakeEmpty();
       return NS_OK;
     }
   }
 
   // cache ancestors
-  nsContentUtils::GetAncestorsAndOffsets(endContainer->AsDOMNode(), endOffset,
+  nsContentUtils::GetAncestorsAndOffsets(endContainer, endOffset,
                                          &mEndNodes, &mEndOffsets);
 
   nsIContent* firstCandidate = nullptr;
   nsIContent* lastCandidate = nullptr;
 
   // find first node in range
   int32_t offset = mRange->StartOffset();
 
--- a/dom/base/nsContentList.cpp
+++ b/dom/base/nsContentList.cpp
@@ -7,17 +7,16 @@
 /*
  * nsBaseContentList is a basic list of content nodes; nsContentList
  * is a commonly used NodeList implementation (used for
  * getElementsByTagName, some properties on HTMLDocument/Document, etc).
  */
 
 #include "nsContentList.h"
 #include "nsIContent.h"
-#include "nsIDOMNode.h"
 #include "nsIDocument.h"
 #include "mozilla/dom/Element.h"
 #include "nsWrapperCacheInlines.h"
 #include "nsContentUtils.h"
 #include "nsCCUncollectableMarker.h"
 #include "nsGkAtoms.h"
 #include "mozilla/dom/HTMLCollectionBinding.h"
 #include "mozilla/dom/NodeListBinding.h"
--- a/dom/base/nsContentPolicy.cpp
+++ b/dom/base/nsContentPolicy.cpp
@@ -12,17 +12,16 @@
 
 #include "nsISupports.h"
 #include "nsXPCOM.h"
 #include "nsContentPolicyUtils.h"
 #include "mozilla/dom/nsCSPService.h"
 #include "nsContentPolicy.h"
 #include "nsIURI.h"
 #include "nsIDocShell.h"
-#include "nsIDOMNode.h"
 #include "nsIDOMWindow.h"
 #include "nsITabChild.h"
 #include "nsIContent.h"
 #include "nsIImageLoadingContent.h"
 #include "nsILoadContext.h"
 #include "nsCOMArray.h"
 #include "nsContentUtils.h"
 #include "mozilla/dom/nsMixedContentBlocker.h"
@@ -89,17 +88,17 @@ nsContentPolicy::CheckPolicy(CPMethod   
 
     //sanity-check passed-through parameters
     MOZ_ASSERT(decision, "Null out pointer");
     WARN_IF_URI_UNINITIALIZED(contentLocation, "Request URI");
     WARN_IF_URI_UNINITIALIZED(requestingLocation, "Requesting URI");
 
 #ifdef DEBUG
     {
-        nsCOMPtr<nsIDOMNode> node(do_QueryInterface(requestingContext));
+        nsCOMPtr<nsINode> node(do_QueryInterface(requestingContext));
         nsCOMPtr<nsIDOMWindow> window(do_QueryInterface(requestingContext));
         nsCOMPtr<nsITabChild> tabChild(do_QueryInterface(requestingContext));
         NS_ASSERTION(!requestingContext || node || window || tabChild,
                      "Context should be a DOM node, DOM window or a tabChild!");
     }
 #endif
 
     /*
--- a/dom/base/nsContentPolicyUtils.h
+++ b/dom/base/nsContentPolicyUtils.h
@@ -280,18 +280,17 @@ NS_CP_GetDocShellFromContext(nsISupports
 {
     if (!aContext) {
         return nullptr;
     }
 
     nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryInterface(aContext);
 
     if (!window) {
-        // our context might be a document (which also QIs to nsIDOMNode), so
-        // try that first
+        // Our context might be a document.
         nsCOMPtr<nsIDocument> doc = do_QueryInterface(aContext);
         if (!doc) {
             // we were not a document after all, get our ownerDocument,
             // hopefully
             nsCOMPtr<nsIContent> content = do_QueryInterface(aContext);
             if (content) {
                 doc = content->OwnerDoc();
             }
--- a/dom/base/nsContentSink.cpp
+++ b/dom/base/nsContentSink.cpp
@@ -35,17 +35,16 @@
 #include "nsIApplicationCacheChannel.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsICookieService.h"
 #include "nsContentUtils.h"
 #include "nsNodeInfoManager.h"
 #include "nsIAppShell.h"
 #include "nsIWidget.h"
 #include "nsWidgetsCID.h"
-#include "nsIDOMNode.h"
 #include "mozAutoDocUpdate.h"
 #include "nsIWebNavigation.h"
 #include "nsGenericHTMLElement.h"
 #include "nsHTMLDNSPrefetch.h"
 #include "nsIObserverService.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/ServiceWorkerDescriptor.h"
 #include "mozilla/dom/ScriptLoader.h"
@@ -873,17 +872,16 @@ nsContentSink::PrefetchPreloadHref(const
   nsCOMPtr<nsIPrefetchService> prefetchService(do_GetService(NS_PREFETCHSERVICE_CONTRACTID));
   if (prefetchService) {
     // construct URI using document charset
     auto encoding = mDocument->GetDocumentCharacterSet();
     nsCOMPtr<nsIURI> uri;
     NS_NewURI(getter_AddRefs(uri), aHref, encoding,
               mDocument->GetDocBaseURI());
     if (uri) {
-      nsCOMPtr<nsIDOMNode> domNode = do_QueryInterface(aSource);
       if (aLinkTypes & nsStyleLinkElement::ePRELOAD) {
         nsAttrValue asAttr;
         Link::ParseAsValue(aAs, asAttr);
         nsContentPolicyType policyType = Link::AsValueToContentPolicy(asAttr);
 
         if (policyType == nsIContentPolicy::TYPE_INVALID) {
           // Ignore preload with a wrong or empty as attribute.
           return;
@@ -892,19 +890,19 @@ nsContentSink::PrefetchPreloadHref(const
         nsAutoString mimeType;
         nsAutoString notUsed;
         nsContentUtils::SplitMimeType(aType, mimeType, notUsed);
         if (!HTMLLinkElement::CheckPreloadAttrs(asAttr, mimeType,
                                                 aMedia,mDocument)) {
           policyType = nsIContentPolicy::TYPE_INVALID;
         }
 
-        prefetchService->PreloadURI(uri, mDocumentURI, domNode, policyType);
+        prefetchService->PreloadURI(uri, mDocumentURI, aSource, policyType);
       } else {
-        prefetchService->PrefetchURI(uri, mDocumentURI, domNode,
+        prefetchService->PrefetchURI(uri, mDocumentURI, aSource,
                                      aLinkTypes & nsStyleLinkElement::ePREFETCH);
       }
     }
   }
 }
 
 void
 nsContentSink::PrefetchDNS(const nsAString &aHref)
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -128,17 +128,16 @@
 #include "nsIContentSecurityPolicy.h"
 #include "nsIContentSink.h"
 #include "nsIContentViewer.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIDocument.h"
 #include "nsIDocumentEncoder.h"
 #include "nsIDOMChromeWindow.h"
-#include "nsIDOMNode.h"
 #include "nsIDOMWindowUtils.h"
 #include "nsIDragService.h"
 #include "nsIFormControl.h"
 #include "nsIForm.h"
 #include "nsIFragmentContentSink.h"
 #include "nsContainerFrame.h"
 #include "nsIHTMLDocument.h"
 #include "nsIIdleService.h"
@@ -2066,20 +2065,17 @@ nsContentUtils::Shutdown()
   }
 
   HTMLInputElement::Shutdown();
   nsMappedAttributes::Shutdown();
 }
 
 /**
  * Checks whether two nodes come from the same origin. aTrustedNode is
- * considered 'safe' in that a user can operate on it and that it isn't
- * a js-object that implements nsIDOMNode.
- * Never call this function with the first node provided by script, it
- * must always be known to be a 'real' node!
+ * considered 'safe' in that a user can operate on it.
  */
 // static
 nsresult
 nsContentUtils::CheckSameOrigin(const nsINode* aTrustedNode,
                                 const nsINode* unTrustedNode)
 {
   MOZ_ASSERT(aTrustedNode);
   MOZ_ASSERT(unTrustedNode);
@@ -2121,25 +2117,16 @@ nsContentUtils::CanCallerAccess(nsIPrinc
 
   // The subject doesn't subsume aPrincipal. Allow access only if the subject
   // is chrome.
   return IsCallerChrome();
 }
 
 // static
 bool
-nsContentUtils::CanCallerAccess(nsIDOMNode *aNode)
-{
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  NS_ENSURE_TRUE(node, false);
-  return CanCallerAccess(node);
-}
-
-// static
-bool
 nsContentUtils::CanCallerAccess(nsINode* aNode)
 {
   return CanCallerAccess(SubjectPrincipal(), aNode->NodePrincipal());
 }
 
 // static
 bool
 nsContentUtils::CanCallerAccess(nsPIDOMWindowInner* aWindow)
@@ -2592,75 +2579,55 @@ nsContentUtils::GetAncestors(nsINode* aN
     aArray.AppendElement(aNode);
     aNode = aNode->GetParentNode();
   }
   return NS_OK;
 }
 
 // static
 nsresult
-nsContentUtils::GetAncestorsAndOffsets(nsIDOMNode* aNode,
+nsContentUtils::GetAncestorsAndOffsets(nsINode* aNode,
                                        int32_t aOffset,
                                        nsTArray<nsIContent*>* aAncestorNodes,
                                        nsTArray<int32_t>* aAncestorOffsets)
 {
   NS_ENSURE_ARG_POINTER(aNode);
 
-  nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
-
-  if (!content) {
+  if (!aNode->IsContent()) {
     return NS_ERROR_FAILURE;
   }
+  nsIContent* content = aNode->AsContent();
 
   if (!aAncestorNodes->IsEmpty()) {
     NS_WARNING("aAncestorNodes is not empty");
     aAncestorNodes->Clear();
   }
 
   if (!aAncestorOffsets->IsEmpty()) {
     NS_WARNING("aAncestorOffsets is not empty");
     aAncestorOffsets->Clear();
   }
 
   // insert the node itself
-  aAncestorNodes->AppendElement(content.get());
+  aAncestorNodes->AppendElement(content);
   aAncestorOffsets->AppendElement(aOffset);
 
   // insert all the ancestors
   nsIContent* child = content;
   nsIContent* parent = child->GetParent();
   while (parent) {
     aAncestorNodes->AppendElement(parent);
     aAncestorOffsets->AppendElement(parent->ComputeIndexOf(child));
     child = parent;
     parent = parent->GetParent();
   }
 
   return NS_OK;
 }
 
-// static
-nsresult
-nsContentUtils::GetCommonAncestor(nsIDOMNode *aNode,
-                                  nsIDOMNode *aOther,
-                                  nsIDOMNode** aCommonAncestor)
-{
-  *aCommonAncestor = nullptr;
-
-  nsCOMPtr<nsINode> node1 = do_QueryInterface(aNode);
-  nsCOMPtr<nsINode> node2 = do_QueryInterface(aOther);
-
-  NS_ENSURE_TRUE(node1 && node2, NS_ERROR_UNEXPECTED);
-
-  nsINode* common = GetCommonAncestor(node1, node2);
-  NS_ENSURE_TRUE(common, NS_ERROR_NOT_AVAILABLE);
-
-  return CallQueryInterface(common, aCommonAncestor);
-}
-
 template <typename Node, typename GetParentFunc>
 static Node*
 GetCommonAncestorInternal(Node* aNode1,
                           Node* aNode2,
                           GetParentFunc aGetParentFunc)
 {
   MOZ_ASSERT(aNode1 != aNode2);
 
@@ -2799,28 +2766,16 @@ nsContentUtils::ComparePoints(nsINode* a
   nsINode* child1 = parents1.ElementAt(--pos1);
   // XXX aOffset2 may be -1 as mentioned above.  So, why does this return it's
   //     *after* of the valid DOM point?
   return parent->ComputeIndexOf(child1) < aOffset2 ? -1 : 1;
 }
 
 /* static */
 int32_t
-nsContentUtils::ComparePoints(nsIDOMNode* aParent1, int32_t aOffset1,
-                              nsIDOMNode* aParent2, int32_t aOffset2,
-                              bool* aDisconnected)
-{
-  nsCOMPtr<nsINode> parent1 = do_QueryInterface(aParent1);
-  nsCOMPtr<nsINode> parent2 = do_QueryInterface(aParent2);
-  NS_ENSURE_TRUE(parent1 && parent2, -1);
-  return ComparePoints(parent1, aOffset1, parent2, aOffset2);
-}
-
-/* static */
-int32_t
 nsContentUtils::ComparePoints(const RawRangeBoundary& aFirst,
                               const RawRangeBoundary& aSecond,
                               bool* aDisconnected)
 {
   if (NS_WARN_IF(!aFirst.IsSet()) || NS_WARN_IF(!aSecond.IsSet())) {
     return -1;
   }
   return ComparePoints(aFirst.Container(), aFirst.Offset(),
@@ -4795,17 +4750,17 @@ nsContentUtils::MaybeFireNodeRemoved(nsI
       WarnScriptWasIgnored(aChild->OwnerDoc());
     }
     return;
   }
 
   if (HasMutationListeners(aChild,
         NS_EVENT_BITS_MUTATION_NODEREMOVED, aParent)) {
     InternalMutationEvent mutation(true, eLegacyNodeRemoved);
-    mutation.mRelatedNode = do_QueryInterface(aParent);
+    mutation.mRelatedNode = aParent;
 
     mozAutoSubtreeModified subtree(aParent->OwnerDoc(), aParent);
     EventDispatcher::Dispatch(aChild, nullptr, &mutation);
   }
 }
 
 void
 nsContentUtils::UnmarkGrayJSListenersInCCGenerationDocuments()
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -64,17 +64,16 @@ class nsHtml5StringParser;
 class nsAtom;
 class nsIChannel;
 class nsIConsoleService;
 class nsIContent;
 class nsIContentPolicy;
 class nsIContentSecurityPolicy;
 class nsIDocShellTreeItem;
 class nsIDocumentLoaderFactory;
-class nsIDOMNode;
 class nsIDragSession;
 class nsIEventTarget;
 class nsIFragmentContentSink;
 class nsIFrame;
 class nsIImageLoadingContent;
 class nsIInterfaceRequestor;
 class nsIIOService;
 class nsILoadInfo;
@@ -381,31 +380,21 @@ public:
   /*
    * This method fills |aAncestorNodes| with all ancestor nodes of |aNode|
    * including |aNode| (QI'd to nsIContent) at the zero index.
    * For each ancestor, there is a corresponding element in |aAncestorOffsets|
    * which is the IndexOf the child in relation to its parent.
    *
    * This method just sucks.
    */
-  static nsresult GetAncestorsAndOffsets(nsIDOMNode* aNode,
+  static nsresult GetAncestorsAndOffsets(nsINode* aNode,
                                          int32_t aOffset,
                                          nsTArray<nsIContent*>* aAncestorNodes,
                                          nsTArray<int32_t>* aAncestorOffsets);
 
-  /*
-   * The out parameter, |aCommonAncestor| will be the closest node, if any,
-   * to both |aNode| and |aOther| which is also an ancestor of each.
-   * Returns an error if the two nodes are disconnected and don't have
-   * a common ancestor.
-   */
-  static nsresult GetCommonAncestor(nsIDOMNode *aNode,
-                                    nsIDOMNode *aOther,
-                                    nsIDOMNode** aCommonAncestor);
-
   /**
    * Returns the common ancestor, if any, for two nodes.
    *
    * Returns null if the nodes are disconnected.
    */
   static nsINode* GetCommonAncestor(nsINode* aNode1, nsINode* aNode2)
   {
     if (aNode1 == aNode2) {
@@ -456,19 +445,16 @@ public:
    *      negative offset values!  E.g., when aOffset1 is -1 and aOffset is 0,
    *      these methods return -1.  Some root callers depend on this behavior.
    *      On the other hand, nsINode can have ATTRCHILD_ARRAY_MAX_CHILD_COUN
    *      (0x3FFFFF) at most.  Therefore, they can be int32_t for now.
    */
   static int32_t ComparePoints(nsINode* aParent1, int32_t aOffset1,
                                nsINode* aParent2, int32_t aOffset2,
                                bool* aDisconnected = nullptr);
-  static int32_t ComparePoints(nsIDOMNode* aParent1, int32_t aOffset1,
-                               nsIDOMNode* aParent2, int32_t aOffset2,
-                               bool* aDisconnected = nullptr);
   static int32_t ComparePoints(const mozilla::RawRangeBoundary& aFirst,
                                const mozilla::RawRangeBoundary& aSecond,
                                bool* aDisconnected = nullptr);
 
   /**
    * Brute-force search of the element subtree rooted at aContent for
    * an element with the given id.  aId must be nonempty, otherwise
    * this method may return nodes even if they have no id!
@@ -482,17 +468,17 @@ public:
 
   /**
    * Reverses the document position flags passed in.
    *
    * @param   aDocumentPosition   The document position flags to be reversed.
    *
    * @return  The reversed document position flags.
    *
-   * @see nsIDOMNode
+   * @see Node
    */
   static uint16_t ReverseDocumentPosition(uint16_t aDocumentPosition);
 
   /**
    * Returns a subdocument for aDocument with a particular outer window ID.
    *
    * @param aDocument
    *        The document whose subdocuments will be searched.
@@ -588,17 +574,16 @@ public:
 
   /**
    * Checks whether two nodes come from the same origin.
    */
   static nsresult CheckSameOrigin(const nsINode* aTrustedNode,
                                   const nsINode* unTrustedNode);
 
   // Check if the (JS) caller can access aNode.
-  static bool CanCallerAccess(nsIDOMNode *aNode);
   static bool CanCallerAccess(nsINode* aNode);
 
   // Check if the (JS) caller can access aWindow.
   // aWindow can be either outer or inner window.
   static bool CanCallerAccess(nsPIDOMWindowInner* aWindow);
 
   // Check if the principal is chrome or an addon with the permission.
   static bool PrincipalHasPermission(nsIPrincipal* aPrincipal, const nsAtom* aPerm);
--- a/dom/base/nsCopySupport.cpp
+++ b/dom/base/nsCopySupport.cpp
@@ -24,17 +24,16 @@
 
 #include "nsIDocShell.h"
 #include "nsIContentViewerEdit.h"
 #include "nsIClipboardHelper.h"
 #include "nsISelectionController.h"
 
 #include "nsPIDOMWindow.h"
 #include "nsIDocument.h"
-#include "nsIDOMNode.h"
 #include "nsIHTMLDocument.h"
 #include "nsGkAtoms.h"
 #include "nsIFrame.h"
 #include "nsIURI.h"
 #include "nsIURIMutator.h"
 #include "nsISimpleEnumerator.h"
 
 // image copy stuff
@@ -496,17 +495,17 @@ static nsresult AppendDOMNode(nsITransfe
   NS_ENSURE_TRUE(document->IsHTMLDocument(), NS_OK);
 
   // init encoder with document and node
   rv = docEncoder->NativeInit(document, NS_LITERAL_STRING(kHTMLMime),
                               nsIDocumentEncoder::OutputAbsoluteLinks |
                               nsIDocumentEncoder::OutputEncodeBasicEntities);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = docEncoder->SetNativeNode(aDOMNode);
+  rv = docEncoder->SetNode(aDOMNode);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // serialize to string
   nsAutoString html, context, info;
   rv = docEncoder->EncodeToStringWithContext(context, info, html);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // copy them to the transferable
--- a/dom/base/nsDOMSerializer.cpp
+++ b/dom/base/nsDOMSerializer.cpp
@@ -54,17 +54,17 @@ SetUpEncoder(nsINode& aRoot, const nsASt
   if (NS_FAILED(rv)) {
     aRv.Throw(rv);
     return nullptr;
   }
 
   // If we are working on the entire document we do not need to
   // specify which part to serialize
   if (!entireDocument) {
-    rv = encoder->SetNativeNode(&aRoot);
+    rv = encoder->SetNode(&aRoot);
   }
 
   if (NS_FAILED(rv)) {
     aRv.Throw(rv);
     return nullptr;
   }
 
   return encoder.forget();
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1358,17 +1358,17 @@ nsDOMWindowUtils::NodesFromRect(float aX
   nsCOMPtr<nsIDocument> doc = GetDocument();
   NS_ENSURE_STATE(doc);
 
   return doc->NodesFromRectHelper(aX, aY, aTopSize, aRightSize, aBottomSize, aLeftSize,
                                   aIgnoreRootScrollFrame, aFlushLayout, aReturn);
 }
 
 NS_IMETHODIMP
-nsDOMWindowUtils::GetTranslationNodes(nsIDOMNode* aRoot,
+nsDOMWindowUtils::GetTranslationNodes(nsINode* aRoot,
                                       nsITranslationNodeList** aRetVal)
 {
   NS_ENSURE_ARG_POINTER(aRetVal);
   nsCOMPtr<nsIContent> root = do_QueryInterface(aRoot);
   NS_ENSURE_STATE(root);
   nsCOMPtr<nsIDocument> doc = GetDocument();
   NS_ENSURE_STATE(doc);
 
@@ -1425,17 +1425,17 @@ nsDOMWindowUtils::GetTranslationNodes(ns
           bool parentInList = false;
           nsIContent* parent = content->GetParent();
           if (parent) {
             parentInList = translationNodesHash.Contains(parent);
           }
           isTranslationRoot = !parentInList;
         }
 
-        list->AppendElement(content->AsDOMNode(), isTranslationRoot);
+        list->AppendElement(content, isTranslationRoot);
         --limit;
         break;
       }
     }
   }
 
   *aRetVal = list.forget().take();
   return NS_OK;
@@ -1823,17 +1823,17 @@ nsDOMWindowUtils::GetFullZoom(float* aFu
   }
 
   *aFullZoom = presContext->DeviceContext()->GetFullZoom();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMWindowUtils::DispatchDOMEventViaPresShell(nsIDOMNode* aTarget,
+nsDOMWindowUtils::DispatchDOMEventViaPresShell(nsINode* aTarget,
                                                Event* aEvent,
                                                bool aTrusted,
                                                bool* aRetVal)
 {
   NS_ENSURE_STATE(aEvent);
   aEvent->SetTrusted(aTrusted);
   WidgetEvent* internalEvent = aEvent->WidgetEventPtr();
   NS_ENSURE_STATE(internalEvent);
@@ -2505,25 +2505,24 @@ nsDOMWindowUtils::GetAsyncPanZoomEnabled
     *aResult = widget->AsyncPanZoomEnabled();
   } else {
     *aResult = gfxPlatform::AsyncPanZoomEnabled();
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMWindowUtils::SetAsyncScrollOffset(nsIDOMNode* aNode,
+nsDOMWindowUtils::SetAsyncScrollOffset(Element* aElement,
                                        float aX, float aY)
 {
-  nsCOMPtr<Element> element = do_QueryInterface(aNode);
-  if (!element) {
+  if (!aElement) {
     return NS_ERROR_INVALID_ARG;
   }
   FrameMetrics::ViewID viewId;
-  if (!nsLayoutUtils::FindIDFor(element, &viewId)) {
+  if (!nsLayoutUtils::FindIDFor(aElement, &viewId)) {
     return NS_ERROR_UNEXPECTED;
   }
   nsIWidget* widget = GetWidget();
   if (!widget) {
     return NS_ERROR_FAILURE;
   }
   LayerManager* manager = widget->GetLayerManager();
   if (!manager) {
@@ -2541,24 +2540,23 @@ nsDOMWindowUtils::SetAsyncScrollOffset(n
   if (!forwarder || !forwarder->HasShadowManager()) {
     return NS_ERROR_UNEXPECTED;
   }
   forwarder->GetShadowManager()->SendSetAsyncScrollOffset(viewId, aX, aY);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMWindowUtils::SetAsyncZoom(nsIDOMNode* aRootElement, float aValue)
+nsDOMWindowUtils::SetAsyncZoom(Element* aRootElement, float aValue)
 {
-  nsCOMPtr<Element> element = do_QueryInterface(aRootElement);
-  if (!element) {
+  if (!aRootElement) {
     return NS_ERROR_INVALID_ARG;
   }
   FrameMetrics::ViewID viewId;
-  if (!nsLayoutUtils::FindIDFor(element, &viewId)) {
+  if (!nsLayoutUtils::FindIDFor(aRootElement, &viewId)) {
     return NS_ERROR_UNEXPECTED;
   }
   nsIWidget* widget = GetWidget();
   if (!widget) {
     return NS_ERROR_FAILURE;
   }
   LayerManager* manager = widget->GetLayerManager();
   if (!manager) {
@@ -3577,21 +3575,20 @@ nsDOMWindowUtils::GetIsParentWindowMainW
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   *aIsVisible = parentWidget->IsVisible();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMWindowUtils::IsNodeDisabledForEvents(nsIDOMNode* aNode, bool* aRetVal)
+nsDOMWindowUtils::IsNodeDisabledForEvents(nsINode* aNode, bool* aRetVal)
 {
   *aRetVal = false;
-  nsCOMPtr<nsINode> n = do_QueryInterface(aNode);
-  nsINode* node = n;
+  nsINode* node = aNode;
   while (node) {
     if (node->IsNodeOfType(nsINode::eHTML_FORM_CONTROL)) {
       nsCOMPtr<nsIFormControl> fc = do_QueryInterface(node);
       if (fc && fc->IsDisabledForEvents(eVoidEvent)) {
         *aRetVal = true;
         break;
       }
     }
@@ -4061,17 +4058,17 @@ nsDOMWindowUtils::TriggerDeviceReset()
   GPUProcessManager* pm = GPUProcessManager::Get();
   if (pm) {
     pm->SimulateDeviceReset();
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMWindowUtils::ForceUseCounterFlush(nsIDOMNode *aNode)
+nsDOMWindowUtils::ForceUseCounterFlush(nsINode *aNode)
 {
   NS_ENSURE_ARG_POINTER(aNode);
 
   if (nsCOMPtr<nsIDocument> doc = do_QueryInterface(aNode)) {
     mozilla::css::ImageLoader* loader = doc->StyleImageLoader();
     loader->FlushUseCounters();
 
     // Flush the document and any external documents that it depends on.
@@ -4289,17 +4286,17 @@ NS_INTERFACE_MAP_BEGIN(nsTranslationNode
   NS_INTERFACE_MAP_ENTRY(nsISupports)
   NS_INTERFACE_MAP_ENTRY(nsITranslationNodeList)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_ADDREF(nsTranslationNodeList)
 NS_IMPL_RELEASE(nsTranslationNodeList)
 
 NS_IMETHODIMP
-nsTranslationNodeList::Item(uint32_t aIndex, nsIDOMNode** aRetVal)
+nsTranslationNodeList::Item(uint32_t aIndex, nsINode** aRetVal)
 {
   NS_ENSURE_ARG_POINTER(aRetVal);
   NS_IF_ADDREF(*aRetVal = mNodes.SafeElementAt(aIndex));
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsTranslationNodeList::IsTranslationRootAtIndex(uint32_t aIndex, bool* aRetVal)
--- a/dom/base/nsDOMWindowUtils.h
+++ b/dom/base/nsDOMWindowUtils.h
@@ -39,27 +39,27 @@ public:
     mNodes.SetCapacity(1000);
     mNodeIsRoot.SetCapacity(1000);
     mLength = 0;
   }
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSITRANSLATIONNODELIST
 
-  void AppendElement(nsIDOMNode* aElement, bool aIsRoot)
+  void AppendElement(nsINode* aElement, bool aIsRoot)
   {
     mNodes.AppendElement(aElement);
     mNodeIsRoot.AppendElement(aIsRoot);
     mLength++;
   }
 
 private:
   ~nsTranslationNodeList() {}
 
-  nsTArray<nsCOMPtr<nsIDOMNode> > mNodes;
+  nsTArray<nsCOMPtr<nsINode> > mNodes;
   nsTArray<bool> mNodeIsRoot;
   uint32_t mLength;
 };
 
 class nsDOMWindowUtils final : public nsIDOMWindowUtils,
                                public nsSupportsWeakReference
 {
   typedef mozilla::widget::TextEventDispatcher
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -1725,17 +1725,16 @@ nsDocument::~nsDocument()
 }
 
 NS_INTERFACE_TABLE_HEAD(nsDocument)
   NS_WRAPPERCACHE_INTERFACE_TABLE_ENTRY
   NS_INTERFACE_TABLE_BEGIN
     NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(nsDocument, nsISupports, nsINode)
     NS_INTERFACE_TABLE_ENTRY(nsDocument, nsINode)
     NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDocument)
-    NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMNode)
     NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIScriptObjectPrincipal)
     NS_INTERFACE_TABLE_ENTRY(nsDocument, mozilla::dom::EventTarget)
     NS_INTERFACE_TABLE_ENTRY(nsDocument, nsISupportsWeakReference)
     NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIRadioGroupContainer)
     NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIMutationObserver)
     NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIApplicationCacheContainer)
   NS_INTERFACE_TABLE_END
   NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsDocument)
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -16,17 +16,16 @@
 #include "jsfriendapi.h"
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "nsCRT.h"
 #include "nsWeakReference.h"
 #include "nsWeakPtr.h"
 #include "nsTArray.h"
 #include "nsIdentifierMapEntry.h"
-#include "nsIDOMNode.h"
 #include "nsStubDocumentObserver.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIContent.h"
 #include "nsIPrincipal.h"
 #include "nsIParser.h"
 #include "nsBindingManager.h"
 #include "nsRefPtrHashtable.h"
 #include "nsJSThingHashtable.h"
@@ -125,17 +124,16 @@ public:
   NS_DECL_NSIREQUEST
 
 private:
   ~nsOnloadBlocker() {}
 };
 
 // Base class for our document implementations.
 class nsDocument : public nsIDocument,
-                   public nsIDOMNode,
                    public nsSupportsWeakReference,
                    public nsIScriptObjectPrincipal,
                    public nsIRadioGroupContainer,
                    public nsIApplicationCacheContainer,
                    public nsStubMutationObserver
 {
   friend class nsIDocument;
 
@@ -241,18 +239,16 @@ public:
   nsresult CloneDocHelper(nsDocument* clone, bool aPreallocateChildren) const;
 
   // Only BlockOnload should call this!
   void AsyncBlockOnload();
 
   virtual void DocAddSizeOfExcludingThis(nsWindowSizes& aWindowSizes) const override;
   // DocAddSizeOfIncludingThis is inherited from nsIDocument.
 
-  virtual nsIDOMNode* AsDOMNode() override { return this; }
-
 protected:
   friend class nsNodeUtils;
 
   void RetrieveRelevantHeaders(nsIChannel *aChannel);
 
   void TryChannelCharset(nsIChannel *aChannel,
                          int32_t& aCharsetSource,
                          NotNull<const Encoding*>& aEncoding,
--- a/dom/base/nsDocumentEncoder.cpp
+++ b/dom/base/nsDocumentEncoder.cpp
@@ -289,41 +289,25 @@ nsDocumentEncoder::SetSelection(Selectio
 NS_IMETHODIMP
 nsDocumentEncoder::SetRange(nsRange* aRange)
 {
   mRange = aRange;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocumentEncoder::SetNode(nsIDOMNode* aNode)
-{
-  mNodeIsContainer = false;
-  mNode = do_QueryInterface(aNode);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDocumentEncoder::SetNativeNode(nsINode* aNode)
+nsDocumentEncoder::SetNode(nsINode* aNode)
 {
   mNodeIsContainer = false;
   mNode = aNode;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocumentEncoder::SetContainerNode(nsIDOMNode *aContainer)
-{
-  mNodeIsContainer = true;
-  mNode = do_QueryInterface(aContainer);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDocumentEncoder::SetNativeContainerNode(nsINode* aContainer)
+nsDocumentEncoder::SetContainerNode(nsINode* aContainer)
 {
   mNodeIsContainer = true;
   mNode = aContainer;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocumentEncoder::SetCharset(const nsACString& aCharset)
@@ -367,20 +351,18 @@ nsDocumentEncoder::SerializeNodeStart(ns
   nsINode* node = nullptr;
   nsCOMPtr<nsINode> fixedNodeKungfuDeathGrip;
 
   // Caller didn't do fixup, so we'll do it ourselves
   if (!aOriginalNode) {
     aOriginalNode = aNode;
     if (mNodeFixup) {
       bool dummy;
-      nsCOMPtr<nsIDOMNode> domNodeIn = do_QueryInterface(aNode);
-      nsCOMPtr<nsIDOMNode> domNodeOut;
-      mNodeFixup->FixupNode(domNodeIn, &dummy, getter_AddRefs(domNodeOut));
-      fixedNodeKungfuDeathGrip = do_QueryInterface(domNodeOut);
+      mNodeFixup->FixupNode(aNode, &dummy,
+                            getter_AddRefs(fixedNodeKungfuDeathGrip));
       node = fixedNodeKungfuDeathGrip;
     }
   }
 
   // Either there was no fixed-up node,
   // or the caller did fixup themselves and aNode is already fixed
   if (!node)
     node = aNode;
@@ -466,20 +448,18 @@ nsDocumentEncoder::SerializeToStringRecu
 
   nsresult rv = NS_OK;
   bool serializeClonedChildren = false;
   nsINode* maybeFixedNode = nullptr;
 
   // Keep the node from FixupNode alive.
   nsCOMPtr<nsINode> fixedNodeKungfuDeathGrip;
   if (mNodeFixup) {
-    nsCOMPtr<nsIDOMNode> domNodeIn = do_QueryInterface(aNode);
-    nsCOMPtr<nsIDOMNode> domNodeOut;
-    mNodeFixup->FixupNode(domNodeIn, &serializeClonedChildren, getter_AddRefs(domNodeOut));
-    fixedNodeKungfuDeathGrip = do_QueryInterface(domNodeOut);
+    mNodeFixup->FixupNode(aNode, &serializeClonedChildren,
+                          getter_AddRefs(fixedNodeKungfuDeathGrip));
     maybeFixedNode = fixedNodeKungfuDeathGrip;
   }
 
   if (!maybeFixedNode)
     maybeFixedNode = aNode;
 
   if ((mFlags & SkipInvisibleContent) &&
       !(mFlags & OutputNonTextContentAsPlaceholder)) {
@@ -844,21 +824,19 @@ nsDocumentEncoder::SerializeRangeToStrin
   mStartDepth = mEndDepth = 0;
   mCommonAncestors.Clear();
   mStartNodes.Clear();
   mStartOffsets.Clear();
   mEndNodes.Clear();
   mEndOffsets.Clear();
 
   nsContentUtils::GetAncestors(mCommonParent, mCommonAncestors);
-  nsCOMPtr<nsIDOMNode> sp = do_QueryInterface(startContainer);
-  nsContentUtils::GetAncestorsAndOffsets(sp, startOffset,
+  nsContentUtils::GetAncestorsAndOffsets(startContainer, startOffset,
                                          &mStartNodes, &mStartOffsets);
-  nsCOMPtr<nsIDOMNode> ep = do_QueryInterface(endContainer);
-  nsContentUtils::GetAncestorsAndOffsets(ep, endOffset,
+  nsContentUtils::GetAncestorsAndOffsets(endContainer, endOffset,
                                          &mEndNodes, &mEndOffsets);
 
   nsCOMPtr<nsIContent> commonContent = do_QueryInterface(mCommonParent);
   mStartRootIndex = mStartNodes.IndexOf(commonContent);
   mEndRootIndex = mEndNodes.IndexOf(commonContent);
 
   nsresult rv = NS_OK;
 
@@ -1164,23 +1142,21 @@ protected:
 
   nsresult PromoteRange(nsRange* inRange);
   nsresult PromoteAncestorChain(nsCOMPtr<nsINode>* ioNode,
                                 int32_t* ioStartOffset,
                                 int32_t* ioEndOffset);
   nsresult GetPromotedPoint(Endpoint aWhere, nsINode* aNode, int32_t aOffset,
                             nsCOMPtr<nsINode>* outNode, int32_t* outOffset, nsINode* aCommon);
   nsCOMPtr<nsINode> GetChildAt(nsINode *aParent, int32_t aOffset);
-  bool IsMozBR(nsIDOMNode* aNode);
   bool IsMozBR(Element* aNode);
   nsresult GetNodeLocation(nsINode *inChild, nsCOMPtr<nsINode> *outParent, int32_t *outOffset);
   bool IsRoot(nsINode* aNode);
   bool IsFirstNode(nsINode *aNode);
   bool IsLastNode(nsINode *aNode);
-  bool IsEmptyTextContent(nsIDOMNode* aNode);
   virtual bool IncludeInContext(nsINode *aNode) override;
   virtual int32_t
   GetImmediateContextCount(const nsTArray<nsINode*>& aAncestorArray) override;
 
   bool mIsTextWidget;
 };
 
 nsHTMLCopyEncoder::nsHTMLCopyEncoder()
@@ -1747,24 +1723,16 @@ nsHTMLCopyEncoder::GetChildAt(nsINode *a
   MOZ_ASSERT(content, "null content in nsHTMLCopyEncoder::GetChildAt");
 
   resultNode = content->GetChildAt_Deprecated(aOffset);
 
   return resultNode;
 }
 
 bool
-nsHTMLCopyEncoder::IsMozBR(nsIDOMNode* aNode)
-{
-  MOZ_ASSERT(aNode);
-  nsCOMPtr<Element> element = do_QueryInterface(aNode);
-  return element && IsMozBR(element);
-}
-
-bool
 nsHTMLCopyEncoder::IsMozBR(Element* aElement)
 {
   return aElement->IsHTMLElement(nsGkAtoms::br) &&
          aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                                NS_LITERAL_STRING("_moz"), eIgnoreCase);
 }
 
 nsresult
@@ -1846,23 +1814,16 @@ nsHTMLCopyEncoder::IsLastNode(nsINode *a
     if (!sibling->TextIsOnlyWhitespace()) {
       return false;
     }
   }
 
   return true;
 }
 
-bool
-nsHTMLCopyEncoder::IsEmptyTextContent(nsIDOMNode* aNode)
-{
-  nsCOMPtr<nsIContent> cont = do_QueryInterface(aNode);
-  return cont && cont->TextIsOnlyWhitespace();
-}
-
 nsresult NS_NewHTMLCopyTextEncoder(nsIDocumentEncoder** aResult); // make mac compiler happy
 
 nsresult
 NS_NewHTMLCopyTextEncoder(nsIDocumentEncoder** aResult)
 {
   *aResult = new nsHTMLCopyEncoder;
  NS_ADDREF(*aResult);
  return NS_OK;
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -363,45 +363,40 @@ nsFocusManager::GetRedirectedFocus(nsICo
           numberControlFrame->GetAnonTextControl();
         return textControl;
       }
     }
   }
 
 #ifdef MOZ_XUL
   if (aContent->IsXULElement()) {
-    nsCOMPtr<nsIDOMNode> inputField;
-
     if (aContent->IsXULElement(nsGkAtoms::textbox)) {
       return aContent->OwnerDoc()->
         GetAnonymousElementByAttribute(aContent, nsGkAtoms::anonid, NS_LITERAL_STRING("input"));
     }
     else {
       nsCOMPtr<nsIDOMXULMenuListElement> menulist = do_QueryInterface(aContent);
       if (menulist) {
+        RefPtr<Element> inputField;
         menulist->GetInputField(getter_AddRefs(inputField));
+        return inputField;
       }
       else if (aContent->IsXULElement(nsGkAtoms::scale)) {
         nsCOMPtr<nsIDocument> doc = aContent->GetComposedDoc();
         if (!doc)
           return nullptr;
 
         nsINodeList* children = doc->BindingManager()->GetAnonymousNodesFor(aContent);
         if (children) {
           nsIContent* child = children->Item(0);
           if (child && child->IsXULElement(nsGkAtoms::slider))
             return child->AsElement();
         }
       }
     }
-
-    if (inputField) {
-      nsCOMPtr<Element> retval = do_QueryInterface(inputField);
-      return retval;
-    }
   }
 #endif
 
   return nullptr;
 }
 
 // static
 InputContextAction::Cause
@@ -1345,23 +1340,22 @@ nsFocusManager::SetFocusInner(Element* a
   //  * isn't called by trusted event (i.e., called by untrusted event or by js)
   //  * the focus is moved to another document's element
   // we need to check the permission.
   if (sendFocusEvent && mFocusedElement && !nsContentUtils::LegacyIsCallerNativeCode() &&
       mFocusedElement->OwnerDoc() != aNewContent->OwnerDoc()) {
     // If the caller cannot access the current focused node, the caller should
     // not be able to steal focus from it. E.g., When the current focused node
     // is in chrome, any web contents should not be able to steal the focus.
-    nsCOMPtr<nsIDOMNode> domNode(do_QueryInterface(mFocusedElement));
-    sendFocusEvent = nsContentUtils::CanCallerAccess(domNode);
+    sendFocusEvent = nsContentUtils::CanCallerAccess(mFocusedElement);
     if (!sendFocusEvent && mMouseButtonEventHandlingDocument) {
       // However, while mouse button event is handling, the handling document's
       // script should be able to steal focus.
-      domNode = do_QueryInterface(mMouseButtonEventHandlingDocument);
-      sendFocusEvent = nsContentUtils::CanCallerAccess(domNode);
+      sendFocusEvent =
+        nsContentUtils::CanCallerAccess(mMouseButtonEventHandlingDocument);
     }
   }
 
   LOGCONTENT("Shift Focus: %s", elementToFocus.get());
   LOGFOCUS((" Flags: %x Current Window: %p New Window: %p Current Element: %p",
            aFlags, mFocusedWindow.get(), newWindow.get(), mFocusedElement.get()));
   LOGFOCUS((" In Active Window: %d In Focused Window: %d SendFocus: %d",
            isElementInActiveWindow, isElementInFocusedWindow, sendFocusEvent));
--- a/dom/base/nsIDocumentEncoder.idl
+++ b/dom/base/nsIDocumentEncoder.idl
@@ -1,21 +1,21 @@
 /* -*- 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 "nsISupports.idl"
 
-interface nsIDOMNode;
 interface nsIOutputStream;
 
+webidl Document;
+webidl Node;
+webidl Range;
 webidl Selection;
-webidl Document;
-webidl Range;
 
 %{ C++
 class nsINode;
 class nsIDocument;
 %}
 [ptr] native nsINodePtr(nsINode);
 [ptr] native nsIDocumentPtr(nsIDocument);
 
@@ -28,17 +28,17 @@ interface nsIDocumentEncoderNodeFixup : 
    * may return a new node with fixed up attributes or null. If null is
    * returned the node should be used as-is.
    * @param aNode Node to fixup.
    * @param [OUT] aSerializeCloneKids True if the document encoder should
    * apply recursive serialization to the children of the fixed up node
    * instead of the children of the original node.
    * @return The resulting fixed up node.
    */
-  nsIDOMNode fixupNode(in nsIDOMNode aNode, out boolean aSerializeCloneKids);
+  Node fixupNode(in Node aNode, out boolean aSerializeCloneKids);
 };
 
 [scriptable, uuid(21f112df-d96f-47da-bfcb-5331273003d1)]
 interface nsIDocumentEncoder : nsISupports
 {
   // Output methods flag bits. There are a frightening number of these,
   // because everyone wants something a little bit different
 
@@ -260,27 +260,25 @@ interface nsIDocumentEncoder : nsISuppor
   void setRange(in Range aRange);
 
   /**
    *  If the node is set to a non-null value, then the
    *  node is used for encoding, otherwise the entire
    *  document or range or selection is encoded.
    * @param aNode The node to encode.
    */
-  void setNode(in nsIDOMNode aNode);
-  [noscript] void setNativeNode(in nsINodePtr aNode);
+  void setNode(in Node aNode);
 
   /**
    *  If the container is set to a non-null value, then its
    *  child nodes are used for encoding, otherwise the entire
    *  document or range or selection or node is encoded.
    *  @param aContainer The node which child nodes will be encoded.
    */
-  void setContainerNode(in nsIDOMNode aContainer);
-  [noscript] void setNativeContainerNode(in nsINodePtr aContainer);
+  void setContainerNode(in Node aContainer);
 
   /**
    *  Documents typically have an intrinsic character set,
    *  but if no intrinsic value is found, the platform character set
    *  is used. This function overrides both the intrinisc and platform
    *  charset.
    *  @param aCharset Overrides the both the intrinsic or platform
    *  character set when encoding the document.
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -1372,17 +1372,17 @@ nsINode::doInsertChildAt(nsIContent* aKi
       nsNodeUtils::ContentAppended(parent, aKid);
     } else {
       nsNodeUtils::ContentInserted(this, aKid);
     }
 
     if (nsContentUtils::HasMutationListeners(aKid,
           NS_EVENT_BITS_MUTATION_NODEINSERTED, this)) {
       InternalMutationEvent mutation(true, eLegacyNodeInserted);
-      mutation.mRelatedNode = do_QueryInterface(this);
+      mutation.mRelatedNode = this;
 
       mozAutoSubtreeModified subtree(OwnerDoc(), this);
       (new AsyncEventDispatcher(aKid, mutation))->RunDOMEventWhenSafe();
     }
   }
 
   return NS_OK;
 }
--- a/dom/base/nsINode.h
+++ b/dom/base/nsINode.h
@@ -6,17 +6,16 @@
 
 #ifndef nsINode_h___
 #define nsINode_h___
 
 #include "mozilla/Likely.h"
 #include "mozilla/UniquePtr.h"
 #include "nsCOMPtr.h"               // for member, local
 #include "nsGkAtoms.h"              // for nsGkAtoms::baseURIProperty
-#include "nsIDOMNode.h"
 #include "mozilla/dom/NodeInfo.h"            // member (in nsCOMPtr)
 #include "nsIVariant.h"             // for use in GetUserData()
 #include "nsIWeakReference.h"
 #include "nsNodeInfoManager.h"      // for use in NodePrincipal()
 #include "nsPropertyTable.h"        // for typedefs
 #include "nsTObserverArray.h"       // for member
 #include "mozilla/ErrorResult.h"
 #include "mozilla/LinkedList.h"
@@ -582,18 +581,16 @@ public:
   /**
    * Return whether the node is an Attr node.
    */
   bool IsAttr() const
   {
     return NodeType() == ATTRIBUTE_NODE;
   }
 
-  virtual nsIDOMNode* AsDOMNode() = 0;
-
   /**
    * Return if this node has any children.
    */
   bool HasChildren() const { return !!mFirstChild; }
 
   /**
    * Get the number of children
    * @return the number of children
@@ -691,17 +688,17 @@ public:
   /**
    * Returns OwnerDoc() if the node is in uncomposed document and ShadowRoot if
    * the node is in Shadow DOM and is in composed document.
    */
   mozilla::dom::DocumentOrShadowRoot* GetUncomposedDocOrConnectedShadowRoot() const;
 
   /**
    * The values returned by this function are the ones defined for
-   * nsIDOMNode.nodeType
+   * Node.nodeType
    */
   uint16_t NodeType() const
   {
     return mNodeInfo->NodeType();
   }
   const nsString& NodeName() const
   {
     return mNodeInfo->NodeName();
@@ -2116,21 +2113,16 @@ protected:
     // object itself, or is reset by ClearSubtreeRootPointer.
     nsINode* MOZ_NON_OWNING_REF mSubtreeRoot;
   };
 
   // Storage for more members that are usually not needed; allocated lazily.
   nsSlots* mSlots;
 };
 
-inline nsIDOMNode* GetAsDOMNode(nsINode* aNode)
-{
-  return aNode ? aNode->AsDOMNode() : nullptr;
-}
-
 // Useful inline function for getting a node given an nsIContent and an
 // nsIDocument.  Returns the first argument cast to nsINode if it is non-null,
 // otherwise returns the second (which may be null).  We use type variables
 // instead of nsIContent* and nsIDocument* because the actual types must be
 // known for the cast to work.
 template<class C, class D>
 inline nsINode* NODE_FROM(C& aContent, D& aDocument)
 {
--- a/dom/base/nsISelectionController.idl
+++ b/dom/base/nsISelectionController.idl
@@ -11,19 +11,19 @@ typedef short SelectionRegion;
 namespace mozilla {
 namespace dom {
 class Selection;
 } // namespace dom
 } // namespace mozilla
 %}
 
 interface nsIContent;
-interface nsIDOMNode;
 interface nsISelectionDisplay;
 
+webidl Node;
 webidl Selection;
 
 [scriptable, uuid(3801c9d4-8e69-4bfc-9edb-b58278621f8f)]
 interface nsISelectionController : nsISelectionDisplay
 {
    // RawSelectionType values:
    const short SELECTION_NONE                      = 0;
    const short SELECTION_NORMAL                    = 1;
@@ -280,17 +280,17 @@ interface nsISelectionController : nsISe
 
   /** CheckVisibility will return true if textnode and offsets are actually rendered
    *  in the current precontext.
    *  @param aNode textNode to test
    *  @param aStartOffset  offset in dom to first char of textnode to test
    *  @param aEndOffset    offset in dom to last char of textnode to test
    *  @param aReturnBool   boolean returned TRUE if visible FALSE if not
    */
-    boolean checkVisibility(in nsIDOMNode node, in short startOffset, in short endOffset);
+    boolean checkVisibility(in Node node, in short startOffset, in short endOffset);
     [noscript,nostdcall] boolean checkVisibilityContent(in nsIContent node, in short startOffset, in short endOffset);
 };
 %{ C++
    #define NS_ISELECTIONCONTROLLER_CID \
    { 0x513b9460, 0xd56a, 0x4c4e, \
    { 0xb6, 0xf9, 0x0b, 0x8a, 0xe4, 0x37, 0x2a, 0x3b }}
 
 namespace mozilla {
--- a/dom/base/nsImageLoadingContent.cpp
+++ b/dom/base/nsImageLoadingContent.cpp
@@ -29,17 +29,16 @@
 #include "nsSVGImageFrame.h"
 
 #include "nsIPresShell.h"
 
 #include "nsIChannel.h"
 #include "nsIStreamListener.h"
 
 #include "nsIFrame.h"
-#include "nsIDOMNode.h"
 
 #include "nsContentUtils.h"
 #include "nsLayoutUtils.h"
 #include "nsIContentPolicy.h"
 #include "SVGObserverUtils.h"
 
 #include "gfxPrefs.h"
 
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -8,17 +8,16 @@
  * Implementation of the DOM Range object.
  */
 
 #include "nscore.h"
 #include "nsRange.h"
 
 #include "nsString.h"
 #include "nsReadableUtils.h"
-#include "nsIDOMNode.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsError.h"
 #include "nsIContentIterator.h"
 #include "nsINodeList.h"
 #include "nsGkAtoms.h"
 #include "nsContentUtils.h"
 #include "nsTextFrame.h"
--- a/dom/base/nsRange.h
+++ b/dom/base/nsRange.h
@@ -9,17 +9,16 @@
  */
 
 #ifndef nsRange_h___
 #define nsRange_h___
 
 #include "nsCOMPtr.h"
 #include "nsINode.h"
 #include "nsIDocument.h"
-#include "nsIDOMNode.h"
 #include "nsLayoutUtils.h"
 #include "prmon.h"
 #include "nsStubMutationObserver.h"
 #include "nsWrapperCache.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/GuardObjects.h"
 #include "mozilla/LinkedList.h"
 #include "mozilla/RangeBoundary.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 "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/nsTextNode.cpp
+++ b/dom/base/nsTextNode.cpp
@@ -94,17 +94,17 @@ private:
 };
 
 nsTextNode::~nsTextNode()
 {
 }
 
 // Use the CC variant of this, even though this class does not define
 // a new CC participant, to make QIing to the CC interfaces faster.
-NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(nsTextNode, CharacterData, nsIDOMNode)
+NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(nsTextNode, CharacterData)
 
 JSObject*
 nsTextNode::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return TextBinding::Wrap(aCx, this, aGivenProto);
 }
 
 bool
--- a/dom/base/nsTextNode.h
+++ b/dom/base/nsTextNode.h
@@ -8,26 +8,24 @@
 #define nsTextNode_h
 
 /*
  * Implementation of DOM Core's Text node.
  */
 
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/Text.h"
-#include "nsIDOMNode.h"
 #include "nsDebug.h"
 
 class nsNodeInfoManager;
 
 /**
  * Class used to implement DOM text nodes
  */
-class nsTextNode : public mozilla::dom::Text,
-                   public nsIDOMNode
+class nsTextNode : public mozilla::dom::Text
 {
 private:
   void Init()
   {
     MOZ_ASSERT(mNodeInfo->NodeType() == TEXT_NODE,
                "Bad NodeType in aNodeInfo");
   }
 
@@ -58,18 +56,16 @@ public:
                               nsIContent* aBindingParent,
                               bool aCompileEventHandlers) override;
   virtual void UnbindFromTree(bool aDeep = true,
                               bool aNullParent = true) override;
 
   nsresult AppendTextForNormalize(const char16_t* aBuffer, uint32_t aLength,
                                   bool aNotify, nsIContent* aNextSibling);
 
-  virtual nsIDOMNode* AsDOMNode() override { return this; }
-
   // Need to have a copy here because including nsDocument.h in this file will
   // fail to build on Windows.
   static bool IsShadowDOMEnabled(JSContext* aCx, JSObject* aObject);
 
 #ifdef DEBUG
   virtual void List(FILE* out, int32_t aIndent) const override;
   virtual void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const override;
 #endif
--- a/dom/base/nsTraversal.cpp
+++ b/dom/base/nsTraversal.cpp
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  *
  * 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 "nsTraversal.h"
 
-#include "nsIDOMNode.h"
 #include "nsError.h"
 #include "nsINode.h"
 #include "mozilla/AutoRestore.h"
 #include "mozilla/dom/NodeFilterBinding.h"
 
 #include "nsGkAtoms.h"
 
 using namespace mozilla;
--- a/dom/base/test/test_bug352728.html
+++ b/dom/base/test/test_bug352728.html
@@ -21,44 +21,32 @@ https://bugzilla.mozilla.org/show_bug.cg
 function checkTypes(aNode, aNodeType, aTypeArray)
 {
   for (var i = 0; i < aTypeArray.length; ++i) {
     ok(aNode instanceof aTypeArray[i], aNodeType + " type test " + i,
        aNodeType + " should be a " + aTypeArray[i]);
   }
 }
 
-function checkInterfaces(aNode, aNodeType, aInterfaceArray)
-{
-  for (var i = 0; i < aInterfaceArray.length; ++i) {
-    ok(aNode instanceof SpecialPowers.Ci[aInterfaceArray[i]],
-       aNodeType + " interface test " + i,
-       aNodeType + " should be a " + aInterfaceArray[i]);
-  }
-}
-
 function testCharacterData(aNode, aText)
 {
   is(aNode.length, aText.length, "Text length should match");
   is(aNode.data, aText, "Text content should match");
   is(aNode.nodeValue, aText, "Check nodeValue");
   is(aNode.localName, undefined, "Check localName")
   is(aNode.namespaceURI, undefined, "Check namespaceURI");
 }
 
 function testComment(aText)
 {
   try {
     var comment = document.createComment(aText);
     var types = [ Comment, CharacterData, Node ];
     checkTypes(comment, "comment", types);
 
-    var interfaces = [ "nsIDOMNode" ];
-    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);
   }
 }
 
@@ -76,19 +64,16 @@ function testCDATASection(aText, aShould
 
 function testPI(aTarget, aData, aShouldSucceed, aReason)
 {
   try {
     var pi = document.createProcessingInstruction(aTarget, aData);
     var types = [ ProcessingInstruction, Node ];
     checkTypes(pi, "processing instruction", types);
 
-    var interfaces = [ "nsIDOMNode" ];
-    checkInterfaces(pi, "processing instruction", interfaces);
-
     is(pi.target, aTarget, "Check target");
     is(pi.data, aData, "Check data");
     is(pi.nodeName, aTarget, "Check nodeName");
     is(pi.nodeValue, aData, "Check nodeValue");
     is(pi.localName, undefined, "Check localName")
     is(pi.namespaceURI, undefined, "Check namespaceURI");
     
     is(pi.nodeType, Node.PROCESSING_INSTRUCTION_NODE, "Check nodeType");
--- 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 = [ "nsIDOMNode" ];
+    var interfaces = [];
     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);
   }
@@ -88,17 +88,17 @@ function testComment(aText)
 
 function testCDATASection(aText, aShouldSucceed)
 {
   try {
     var cdataSection = document.createCDATASection(aText);
     var types = [ CDATASection, CharacterData, Node ];
     checkTypes(cdataSection, "CDATA section", types);
 
-    var interfaces = [ "nsIDOMNode" ];
+    var interfaces = [];
     checkInterfaces(cdataSection, "CDATA section", interfaces);
 
     testCharacterData(cdataSection, aText);
     is(cdataSection.nodeName, "#cdata-section", "Check nodeName");
     is(cdataSection.nodeType, Node.CDATA_SECTION_NODE, "Check nodeType");
 
     if (!aShouldSucceed) {
       ok(0, "Invalid CDATA section creation",
@@ -119,17 +119,17 @@ function testCDATASection(aText, aShould
 
 function testPI(aTarget, aData, aShouldSucceed, aReason)
 {
   try {
     var pi = document.createProcessingInstruction(aTarget, aData);
     var types = [ ProcessingInstruction, Node ];
     checkTypes(pi, "processing instruction", types);
 
-    var interfaces = [ "nsIDOMNode" ];
+    var interfaces = [];
     checkInterfaces(pi, "processing instruction", interfaces);
 
     is(pi.target, aTarget, "Check target");
     is(pi.data, aData, "Check data");
     is(pi.nodeName, aTarget, "Check nodeName");
     is(pi.nodeValue, aData, "Check nodeValue");
     is(pi.localName, undefined, "Check localName")
     is(pi.namespaceURI, undefined, "Check namespaceURI");
--- a/dom/base/test/unit/head_xml.js
+++ b/dom/base/test/unit/head_xml.js
@@ -7,19 +7,17 @@
 const I                    = Ci;
 const C                    = Cc;
 
 const nsIFile         = I.nsIFile;
 const nsIProperties        = I.nsIProperties;
 const nsIFileInputStream   = I.nsIFileInputStream;
 const nsIInputStream       = I.nsIInputStream;
 
-const nsIDOMNode           = I.nsIDOMNode;
-
-Cu.importGlobalProperties(["DOMParser", "Element", "XMLSerializer"]);
+Cu.importGlobalProperties(["DOMParser", "Element", "Node", "XMLSerializer"]);
 
 function getParser() {
   var parser = new DOMParser();
   parser.forceEnableXULXBL();
   return parser;
 }
 
 var __testsDirectory = null;
@@ -62,17 +60,17 @@ function SerializeXML(node) {
   return DOMSerializer().serializeToString(node);
 }
 
 function roundtrip(obj) {
   if (typeof(obj) == "string") {
     return SerializeXML(ParseXML(obj));
   }
 
-  Assert.equal(obj instanceof nsIDOMNode, true);
+  Assert.equal(Node.isInstance(obj), true);
   return ParseXML(SerializeXML(obj));
 }
 
 function do_compare_attrs(e1, e2) {
   const xmlns = "http://www.w3.org/2000/xmlns/";
 
   var a1 = e1.attributes;
   var a2 = e2.attributes;
@@ -89,33 +87,33 @@ function do_compare_attrs(e1, e2) {
       Assert.equal(att.value, att2.value);
     }
   }
 }
 
 function do_check_equiv(dom1, dom2) {
   Assert.equal(dom1.nodeType, dom2.nodeType);
   switch (dom1.nodeType) {
-  case nsIDOMNode.PROCESSING_INSTRUCTION_NODE:
+  case Node.PROCESSING_INSTRUCTION_NODE:
     Assert.equal(dom1.target, dom2.target);
     Assert.equal(dom1.data, dom2.data);
-  case nsIDOMNode.TEXT_NODE:
-  case nsIDOMNode.CDATA_SECTION_NODE:
-  case nsIDOMNode.COMMENT_NODE:
+  case Node.TEXT_NODE:
+  case Node.CDATA_SECTION_NODE:
+  case Node.COMMENT_NODE:
     Assert.equal(dom1.data, dom2.data);
     break;
-  case nsIDOMNode.ELEMENT_NODE:
+  case Node.ELEMENT_NODE:
     Assert.equal(dom1.namespaceURI, dom2.namespaceURI);
     Assert.equal(dom1.localName, dom2.localName);
     // Compare attrs in both directions -- do_compare_attrs does a
     // subset check.
     do_compare_attrs(dom1, dom2);
     do_compare_attrs(dom2, dom1);
     // Fall through
-  case nsIDOMNode.DOCUMENT_NODE:
+  case Node.DOCUMENT_NODE:
     Assert.equal(dom1.childNodes.length, dom2.childNodes.length);
     for (var i = 0; i < dom1.childNodes.length; ++i) {
       do_check_equiv(dom1.childNodes.item(i), dom2.childNodes.item(i));
     }
     break;
   }
 }
 
--- a/dom/base/test/unit/test_range.js
+++ b/dom/base/test/unit/test_range.js
@@ -48,17 +48,17 @@ function dumpFragment(aFragment) {
 
 /**
  * Translate an XPath to a DOM node. This method uses a document
  * fragment as context node.
  *
  * @param aContextNode The context node to apply the XPath to.
  * @param aPath        The XPath to use.
  *
- * @return nsIDOMNode  The target node retrieved from the XPath.
+ * @return Node  The target node retrieved from the XPath.
  */
 function evalXPathInDocumentFragment(aContextNode, aPath) {
   Assert.equal(ChromeUtils.getClassName(aContextNode), "DocumentFragment");
   Assert.ok(aContextNode.childNodes.length > 0);
   if (aPath == ".") {
     return aContextNode;
   }
 
@@ -236,17 +236,17 @@ function do_extract_test(doc) {
     Assert.equal(baseExtract.nextSibling, null);
 
     /* We do all our tests on DOM document fragments, derived from the test
        element's children.  This lets us rip the various fragments to shreds,
        while preserving the original elements so we can make more copies of
        them.
 
        After the range's extraction or deletion is done, we use
-       nsIDOMNode.isEqualNode() between the altered source fragment and the
+       Node.isEqualNode() between the altered source fragment and the
        result fragment.  We also run isEqualNode() between the extracted
        fragment and the fragment from the baseExtract node.  If they are not
        equal, we have failed a test.
 
        We also have to ensure the original nodes on the end points of the
        range are still in the source fragment.  This is bug 332148.  The nodes
        may not be replaced with equal but separate nodes.  The range extraction
        may alter these nodes - in the case of text containers, they will - but
--- a/dom/events/DataTransfer.cpp
+++ b/dom/events/DataTransfer.cpp
@@ -426,25 +426,24 @@ DataTransfer::SetMozCursor(const nsAStri
 already_AddRefed<nsINode>
 DataTransfer::GetMozSourceNode()
 {
   nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
   if (!dragSession) {
     return nullptr;
   }
 
-  nsCOMPtr<nsIDOMNode> sourceNode;
+  nsCOMPtr<nsINode> sourceNode;
   dragSession->GetSourceNode(getter_AddRefs(sourceNode));
-  nsCOMPtr<nsINode> node = do_QueryInterface(sourceNode);
-  if (node && !nsContentUtils::LegacyIsCallerNativeCode()
-      && !nsContentUtils::CanCallerAccess(node)) {
+  if (sourceNode && !nsContentUtils::LegacyIsCallerNativeCode()
+      && !nsContentUtils::CanCallerAccess(sourceNode)) {
     return nullptr;
   }
 
-  return node.forget();
+  return sourceNode.forget();
 }
 
 already_AddRefed<DOMStringList>
 DataTransfer::MozTypesAt(uint32_t aIndex, CallerType aCallerType,
                          ErrorResult& aRv) const
 {
   // Only the first item is valid for clipboard events
   if (aIndex > 0 &&
@@ -739,17 +738,17 @@ void
 DataTransfer::UpdateDragImage(Element& aImage, int32_t aX, int32_t aY)
 {
   if (mEventMessage < eDragDropEventFirst || mEventMessage > eDragDropEventLast) {
     return;
   }
 
   nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
   if (dragSession) {
-    dragSession->UpdateDragImage(aImage.AsDOMNode(), aX, aY);
+    dragSession->UpdateDragImage(&aImage, aX, aY);
   }
 }
 
 already_AddRefed<Promise>
 DataTransfer::GetFilesAndDirectories(nsIPrincipal& aSubjectPrincipal,
                                      ErrorResult& aRv)
 {
   nsCOMPtr<nsINode> parentNode = do_QueryInterface(mParent);
@@ -817,26 +816,21 @@ DataTransfer::Clone(nsISupports* aParent
                      mClipboardType, mItems, mDragImage, mDragImageX,
                      mDragImageY);
 
   newDataTransfer.forget(aNewDataTransfer);
   return NS_OK;
 }
 
 already_AddRefed<nsIArray>
-DataTransfer::GetTransferables(nsIDOMNode* aDragTarget)
+DataTransfer::GetTransferables(nsINode* aDragTarget)
 {
   MOZ_ASSERT(aDragTarget);
 
-  nsCOMPtr<nsINode> dragNode = do_QueryInterface(aDragTarget);
-  if (!dragNode) {
-    return nullptr;
-  }
-
-  nsIDocument* doc = dragNode->GetComposedDoc();
+  nsIDocument* doc = aDragTarget->GetComposedDoc();
   if (!doc) {
     return nullptr;
   }
 
   return GetTransferables(doc->GetLoadContext());
 }
 
 already_AddRefed<nsIArray>
--- a/dom/events/DataTransfer.h
+++ b/dom/events/DataTransfer.h
@@ -337,17 +337,17 @@ public:
     return mEventMessage;
   }
   bool IsCrossDomainSubFrameDrop() const {
     return mIsCrossDomainSubFrameDrop;
   }
 
   // converts the data into an array of nsITransferable objects to be used for
   // drag and drop or clipboard operations.
-  already_AddRefed<nsIArray> GetTransferables(nsIDOMNode* aDragTarget);
+  already_AddRefed<nsIArray> GetTransferables(nsINode* aDragTarget);
 
   already_AddRefed<nsIArray>
   GetTransferables(nsILoadContext* aLoadContext);
 
   // converts the data for a single item at aIndex into an nsITransferable
   // object.
   already_AddRefed<nsITransferable>
   GetTransferable(uint32_t aIndex, nsILoadContext* aLoadContext);
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -2101,18 +2101,17 @@ EventStateManager::DoDefaultDragStart(ns
     action = nsIDragService::DRAGDROP_ACTION_COPY |
              nsIDragService::DRAGDROP_ACTION_MOVE |
              nsIDragService::DRAGDROP_ACTION_LINK;
 
   // get any custom drag image that was set
   int32_t imageX, imageY;
   Element* dragImage = aDataTransfer->GetDragImage(&imageX, &imageY);
 
-  nsCOMPtr<nsIArray> transArray =
-    aDataTransfer->GetTransferables(dragTarget->AsDOMNode());
+  nsCOMPtr<nsIArray> transArray = aDataTransfer->GetTransferables(dragTarget);
   if (!transArray)
     return false;
 
   // After this function returns, the DataTransfer will be cleared so it appears
   // empty to content. We need to pass a DataTransfer into the Drag Session, so
   // we need to make a copy.
   RefPtr<DataTransfer> dataTransfer;
   aDataTransfer->Clone(aDragTarget, eDrop, aDataTransfer->MozUserCancelled(),
@@ -2152,21 +2151,20 @@ EventStateManager::DoDefaultDragStart(ns
           do_QueryFrame(dragTarget->GetPrimaryFrame());
         if (treeBody) {
           treeBody->GetSelectionRegion(getter_AddRefs(region));
         }
       }
     }
 #endif
 
-    dragService->InvokeDragSessionWithImage(dragTarget->AsDOMNode(),
+    dragService->InvokeDragSessionWithImage(dragTarget,
                                             aPrincipalURISpec, transArray,
                                             region, action,
-                                            dragImage ? dragImage->AsDOMNode() :
-                                                        nullptr,
+                                            dragImage,
                                             imageX, imageY, event,
                                             dataTransfer);
   }
 
   return true;
 }
 
 nsresult
--- a/dom/events/InternalMutationEvent.h
+++ b/dom/events/InternalMutationEvent.h
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_MutationEvent_h__
 #define mozilla_MutationEvent_h__
 
 #include "mozilla/BasicEvents.h"
 #include "nsCOMPtr.h"
 #include "nsAtom.h"
-#include "nsIDOMNode.h"
+#include "nsINode.h"
 
 namespace mozilla {
 
 class InternalMutationEvent : public WidgetEvent
 {
 public:
   virtual InternalMutationEvent* AsMutationEvent() override { return this; }
 
@@ -31,17 +31,17 @@ public:
     MOZ_ASSERT(mClass == eMutationEventClass,
                "Duplicate() must be overridden by sub class");
     InternalMutationEvent* result = new InternalMutationEvent(false, mMessage);
     result->AssignMutationEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
 
-  nsCOMPtr<nsIDOMNode> mRelatedNode;
+  nsCOMPtr<nsINode> mRelatedNode;
   RefPtr<nsAtom>    mAttrName;
   RefPtr<nsAtom>    mPrevAttrValue;
   RefPtr<nsAtom>    mNewAttrValue;
   unsigned short       mAttrChange;
 
   void AssignMutationEventData(const InternalMutationEvent& aEvent,
                                bool aCopyTargets)
   {
--- a/dom/events/MutationEvent.cpp
+++ b/dom/events/MutationEvent.cpp
@@ -17,22 +17,20 @@ MutationEvent::MutationEvent(EventTarget
                              nsPresContext* aPresContext,
                              InternalMutationEvent* aEvent)
   : Event(aOwner, aPresContext,
           aEvent ? aEvent : new InternalMutationEvent(false, eVoidEvent))
 {
   mEventIsInternal = (aEvent == nullptr);
 }
 
-already_AddRefed<nsINode>
+nsINode*
 MutationEvent::GetRelatedNode()
 {
-  nsCOMPtr<nsINode> n =
-    do_QueryInterface(mEvent->AsMutationEvent()->mRelatedNode);
-  return n.forget();
+  return mEvent->AsMutationEvent()->mRelatedNode;
 }
 
 void
 MutationEvent::GetPrevValue(nsAString& aPrevValue) const
 {
   InternalMutationEvent* mutation = mEvent->AsMutationEvent();
   if (mutation->mPrevAttrValue)
     mutation->mPrevAttrValue->ToString(aPrevValue);
@@ -70,17 +68,17 @@ MutationEvent::InitMutationEvent(const n
                                  uint16_t& aAttrChange,
                                  ErrorResult& aRv)
 {
   NS_ENSURE_TRUE_VOID(!mEvent->mFlags.mIsBeingDispatched);
 
   Event::InitEvent(aType, aCanBubble, aCancelable);
 
   InternalMutationEvent* mutation = mEvent->AsMutationEvent();
-  mutation->mRelatedNode = aRelatedNode ? aRelatedNode->AsDOMNode() : nullptr;
+  mutation->mRelatedNode = aRelatedNode;
   if (!aPrevValue.IsEmpty())
     mutation->mPrevAttrValue = NS_Atomize(aPrevValue);
   if (!aNewValue.IsEmpty())
     mutation->mNewAttrValue = NS_Atomize(aNewValue);
   if (!aAttrName.IsEmpty()) {
     mutation->mAttrName = NS_Atomize(aAttrName);
   }
   mutation->mAttrChange = aAttrChange;
--- a/dom/events/MutationEvent.h
+++ b/dom/events/MutationEvent.h
@@ -28,17 +28,17 @@ public:
   {
     return MutationEventBinding::Wrap(aCx, this, aGivenProto);
   }
 
   void GetPrevValue(nsAString& aPrevValue) const;
   void GetNewValue(nsAString& aNewValue) const;
   void GetAttrName(nsAString& aAttrName) const;
 
-  already_AddRefed<nsINode> GetRelatedNode();
+  nsINode* GetRelatedNode();
 
   uint16_t AttrChange();
 
   void InitMutationEvent(const nsAString& aType,
                          bool aCanBubble, bool aCancelable,
                          nsINode* aRelatedNode,
                          const nsAString& aPrevValue,
                          const nsAString& aNewValue,
--- a/dom/events/UIEvent.cpp
+++ b/dom/events/UIEvent.cpp
@@ -13,17 +13,16 @@
 #include "mozilla/EventStateManager.h"
 #include "mozilla/TextEvents.h"
 #include "nsCOMPtr.h"
 #include "nsContentUtils.h"
 #include "nsIContent.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIDocShell.h"
 #include "nsIDOMWindow.h"
-#include "nsIDOMNode.h"
 #include "nsIFrame.h"
 #include "prtime.h"
 
 namespace mozilla {
 namespace dom {
 
 UIEvent::UIEvent(EventTarget* aOwner,
                  nsPresContext* aPresContext,
--- a/dom/flex/test/chrome/test_flex_items.html
+++ b/dom/flex/test/chrome/test_flex_items.html
@@ -36,17 +36,17 @@
   #second	     { width: 100px; }
 </style>
 
 <script>
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 
-const TEXT_NODE = Ci.nsIDOMNode.TEXT_NODE;
+const TEXT_NODE = Node.TEXT_NODE;
 
 function testItemMatchesExpectedValues(item, values, index) {
   if (typeof(values.node) != "undefined") {
     is(item.node, values.node, "Item index " + index + " has expected node.");
   }
 
   if (typeof(values.node_todo) != "undefined") {
     todo_is(item.node, values.node_todo, "Item index " + index + " has expected node.");
--- a/dom/html/HTMLAudioElement.h
+++ b/dom/html/HTMLAudioElement.h
@@ -30,18 +30,16 @@ public:
 
   // nsIDOMHTMLMediaElement
   using HTMLMediaElement::GetPaused;
 
   virtual nsresult Clone(NodeInfo *aNodeInfo, nsINode **aResult,
                          bool aPreallocateChildren) const override;
   virtual nsresult SetAcceptHeader(nsIHttpChannel* aChannel) override;
 
-  virtual nsIDOMNode* AsDOMNode() override { return this; }
-
   // WebIDL
 
   static already_AddRefed<HTMLAudioElement>
   Audio(const GlobalObject& aGlobal,
         const Optional<nsAString>& aSrc, ErrorResult& aRv);
 
 protected:
   virtual ~HTMLAudioElement();
--- a/dom/html/HTMLFormControlsCollection.cpp
+++ b/dom/html/HTMLFormControlsCollection.cpp
@@ -8,17 +8,16 @@
 
 #include "mozilla/FlushType.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/HTMLFormControlsCollectionBinding.h"
 #include "mozilla/dom/HTMLFormElement.h"
 #include "nsGenericHTMLElement.h" // nsGenericHTMLFormElement
 #include "nsIDocument.h"
-#include "nsIDOMNode.h"
 #include "nsIFormControl.h"
 #include "RadioNodeList.h"
 #include "jsfriendapi.h"
 
 namespace mozilla {
 namespace dom {
 
 /* static */ bool
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -1117,17 +1117,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLInputElement,
                                              nsGenericHTMLFormElementWithState,
                                              nsITextControlElement,
                                              imgINotificationObserver,
                                              nsIImageLoadingContent,
                                              nsIDOMNSEditableElement,
                                              nsIConstraintValidation)
 
-// nsIDOMNode
+// nsINode
 
 nsresult
 HTMLInputElement::Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
                         bool aPreallocateArrays) const
 {
   *aResult = nullptr;
 
   already_AddRefed<mozilla::dom::NodeInfo> ni = RefPtr<mozilla::dom::NodeInfo>(aNodeInfo).forget();
--- a/dom/html/HTMLOptGroupElement.h
+++ b/dom/html/HTMLOptGroupElement.h
@@ -40,18 +40,16 @@ public:
                          bool aPreallocateChildren) const override;
 
   virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
                                 const nsAttrValue* aValue,
                                 const nsAttrValue* aOldValue,
                                 nsIPrincipal* aSubjectPrincipal,
                                 bool aNotify) override;
 
-  virtual nsIDOMNode* AsDOMNode() override { return this; }
-
   bool Disabled() const
   {
     return GetBoolAttr(nsGkAtoms::disabled);
   }
   void SetDisabled(bool aValue, ErrorResult& aError)
   {
      SetHTMLBoolAttr(nsGkAtoms::disabled, aValue, aError);
   }
--- a/dom/html/HTMLOptionElement.cpp
+++ b/dom/html/HTMLOptionElement.cpp
@@ -6,17 +6,16 @@
 
 #include "mozilla/dom/HTMLOptionElement.h"
 #include "mozilla/dom/HTMLOptionElementBinding.h"
 #include "mozilla/dom/HTMLSelectElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsIFormControl.h"
 #include "nsIForm.h"
-#include "nsIDOMNode.h"
 #include "nsISelectControlFrame.h"
 
 // Notify/query select frame for selected state
 #include "nsIFormControlFrame.h"
 #include "nsIDocument.h"
 #include "nsNodeInfoManager.h"
 #include "nsCOMPtr.h"
 #include "mozilla/EventStates.h"
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -99,23 +99,16 @@
 #include "nsComputedDOMStyle.h"
 #include "ReferrerPolicy.h"
 #include "mozilla/dom/HTMLLabelElement.h"
 #include "mozilla/dom/HTMLInputElement.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
-NS_IMPL_ADDREF_INHERITED(nsGenericHTMLElement, nsGenericHTMLElementBase)
-NS_IMPL_RELEASE_INHERITED(nsGenericHTMLElement, nsGenericHTMLElementBase)
-
-NS_INTERFACE_MAP_BEGIN(nsGenericHTMLElement)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
-NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElementBase)
-
 nsresult
 nsGenericHTMLElement::CopyInnerTo(Element* aDst, bool aPreallocateChildren)
 {
   MOZ_ASSERT(!aDst->GetUncomposedDoc(),
              "Should not CopyInnerTo an Element in a document");
   nsresult rv;
 
   bool reparse = (aDst->OwnerDoc() != OwnerDoc());
--- a/dom/html/nsGenericHTMLElement.h
+++ b/dom/html/nsGenericHTMLElement.h
@@ -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/. */
 #ifndef nsGenericHTMLElement_h___
 #define nsGenericHTMLElement_h___
 
 #include "mozilla/Attributes.h"
 #include "mozilla/EventForwards.h"
 #include "nsMappedAttributeElement.h"
-#include "nsIDOMNode.h"
 #include "nsNameSpaceManager.h"  // for kNameSpaceID_None
 #include "nsIFormControl.h"
 #include "nsGkAtoms.h"
 #include "nsContentCreatorFunctions.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "mozilla/dom/DOMRect.h"
 #include "mozilla/dom/ValidityState.h"
@@ -41,32 +40,32 @@ class HTMLMenuElement;
 } // namespace dom
 } // namespace mozilla
 
 typedef nsMappedAttributeElement nsGenericHTMLElementBase;
 
 /**
  * A common superclass for HTML elements
  */
-class nsGenericHTMLElement : public nsGenericHTMLElementBase,
-                             public nsIDOMNode
+class nsGenericHTMLElement : public nsGenericHTMLElementBase
 {
 public:
   using Element::SetTabIndex;
   using Element::Focus;
   explicit nsGenericHTMLElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
     : nsGenericHTMLElementBase(aNodeInfo)
   {
     NS_ASSERTION(mNodeInfo->NamespaceID() == kNameSpaceID_XHTML,
                  "Unexpected namespace");
     AddStatesSilently(NS_EVENT_STATE_LTR);
     SetFlags(NODE_HAS_DIRECTION_LTR);
   }
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsGenericHTMLElement,
+                                       nsGenericHTMLElementBase)
 
   NS_IMPL_FROMNODE(nsGenericHTMLElement, kNameSpaceID_XHTML)
 
   // From Element
   nsresult CopyInnerTo(mozilla::dom::Element* aDest, bool aPreallocateChildren);
 
   void GetTitle(mozilla::dom::DOMString& aTitle)
   {
@@ -264,18 +263,16 @@ public:
   /**
    * Get width and height, using given image request if attributes are unset.
    * Pass a reference to the image request, since the method may change the
    * value and we want to use the updated value.
    */
   MOZ_CAN_RUN_SCRIPT
   nsSize GetWidthHeightForImage(RefPtr<imgRequestProxy>& aImageRequest);
 
-  virtual nsIDOMNode* AsDOMNode() override { return this; }
-
 public:
   // Implementation for nsIContent
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent,
                               bool aCompileEventHandlers) override;
   virtual void UnbindFromTree(bool aDeep = true,
                               bool aNullParent = true) override;
 
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -17,17 +17,16 @@
 #include "nsUnicharUtils.h"
 #include "nsIHTMLContentSink.h"
 #include "nsIXMLContentSink.h"
 #include "nsHTMLParts.h"
 #include "nsHTMLStyleSheet.h"
 #include "nsGkAtoms.h"
 #include "nsIPresShell.h"
 #include "nsPresContext.h"
-#include "nsIDOMNode.h" // for Find
 #include "nsPIDOMWindow.h"
 #include "nsDOMString.h"
 #include "nsIStreamListener.h"
 #include "nsIURI.h"
 #include "nsIURIMutator.h"
 #include "nsIIOService.h"
 #include "nsNetUtil.h"
 #include "nsIPrivateBrowsingChannel.h"
@@ -1174,17 +1173,17 @@ nsHTMLDocument::SetCookie(const nsAStrin
 already_AddRefed<nsPIDOMWindowOuter>
 nsHTMLDocument::Open(JSContext* /* unused */,
                      const nsAString& aURL,
                      const nsAString& aName,
                      const nsAString& aFeatures,
                      bool aReplace,
                      ErrorResult& rv)
 {
-  MOZ_ASSERT(nsContentUtils::CanCallerAccess(static_cast<nsIDOMNode*>(this)),
+  MOZ_ASSERT(nsContentUtils::CanCallerAccess(this),
              "XOW should have caught this!");
 
   nsCOMPtr<nsPIDOMWindowInner> window = GetInnerWindow();
   if (!window) {
     rv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
     return nullptr;
   }
   nsCOMPtr<nsPIDOMWindowOuter> outer =
@@ -1204,17 +1203,17 @@ already_AddRefed<nsIDocument>
 nsHTMLDocument::Open(JSContext* cx,
                      const Optional<nsAString>& /* unused */,
                      const nsAString& aReplace,
                      ErrorResult& aError)
 {
   // Implements the "When called with two arguments (or fewer)" steps here:
   // https://html.spec.whatwg.org/multipage/webappapis.html#opening-the-input-stream
 
-  MOZ_ASSERT(nsContentUtils::CanCallerAccess(static_cast<nsIDOMNode*>(this)),
+  MOZ_ASSERT(nsContentUtils::CanCallerAccess(this),
              "XOW should have caught this!");
   if (!IsHTMLDocument() || mDisableDocWrite) {
     // No calling document.open() on XHTML
     aError.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return nullptr;
   }
 
   if (ShouldThrowOnDynamicMarkupInsertion()) {
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -320,17 +320,17 @@ public:
   NS_IMETHOD IntraLineMove(bool aForward, bool aExtend) override;
   NS_IMETHOD PageMove(bool aForward, bool aExtend) override;
   NS_IMETHOD CompleteScroll(bool aForward) override;
   NS_IMETHOD CompleteMove(bool aForward, bool aExtend) override;
   NS_IMETHOD ScrollPage(bool aForward) override;
   NS_IMETHOD ScrollLine(bool aForward) override;
   NS_IMETHOD ScrollCharacter(bool aRight) override;
   NS_IMETHOD SelectAll(void) override;
-  NS_IMETHOD CheckVisibility(nsIDOMNode *node, int16_t startOffset, int16_t EndOffset, bool* _retval) override;
+  NS_IMETHOD CheckVisibility(nsINode *node, int16_t startOffset, int16_t EndOffset, bool* _retval) override;
   virtual nsresult CheckVisibilityContent(nsIContent* aNode, int16_t aStartOffset, int16_t aEndOffset, bool* aRetval) override;
 
 private:
   RefPtr<nsFrameSelection> mFrameSelection;
   nsCOMPtr<nsIContent>       mLimiter;
   nsIScrollableFrame        *mScrollFrame;
   nsWeakPtr mPresShellWeak;
 };
@@ -761,17 +761,17 @@ nsTextInputSelectionImpl::SelectAll()
   if (mFrameSelection) {
     RefPtr<nsFrameSelection> frameSelection = mFrameSelection;
     return frameSelection->SelectAll();
   }
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
-nsTextInputSelectionImpl::CheckVisibility(nsIDOMNode *node, int16_t startOffset, int16_t EndOffset, bool *_retval)
+nsTextInputSelectionImpl::CheckVisibility(nsINode *node, int16_t startOffset, int16_t EndOffset, bool *_retval)
 {
   if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
   nsresult result;
   nsCOMPtr<nsISelectionController> shell = do_QueryReferent(mPresShellWeak, &result);
   if (shell)
   {
     return shell->CheckVisibility(node,startOffset,EndOffset, _retval);
   }
--- a/dom/html/test/test_bug389797.html
+++ b/dom/html/test/test_bug389797.html
@@ -29,18 +29,17 @@ function getClassName(tag) {
 
 function HTML_TAG(aTagName, aImplClass) {
   allTags.push(aTagName);
   classInfos[aTagName] = aImplClass;
   interfaces[aTagName] = [];
 
   // Some interfaces don't appear in classinfo because other interfaces that
   // inherit from them do.
-  interfacesNonClassinfo[aTagName] =
-    [ "nsIDOMNode" ];
+  interfacesNonClassinfo[aTagName] = [ ];
 
   var interfaceName = "nsIDOM" + getClassName(aTagName);
   if (interfaceName in SpecialPowers.Ci) {  // no nsIDOMHTMLSpanElement
     interfaces[aTagName].push(interfaceName);
   }
 
   var interfaceNameNS = "nsIDOMNS" + getClassName(aTagName);
   if (interfaceNameNS in SpecialPowers.Ci) {
--- a/dom/indexedDB/PermissionRequestBase.cpp
+++ b/dom/indexedDB/PermissionRequestBase.cpp
@@ -186,34 +186,32 @@ PermissionRequestBase::SetExplicitPermis
                                           aIntPermission,
                                           nsIPermissionManager::EXPIRE_NEVER,
                                           /* aExpireTime */ 0);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return;
   }
 }
 
-NS_IMPL_ISUPPORTS(PermissionRequestBase, nsIObserver, nsIInterfaceRequestor)
+NS_IMPL_ISUPPORTS(PermissionRequestBase, nsIObserver, nsIIDBPermissionsRequest)
 
 NS_IMETHODIMP
-PermissionRequestBase::GetInterface(const nsIID& aIID,
-                                    void** aResult)
+PermissionRequestBase::GetBrowserElement(Element** aElement)
 {
   AssertSanity();
-
-  if (aIID.Equals(NS_GET_IID(nsIObserver))) {
-    return QueryInterface(aIID, aResult);
-  }
+  *aElement = do_AddRef(mOwnerElement).take();
+  return NS_OK;
+}
 
-  if (aIID.Equals(NS_GET_IID(nsIDOMNode)) && mOwnerElement) {
-    return mOwnerElement->QueryInterface(aIID, aResult);
-  }
-
-  *aResult = nullptr;
-  return NS_ERROR_NOT_AVAILABLE;
+NS_IMETHODIMP
+PermissionRequestBase::GetResponseObserver(nsIObserver** aObserver)
+{
+  AssertSanity();
+  *aObserver = do_AddRef(this).take();
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 PermissionRequestBase::Observe(nsISupports* aSubject,
                                const char* aTopic,
                                const char16_t* aData)
 {
   AssertSanity();
--- a/dom/indexedDB/PermissionRequestBase.h
+++ b/dom/indexedDB/PermissionRequestBase.h
@@ -4,34 +4,34 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_indexeddb_permissionrequestbase_h__
 #define mozilla_dom_indexeddb_permissionrequestbase_h__
 
 #include "mozilla/Attributes.h"
 #include "nsCOMPtr.h"
-#include "nsIInterfaceRequestor.h"
+#include "nsIIDBPermissionsRequest.h"
 #include "nsIObserver.h"
 #include "nsIPermissionManager.h"
 #include "nsISupportsImpl.h"
 #include "nsString.h"
 
 class nsIPrincipal;
 
 namespace mozilla {
 namespace dom {
 
 class Element;
 
 namespace indexedDB {
 
 class PermissionRequestBase
   : public nsIObserver
-  , public nsIInterfaceRequestor
+  , public nsIIDBPermissionsRequest
 {
   nsCOMPtr<Element> mOwnerElement;
   nsCOMPtr<nsIPrincipal> mPrincipal;
 
 public:
   enum PermissionValue {
     kPermissionAllowed = nsIPermissionManager::ALLOW_ACTION,
     kPermissionDenied = nsIPermissionManager::DENY_ACTION,
@@ -66,16 +66,16 @@ protected:
   OnPromptComplete(PermissionValue aPermissionValue) = 0;
 
 private:
   void
   SetExplicitPermission(nsIPrincipal* aPrincipal,
                         uint32_t aIntPermission);
 
   NS_DECL_NSIOBSERVER
-  NS_DECL_NSIINTERFACEREQUESTOR
+  NS_DECL_NSIIDBPERMISSIONSREQUEST
 };
 
 } // namespace indexedDB
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_indexeddb_permissionrequestbase_h__
--- a/dom/indexedDB/moz.build
+++ b/dom/indexedDB/moz.build
@@ -104,8 +104,14 @@ if CONFIG['CC_TYPE'] in ('clang', 'gcc')
 LOCAL_INCLUDES += [
     '/db/sqlite3/src',
     '/dom/base',
     '/dom/storage',
     '/ipc/glue',
     '/xpcom/build',
     '/xpcom/threads',
 ]
+
+XPIDL_SOURCES += [
+    'nsIIDBPermissionsRequest.idl',
+]
+
+XPIDL_MODULE = 'dom_indexeddb'
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/nsIIDBPermissionsRequest.idl
@@ -0,0 +1,24 @@
+/* -*- 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/. */
+
+/**
+ * Interface for IDB permission requests.  This is passed as the
+ * subject for the permission request observer service notifications.
+ */
+#include "nsISupports.idl"
+
+interface nsIObserver;
+
+webidl Element;
+
+[scriptable, builtinclass, uuid(c3493c65-0530-496e-995c-bcd38dbfce21)]
+interface nsIIDBPermissionsRequest : nsISupports
+{
+  // The <browser> element the permission request is coming from.
+  readonly attribute Element browserElement;
+
+  // The nsIObserver that can be used to send the reply notification.
+  readonly attribute nsIObserver responseObserver;
+};
--- a/dom/interfaces/base/domstubs.idl
+++ b/dom/interfaces/base/domstubs.idl
@@ -10,19 +10,16 @@ class nsWrapperCache;
 %}
 
 [ptr] native nsWrapperCachePtr(nsWrapperCache);
 
 typedef unsigned long long DOMTimeStamp;
 typedef double DOMHighResTimeStamp;
 typedef unsigned long long nsViewID;
 
-// Core
-interface nsIDOMNode;
-
 // Needed for raises() in our IDL
 %{C++
 namespace mozilla {
 namespace dom {
 class DOMException;
 }
 }
 %}
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -26,17 +26,16 @@ struct nsRect;
 %}
 
 [ref] native nsConstRect(const nsRect);
 native nscolor(nscolor);
 [ptr] native gfxContext(gfxContext);
 
 interface nsIArray;
 interface nsICycleCollectorListener;
-interface nsIDOMNode;
 interface nsIPreloadedStyleSheet;
 interface nsITransferable;
 interface nsIQueryContentEventResult;
 interface nsIDOMWindow;
 interface nsIFile;
 interface nsIURI;
 interface nsIRunnable;
 interface nsITranslationNodeList;
@@ -44,16 +43,17 @@ interface nsIJSRAIIHelper;
 interface nsIContentPermissionRequest;
 interface nsIObserver;
 interface nsIDOMStorage;
 
 webidl DOMRect;
 webidl Element;
 webidl EventTarget;
 webidl Event;
+webidl Node;
 webidl NodeList;
 
 [scriptable, uuid(4d6732ca-9da7-4176-b8a1-8dde15cd0bf9)]
 interface nsIDOMWindowUtils : nsISupports {
 
   /**
    * Image animation mode of the window. When this attribute's value
    * is changed, the implementation should set all images in the window
@@ -775,17 +775,17 @@ interface nsIDOMWindowUtils : nsISupport
 
   /**
    * Get a list of nodes that have meaningful textual content to
    * be translated. The implementation of this algorithm is in flux
    * as we experiment and refine which approach works best.
    *
    * This method requires chrome privileges.
    */
-  nsITranslationNodeList getTranslationNodes(in nsIDOMNode aRoot);
+  nsITranslationNodeList getTranslationNodes(in Node aRoot);
 
   /**
    * Compare the two canvases, returning the number of differing pixels and
    * the maximum difference in a channel.  This will throw an error if
    * the dimensions of the two canvases are different.
    *
    * This method requires chrome privileges.
    */
@@ -931,17 +931,17 @@ interface nsIDOMWindowUtils : nsISupport
    *
    * Cannot be accessed from unprivileged context (not
    * content-accessible) Will throw a DOM security error if called
    * without chrome privileges.
    *
    * @note Event handlers won't get aEvent as parameter, but a similar event.
    *       Also, aEvent should not be reused.
    */
-  boolean dispatchDOMEventViaPresShell(in nsIDOMNode aTarget,
+  boolean dispatchDOMEventViaPresShell(in Node aTarget,
                                        in Event aEvent,
                                        in boolean aTrusted);
 
   /**
    * Sets WidgetEvent::mFlags::mOnlyChromeDispatch to true to ensure that
    * the event is propagated only to chrome.
    * Event's .target property will be aTarget.
    * Returns the same value as what EventTarget.dispatchEvent does.
@@ -1397,25 +1397,25 @@ interface nsIDOMWindowUtils : nsISupport
    */
   readonly attribute bool asyncPanZoomEnabled;
 
   /**
    * Set async scroll offset on an element. The next composite will render
    * with that offset if async scrolling is enabled, and then the offset
    * will be removed. Only call this while test-controlled refreshes is enabled.
    */
-  void setAsyncScrollOffset(in nsIDOMNode aNode, in float aX, in float aY);
+  void setAsyncScrollOffset(in Element aElement, in float aX, in float aY);
 
   /**
    * Set async zoom value. aRootElement should be the document element of our
    * document. The next composite will render with that zoom added to any
    * existing zoom if async scrolling is enabled, and then the zoom will be
    * removed. Only call this while test-controlled refreshes is enabled.
    */
-  void setAsyncZoom(in nsIDOMNode aRootElement, in float aValue);
+  void setAsyncZoom(in Element aRootElement, in float aValue);
 
   /**
    * Do a round-trip to the compositor to ensure any pending APZ repaint requests
    * get flushed to the main thread. If the function returns true, the flush was
    * triggered and an "apz-repaints-flushed" notification will be dispatched via
    * the observer service once the flush is complete. If the function returns
    * false, an error occurred or a flush is not needed, and the notification
    * will not fire. This is intended to be used by test code only!
@@ -1677,17 +1677,17 @@ interface nsIDOMWindowUtils : nsISupport
    */
   readonly attribute boolean isParentWindowMainWidgetVisible;
 
   /**
    * In certain cases the event handling of nodes, form controls in practice,
    * may be disabled. Such cases are for example the existence of disabled
    * attribute or -moz-user-input: none.
    */
-  boolean isNodeDisabledForEvents(in nsIDOMNode aNode);
+  boolean isNodeDisabledForEvents(in Node aNode);
 
   /**
    * Setting paintFlashing to true will flash newly painted area.
    */
   attribute boolean paintFlashing;
 
   /*
    * Returns the value of a given property animated on the compositor thread.
@@ -1825,17 +1825,17 @@ interface nsIDOMWindowUtils : nsISupport
    * Force the use counters for the node's associated document(s) to be
    * flushed to telemetry.  For example, a document node will flush its own
    * counters and an image node with an SVG source will flush the SVG
    * document's counters.  Normally, use counters are flushed to telemetry
    * upon document destruction, but as document destruction is somewhat
    * non-deterministic, we have this method here for more determinism when
    * running tests.
    */
-  void forceUseCounterFlush(in nsIDOMNode aNode);
+  void forceUseCounterFlush(in Node aNode);
 
   /**
    * Enable or disable displayport suppression. This is intended to be used by
    * testing code, to provide more deterministic behaviour over the displayport
    * suppression during tests. Note that this updates a flag, so whatever value
    * was last provided is what will be used.
    */
   void respectDisplayPortSuppression(in boolean aEnabled);
@@ -1949,17 +1949,17 @@ interface nsIDOMWindowUtils : nsISupport
   const long DIRECTION_LTR = 0;
   const long DIRECTION_RTL = 1;
   const long DIRECTION_NOT_SET = 2;
 };
 
 [scriptable, uuid(c694e359-7227-4392-a138-33c0cc1f15a6)]
 interface nsITranslationNodeList : nsISupports {
   readonly attribute unsigned long length;
-  nsIDOMNode item(in unsigned long index);
+  Node item(in unsigned long index);
 
   // A translation root is a block element, or an inline element
   // which its parent is not a translation node.
   boolean isTranslationRootAtIndex(in unsigned long index);
 };
 
 /**
  * JS doesn't do RAII very well. We can use this interface to make remembering
--- a/dom/interfaces/core/moz.build
+++ b/dom/interfaces/core/moz.build
@@ -3,14 +3,13 @@
 # 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/.
 
 with Files("**"):
     BUG_COMPONENT = ("Core", "DOM")
 
 XPIDL_SOURCES += [
-    'nsIDOMNode.idl',
     'nsIDOMNSEditableElement.idl',
 ]
 
 XPIDL_MODULE = 'dom_core'
 
deleted file mode 100644
--- a/dom/interfaces/core/nsIDOMNode.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 "domstubs.idl"
-
-/**
- * The nsIDOMNode interface is the primary datatype for the entire
- * Document Object Model.
- * It represents a single node in the document tree.
- *
- * For more information on this interface please see
- * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
- */
-
-[shim(Node), uuid(cc35b412-009b-46a3-9be0-76448f12548d)]
-interface nsIDOMNode : nsISupports
-{
-};
--- a/dom/interfaces/xul/nsIDOMXULMenuListElement.idl
+++ b/dom/interfaces/xul/nsIDOMXULMenuListElement.idl
@@ -1,23 +1,24 @@
 /* -*- 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 "nsIDOMXULSelectCntrlEl.idl"
-interface nsIDOMNode;
+
+webidl Element;
 
 [scriptable, uuid(36c16a17-c0e9-4b35-951b-81a147314ef1)]
 interface nsIDOMXULMenuListElement : nsIDOMXULSelectControlElement {
   attribute boolean editable;
   attribute boolean open;
   
   // label of selected option or value of textfield for editable menu lists
   readonly attribute DOMString label;
 
   attribute DOMString crop;
   attribute DOMString image;
   
   // For editable menu lists only.
-  readonly attribute nsIDOMNode inputField;
+  readonly attribute Element inputField;
 };
 
--- a/dom/interfaces/xul/nsIDOMXULRelatedElement.idl
+++ b/dom/interfaces/xul/nsIDOMXULRelatedElement.idl
@@ -1,18 +1,21 @@
 /* -*- 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"
 
+webidl Element;
+webidl Node;
+
 [scriptable, uuid(9fbac05a-fb27-470d-8e5f-028b2dc54ad0)]
 interface nsIDOMXULRelatedElement : nsISupports
 {
   /**
    * Retrun an element associated with the given element. It's implemented
    * by container elements having relation between their items. For example,
    * this interface is implemented by XUL tabs and XUL tabpanels elements
    * and used to get XUL tab element by linked tab panel and vice versa.
    */
-  nsIDOMNode getRelatedElement(in nsIDOMNode aElement);
+  Element getRelatedElement(in Node aElement);
 };
--- a/dom/mathml/nsMathMLElement.cpp
+++ b/dom/mathml/nsMathMLElement.cpp
@@ -31,17 +31,17 @@
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 //----------------------------------------------------------------------
 // nsISupports methods:
 
 NS_IMPL_ISUPPORTS_INHERITED(nsMathMLElement, nsMathMLElementBase,
-                            nsIDOMNode, Link)
+                            Link)
 
 static nsresult
 WarnDeprecated(const char16_t* aDeprecatedAttribute,
                const char16_t* aFavoredAttribute, nsIDocument* aDocument)
 {
   const char16_t *argv[] =
     { aDeprecatedAttribute, aFavoredAttribute };
   return nsContentUtils::
--- a/dom/mathml/nsMathMLElement.h
+++ b/dom/mathml/nsMathMLElement.h
@@ -5,34 +5,32 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsMathMLElement_h
 #define nsMathMLElement_h
 
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/Element.h"
 #include "nsMappedAttributeElement.h"
-#include "nsIDOMNode.h"
 #include "Link.h"
 #include "mozilla/dom/DOMRect.h"
 
 class nsCSSValue;
 
 typedef nsMappedAttributeElement nsMathMLElementBase;
 
 namespace mozilla {
 class EventChainPostVisitor;
 class EventChainPreVisitor;
 } // namespace mozilla
 
 /*
  * The base class for MathML elements.
  */
 class nsMathMLElement final : public nsMathMLElementBase,
-                              public nsIDOMNode,
                               public mozilla::dom::Link
 {
 public:
   explicit nsMathMLElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
   explicit nsMathMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   // Implementation of nsISupports is inherited from nsMathMLElementBase
   NS_DECL_ISUPPORTS_INHERITED
@@ -85,18 +83,16 @@ public:
     return mIncrementScriptLevel;
   }
 
   virtual bool IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse) override;
   virtual bool IsLink(nsIURI** aURI) const override;
   virtual void GetLinkTarget(nsAString& aTarget) override;
   virtual already_AddRefed<nsIURI> GetHrefURI() const override;
 
-  virtual nsIDOMNode* AsDOMNode() override { return this; }
-
   virtual void NodeInfoChanged(nsIDocument* aOldDoc) override
   {
     ClearHasPendingLinkUpdate();
     nsMathMLElementBase::NodeInfoChanged(aOldDoc);
   }
 
 protected:
   virtual ~nsMathMLElement() {}
--- a/dom/performance/PerformanceNavigationTiming.cpp
+++ b/dom/performance/PerformanceNavigationTiming.cpp
@@ -16,62 +16,93 @@ NS_IMPL_ADDREF_INHERITED(PerformanceNavi
 NS_IMPL_RELEASE_INHERITED(PerformanceNavigationTiming, PerformanceResourceTiming)
 
 JSObject*
 PerformanceNavigationTiming::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return PerformanceNavigationTimingBinding::Wrap(aCx, this, aGivenProto);
 }
 
+#define REDUCE_TIME_PRECISION                               \
+  if (mPerformance->IsSystemPrincipal()) {                  \
+    return rawValue;                                        \
+  }                                                         \
+  return nsRFPService::ReduceTimePrecisionAsMSecs(rawValue, \
+    mPerformance->GetRandomTimelineSeed())
+
 DOMHighResTimeStamp
 PerformanceNavigationTiming::UnloadEventStart() const
 {
-  return mPerformance->GetDOMTiming()->GetUnloadEventStartHighRes();
+  DOMHighResTimeStamp rawValue =
+    mPerformance->GetDOMTiming()->GetUnloadEventStartHighRes();
+
+  REDUCE_TIME_PRECISION;
 }
 
 DOMHighResTimeStamp
 PerformanceNavigationTiming::UnloadEventEnd() const
 {
-  return mPerformance->GetDOMTiming()->GetUnloadEventEndHighRes();
+  DOMHighResTimeStamp rawValue =
+    mPerformance->GetDOMTiming()->GetUnloadEventEndHighRes();
+
+  REDUCE_TIME_PRECISION;
 }
 
 DOMHighResTimeStamp
 PerformanceNavigationTiming::DomInteractive() const
 {
-  return mPerformance->GetDOMTiming()->GetDomInteractiveHighRes();
+  DOMHighResTimeStamp rawValue =
+    mPerformance->GetDOMTiming()->GetDomInteractiveHighRes();
+
+  REDUCE_TIME_PRECISION;
 }
 
 DOMHighResTimeStamp
 PerformanceNavigationTiming::DomContentLoadedEventStart() const
 {
-  return mPerformance->GetDOMTiming()->GetDomContentLoadedEventStartHighRes();
+  DOMHighResTimeStamp rawValue =
+    mPerformance->GetDOMTiming()->GetDomContentLoadedEventStartHighRes();
+
+  REDUCE_TIME_PRECISION;
 }
 
 DOMHighResTimeStamp
 PerformanceNavigationTiming::DomContentLoadedEventEnd() const
 {
-  return mPerformance->GetDOMTiming()->GetDomContentLoadedEventEndHighRes();
+  DOMHighResTimeStamp rawValue =
+    mPerformance->GetDOMTiming()->GetDomContentLoadedEventEndHighRes();
+
+  REDUCE_TIME_PRECISION;
 }
 
 DOMHighResTimeStamp
 PerformanceNavigationTiming::DomComplete() const
 {
-  return mPerformance->GetDOMTiming()->GetDomCompleteHighRes();
+  DOMHighResTimeStamp rawValue =
+    mPerformance->GetDOMTiming()->GetDomCompleteHighRes();
+
+  REDUCE_TIME_PRECISION;
 }
 
 DOMHighResTimeStamp
 PerformanceNavigationTiming::LoadEventStart() const
 {
-  return mPerformance->GetDOMTiming()->GetLoadEventStartHighRes();
+  DOMHighResTimeStamp rawValue =
+    mPerformance->GetDOMTiming()->GetLoadEventStartHighRes();
+
+  REDUCE_TIME_PRECISION;
 }
 
 DOMHighResTimeStamp
 PerformanceNavigationTiming::LoadEventEnd() const
 {
-  return mPerformance->GetDOMTiming()->GetLoadEventEndHighRes();
+  DOMHighResTimeStamp rawValue =
+    mPerformance->GetDOMTiming()->GetLoadEventEndHighRes();
+
+  REDUCE_TIME_PRECISION;
 }
 
 NavigationType
 PerformanceNavigationTiming::Type() const
 {
   switch(mPerformance->GetDOMTiming()->GetType()) {
     case nsDOMNavigationTiming::TYPE_NAVIGATE:
       return NavigationType::Navigate;
--- a/dom/performance/tests/mochitest.ini
+++ b/dom/performance/tests/mochitest.ini
@@ -8,16 +8,17 @@ support-files =
   sharedworker_performance_user_timing.js
   test_worker_performance_entries.js
   test_worker_performance_entries.sjs
   empty.js
   serverTiming.sjs
 
 [test_performance_observer.html]
 [test_performance_user_timing.html]
+[test_performance_navigation_timing.html]
 [test_worker_user_timing.html]
 [test_worker_observer.html]
 [test_sharedWorker_performance_user_timing.html]
 [test_worker_performance_now.html]
 [test_timeOrigin.html]
 [test_worker_performance_entries.html]
 [test_performance_timing_json.html]
 [test_performance_server_timing.html]
new file mode 100644
--- /dev/null
+++ b/dom/performance/tests/test_performance_navigation_timing.html
@@ -0,0 +1,104 @@
+<!DOCTYPE HTML>
+<html>
+    <!--
+    https://bugzilla.mozilla.org/show_bug.cgi?id=1462891
+    -->
+    <head>
+        <title>Test for Bug 1462891</title>
+        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+        <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+    </head>
+    <body>
+        <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1462891">Mozilla Bug 1462891 - Navigation Timing API</a>
+        <div id="content">
+        </div>
+        <pre id="test">
+            <script class="testbody" type="text/javascript">
+             var index = 0;
+             let isRounded = (x, shouldRound, expectedPrecision) => {
+                if (!shouldRound)
+                   return true;
+
+                let rounded = (Math.floor(x / expectedPrecision) * expectedPrecision);
+                // First we do the perfectly normal check that should work just fine
+                if (rounded === x || x === 0)
+                return true;
+
+                // When we're diving by non-whole numbers, we may not get perfect
+                // multiplication/division because of floating points.
+                // When dealing with ms since epoch, a double's precision is on the order
+                // of 1/5 of a microsecond, so we use a value a little higher than that as
+                // our epsilon.
+                // To be clear, this error is introduced in our re-calculation of 'rounded'
+                // above in JavaScript.
+                if (Math.abs(rounded - x + expectedPrecision) < .0005) {
+                 return true;
+                } else if (Math.abs(rounded - x) < .0005) {
+                 return true;
+                }
+
+                 // Then we handle the case where you're sub-millisecond and the timer is not
+                 // We check that the timer is not sub-millisecond by assuming it is not if it
+                 // returns an even number of milliseconds
+                 if (expectedPrecision < 1 && Math.round(x) == x) {
+                   if (Math.round(rounded) == x) {
+                     return true;
+                   }
+                 }
+
+                 ok(false, "Looming Test Failure, Additional Debugging Info: Expected Precision: " + expectedPrecision + " Measured Value: " + x +
+                   " Rounded Vaue: " + rounded + " Fuzzy1: " + Math.abs(rounded - x + expectedPrecision) +
+                   " Fuzzy 2: " + Math.abs(rounded - x));
+
+                 return false;
+            };
+
+            var metrics = [
+                "unloadEventStart",
+                "unloadEventEnd",
+                "domInteractive",
+                "domContentLoadedEventStart",
+                "domContentLoadedEventEnd",
+                "domComplete",
+                "loadEventStart",
+                "loadEventEnd"
+            ];
+
+            async function runTests(resistFingerprinting, reduceTimerPrecision, expectedPrecision) {
+                await SpecialPowers.pushPrefEnv({
+                    "set": [["privacy.resistFingerprinting", resistFingerprinting],
+                            ["privacy.reduceTimerPrecision", reduceTimerPrecision],
+                            ["privacy.resistFingerprinting.reduceTimerPrecision.microseconds", expectedPrecision * 1000]
+                ]});
+                var entries = performance.getEntriesByType("navigation");
+                is(entries.length, resistFingerprinting ? 0 : 1, "Checking PerformanceNavigationEntry count");
+
+                for (let i=0; i<entries.length; i++) {
+                    for (let j=0; j<metrics.length; j++) {
+                        ok(isRounded(entries[i][metrics[j]], reduceTimerPrecision, expectedPrecision),
+                            "Testing " + metrics[j] + " with value " + entries[i][metrics[j]] +
+                            " with resistFingerprinting " + resistFingerprinting + " reduceTimerPrecision " +
+                            reduceTimerPrecision + " precision " + expectedPrecision);
+                    }
+                }
+            }
+
+            async function startTests() {
+                await runTests(false, false, 2);
+                await runTests(true, false, 2);
+                await runTests(true, true, 2);
+                await runTests(false, true, 1000);
+                await runTests(false, true, 133);
+                await runTests(false, true, 13);
+                await runTests(false, true, 2);
+                await runTests(false, true, 1);
+
+                SimpleTest.finish();
+            }
+
+            SimpleTest.waitForExplicitFinish();
+            addLoadEvent(startTests);
+            </script>
+        </pre>
+    </body>
+</html>
--- a/dom/plugins/ipc/FunctionHook.h
+++ b/dom/plugins/ipc/FunctionHook.h
@@ -95,17 +95,17 @@ typedef bool(ShouldHookFunc)(int aQuirks
 
 template<FunctionHookId functionId, typename FunctionType>
 class BasicFunctionHook : public FunctionHook
 {
 public:
   BasicFunctionHook(const char* aModuleName,
                     const char* aFunctionName, FunctionType* aOldFunction,
                     FunctionType* aNewFunction) :
-    mOldFunction(aOldFunction), mIsHooked(false), mModuleName(aModuleName),
+    mOldFunction(aOldFunction), mRegistration(UNREGISTERED), mModuleName(aModuleName),
     mFunctionName(aFunctionName), mNewFunction(aNewFunction)
   {
     MOZ_ASSERT(mOldFunction);
     MOZ_ASSERT(mNewFunction);
   }
 
   /**
    * Hooks the function if we haven't already and if ShouldHook() says to.
@@ -124,18 +124,19 @@ public:
 
   FunctionType* OriginalFunction() const { return mOldFunction; }
 
 protected:
   // Once the function is hooked, this field will take the value of a pointer to
   // a function that performs the old behavior.  Before that, it is a pointer to
   // the original function.
   FunctionType* mOldFunction;
-  // True if we have already hooked the function.
-  bool mIsHooked;
+
+  enum RegistrationStatus { UNREGISTERED, FAILED, SUCCEEDED };
+  RegistrationStatus mRegistration;
 
   // The name of the module containing the function to hook.  E.g. "user32.dll".
   const nsCString mModuleName;
   // The name of the function in the module.
   const nsCString mFunctionName;
   // The function that we should replace functionName with.  The signature of
   // newFunction must match that of functionName.
   FunctionType* const mNewFunction;
@@ -148,36 +149,43 @@ template<FunctionHookId functionId, type
 ShouldHookFunc* const BasicFunctionHook<functionId, FunctionType>::mShouldHook = AlwaysHook;
 
 template <FunctionHookId functionId, typename FunctionType>
 bool
 BasicFunctionHook<functionId, FunctionType>::Register(int aQuirks)
 {
   MOZ_RELEASE_ASSERT(XRE_IsPluginProcess());
 
-  // If we have already hooked or if quirks tell us not to then don't hook.
-  if (mIsHooked || !mShouldHook(aQuirks)) {
+  // If we have already attempted to hook this function or if quirks tell us
+  // not to then don't hook.
+  if (mRegistration != UNREGISTERED || !mShouldHook(aQuirks)) {
     return true;
   }
 
+  bool isHooked = false;
+  mRegistration = FAILED;
+
 #if defined(XP_WIN)
   WindowsDllInterceptor* dllInterceptor =
     FunctionHook::GetDllInterceptorFor(mModuleName.Data());
   if (!dllInterceptor) {
     return false;
   }
 
-  mIsHooked =
+  isHooked =
     dllInterceptor->AddHook(mFunctionName.Data(), reinterpret_cast<intptr_t>(mNewFunction),
                             reinterpret_cast<void**>(&mOldFunction));
 #endif
 
+  if (isHooked) {
+    mRegistration = SUCCEEDED;
+  }
   HOOK_LOG(LogLevel::Debug,
            ("Registering to intercept function '%s' : '%s'", mFunctionName.Data(),
-            SuccessMsg(mIsHooked)));
+            SuccessMsg(isHooked)));
 
-  return mIsHooked;
+  return isHooked;
 }
 
 }
 }
 
 #endif // dom_plugins_ipc_functionhook_h
--- a/dom/security/nsCSPContext.cpp
+++ b/dom/security/nsCSPContext.cpp
@@ -14,17 +14,16 @@
 #include "nsCSPParser.h"
 #include "nsCSPService.h"
 #include "nsError.h"
 #include "nsIAsyncVerifyRedirectCallback.h"
 #include "nsIClassInfoImpl.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDocument.h"
-#include "nsIDOMNode.h"
 #include "nsIHttpChannel.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIObjectInputStream.h"
 #include "nsIObjectOutputStream.h"
 #include "nsIObserver.h"
 #include "nsIObserverService.h"
 #include "nsIStringStream.h"
--- a/dom/svg/DOMSVGLength.h
+++ b/dom/svg/DOMSVGLength.h
@@ -178,17 +178,17 @@ public:
   void GetValueAsString(nsAString& aValue);
   void SetValueAsString(const nsAString& aValue, ErrorResult& aRv);
   void NewValueSpecifiedUnits(uint16_t aUnit, float aValue,
                               ErrorResult& aRv);
   void ConvertToSpecifiedUnits(uint16_t aUnit, ErrorResult& aRv);
 
   nsISupports* GetParentObject() const {
     auto svgElement = mList ? Element() : mSVGElement.get();
-    return static_cast<nsIDOMNode*>(svgElement);
+    return svgElement;
   }
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 private:
 
   nsSVGElement* Element() const {
     return mList->Element();
--- a/dom/svg/SVGAElement.cpp
+++ b/dom/svg/SVGAElement.cpp
@@ -40,17 +40,16 @@ const DOMTokenListSupportedToken SVGAEle
   "noopener",
   nullptr
 };
 
 //----------------------------------------------------------------------
 // nsISupports methods
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SVGAElement)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
   NS_INTERFACE_MAP_ENTRY(Link)
 NS_INTERFACE_MAP_END_INHERITING(SVGAElementBase)
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(SVGAElement,
                                    SVGAElementBase,
                                    mRelList)
 
 NS_IMPL_ADDREF_INHERITED(SVGAElement, SVGAElementBase)
--- a/dom/svg/SVGAnimateElement.cpp
+++ b/dom/svg/SVGAnimateElement.cpp
@@ -22,17 +22,17 @@ SVGAnimateElement::WrapNode(JSContext *a
 // Implementation
 
 SVGAnimateElement::SVGAnimateElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGAnimationElement(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAnimateElement)
 
 //----------------------------------------------------------------------
 
 nsSMILAnimationFunction&
 SVGAnimateElement::AnimationFunction()
 {
--- a/dom/svg/SVGAnimateElement.h
+++ b/dom/svg/SVGAnimateElement.h
@@ -25,17 +25,17 @@ protected:
   nsSMILAnimationFunction mAnimationFunction;
   friend nsresult
     (::NS_NewSVGAnimateElement(nsIContent **aResult,
                                already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
-  // nsIDOMNode
+  // nsINode
   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
                          bool aPreallocateChildren) const override;
 
   // SVGAnimationElement
   virtual nsSMILAnimationFunction& AnimationFunction() override;
 };
 
 } // namespace dom
--- a/dom/svg/SVGAnimateMotionElement.cpp
+++ b/dom/svg/SVGAnimateMotionElement.cpp
@@ -22,17 +22,17 @@ SVGAnimateMotionElement::WrapNode(JSCont
 // Implementation
 
 SVGAnimateMotionElement::SVGAnimateMotionElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGAnimationElement(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAnimateMotionElement)
 
 //----------------------------------------------------------------------
 
 nsSMILAnimationFunction&
 SVGAnimateMotionElement::AnimationFunction()
 {
--- a/dom/svg/SVGAnimateMotionElement.h
+++ b/dom/svg/SVGAnimateMotionElement.h
@@ -25,17 +25,17 @@ protected:
   SVGMotionSMILAnimationFunction mAnimationFunction;
   friend nsresult
     (::NS_NewSVGAnimateMotionElement(nsIContent **aResult,
                                      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
-  // nsIDOMNode specializations
+  // nsINode specializations
   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
                          bool aPreallocateChildren) const override;
 
   // SVGAnimationElement
   virtual nsSMILAnimationFunction& AnimationFunction() override;
   virtual bool GetTargetAttributeName(int32_t *aNamespaceID,
                                       nsAtom **aLocalName) const override;
 
--- a/dom/svg/SVGAnimateTransformElement.cpp
+++ b/dom/svg/SVGAnimateTransformElement.cpp
@@ -50,17 +50,17 @@ SVGAnimateTransformElement::ParseAttribu
 
   return SVGAnimationElement::ParseAttribute(aNamespaceID,
                                              aAttribute, aValue,
                                              aMaybeScriptedPrincipal,
                                              aResult);
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAnimateTransformElement)
 
 //----------------------------------------------------------------------
 
 nsSMILAnimationFunction&
 SVGAnimateTransformElement::AnimationFunction()
 {
--- a/dom/svg/SVGAnimateTransformElement.h
+++ b/dom/svg/SVGAnimateTransformElement.h
@@ -25,17 +25,17 @@ protected:
   nsSMILAnimationFunction mAnimationFunction;
   friend nsresult
     (::NS_NewSVGAnimateTransformElement(nsIContent **aResult,
                                         already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
-  // nsIDOMNode specializations
+  // nsINode specializations
   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
                          bool aPreallocateChildren) const override;
 
   // Element specializations
   virtual bool ParseAttribute(int32_t aNamespaceID,
                               nsAtom* aAttribute,
                               const nsAString& aValue,
                               nsIPrincipal* aMaybeScriptedPrincipal,
--- a/dom/svg/SVGCircleElement.cpp
+++ b/dom/svg/SVGCircleElement.cpp
@@ -34,17 +34,17 @@ nsSVGElement::LengthInfo SVGCircleElemen
 // Implementation
 
 SVGCircleElement::SVGCircleElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGCircleElementBase(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGCircleElement)
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedLength>
 SVGCircleElement::Cx()
 {
--- a/dom/svg/SVGClipPathElement.cpp
+++ b/dom/svg/SVGClipPathElement.cpp
@@ -56,14 +56,14 @@ SVGClipPathElement::GetEnumInfo()
 bool
 SVGClipPathElement::IsUnitsObjectBoundingBox() const
 {
   return mEnumAttributes[CLIPPATHUNITS].GetAnimValue() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
 }
 
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGClipPathElement)
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/svg/SVGDefsElement.cpp
+++ b/dom/svg/SVGDefsElement.cpp
@@ -22,17 +22,17 @@ SVGDefsElement::WrapNode(JSContext* aCx,
 // Implementation
 
 SVGDefsElement::SVGDefsElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGGraphicsElement(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGDefsElement)
 
 
 //----------------------------------------------------------------------
 // nsIContent methods
 
--- a/dom/svg/SVGDescElement.cpp
+++ b/dom/svg/SVGDescElement.cpp
@@ -22,15 +22,15 @@ SVGDescElement::WrapNode(JSContext* aCx,
 // Implementation
 
 SVGDescElement::SVGDescElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGDescElementBase(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGDescElement)
 
 } // namespace dom
 } // namespace mozilla
 
--- a/dom/svg/SVGEllipseElement.cpp
+++ b/dom/svg/SVGEllipseElement.cpp
@@ -36,17 +36,17 @@ nsSVGElement::LengthInfo SVGEllipseEleme
 // Implementation
 
 SVGEllipseElement::SVGEllipseElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGEllipseElementBase(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGEllipseElement)
 
 //----------------------------------------------------------------------
 // nsIDOMSVGEllipseElement methods
 
 already_AddRefed<SVGAnimatedLength>
 SVGEllipseElement::Cx()
--- a/dom/svg/SVGFEBlendElement.cpp
+++ b/dom/svg/SVGFEBlendElement.cpp
@@ -52,17 +52,17 @@ nsSVGElement::EnumInfo SVGFEBlendElement
 nsSVGElement::StringInfo SVGFEBlendElement::sStringInfo[3] =
 {
   { &nsGkAtoms::result, kNameSpaceID_None, true },
   { &nsGkAtoms::in, kNameSpaceID_None, true },
   { &nsGkAtoms::in2, kNameSpaceID_None, true }
 };
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEBlendElement)
 
 //----------------------------------------------------------------------
 // nsIDOMSVGFEBlendElement methods
 
 already_AddRefed<SVGAnimatedString>
 SVGFEBlendElement::In1()
--- a/dom/svg/SVGFEColorMatrixElement.cpp
+++ b/dom/svg/SVGFEColorMatrixElement.cpp
@@ -47,17 +47,17 @@ nsSVGElement::StringInfo SVGFEColorMatri
 };
 
 nsSVGElement::NumberListInfo SVGFEColorMatrixElement::sNumberListInfo[1] =
 {
   { &nsGkAtoms::values }
 };
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEColorMatrixElement)
 
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedString>
--- a/dom/svg/SVGFEComponentTransferElement.cpp
+++ b/dom/svg/SVGFEComponentTransferElement.cpp
@@ -25,17 +25,17 @@ SVGFEComponentTransferElement::WrapNode(
 
 nsSVGElement::StringInfo SVGFEComponentTransferElement::sStringInfo[2] =
 {
   { &nsGkAtoms::result, kNameSpaceID_None, true },
   { &nsGkAtoms::in, kNameSpaceID_None, true }
 };
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEComponentTransferElement)
 
 already_AddRefed<SVGAnimatedString>
 SVGFEComponentTransferElement::In1()
 {
   return mStringAttributes[IN1].ToDOMAnimatedString(this);
 }
--- a/dom/svg/SVGFECompositeElement.cpp
+++ b/dom/svg/SVGFECompositeElement.cpp
@@ -49,17 +49,17 @@ nsSVGElement::EnumInfo SVGFECompositeEle
 nsSVGElement::StringInfo SVGFECompositeElement::sStringInfo[3] =
 {
   { &nsGkAtoms::result, kNameSpaceID_None, true },
   { &nsGkAtoms::in, kNameSpaceID_None, true },
   { &nsGkAtoms::in2, kNameSpaceID_None, true }
 };
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFECompositeElement)
 
 already_AddRefed<SVGAnimatedString>
 SVGFECompositeElement::In1()
 {
   return mStringAttributes[IN1].ToDOMAnimatedString(this);
 }
--- a/dom/svg/SVGFEConvolveMatrixElement.cpp
+++ b/dom/svg/SVGFEConvolveMatrixElement.cpp
@@ -74,17 +74,17 @@ nsSVGElement::StringInfo SVGFEConvolveMa
 };
 
 nsSVGElement::NumberListInfo SVGFEConvolveMatrixElement::sNumberListInfo[1] =
 {
   { &nsGkAtoms::kernelMatrix }
 };
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEConvolveMatrixElement)
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedString>
 SVGFEConvolveMatrixElement::In1()
 {
--- a/dom/svg/SVGFEDiffuseLightingElement.cpp
+++ b/dom/svg/SVGFEDiffuseLightingElement.cpp
@@ -18,17 +18,17 @@ namespace dom {
 
 JSObject*
 SVGFEDiffuseLightingElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return SVGFEDiffuseLightingElementBinding::Wrap(aCx, this, aGivenProto);
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEDiffuseLightingElement)
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedString>
 SVGFEDiffuseLightingElement::In1()
 {
--- a/dom/svg/SVGFEDisplacementMapElement.cpp
+++ b/dom/svg/SVGFEDisplacementMapElement.cpp
@@ -50,17 +50,17 @@ nsSVGElement::EnumInfo SVGFEDisplacement
 nsSVGElement::StringInfo SVGFEDisplacementMapElement::sStringInfo[3] =
 {
   { &nsGkAtoms::result, kNameSpaceID_None, true },
   { &nsGkAtoms::in, kNameSpaceID_None, true },
   { &nsGkAtoms::in2, kNameSpaceID_None, true }
 };
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEDisplacementMapElement)
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedString>
 SVGFEDisplacementMapElement::In1()
 {
--- a/dom/svg/SVGFEDistantLightElement.cpp
+++ b/dom/svg/SVGFEDistantLightElement.cpp
@@ -24,17 +24,17 @@ SVGFEDistantLightElement::WrapNode(JSCon
 nsSVGElement::NumberInfo SVGFEDistantLightElement::sNumberInfo[2] =
 {
   { &nsGkAtoms::azimuth,   0, false },
   { &nsGkAtoms::elevation, 0, false }
 };
 
 //----------------------------------------------------------------------
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEDistantLightElement)
 
 // nsFEUnstyledElement methods
 
 bool
 SVGFEDistantLightElement::AttributeAffectsRendering(int32_t aNameSpaceID,
                                                     nsAtom* aAttribute) const
--- a/dom/svg/SVGFEDropShadowElement.cpp
+++ b/dom/svg/SVGFEDropShadowElement.cpp
@@ -35,17 +35,17 @@ nsSVGElement::NumberPairInfo SVGFEDropSh
 
 nsSVGElement::StringInfo SVGFEDropShadowElement::sStringInfo[2] =
 {
   { &nsGkAtoms::result, kNameSpaceID_None, true },
   { &nsGkAtoms::in, kNameSpaceID_None, true }
 };
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEDropShadowElement)
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedString>
 SVGFEDropShadowElement::In1()
 {
--- a/dom/svg/SVGFEFloodElement.cpp
+++ b/dom/svg/SVGFEFloodElement.cpp
@@ -25,17 +25,17 @@ SVGFEFloodElement::WrapNode(JSContext *a
 }
 
 nsSVGElement::StringInfo SVGFEFloodElement::sStringInfo[1] =
 {
   { &nsGkAtoms::result, kNameSpaceID_None, true }
 };
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEFloodElement)
 
 FilterPrimitiveDescription
 SVGFEFloodElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
                                            const IntRect& aFilterSubregion,
                                            const nsTArray<bool>& aInputsAreTainted,
                                            nsTArray<RefPtr<SourceSurface>>& aInputImages)
--- a/dom/svg/SVGFEGaussianBlurElement.cpp
+++ b/dom/svg/SVGFEGaussianBlurElement.cpp
@@ -29,17 +29,17 @@ nsSVGElement::NumberPairInfo SVGFEGaussi
 
 nsSVGElement::StringInfo SVGFEGaussianBlurElement::sStringInfo[2] =
 {
   { &nsGkAtoms::result, kNameSpaceID_None, true },
   { &nsGkAtoms::in, kNameSpaceID_None, true }
 };
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEGaussianBlurElement)
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedString>
 SVGFEGaussianBlurElement::In1()
 {
--- a/dom/svg/SVGFEImageElement.cpp
+++ b/dom/svg/SVGFEImageElement.cpp
@@ -38,17 +38,16 @@ nsSVGElement::StringInfo SVGFEImageEleme
   { &nsGkAtoms::href, kNameSpaceID_None, true },
   { &nsGkAtoms::href, kNameSpaceID_XLink, true }
 };
 
 //----------------------------------------------------------------------
 // nsISupports methods
 
 NS_IMPL_ISUPPORTS_INHERITED(SVGFEImageElement, SVGFEImageElementBase,
-                            nsIDOMNode,
                             imgINotificationObserver, nsIImageLoadingContent)
 
 //----------------------------------------------------------------------
 // Implementation
 
 SVGFEImageElement::SVGFEImageElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGFEImageElementBase(aNodeInfo)
 {
@@ -193,17 +192,17 @@ SVGFEImageElement::UnbindFromTree(bool a
 EventStates
 SVGFEImageElement::IntrinsicState() const
 {
   return SVGFEImageElementBase::IntrinsicState() |
     nsImageLoadingContent::ImageState();
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEImageElement)
 
 already_AddRefed<SVGAnimatedString>
 SVGFEImageElement::Href()
 {
   return mStringAttributes[HREF].IsExplicitlySet()
          ? mStringAttributes[HREF].ToDOMAnimatedString(this)
--- a/dom/svg/SVGFEMergeNodeElement.cpp
+++ b/dom/svg/SVGFEMergeNodeElement.cpp
@@ -19,17 +19,17 @@ SVGFEMergeNodeElement::WrapNode(JSContex
 }
 
 nsSVGElement::StringInfo SVGFEMergeNodeElement::sStringInfo[1] =
 {
   { &nsGkAtoms::in, kNameSpaceID_None, true }
 };
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEMergeNodeElement)
 
 //----------------------------------------------------------------------
 // nsFEUnstyledElement methods
 
 bool
 SVGFEMergeNodeElement::AttributeAffectsRendering(int32_t aNameSpaceID,
--- a/dom/svg/SVGFEMorphologyElement.cpp
+++ b/dom/svg/SVGFEMorphologyElement.cpp
@@ -42,17 +42,17 @@ nsSVGElement::EnumInfo SVGFEMorphologyEl
 
 nsSVGElement::StringInfo SVGFEMorphologyElement::sStringInfo[2] =
 {
   { &nsGkAtoms::result, kNameSpaceID_None, true },
   { &nsGkAtoms::in, kNameSpaceID_None, true }
 };
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEMorphologyElement)
 
 
 //----------------------------------------------------------------------
 // SVGFEMorphologyElement methods
 
--- a/dom/svg/SVGFEOffsetElement.cpp
+++ b/dom/svg/SVGFEOffsetElement.cpp
@@ -29,17 +29,17 @@ nsSVGElement::NumberInfo SVGFEOffsetElem
 
 nsSVGElement::StringInfo SVGFEOffsetElement::sStringInfo[2] =
 {
   { &nsGkAtoms::result, kNameSpaceID_None, true },
   { &nsGkAtoms::in, kNameSpaceID_None, true }
 };
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEOffsetElement)
 
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedString>
--- a/dom/svg/SVGFEPointLightElement.cpp
+++ b/dom/svg/SVGFEPointLightElement.cpp
@@ -24,17 +24,17 @@ SVGFEPointLightElement::WrapNode(JSConte
 nsSVGElement::NumberInfo SVGFEPointLightElement::sNumberInfo[3] =
 {
   { &nsGkAtoms::x, 0, false },
   { &nsGkAtoms::y, 0, false },
   { &nsGkAtoms::z, 0, false }
 };
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEPointLightElement)
 
 //----------------------------------------------------------------------
 // nsFEUnstyledElement methods
 
 bool
 SVGFEPointLightElement::AttributeAffectsRendering(int32_t aNameSpaceID,
--- a/dom/svg/SVGFESpecularLightingElement.cpp
+++ b/dom/svg/SVGFESpecularLightingElement.cpp
@@ -18,17 +18,17 @@ namespace dom {
 
 JSObject*
 SVGFESpecularLightingElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return SVGFESpecularLightingElementBinding::Wrap(aCx, this, aGivenProto);
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFESpecularLightingElement)
 
 already_AddRefed<SVGAnimatedString>
 SVGFESpecularLightingElement::In1()
 {
   return mStringAttributes[IN1].ToDOMAnimatedString(this);
 }
--- a/dom/svg/SVGFESpotLightElement.cpp
+++ b/dom/svg/SVGFESpotLightElement.cpp
@@ -29,17 +29,17 @@ nsSVGElement::NumberInfo SVGFESpotLightE
   { &nsGkAtoms::pointsAtX, 0, false },
   { &nsGkAtoms::pointsAtY, 0, false },
   { &nsGkAtoms::pointsAtZ, 0, false },
   { &nsGkAtoms::specularExponent, 1, false },
   { &nsGkAtoms::limitingConeAngle, 0, false }
 };
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFESpotLightElement)
 
 //----------------------------------------------------------------------
 // nsFEUnstyledElement methods
 
 bool
 SVGFESpotLightElement::AttributeAffectsRendering(int32_t aNameSpaceID,
--- a/dom/svg/SVGFETileElement.cpp
+++ b/dom/svg/SVGFETileElement.cpp
@@ -23,17 +23,17 @@ SVGFETileElement::WrapNode(JSContext *aC
 
 nsSVGElement::StringInfo SVGFETileElement::sStringInfo[2] =
 {
   { &nsGkAtoms::result, kNameSpaceID_None, true },
   { &nsGkAtoms::in, kNameSpaceID_None, true }
 };
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFETileElement)
 
 already_AddRefed<SVGAnimatedString>
 SVGFETileElement::In1()
 {
   return mStringAttributes[IN1].ToDOMAnimatedString(this);
--- a/dom/svg/SVGFETurbulenceElement.cpp
+++ b/dom/svg/SVGFETurbulenceElement.cpp
@@ -72,17 +72,17 @@ nsSVGElement::EnumInfo SVGFETurbulenceEl
 };
 
 nsSVGElement::StringInfo SVGFETurbulenceElement::sStringInfo[1] =
 {
   { &nsGkAtoms::result, kNameSpaceID_None, true }
 };
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFETurbulenceElement)
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedNumber>
 SVGFETurbulenceElement::BaseFrequencyX()
 {
--- a/dom/svg/SVGFilterElement.cpp
+++ b/dom/svg/SVGFilterElement.cpp
@@ -57,17 +57,17 @@ nsSVGElement::StringInfo SVGFilterElemen
 // Implementation
 
 SVGFilterElement::SVGFilterElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGFilterElementBase(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFilterElement)
 
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedLength>
--- a/dom/svg/SVGForeignObjectElement.cpp
+++ b/dom/svg/SVGForeignObjectElement.cpp
@@ -35,17 +35,17 @@ nsSVGElement::LengthInfo SVGForeignObjec
 // Implementation
 
 SVGForeignObjectElement::SVGForeignObjectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGGraphicsElement(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGForeignObjectElement)
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedLength>
 SVGForeignObjectElement::X()
 {
--- a/dom/svg/SVGGElement.cpp
+++ b/dom/svg/SVGGElement.cpp
@@ -23,17 +23,17 @@ SVGGElement::WrapNode(JSContext *aCx, JS
 
 SVGGElement::SVGGElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGGraphicsElement(aNodeInfo)
 {
 }
 
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGGElement)
 
 
 //----------------------------------------------------------------------
 // nsIContent methods
 
--- a/dom/svg/SVGGradientElement.cpp
+++ b/dom/svg/SVGGradientElement.cpp
@@ -142,17 +142,17 @@ nsSVGElement::LengthInfo SVGLinearGradie
 // Implementation
 
 SVGLinearGradientElement::SVGLinearGradientElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGLinearGradientElementBase(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGLinearGradientElement)
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedLength>
 SVGLinearGradientElement::X1()
 {
@@ -218,17 +218,17 @@ nsSVGElement::LengthInfo SVGRadialGradie
 // Implementation
 
 SVGRadialGradientElement::SVGRadialGradientElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGRadialGradientElementBase(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGRadialGradientElement)
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedLength>
 SVGRadialGradientElement::Cx()
 {
--- a/dom/svg/SVGImageElement.cpp
+++ b/dom/svg/SVGImageElement.cpp
@@ -44,17 +44,16 @@ nsSVGElement::StringInfo SVGImageElement
   { &nsGkAtoms::href, kNameSpaceID_None, true },
   { &nsGkAtoms::href, kNameSpaceID_XLink, true }
 };
 
 //----------------------------------------------------------------------
 // nsISupports methods
 
 NS_IMPL_ISUPPORTS_INHERITED(SVGImageElement, SVGImageElementBase,
-                            nsIDOMNode,
                             imgINotificationObserver,
                             nsIImageLoadingContent)
 
 //----------------------------------------------------------------------
 // Implementation
 
 SVGImageElement::SVGImageElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGImageElementBase(aNodeInfo)
@@ -64,17 +63,17 @@ SVGImageElement::SVGImageElement(already
 }
 
 SVGImageElement::~SVGImageElement()
 {
   DestroyImageLoadingContent();
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGImageElement)
 
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedLength>
--- a/dom/svg/SVGLineElement.cpp
+++ b/dom/svg/SVGLineElement.cpp
@@ -51,17 +51,17 @@ SVGLineElement::MaybeAdjustForZeroLength
       float tinyLength =
         strokeOptions.mLineWidth / SVG_ZERO_LENGTH_PATH_FIX_FACTOR;
       aX2 += tinyLength;
     }
   }
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGLineElement)
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedLength>
 SVGLineElement::X1()
 {
--- a/dom/svg/SVGMPathElement.cpp
+++ b/dom/svg/SVGMPathElement.cpp
@@ -44,33 +44,32 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_
   tmp->mPathTracker.Traverse(&cb);
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 //----------------------------------------------------------------------
 // nsISupports methods
 
 NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(SVGMPathElement,
                                              SVGMPathElementBase,
-                                             nsIDOMNode,
                                              nsIMutationObserver)
 
 // Constructor
 SVGMPathElement::SVGMPathElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGMPathElementBase(aNodeInfo)
   , mPathTracker(this)
 {
 }
 
 SVGMPathElement::~SVGMPathElement()
 {
   UnlinkHrefTarget(false);
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGMPathElement)
 
 already_AddRefed<SVGAnimatedString>
 SVGMPathElement::Href()
 {
   return mStringAttributes[HREF].IsExplicitlySet()
          ? mStringAttributes[HREF].ToDOMAnimatedString(this)
--- a/dom/svg/SVGMarkerElement.cpp
+++ b/dom/svg/SVGMarkerElement.cpp
@@ -100,17 +100,17 @@ nsSVGOrientType::ToDOMAnimatedEnum(nsSVG
 }
 
 SVGMarkerElement::SVGMarkerElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGMarkerElementBase(aNodeInfo), mCoordCtx(nullptr)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGMarkerElement)
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedRect>
 SVGMarkerElement::ViewBox()
 {
--- a/dom/svg/SVGMaskElement.cpp
+++ b/dom/svg/SVGMaskElement.cpp
@@ -52,17 +52,17 @@ nsSVGElement::EnumInfo SVGMaskElement::s
 // Implementation
 
 SVGMaskElement::SVGMaskElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGMaskElementBase(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode method
+// nsINode method
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGMaskElement)
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedEnumeration>
 SVGMaskElement::MaskUnits()
 {
--- a/dom/svg/SVGMetadataElement.cpp
+++ b/dom/svg/SVGMetadataElement.cpp
@@ -30,15 +30,15 @@ SVGMetadataElement::SVGMetadataElement(a
 nsresult
 SVGMetadataElement::Init()
 {
   return NS_OK;
 }
 
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGMetadataElement)
 
 } // namespace dom
 } // namespace mozilla
 
--- a/dom/svg/SVGPathElement.cpp
+++ b/dom/svg/SVGPathElement.cpp
@@ -51,17 +51,17 @@ void
 SVGPathElement::AddSizeOfExcludingThis(nsWindowSizes& aSizes,
                                        size_t* aNodeSize) const
 {
   SVGPathElementBase::AddSizeOfExcludingThis(aSizes, aNodeSize);
   *aNodeSize += mD.SizeOfExcludingThis(aSizes.mState.mMallocSizeOf);
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPathElement)
 
 uint32_t
 SVGPathElement::GetPathSegAtLength(float distance)
 {
   return mD.GetAnimValue().GetPathSegAtLength(distance);
 }
--- a/dom/svg/SVGPatternElement.cpp
+++ b/dom/svg/SVGPatternElement.cpp
@@ -59,17 +59,17 @@ nsSVGElement::StringInfo SVGPatternEleme
 // Implementation
 
 SVGPatternElement::SVGPatternElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGPatternElementBase(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode method
+// nsINode method
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPatternElement)
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedRect>
 SVGPatternElement::ViewBox()
 {
--- a/dom/svg/SVGPolygonElement.cpp
+++ b/dom/svg/SVGPolygonElement.cpp
@@ -27,17 +27,17 @@ SVGPolygonElement::WrapNode(JSContext *a
 // Implementation
 
 SVGPolygonElement::SVGPolygonElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGPolygonElementBase(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPolygonElement)
 
 //----------------------------------------------------------------------
 // SVGGeometryElement methods
 
 void
 SVGPolygonElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
--- a/dom/svg/SVGPolylineElement.cpp
+++ b/dom/svg/SVGPolylineElement.cpp
@@ -26,17 +26,17 @@ SVGPolylineElement::WrapNode(JSContext *
 // Implementation
 
 SVGPolylineElement::SVGPolylineElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGPolylineElementBase(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPolylineElement)
 
 //----------------------------------------------------------------------
 // SVGGeometryElement methods
 
 already_AddRefed<Path>
 SVGPolylineElement::BuildPath(PathBuilder* aBuilder)
--- a/dom/svg/SVGRectElement.cpp
+++ b/dom/svg/SVGRectElement.cpp
@@ -43,17 +43,17 @@ nsSVGElement::LengthInfo SVGRectElement:
 // Implementation
 
 SVGRectElement::SVGRectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGRectElementBase(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGRectElement)
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedLength>
 SVGRectElement::X()
 {
--- a/dom/svg/SVGSVGElement.cpp
+++ b/dom/svg/SVGSVGElement.cpp
@@ -67,17 +67,17 @@ DOMSVGPoint*
 DOMSVGTranslatePoint::Copy()
 {
   return new DOMSVGPoint(mPt.GetX(), mPt.GetY());
 }
 
 nsISupports*
 DOMSVGTranslatePoint::GetParentObject()
 {
-  return static_cast<nsIDOMNode*>(mElement);
+  return ToSupports(mElement);
 }
 
 void
 DOMSVGTranslatePoint::SetX(float aValue, ErrorResult& rv)
 {
   mElement->SetCurrentTranslate(aValue, mPt.GetY());
 }
 
@@ -118,19 +118,18 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_IN
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(SVGSVGElement,
                                                   SVGSVGElementBase)
   if (tmp->mTimedDocumentRoot) {
     tmp->mTimedDocumentRoot->Traverse(&cb);
   }
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
-NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(SVGSVGElement,
-                                             SVGSVGElementBase,
-                                             nsIDOMNode)
+NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(SVGSVGElement,
+                                               SVGSVGElementBase)
 
 SVGView::SVGView()
 {
   mZoomAndPan.Init(SVGSVGElement::ZOOMANDPAN,
                    SVG_ZOOMANDPAN_MAGNIFY);
   mViewBox.Init();
   mPreserveAspectRatio.Init();
 }
@@ -152,17 +151,17 @@ SVGSVGElement::SVGSVGElement(already_Add
 {
 }
 
 SVGSVGElement::~SVGSVGElement()
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT_AND_PARSER(SVGSVGElement)
 
 //----------------------------------------------------------------------
 // nsIDOMSVGSVGElement methods:
 
 already_AddRefed<SVGAnimatedLength>
 SVGSVGElement::X()
--- a/dom/svg/SVGScriptElement.cpp
+++ b/dom/svg/SVGScriptElement.cpp
@@ -27,17 +27,16 @@ nsSVGElement::StringInfo SVGScriptElemen
   { &nsGkAtoms::href, kNameSpaceID_None, false },
   { &nsGkAtoms::href, kNameSpaceID_XLink, false }
 };
 
 //----------------------------------------------------------------------
 // nsISupports methods
 
 NS_IMPL_ISUPPORTS_INHERITED(SVGScriptElement, SVGScriptElementBase,
-                            nsIDOMNode,
                             nsIScriptLoaderObserver,
                             nsIScriptElement, nsIMutationObserver)
 
 //----------------------------------------------------------------------
 // Implementation
 
 SVGScriptElement::SVGScriptElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
                                    FromParser aFromParser)
@@ -47,17 +46,17 @@ SVGScriptElement::SVGScriptElement(alrea
   AddMutationObserver(this);
 }
 
 SVGScriptElement::~SVGScriptElement()
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 nsresult
 SVGScriptElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
                         bool aPreallocateChildren) const
 {
   *aResult = nullptr;
 
   already_AddRefed<mozilla::dom::NodeInfo> ni = RefPtr<mozilla::dom::NodeInfo>(aNodeInfo).forget();
--- a/dom/svg/SVGSetElement.cpp
+++ b/dom/svg/SVGSetElement.cpp
@@ -22,17 +22,17 @@ SVGSetElement::WrapNode(JSContext *aCx, 
 // Implementation
 
 SVGSetElement::SVGSetElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGAnimationElement(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGSetElement)
 
 //----------------------------------------------------------------------
 
 nsSMILAnimationFunction&
 SVGSetElement::AnimationFunction()
 {
--- a/dom/svg/SVGSetElement.h
+++ b/dom/svg/SVGSetElement.h
@@ -25,17 +25,17 @@ protected:
   nsSMILSetAnimationFunction mAnimationFunction;
 
   friend nsresult (::NS_NewSVGSetElement(nsIContent **aResult,
                                          already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
-  // nsIDOMNode
+  // nsINode
   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
                          bool aPreallocateChildren) const override;
 
   // SVGAnimationElement
   virtual nsSMILAnimationFunction& AnimationFunction() override;
 };
 
 } // namespace dom
--- a/dom/svg/SVGStopElement.cpp
+++ b/dom/svg/SVGStopElement.cpp
@@ -25,17 +25,17 @@ nsSVGElement::NumberInfo SVGStopElement:
 // Implementation
 
 SVGStopElement::SVGStopElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGStopElementBase(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGStopElement)
 
 //----------------------------------------------------------------------
 
 already_AddRefed<SVGAnimatedNumber>
 SVGStopElement::Offset()
 {
--- a/dom/svg/SVGStyleElement.cpp
+++ b/dom/svg/SVGStyleElement.cpp
@@ -49,17 +49,17 @@ SVGStyleElement::SVGStyleElement(already
   AddMutationObserver(this);
 }
 
 SVGStyleElement::~SVGStyleElement()
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGStyleElement)
 
 
 //----------------------------------------------------------------------
 // nsIContent methods
 
--- a/dom/svg/SVGSwitchElement.cpp
+++ b/dom/svg/SVGSwitchElement.cpp
@@ -68,17 +68,17 @@ SVGSwitchElement::MaybeInvalidate()
       nsChangeHint_InvalidateRenderingObservers);
     nsSVGUtils::ScheduleReflowSVG(frame);
   }
 
   mActiveChild = newActiveChild;
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGSwitchElement)
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 nsresult
--- a/dom/svg/SVGSymbolElement.cpp
+++ b/dom/svg/SVGSymbolElement.cpp
@@ -17,30 +17,29 @@ SVGSymbolElement::WrapNode(JSContext *aC
 {
   return SVGSymbolElementBinding::Wrap(aCx, this, aGivenProto);
 }
 
 //----------------------------------------------------------------------
 // nsISupports methods
 
 NS_IMPL_ISUPPORTS_INHERITED(SVGSymbolElement, SVGSymbolElementBase,
-                            nsIDOMNode,
                             mozilla::dom::SVGTests)
 
 //----------------------------------------------------------------------
 // Implementation
 
 SVGSymbolElement::SVGSymbolElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGSymbolElementBase(aNodeInfo)
 {
 }
 
 SVGSymbolElement::~SVGSymbolElement()
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGSymbolElement)
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/svg/SVGTSpanElement.cpp
+++ b/dom/svg/SVGTSpanElement.cpp
@@ -37,17 +37,17 @@ SVGTSpanElement::GetEnumInfo()
 nsSVGElement::LengthAttributesInfo
 SVGTSpanElement::GetLengthInfo()
 {
   return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
                               ArrayLength(sLengthInfo));
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGTSpanElement)
 
 //----------------------------------------------------------------------
 // nsIContent methods
 
 NS_IMETHODIMP_(bool)
--- a/dom/svg/SVGTextElement.cpp
+++ b/dom/svg/SVGTextElement.cpp
@@ -36,17 +36,17 @@ SVGTextElement::GetEnumInfo()
 nsSVGElement::LengthAttributesInfo
 SVGTextElement::GetLengthInfo()
 {
   return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
                               ArrayLength(sLengthInfo));
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGTextElement)
 
 
 //----------------------------------------------------------------------
 // nsIContent methods
 
--- a/dom/svg/SVGTextPathElement.cpp
+++ b/dom/svg/SVGTextPathElement.cpp
@@ -86,17 +86,17 @@ nsSVGElement::StringInfo SVGTextPathElem
 // Implementation
 
 SVGTextPathElement::SVGTextPathElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGTextPathElementBase(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGTextPathElement)
 
 already_AddRefed<SVGAnimatedString>
 SVGTextPathElement::Href()
 {
   return mStringAttributes[HREF].IsExplicitlySet()
          ? mStringAttributes[HREF].ToDOMAnimatedString(this)
--- a/dom/svg/SVGTitleElement.cpp
+++ b/dom/svg/SVGTitleElement.cpp
@@ -17,17 +17,16 @@ SVGTitleElement::WrapNode(JSContext *aCx
 {
   return SVGTitleElementBinding::Wrap(aCx, this, aGivenProto);
 }
 
 //----------------------------------------------------------------------
 // nsISupports methods
 
 NS_IMPL_ISUPPORTS_INHERITED(SVGTitleElement, SVGTitleElementBase,
-                            nsIDOMNode,
                             nsIMutationObserver)
 
 //----------------------------------------------------------------------
 // Implementation
 
 SVGTitleElement::SVGTitleElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGTitleElementBase(aNodeInfo)
 {
@@ -103,15 +102,15 @@ SVGTitleElement::SendTitleChangeEvent(bo
 {
   nsIDocument* doc = GetUncomposedDoc();
   if (doc) {
     doc->NotifyPossibleTitleChange(aBound);
   }
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGTitleElement)
 
 } // namespace dom
 } // namespace mozilla
 
--- a/dom/svg/SVGUseElement.cpp
+++ b/dom/svg/SVGUseElement.cpp
@@ -80,17 +80,17 @@ SVGUseElement::SVGUseElement(already_Add
 }
 
 SVGUseElement::~SVGUseElement()
 {
   UnlinkSource();
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 nsresult
 SVGUseElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
                      bool aPreallocateChildren) const
 {
   *aResult = nullptr;
   already_AddRefed<mozilla::dom::NodeInfo> ni = RefPtr<mozilla::dom::NodeInfo>(aNodeInfo).forget();
   SVGUseElement *it = new SVGUseElement(ni);
--- a/dom/svg/SVGViewElement.cpp
+++ b/dom/svg/SVGViewElement.cpp
@@ -38,17 +38,17 @@ nsSVGElement::EnumInfo SVGViewElement::s
 // Implementation
 
 SVGViewElement::SVGViewElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGViewElementBase(aNodeInfo)
 {
 }
 
 //----------------------------------------------------------------------
-// nsIDOMNode methods
+// nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGViewElement)
 
 void
 SVGViewElement::SetZoomAndPan(uint16_t aZoomAndPan, ErrorResult& rv)
 {
   if (aZoomAndPan == SVG_ZOOMANDPAN_DISABLE ||
       aZoomAndPan == SVG_ZOOMANDPAN_MAGNIFY) {
--- a/dom/svg/nsSVGElement.cpp
+++ b/dom/svg/nsSVGElement.cpp
@@ -224,22 +224,16 @@ nsSVGElement::Init()
   for (i = 0; i < stringInfo.mStringCount; i++) {
     stringInfo.Reset(i);
   }
 
   return NS_OK;
 }
 
 //----------------------------------------------------------------------
-// nsISupports methods
-
-NS_IMPL_ISUPPORTS_INHERITED(nsSVGElement, nsSVGElementBase,
-                            nsIDOMNode)
-
-//----------------------------------------------------------------------
 // Implementation
 
 //----------------------------------------------------------------------
 // nsIContent methods
 
 nsresult
 nsSVGElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                          nsIContent* aBindingParent,
@@ -2399,17 +2393,17 @@ nsSVGElement::GetStringListInfo()
 }
 
 nsAttrValue
 nsSVGElement::WillChangeStringList(bool aIsConditionalProcessingAttribute,
                                    uint8_t aAttrEnum)
 {
   nsAtom* name;
   if (aIsConditionalProcessingAttribute) {
-    nsCOMPtr<SVGTests> tests(do_QueryInterface(static_cast<nsIDOMNode*>(this)));
+    nsCOMPtr<SVGTests> tests(do_QueryInterface(this));
     name = tests->GetAttrName(aAttrEnum);
   } else {
     name = *GetStringListInfo().mStringListInfo[aAttrEnum].mName;
   }
   return WillChangeValue(name);
 }
 
 void
--- a/dom/svg/nsSVGElement.h
+++ b/dom/svg/nsSVGElement.h
@@ -19,17 +19,16 @@
 #include "nsCycleCollectionParticipant.h"
 #include "nsError.h"
 #include "mozilla/dom/DOMRect.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/gfx/MatrixFwd.h"
 #include "nsISupportsImpl.h"
 #include "nsStyledElement.h"
 #include "nsSVGClass.h"
-#include "nsIDOMNode.h"
 #include "SVGContentUtils.h"
 #include "gfxMatrix.h"
 
 class nsSVGAngle;
 class nsSVGBoolean;
 class nsSVGEnum;
 class nsSVGInteger;
 class nsSVGIntegerPair;
@@ -61,17 +60,16 @@ class DOMSVGStringList;
 
 } // namespace mozilla
 
 struct nsSVGEnumMapping;
 
 typedef nsStyledElement nsSVGElementBase;
 
 class nsSVGElement : public nsSVGElementBase    // nsIContent
-                   , public nsIDOMNode
 {
 protected:
   explicit nsSVGElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
   friend nsresult NS_NewSVGElement(mozilla::dom::Element **aResult,
                                    already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   nsresult Init();
   virtual ~nsSVGElement();
 
@@ -86,17 +84,17 @@ public:
   typedef mozilla::SVGAnimatedLengthList SVGAnimatedLengthList;
   typedef mozilla::SVGAnimatedPointList SVGAnimatedPointList;
   typedef mozilla::SVGAnimatedPathSegList SVGAnimatedPathSegList;
   typedef mozilla::SVGAnimatedPreserveAspectRatio SVGAnimatedPreserveAspectRatio;
   typedef mozilla::nsSVGAnimatedTransformList nsSVGAnimatedTransformList;
   typedef mozilla::SVGStringList SVGStringList;
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsSVGElement, nsSVGElementBase)
 
   void DidAnimateClass();
 
   // nsIContent interface methods
 
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent,
                               bool aCompileEventHandlers) override;
@@ -301,17 +299,16 @@ public:
   {
     if (!mClassAttribute.IsAnimated()) {
       return nullptr;
     }
     return mClassAnimAttr;
   }
 
   virtual void ClearAnyCachedPath() {}
-  nsIDOMNode* AsDOMNode() final { return this; }
   virtual bool IsTransformable() { return false; }
 
   // WebIDL
   mozilla::dom::SVGSVGElement* GetOwnerSVGElement();
   nsSVGElement* GetViewportElement();
   already_AddRefed<mozilla::dom::SVGAnimatedString> ClassName();
 
   virtual bool IsSVGFocusable(bool* aIsFocusable, int32_t* aTabIndex);
--- a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
+++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
@@ -25,17 +25,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 "nsIDOMNode.h"
 #include "nsIDOMWindowUtils.h"
 #include "nsIDocShell.h"
 #include "nsIDocument.h"
 #include "nsIDocumentEncoder.h"
 #include "nsILoadContext.h"
 #include "nsIProtocolHandler.h"
 #include "nsISHEntry.h"
 #include "nsISupportsPrimitives.h"
@@ -231,17 +230,17 @@ WebBrowserPersistLocalDocument::GetBaseU
 
 namespace {
 
 // Helper class for ReadResources().
 class ResourceReader final : public nsIWebBrowserPersistDocumentReceiver {
 public:
     ResourceReader(WebBrowserPersistLocalDocument* aParent,
                    nsIWebBrowserPersistResourceVisitor* aVisitor);
-    nsresult OnWalkDOMNode(nsIDOMNode* aNode);
+    nsresult OnWalkDOMNode(nsINode* aNode);
 
     // This is called both to indicate the end of the document walk
     // and when a subdocument is (maybe asynchronously) sent to the
     // visitor.  The call to EndVisit needs to happen after both of
     // those have finished.
     void DocumentDone(nsresult aStatus);
 
     NS_DECL_NSIWEBBROWSERPERSISTDOCUMENTRECEIVER
@@ -258,20 +257,20 @@ private:
     // being walked and any outstanding asynchronous subdocument
     // StartPersistence calls.
     size_t mOutstandingDocuments;
     // Collects the status parameters to DocumentDone calls.
     nsresult mEndStatus;
 
     nsresult OnWalkURI(const nsACString& aURISpec);
     nsresult OnWalkURI(nsIURI* aURI);
-    nsresult OnWalkAttribute(nsIDOMNode* aNode,
+    nsresult OnWalkAttribute(Element* aElement,
                              const char* aAttribute,
                              const char* aNamespaceURI = "");
-    nsresult OnWalkSubframe(nsIDOMNode* aNode);
+    nsresult OnWalkSubframe(nsINode* aNode);
 
     ~ResourceReader();
 
     using IWBP = nsIWebBrowserPersist;
 };
 
 NS_IMPL_ISUPPORTS(ResourceReader, nsIWebBrowserPersistDocumentReceiver)
 
@@ -300,17 +299,17 @@ ResourceReader::DocumentDone(nsresult aS
         mEndStatus = aStatus;
     }
     if (--mOutstandingDocuments == 0) {
         mVisitor->EndVisit(mParent, mEndStatus);
     }
 }
 
 nsresult
-ResourceReader::OnWalkSubframe(nsIDOMNode* aNode)
+ResourceReader::OnWalkSubframe(nsINode* aNode)
 {
     nsCOMPtr<nsIFrameLoaderOwner> loaderOwner = do_QueryInterface(aNode);
     NS_ENSURE_STATE(loaderOwner);
     RefPtr<nsFrameLoader> loader = loaderOwner->GetFrameLoader();
     NS_ENSURE_STATE(loader);
 
     ++mOutstandingDocuments;
     // Pass in 0 as the outer window ID so that we start
@@ -375,48 +374,45 @@ ResourceReader::OnWalkURI(const nsACStri
                    aURISpec,
                    mParent->GetCharacterSet(),
                    mCurrentBaseURI);
     NS_ENSURE_SUCCESS(rv, rv);
     return OnWalkURI(uri);
 }
 
 static void
-ExtractAttribute(nsIDOMNode* aNode,
+ExtractAttribute(Element* aElement,
                  const char* aAttribute,
                  const char* aNamespaceURI,
                  nsCString&  aValue)
 {
-    nsCOMPtr<dom::Element> element = do_QueryInterface(aNode);
-    MOZ_ASSERT(element);
-
     // Find the named URI attribute on the (element) node and store
     // a reference to the URI that maps onto a local file name
 
-    RefPtr<nsDOMAttributeMap> attrMap = element->Attributes();
+    RefPtr<nsDOMAttributeMap> attrMap = aElement->Attributes();
 
     NS_ConvertASCIItoUTF16 namespaceURI(aNamespaceURI);
     NS_ConvertASCIItoUTF16 attribute(aAttribute);
     RefPtr<dom::Attr> attr = attrMap->GetNamedItemNS(namespaceURI, attribute);
     if (attr) {
         nsAutoString value;
         attr->GetValue(value);
         CopyUTF16toUTF8(value, aValue);
     } else {
         aValue.Truncate();
     }
 }
 
 nsresult
-ResourceReader::OnWalkAttribute(nsIDOMNode* aNode,
+ResourceReader::OnWalkAttribute(Element* aElement,
                                 const char* aAttribute,
                                 const char* aNamespaceURI)
 {
     nsAutoCString uriSpec;
-    ExtractAttribute(aNode, aAttribute, aNamespaceURI, uriSpec);
+    ExtractAttribute(aElement, aAttribute, aNamespaceURI, uriSpec);
     if (uriSpec.IsEmpty()) {
         return NS_OK;
     }
     return OnWalkURI(uriSpec);
 }
 
 static nsresult
 GetXMLStyleSheetLink(dom::ProcessingInstruction *aPI, nsAString &aHref)
@@ -424,87 +420,84 @@ GetXMLStyleSheetLink(dom::ProcessingInst
     nsAutoString data;
     aPI->GetData(data);
 
     nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::href, aHref);
     return NS_OK;
 }
 
 nsresult
-ResourceReader::OnWalkDOMNode(nsIDOMNode* aNode)
+ResourceReader::OnWalkDOMNode(nsINode* aNode)
 {
-    nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
-    if (!content) {
-        return NS_OK;
-    }
-
     // Fixup xml-stylesheet processing instructions
-    if (auto nodeAsPI = dom::ProcessingInstruction::FromNode(content)) {
+    if (auto nodeAsPI = dom::ProcessingInstruction::FromNode(aNode)) {
         nsAutoString target;
         nodeAsPI->GetTarget(target);
         if (target.EqualsLiteral("xml-stylesheet")) {
             nsAutoString href;
             GetXMLStyleSheetLink(nodeAsPI, href);
             if (!href.IsEmpty()) {
                 return OnWalkURI(NS_ConvertUTF16toUTF8(href));
             }
         }
         return NS_OK;
     }
 
     // Test the node to see if it's an image, frame, iframe, css, js
-    if (content->IsHTMLElement(nsGkAtoms::img)) {
-        return OnWalkAttribute(aNode, "src");
+    if (aNode->IsHTMLElement(nsGkAtoms::img)) {
+        return OnWalkAttribute(aNode->AsElement(), "src");
     }
 
-    if (content->IsSVGElement(nsGkAtoms::img)) {
-        return OnWalkAttribute(aNode, "href", "http://www.w3.org/1999/xlink");
+    if (aNode->IsSVGElement(nsGkAtoms::img)) {
+        return OnWalkAttribute(aNode->AsElement(), "href",
+                               "http://www.w3.org/1999/xlink");
     }
 
-    if (content->IsAnyOfHTMLElements(nsGkAtoms::audio, nsGkAtoms::video)) {
-        return OnWalkAttribute(aNode, "src");
+    if (aNode->IsAnyOfHTMLElements(nsGkAtoms::audio, nsGkAtoms::video)) {
+        return OnWalkAttribute(aNode->AsElement(), "src");
     }
 
-    if (content->IsHTMLElement(nsGkAtoms::source)) {
-        return OnWalkAttribute(aNode, "src");
+    if (aNode->IsHTMLElement(nsGkAtoms::source)) {
+        return OnWalkAttribute(aNode->AsElement(), "src");
     }
 
-    if (content->IsHTMLElement(nsGkAtoms::body)) {
-        return OnWalkAttribute(aNode, "background");
+    if (aNode->IsHTMLElement(nsGkAtoms::body)) {
+        return OnWalkAttribute(aNode->AsElement(), "background");
     }
 
-    if (content->IsHTMLElement(nsGkAtoms::table)) {
-        return OnWalkAttribute(aNode, "background");
+    if (aNode->IsHTMLElement(nsGkAtoms::table)) {
+        return OnWalkAttribute(aNode->AsElement(), "background");
     }
 
-    if (content->IsHTMLElement(nsGkAtoms::tr)) {
-        return OnWalkAttribute(aNode, "background");
+    if (aNode->IsHTMLElement(nsGkAtoms::tr)) {
+        return OnWalkAttribute(aNode->AsElement(), "background");
     }
 
-    if (content->IsAnyOfHTMLElements(nsGkAtoms::td, nsGkAtoms::th)) {
-        return OnWalkAttribute(aNode, "background");
+    if (aNode->IsAnyOfHTMLElements(nsGkAtoms::td, nsGkAtoms::th)) {
+        return OnWalkAttribute(aNode->AsElement(), "background");
     }
 
-    if (content->IsHTMLElement(nsGkAtoms::script)) {
-        return OnWalkAttribute(aNode, "src");
+    if (aNode->IsHTMLElement(nsGkAtoms::script)) {
+        return OnWalkAttribute(aNode->AsElement(), "src");
     }
 
-    if (content->IsSVGElement(nsGkAtoms::script)) {
-        return OnWalkAttribute(aNode, "href", "http://www.w3.org/1999/xlink");
+    if (aNode->IsSVGElement(nsGkAtoms::script)) {
+        return OnWalkAttribute(aNode->AsElement(), "href",
+                               "http://www.w3.org/1999/xlink");
     }
 
-    if (content->IsHTMLElement(nsGkAtoms::embed)) {
-        return OnWalkAttribute(aNode, "src");
+    if (aNode->IsHTMLElement(nsGkAtoms::embed)) {
+        return OnWalkAttribute(aNode->AsElement(), "src");
     }
 
-    if (content->IsHTMLElement(nsGkAtoms::object)) {
-        return OnWalkAttribute(aNode, "data");
+    if (aNode->IsHTMLElement(nsGkAtoms::object)) {
+        return OnWalkAttribute(aNode->AsElement(), "data");
     }
 
-    if (auto nodeAsLink = dom::HTMLLinkElement::FromNode(content)) {
+    if (auto nodeAsLink = dom::HTMLLinkElement::FromNode(aNode)) {
         // Test if the link has a rel value indicating it to be a stylesheet
         nsAutoString linkRel;
         nodeAsLink->GetRel(linkRel);
         if (!linkRel.IsEmpty()) {
             nsReadingIterator<char16_t> start;
             nsReadingIterator<char16_t> end;
             nsReadingIterator<char16_t> current;
 
@@ -522,39 +515,39 @@ ResourceReader::OnWalkDOMNode(nsIDOMNode
                 nsReadingIterator<char16_t> startWord = current;
                 do {
                     ++current;
                 } while (current != end && !nsCRT::IsAsciiSpace(*current));
 
                 // Store the link for fix up if it says "stylesheet"
                 if (Substring(startWord, current)
                         .LowerCaseEqualsLiteral("stylesheet")) {
-                    OnWalkAttribute(aNode, "href");
+                    OnWalkAttribute(aNode->AsElement(), "href");
                     return NS_OK;
                 }
                 if (current == end) {
                     break;
                 }
             }
         }
         return NS_OK;
     }
 
-    if (content->IsHTMLElement(nsGkAtoms::frame)) {
+    if (aNode->IsHTMLElement(nsGkAtoms::frame)) {
         return OnWalkSubframe(aNode);
     }
 
-    if (content->IsHTMLElement(nsGkAtoms::iframe) &&
+    if (aNode->IsHTMLElement(nsGkAtoms::iframe) &&
         !(mPersistFlags & IWBP::PERSIST_FLAGS_IGNORE_IFRAMES)) {
         return OnWalkSubframe(aNode);
     }
 
-    auto nodeAsInput = dom::HTMLInputElement::FromNode(content);
+    auto nodeAsInput = dom::HTMLInputElement::FromNode(aNode);
     if (nodeAsInput) {
-        return OnWalkAttribute(aNode, "src");
+        return OnWalkAttribute(aNode->AsElement(), "src");
     }
 
     return NS_OK;
 }
 
 // Helper class for node rewriting in writeContent().
 class PersistNodeFixup final : public nsIDocumentEncoderNodeFixup {
 public:
@@ -570,19 +563,16 @@ private:
     nsClassHashtable<nsCStringHashKey, nsCString> mMap;
     nsCOMPtr<nsIURI> mCurrentBaseURI;
     nsCOMPtr<nsIURI> mTargetBaseURI;
 
     bool IsFlagSet(uint32_t aFlag) const {
         return mParent->GetPersistFlags() & aFlag;
     }
 
-    // Helper for XPCOM FixupNode.
-    nsresult FixupNode(nsINode *aNodeIn, bool *aSerializeCloneKids,
-                       nsINode **aNodeOut);
     nsresult GetNodeToFixup(nsINode* aNodeIn, nsINode** aNodeOut);
     nsresult FixupURI(nsAString& aURI);
     nsresult FixupAttribute(nsINode* aNode,
                             const char* aAttribute,
                             const char* aNamespaceURI = "");
     nsresult FixupAnchor(nsINode* aNode);
     nsresult FixupXMLStyleSheetLink(dom::ProcessingInstruction* aPI,
                                     const nsAString& aHref);
@@ -826,36 +816,16 @@ PersistNodeFixup::FixupXMLStyleSheetLink
         }
         aPI->SetData(newData, IgnoreErrors());
     }
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
-PersistNodeFixup::FixupNode(nsIDOMNode *aNodeIn,
-                            bool *aSerializeCloneKids,
-                            nsIDOMNode **aNodeOut)
-{
-    nsCOMPtr<nsINode> nodeIn = do_QueryInterface(aNodeIn);
-    nsCOMPtr<nsINode> nodeOut;
-    nsresult rv = FixupNode(nodeIn, aSerializeCloneKids,
-                            getter_AddRefs(nodeOut));
-    // FixupNode can return NS_OK and a null outparam, so check
-    // the actual value we got before dereferencing it.
-    if (nodeOut) {
-      NS_ADDREF(*aNodeOut = nodeOut->AsDOMNode());
-    } else {
-      *aNodeOut = nullptr;
-    }
-
-    return rv;
-}
-
-nsresult
 PersistNodeFixup::FixupNode(nsINode* aNodeIn,
                             bool* aSerializeCloneKids,
                             nsINode** aNodeOut)
 {
     *aNodeOut = nullptr;
     *aSerializeCloneKids = false;
 
     uint16_t type = aNodeIn->NodeType();
@@ -1179,17 +1149,17 @@ WebBrowserPersistLocalDocument::ReadReso
     if (NS_WARN_IF(err.Failed())) {
         return err.StealNSResult();
     }
     MOZ_ASSERT(walker);
 
     RefPtr<ResourceReader> reader = new ResourceReader(this, aVisitor);
     nsCOMPtr<nsINode> currentNode = walker->CurrentNode();
     do {
-        rv = reader->OnWalkDOMNode(currentNode->AsDOMNode());
+        rv = reader->OnWalkDOMNode(currentNode);
         if (NS_WARN_IF(NS_FAILED(rv))) {
             break;
         }
 
         ErrorResult err;
         currentNode = walker->NextNode(err);
         if (NS_WARN_IF(err.Failed())) {
             err.SuppressException();
--- a/dom/websocket/WebSocket.cpp
+++ b/dom/websocket/WebSocket.cpp
@@ -1860,17 +1860,17 @@ WebSocketImpl::InitializeConnection(nsIP
   mOriginDocument = nullptr;
 
 
   // The TriggeringPrincipal for websockets must always be a script.
   // Let's make sure that the doc's principal (if a doc exists)
   // and aPrincipal are same origin.
   MOZ_ASSERT(!doc || doc->NodePrincipal()->Equals(aPrincipal));
 
-  rv = wsChannel->InitLoadInfo(doc ? doc->AsDOMNode() : nullptr,
+  rv = wsChannel->InitLoadInfo(doc,
                                doc ? doc->NodePrincipal() : aPrincipal,
                                aPrincipal,
                                nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
                                nsIContentPolicy::TYPE_WEBSOCKET);
   MOZ_ASSERT(NS_SUCCEEDED(rv));
 
   if (!mRequestedProtocolList.IsEmpty()) {
     rv = wsChannel->SetProtocol(mRequestedProtocolList);
--- a/dom/xbl/XBLChildrenElement.cpp
+++ b/dom/xbl/XBLChildrenElement.cpp
@@ -11,20 +11,16 @@
 
 namespace mozilla {
 namespace dom {
 
 XBLChildrenElement::~XBLChildrenElement()
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED(XBLChildrenElement,
-                            Element,
-                            nsIDOMNode)
-
 NS_IMPL_ELEMENT_CLONE(XBLChildrenElement)
 
 nsresult
 XBLChildrenElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
                                   const nsAttrValueOrString* aValue,
                                   bool aNotify)
 {
   if (aNamespaceID == kNameSpaceID_None) {
--- a/dom/xbl/XBLChildrenElement.h
+++ b/dom/xbl/XBLChildrenElement.h
@@ -2,17 +2,16 @@
 /* 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/. */
 
 #ifndef nsXBLChildrenElement_h___
 #define nsXBLChildrenElement_h___
 
-#include "nsIDOMNode.h"
 #include "nsINodeList.h"
 #include "nsBindingManager.h"
 #include "mozilla/dom/nsXMLElement.h"
 
 class nsAnonymousContentList;
 
 namespace mozilla {
 namespace dom {
@@ -25,24 +24,22 @@ public:
   {
   }
   explicit XBLChildrenElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
     : nsXMLElement(aNodeInfo)
   {
   }
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(XBLChildrenElement, nsXMLElement)
 
   // nsINode interface methods
   virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
                          bool aPreallocateChildren) const override;
 
-  virtual nsIDOMNode* AsDOMNode() override { return this; }
-
   void AppendInsertedChild(nsIContent* aChild, bool aNotify)
   {
     // Appending an inserted child causes the inserted
     // children to be projected instead of default content.
     MaybeRemoveDefaultContent(aNotify);
 
     mInsertedChildren.AppendElement(aChild);
     aChild->SetXBLInsertionPoint(this);
--- a/dom/xbl/nsXBLContentSink.cpp
+++ b/dom/xbl/nsXBLContentSink.cpp
@@ -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/. */
 
 #include "mozilla/ArrayUtils.h"
 
 #include "nsXBLContentSink.h"
 #include "nsIDocument.h"
 #include "nsBindingManager.h"
-#include "nsIDOMNode.h"
 #include "nsGkAtoms.h"
 #include "nsNameSpaceManager.h"
 #include "nsIURI.h"
 #include "nsTextFragment.h"
 #ifdef MOZ_XUL
 #include "nsXULElement.h"
 #endif
 #include "nsXBLProtoImplProperty.h"
--- a/dom/xbl/nsXBLProtoImpl.cpp
+++ b/dom/xbl/nsXBLProtoImpl.cpp
@@ -7,17 +7,16 @@
 #include "mozilla/DebugOnly.h"
 
 #include "nsXBLProtoImpl.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsContentUtils.h"
 #include "nsIXPConnect.h"
 #include "nsIServiceManager.h"
-#include "nsIDOMNode.h"
 #include "nsXBLPrototypeBinding.h"
 #include "nsXBLProtoImplProperty.h"
 #include "nsIURI.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/XULElementBinding.h"
 #include "xpcpublic.h"
 #include "js/CharacterEncoding.h"
 
--- a/dom/xml/CDATASection.cpp
+++ b/dom/xml/CDATASection.cpp
@@ -10,18 +10,16 @@
 
 namespace mozilla {
 namespace dom {
 
 CDATASection::~CDATASection()
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED(CDATASection, CharacterData, nsIDOMNode)
-
 JSObject*
 CDATASection::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return CDATASectionBinding::Wrap(aCx, this, aGivenProto);
 }
 
 bool
 CDATASection::IsNodeOfType(uint32_t aFlags) const
--- a/dom/xml/CDATASection.h
+++ b/dom/xml/CDATASection.h
@@ -4,23 +4,21 @@
  * 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_CDATASection_h
 #define mozilla_dom_CDATASection_h
 
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/Text.h"
-#include "nsIDOMNode.h"
 
 namespace mozilla {
 namespace dom {
 
-class CDATASection final : public Text,
-                           public nsIDOMNode
+class CDATASection final : public Text
 {
 private:
   void Init()
   {
     MOZ_ASSERT(mNodeInfo->NodeType() == CDATA_SECTION_NODE,
                "Bad NodeType in aNodeInfo");
   }
 
@@ -37,26 +35,25 @@ public:
     : Text(aNodeInfoManager->GetNodeInfo(nsGkAtoms::cdataTagName,
                                          nullptr, kNameSpaceID_None,
                                          CDATA_SECTION_NODE))
   {
     Init();
   }
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(CDATASection, Text)
 
   // nsINode
   virtual bool IsNodeOfType(uint32_t aFlags) const override;
 
   virtual already_AddRefed<CharacterData>
     CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
                   bool aCloneText) const override;
 
-  virtual nsIDOMNode* AsDOMNode() override { return this; }
 #ifdef DEBUG
   virtual void List(FILE* out, int32_t aIndent) const override;
   virtual void DumpContent(FILE* out, int32_t aIndent,bool aDumpAll) const override;
 #endif
 
 protected:
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 };
--- a/dom/xml/ProcessingInstruction.cpp
+++ b/dom/xml/ProcessingInstruction.cpp
@@ -59,17 +59,17 @@ ProcessingInstruction::ProcessingInstruc
 }
 
 ProcessingInstruction::~ProcessingInstruction()
 {
 }
 
 // If you add nsIStyleSheetLinkingElement here, make sure we actually
 // implement the nsStyleLinkElement methods.
-NS_IMPL_ISUPPORTS_INHERITED(ProcessingInstruction, CharacterData, nsIDOMNode)
+NS_IMPL_ISUPPORTS_INHERITED0(ProcessingInstruction, CharacterData)
 
 JSObject*
 ProcessingInstruction::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return ProcessingInstructionBinding::Wrap(aCx, this, aGivenProto);
 }
 
 bool
--- a/dom/xml/ProcessingInstruction.h
+++ b/dom/xml/ProcessingInstruction.h
@@ -4,48 +4,45 @@
  * 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_ProcessingInstruction_h
 #define mozilla_dom_ProcessingInstruction_h
 
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/CharacterData.h"
-#include "nsIDOMNode.h"
 #include "nsAString.h"
 #include "nsStyleLinkElement.h"
 
 class nsIPrincipal;
 class nsIURI;
 
 namespace mozilla {
 namespace dom {
 
 class ProcessingInstruction : public CharacterData
                             , public nsStyleLinkElement
-                            , public nsIDOMNode
 {
 public:
   ProcessingInstruction(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                         const nsAString& aData);
 
-  // nsISupports
+  // nsISupports.  We need to declare QI, because nsStyleLinkElement
+  // has a pure-virtual QI.
   NS_DECL_ISUPPORTS_INHERITED
 
   virtual already_AddRefed<CharacterData>
     CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
                   bool aCloneText) const override;
 
 #ifdef DEBUG
   virtual void List(FILE* out, int32_t aIndent) const override;
   virtual void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const override;
 #endif
 
-  virtual nsIDOMNode* AsDOMNode() override { return this; }
-
   // WebIDL API
   void GetTarget(nsAString& aTarget)
   {
     aTarget = NodeName();
   }
 
   NS_IMPL_FROMNODE_HELPER(ProcessingInstruction, IsProcessingInstruction())
 
--- a/dom/xml/XMLStylesheetProcessingInstruction.cpp
+++ b/dom/xml/XMLStylesheetProcessingInstruction.cpp
@@ -10,17 +10,16 @@
 
 namespace mozilla {
 namespace dom {
 
 // nsISupports implementation
 
 NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(XMLStylesheetProcessingInstruction,
                                              ProcessingInstruction,
-                                             nsIDOMNode,
                                              nsIStyleSheetLinkingElement)
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(XMLStylesheetProcessingInstruction)
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(XMLStylesheetProcessingInstruction,
                                                   ProcessingInstruction)
   tmp->nsStyleLinkElement::Traverse(cb);
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
@@ -60,17 +59,17 @@ void
 XMLStylesheetProcessingInstruction::UnbindFromTree(bool aDeep, bool aNullParent)
 {
   nsCOMPtr<nsIDocument> oldDoc = GetUncomposedDoc();
 
   ProcessingInstruction::UnbindFromTree(aDeep, aNullParent);
   Unused << UpdateStyleSheetInternal(oldDoc, nullptr);
 }
 
-// nsIDOMNode
+// nsINode
 
 void
 XMLStylesheetProcessingInstruction::SetNodeValueInternal(const nsAString& aNodeValue,
                                                          ErrorResult& aError)
 {
   CharacterData::SetNodeValueInternal(aNodeValue, aError);
   if (!aError.Failed()) {
     Unused << UpdateStyleSheetInternal(nullptr, nullptr, ForceUpdate::Yes);
--- a/dom/xml/XMLStylesheetProcessingInstruction.h
+++ b/dom/xml/XMLStylesheetProcessingInstruction.h
@@ -38,17 +38,17 @@ public:
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // CC
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XMLStylesheetProcessingInstruction,
                                            ProcessingInstruction)
 
-  // nsIDOMNode
+  // nsINode
   virtual void SetNodeValueInternal(const nsAString& aNodeValue,
                                     mozilla::ErrorResult& aError) override;
 
   // nsIContent
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent,
                               bool aCompileEventHandlers) override;
   virtual void UnbindFromTree(bool aDeep = true,
--- a/dom/xml/nsXMLElement.cpp
+++ b/dom/xml/nsXMLElement.cpp
@@ -16,19 +16,16 @@ nsresult
 NS_NewXMLElement(Element** aInstancePtrResult,
                  already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
 {
   nsXMLElement* it = new nsXMLElement(aNodeInfo);
   NS_ADDREF(*aInstancePtrResult = it);
   return NS_OK;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED(nsXMLElement, Element,
-                            nsIDOMNode)
-
 JSObject*
 nsXMLElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return ElementBinding::Wrap(aCx, this, aGivenProto);
 }
 
 void
 nsXMLElement::UnbindFromTree(bool aDeep, bool aNullParent)
--- a/dom/xml/nsXMLElement.h
+++ b/dom/xml/nsXMLElement.h
@@ -3,38 +3,34 @@
 /* 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 nsXMLElement_h___
 #define nsXMLElement_h___
 
 #include "mozilla/Attributes.h"
-#include "nsIDOMNode.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/DOMRect.h"
 
-class nsXMLElement : public mozilla::dom::Element,
-                     public nsIDOMNode
+class nsXMLElement : public mozilla::dom::Element
 {
 public:
   explicit nsXMLElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
     : mozilla::dom::Element(aNodeInfo)
   {
   }
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsXMLElement, mozilla::dom::Element)
 
   // nsINode interface methods
   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
                          bool aPreallocateChildren) const override;
 
-  virtual nsIDOMNode* AsDOMNode() override { return this; }
-
   virtual void UnbindFromTree(bool aDeep = true,
                               bool aNullParent = true) override;
 
 protected:
   virtual ~nsXMLElement() {}
 
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 };
--- a/dom/xslt/xpath/XPathResult.cpp
+++ b/dom/xslt/xpath/XPathResult.cpp
@@ -4,17 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "XPathResult.h"
 #include "txExprResult.h"
 #include "txNodeSet.h"
 #include "nsError.h"
 #include "mozilla/dom/Attr.h"
 #include "mozilla/dom/Element.h"
-#include "nsIDOMNode.h"
 #include "nsDOMString.h"
 #include "txXPathTreeWalker.h"
 #include "nsCycleCollectionParticipant.h"
 #include "mozilla/dom/XPathResultBinding.h"
 
 namespace mozilla {
 namespace dom {
 
--- a/dom/xslt/xpath/txXPathTreeWalker.h
+++ b/dom/xslt/xpath/txXPathTreeWalker.h
@@ -93,20 +93,16 @@ class txXPathNativeNode
 {
 public:
     static txXPathNode* createXPathNode(nsINode* aNode,
                                         bool aKeepRootAlive = false);
     static txXPathNode* createXPathNode(nsIContent* aContent,
                                         bool aKeepRootAlive = false);
     static txXPathNode* createXPathNode(nsIDocument* aDocument);
     static nsINode* getNode(const txXPathNode& aNode);
-    static nsresult getNode(const txXPathNode& aNode, nsIDOMNode** aResult)
-    {
-        return CallQueryInterface(getNode(aNode), aResult);
-    }
     static nsIContent* getContent(const txXPathNode& aNode);
     static nsIDocument* getDocument(const txXPathNode& aNode);
     static void addRef(const txXPathNode& aNode)
     {
         NS_ADDREF(aNode.mNode);
     }
     static void release(const txXPathNode& aNode)
     {
--- a/dom/xslt/xslt/txEXSLTFunctions.cpp
+++ b/dom/xslt/xslt/txEXSLTFunctions.cpp
@@ -93,19 +93,17 @@ createTextNode(txIEvalContext *aContext,
         return NS_ERROR_UNEXPECTED;
     }
 
     RefPtr<nsTextNode> text = new nsTextNode(doc->NodeInfoManager());
 
     nsresult rv = text->SetText(aValue, false);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    // nsTextNode implements both nsIDOMNode and nsIContent, so the
-    // call would be ambiguous without the AsContent() call.
-    *aResult = txXPathNativeNode::createXPathNode(text->AsContent(), true);
+    *aResult = txXPathNativeNode::createXPathNode(text, true);
     NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
 
     return NS_OK;
 }
 
 static nsresult
 createAndAddToResult(nsAtom* aName, const nsAString& aValue,
                      txNodeSet* aResultSet, DocumentFragment* aResultHolder)
--- a/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp
+++ b/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp
@@ -1,16 +1,15 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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 "nsCOMArray.h"
 #include "nsIAuthPrompt.h"
-#include "nsIDOMNode.h"
 #include "nsIDocument.h"
 #include "nsIExpatSink.h"
 #include "nsIChannelEventSink.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsILoadGroup.h"
 #include "nsIParser.h"
 #include "nsCharsetSource.h"
 #include "nsIRequestObserver.h"
--- a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
+++ b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
@@ -815,23 +815,20 @@ txMozillaXSLTProcessor::SetParameter(con
                 nsresult rv = xpathResult->GetExprResult(getter_AddRefs(result));
                 NS_ENSURE_SUCCESS(rv, rv);
 
                 if (result->getResultType() == txAExprResult::NODESET) {
                     txNodeSet *nodeSet =
                         static_cast<txNodeSet*>
                                    (static_cast<txAExprResult*>(result));
 
-                    nsCOMPtr<nsIDOMNode> node;
                     int32_t i, count = nodeSet->size();
                     for (i = 0; i < count; ++i) {
-                        rv = txXPathNativeNode::getNode(nodeSet->get(i),
-                                                        getter_AddRefs(node));
-                        NS_ENSURE_SUCCESS(rv, rv);
-
+                        nsINode* node =
+                            txXPathNativeNode::getNode(nodeSet->get(i));
                         if (!nsContentUtils::CanCallerAccess(node)) {
                             return NS_ERROR_DOM_SECURITY_ERR;
                         }
                     }
                 }
 
                 // Clone the XPathResult so that mutations don't affect this
                 // variable.
@@ -891,17 +888,17 @@ txMozillaXSLTProcessor::SetParameter(con
                 return NS_ERROR_ILLEGAL_VALUE;
             }
 
             nsISupports** values = static_cast<nsISupports**>(array);
 
             uint32_t i;
             for (i = 0; i < count; ++i) {
                 nsISupports *supports = values[i];
-                nsCOMPtr<nsIDOMNode> node = do_QueryInterface(supports);
+                nsCOMPtr<nsINode> node = do_QueryInterface(supports);
 
                 if (node) {
                     rv = nsContentUtils::CanCallerAccess(node) ? NS_OK :
                          NS_ERROR_DOM_SECURITY_ERR;
                 }
                 else {
                     // We only support arrays of DOM nodes.
                     rv = NS_ERROR_ILLEGAL_VALUE;
--- a/dom/xul/XULDocument.cpp
+++ b/dom/xul/XULDocument.cpp
@@ -1498,17 +1498,17 @@ XULDocument::RemoveSubtreeFromDocument(n
         RemoveBroadcastListenerFor(*broadcaster, *listener, attribute);
     }
 
     return NS_OK;
 }
 
 //----------------------------------------------------------------------
 //
-// nsIDOMNode interface
+// nsINode interface
 //
 
 nsresult
 XULDocument::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
                    bool aPreallocateChildren) const
 {
     // We don't allow cloning of a XUL document
     *aResult = nullptr;
--- a/dom/xul/nsIXULSortService.idl
+++ b/dom/xul/nsIXULSortService.idl
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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 nsIDOMNode;
+webidl Element;
 
 /**
  * A service used to sort the contents of a XUL widget.
  */
 [scriptable, uuid(F29270C8-3BE5-4046-9B57-945A84DFF132)]
 interface nsIXULSortService : nsISupports
 {
     const unsigned long SORT_COMPARECASE = 0x0001;
@@ -26,17 +26,17 @@ interface nsIXULSortService : nsISupport
      * @param aSortHints One or more hints as to how to sort:
      *
      *   ascending: to sort the contents in ascending order
      *   descending: to sort the contents in descending order
      *   comparecase: perform case sensitive comparisons
      *   integer: treat values as integers, non-integers are compared as strings
      *   twostate: don't allow the natural (unordered state)
      */
-    void sort(in nsIDOMNode aNode,
+    void sort(in Element aNode,
               in AString aSortKey,
               in AString aSortHints);
 };
 
 %{C++
 nsresult
 NS_NewXULSortService(nsIXULSortService **result);
 %}
--- a/dom/xul/nsXULCommandDispatcher.h
+++ b/dom/xul/nsXULCommandDispatcher.h
@@ -11,17 +11,16 @@
 */
 
 #ifndef nsXULCommandDispatcher_h__
 #define nsXULCommandDispatcher_h__
 
 #include "nsCOMPtr.h"
 #include "nsIDOMXULCommandDispatcher.h"
 #include "nsWeakReference.h"
-#include "nsIDOMNode.h"
 #include "nsString.h"
 #include "nsCycleCollectionParticipant.h"
 #include "mozilla/RefPtr.h"
 
 class nsPIWindowRoot;
 
 namespace mozilla {
 namespace dom {
--- a/dom/xul/nsXULElement.cpp
+++ b/dom/xul/nsXULElement.cpp
@@ -313,24 +313,23 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_IN
     tmp->ClearHasID();
     NS_IMPL_CYCLE_COLLECTION_UNLINK(mBindingParent);
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_IMPL_ADDREF_INHERITED(nsXULElement, nsStyledElement)
 NS_IMPL_RELEASE_INHERITED(nsXULElement, nsStyledElement)
 
 NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsXULElement)
-    NS_INTERFACE_TABLE_INHERITED(nsXULElement, nsIDOMNode)
     NS_ELEMENT_INTERFACE_TABLE_TO_MAP_SEGUE
     NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIFrameLoaderOwner,
                                    new nsXULElementTearoff(this))
 NS_INTERFACE_MAP_END_INHERITING(nsStyledElement)
 
 //----------------------------------------------------------------------
-// nsIDOMNode interface
+// nsINode interface
 
 nsresult
 nsXULElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
                     bool aPreallocateChildren) const
 {
     *aResult = nullptr;
 
     RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo;
--- a/dom/xul/nsXULElement.h
+++ b/dom/xul/nsXULElement.h
@@ -13,17 +13,16 @@
 #define nsXULElement_h__
 
 #include "js/TracingAPI.h"
 #include "mozilla/Attributes.h"
 #include "nsIServiceManager.h"
 #include "nsAtom.h"
 #include "mozilla/dom/NodeInfo.h"
 #include "nsIControllers.h"
-#include "nsIDOMNode.h"
 #include "nsIDOMXULMultSelectCntrlEl.h"
 #include "nsIURI.h"
 #include "nsLayoutCID.h"
 #include "nsAttrAndChildArray.h"
 #include "nsGkAtoms.h"
 #include "nsStringFwd.h"
 #include "nsStyledElement.h"
 #include "nsIFrameLoaderOwner.h"
@@ -329,18 +328,17 @@ enum {
   XUL_ELEMENT_HAS_CONTENTMENU_LISTENER =  XUL_ELEMENT_FLAG_BIT(0),
   XUL_ELEMENT_HAS_POPUP_LISTENER =        XUL_ELEMENT_FLAG_BIT(1)
 };
 
 ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 2);
 
 #undef XUL_ELEMENT_FLAG_BIT
 
-class nsXULElement : public nsStyledElement,
-                     public nsIDOMNode
+class nsXULElement : public nsStyledElement
 {
 protected:
     // Use Construct to construct elements instead of this constructor.
     explicit nsXULElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
 
 public:
     using Element::Blur;
     using Element::Focus;
@@ -408,18 +406,16 @@ public:
     // This function should ONLY be used by BindToTree implementations.
     // The function exists solely because XUL elements store the binding
     // parent as a member instead of in the slots, as Element does.
     void SetXULBindingParent(nsIContent* aBindingParent)
     {
       mBindingParent = aBindingParent;
     }
 
-    virtual nsIDOMNode* AsDOMNode() override { return this; }
-
     virtual bool IsEventAttributeNameInternal(nsAtom* aName) override;
 
     typedef mozilla::dom::DOMString DOMString;
     void GetXULAttr(nsAtom* aName, DOMString& aResult) const
     {
         GetAttr(kNameSpaceID_None, aName, aResult);
     }
     void SetXULAttr(nsAtom* aName, const nsAString& aValue,
--- a/dom/xul/nsXULSortService.cpp
+++ b/dom/xul/nsXULSortService.cpp
@@ -4,17 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
   This file provides the implementation for the sort service manager.
  */
 
 #include "nsCOMPtr.h"
 #include "nsIContent.h"
-#include "nsIDOMNode.h"
 #include "nsIServiceManager.h"
 #include "nsGkAtoms.h"
 #include "nsNameSpaceManager.h"
 #include "nsXULContentUtils.h"
 #include "nsString.h"
 #include "nsQuickSort.h"
 #include "nsWhitespaceTokenizer.h"
 #include "nsXULSortService.h"
@@ -334,33 +333,28 @@ XULSortServiceImpl::CompareValues(const 
                              aLeft, aRight, &result);
     return result;
   }
 
   return ::Compare(aLeft, aRight, nsCaseInsensitiveStringComparator());
 }
 
 NS_IMETHODIMP
-XULSortServiceImpl::Sort(nsIDOMNode* aNode,
+XULSortServiceImpl::Sort(Element* aNode,
                          const nsAString& aSortKey,
                          const nsAString& aSortHints)
 {
-  // get root content node
-  nsCOMPtr<Element> sortNode = do_QueryInterface(aNode);
-  if (!sortNode)
-    return NS_ERROR_FAILURE;
-
   nsSortState sortState;
-  nsresult rv = InitializeSortState(sortNode, sortNode,
+  nsresult rv = InitializeSortState(aNode, aNode,
                                     aSortKey, aSortHints, &sortState);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // store sort info in attributes on content
-  SetSortHints(sortNode, &sortState);
-  rv = SortContainer(sortNode, &sortState);
+  SetSortHints(aNode, &sortState);
+  rv = SortContainer(aNode, &sortState);
 
   return rv;
 }
 
 nsresult
 NS_NewXULSortService(nsIXULSortService** sortService)
 {
   *sortService = new XULSortServiceImpl();
--- a/editor/libeditor/TextEditor.cpp
+++ b/editor/libeditor/TextEditor.cpp
@@ -1712,17 +1712,17 @@ TextEditor::GetAndInitDocEncoder(const n
   // ... or if the root element is not a body,
   // in which case we set the selection to encompass the root.
   else {
     dom::Element* rootElement = GetRoot();
     if (NS_WARN_IF(!rootElement)) {
       return nullptr;
     }
     if (!rootElement->IsHTMLElement(nsGkAtoms::body)) {
-      rv = docEncoder->SetNativeContainerNode(rootElement);
+      rv = docEncoder->SetContainerNode(rootElement);
       if (NS_WARN_IF(NS_FAILED(rv))) {
         return nullptr;
       }
     }
   }
 
   return docEncoder.forget();
 }
--- a/extensions/spellcheck/locales/en-US/hunspell/README_en_US.txt
+++ b/extensions/spellcheck/locales/en-US/hunspell/README_en_US.txt
@@ -1,11 +1,11 @@
 en_US-mozilla Hunspell Dictionary
-Generated from SCOWL Version 2017.08.24
-Mon Dec  4 10:21:53 EST 2017
+Generated from SCOWL Version 2018.04.16
+Tue May 29 16:25:01 EDT 2018
 
 http://wordlist.sourceforge.net
 
 README file for English Hunspell dictionaries derived from SCOWL.
 
 These dictionaries are created using the speller/make-hunspell-dict
 script in SCOWL.
 
@@ -339,9 +339,9 @@ and Australian word list.  It is under t
   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   SUCH DAMAGE.
 
-Build Date: Mon Dec  4 10:21:53 EST 2017
+Build Date: Tue May 29 16:25:01 EDT 2018
--- a/extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/5-mozilla-added
+++ b/extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/5-mozilla-added
@@ -481,16 +481,18 @@ Bab
 Bab's
 Babb
 Babb's
 Babbie
 Babbie's
 Babette
 Babette's
 Babs
+Bahasa
+Bahasa's
 Bailie
 Bailie's
 Baillie
 Baillie's
 Baily
 Baily's
 Bald's
 Bancorp
@@ -631,16 +633,18 @@ BibTeX's
 Bibby
 Bibby's
 Bibi
 Bibi's
 Bil
 Bil's
 Bili
 Bili's
+Bing
+Bing's
 Bink
 Bink's
 Binky
 Binky's
 Binnie
 Binnie's
 Birgit
 Birgit's
@@ -740,16 +744,17 @@ Brose's
 Bryn
 Bryn's
 Brynn
 Brynn's
 Bucky
 Bucky's
 Budd
 Budd's
+Buenos
 Burk
 Burk's
 Burkina
 Burkina's
 Burnaby
 Burnaby's
 Burnard
 Burnard's
@@ -1571,16 +1576,18 @@ Elyse's
 Elyssa
 Elyssa's
 Ema
 Ema's
 Emanuele
 Emanuele's
 Emeline
 Emeline's
+Emeryville
+Emeryville's
 Emilie
 Emilie's
 Emlen
 Emlen's
 Emlyn
 Emlyn's
 Emmaline
 Emmaline's
@@ -1764,18 +1771,16 @@ Fina's
 FindArticles
 FindArticles's
 FindLaw
 FindLaw's
 Findlay
 Findlay's
 Findley
 Findley's
-Finlay
-Finlay's
 Fitz
 Fitz's
 Flem
 Flemming
 Flemming's
 Fletch
 Fletch's
 Fleur
@@ -1882,16 +1887,17 @@ GameCube's
 GameFAQs
 GameFAQs's
 GameSpot
 GameSpot's
 Gan
 Gan's
 Gannon
 Gannon's
+Garamond
 Gard
 Gardiner
 Gare
 Gare's
 Garey
 Garey's
 Garrard
 Garrard's
@@ -2139,16 +2145,17 @@ Gusti's
 Gusty's
 Gwendolen
 Gwendolen's
 Gwyneth
 Gwyneth's
 Gwynne
 Gwynne's
 HTTPS
+HVAC
 Had's
 Hadleigh
 Hadleigh's
 Hadley
 Hadley's
 Hadria
 Hadria's
 Hagan
@@ -2363,22 +2370,26 @@ Hy
 Hy's
 Hyacinthe
 Hyacinthe's
 Hyatt
 Hyatt's
 Hyman
 Hyman's
 Hymie
+IANAL
+IIRC
 IMDb
 IMDb's
 IMDbPro
 IMDbPro's
 IPO's
 IPOs
+ISP's
+ISPs
 Iain
 Iain's
 Ianthe
 Ianthe's
 Ibrahim
 Ibrahim's
 Ichabod
 Ichabod's
@@ -2448,16 +2459,18 @@ Isidora's
 Isidore
 Isidore's
 Isidoro
 Isidoro's
 Isobel
 Isobel's
 Issy
 Issy's
+Italia
+Italia's
 Ivar
 Ivar's
 Ive
 Ive's
 Iver
 Iver's
 Ivie
 Ivie's
@@ -3124,16 +3137,17 @@ Lyn's
 Lynde
 Lynde's
 Lyndsay
 Lyndsay's
 Lyndsey
 Lyndsey's
 Lyssa
 Lyssa's
+MDF
 MHz's
 MPEG's
 MPEGs
 Mab
 Macau
 Macau's
 Macromedia
 Macromedia's
@@ -3540,18 +3554,16 @@ Mozillian's
 Mozillians
 Munroe
 Munroe's
 Murdock
 Murdock's
 Murry
 Murry's
 My's
-MySQL
-MySQL's
 MySpell
 MySpell's
 Myer
 Myer's
 Myriam
 Myriam's
 NGO
 NGO's
@@ -3607,16 +3619,19 @@ Nealy's
 Necko
 Necko's
 Neda
 Neda's
 Nedda
 Nedda's
 Neddy
 Neddy's
+Nederland
+Nederland's
+Nederlands
 Neel
 Neel's
 Neely
 Neely's
 Neill
 Neill's
 Neils
 Nelle
@@ -3795,16 +3810,21 @@ Oxley
 Oxley's
 Ozzy
 Ozzy's
 PDA
 PDA's
 PDAs
 PDF's
 PDFs
+PNG
+PNG's
+PNGs
+POTUS
+POTUS's
 PRNewswire
 PRNewswire's
 Paco
 Paco's
 Padgett
 Padgett's
 Padraic
 Padraic's
@@ -3901,16 +3921,17 @@ Peterborough's
 Petey
 Petey's
 Petr
 Petr's
 Petronella
 Petronella's
 Petronilla
 Petronilla's
+Peyronie's
 Peyton
 Peyton's
 Phebe
 Philippa
 Philippa's
 Phillida
 Phillida's
 Phillipe
@@ -3939,20 +3960,21 @@ Pietra's
 Pietro
 Pietro's
 Pinchas
 Pinchas's
 Piotr
 Piotr's
 Pippa
 Pippa's
+Pixar
+Pixar's
+Polska
 PostScript
 PostScript's
-PostgreSQL
-PostgreSQL's
 Poul
 Poul's
 Poynter
 Poynter's
 Prentiss
 Prentiss's
 Prinz
 Pris
@@ -4064,16 +4086,17 @@ Rayner
 Rayner's
 Raynor
 Raynor's
 Rea
 Rea's
 Reade
 Rebeca
 Rebeca's
+Rebecca
 Rebecca's
 Rebecka
 Rebecka's
 Redd
 Redd's
 Ree
 Ree's
 Reece
@@ -4297,19 +4320,26 @@ Rurik
 Rustin
 Rustin's
 Rutger
 Rutger's
 Rutter
 Rutter's
 Ruy
 Ruy's
+SCOTUS
+SCOTUS's
+SME
+SME's
+SMEs
+SMEs's
 SNP
 SNP's
 SNPs
+SSN
 Saba
 Saba's
 Saccharomyces
 Saccharomyces's
 Sacha
 Sacha's
 Sada
 Sada's
@@ -4403,18 +4433,16 @@ Shamus's
 Shandy
 Shandy's
 Shani
 Shani's
 Shanta
 Shanta's
 Shara
 Shara's
-SharePoint
-SharePoint's
 Sharma
 Sharma's
 Shayla
 Shayla's
 Shayna
 Shayna's
 Shayne
 Shayne's
@@ -4571,16 +4599,18 @@ Suki
 Suki's
 Sula
 Sula's
 Sunbird
 Sunbird's
 Sunderland
 Sunderland's
 Sunny's
+Suomi
+Suomi's
 Susann
 Susann's
 Susannah
 Susannah's
 Susi
 Susi's
 Susy
 Susy's
@@ -4606,16 +4636,22 @@ Symantec's
 Symbian
 Symbian's
 Symon
 Symon's
 TEirtza
 TEirtza's
 THz
 THz's
+TIF
+TIF's
+TIFF
+TIFF's
+TIFFs
+TIFs
 Tabb
 Tabb's
 Taber
 Taber's
 Tabor
 Taddeo
 Taddeo's
 Tait
@@ -5061,33 +5097,37 @@ Winny
 Winny's
 Winona
 Winona's
 Winslow
 Winslow's
 Witty's
 Woodie
 Woodie's
-WordPress
-WordPress's
 Worden
 Worden's
 WorldCa