Bug 1455676 part 6. Remove nsIDOMNode usage from docshell/. r=qdot
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 29 May 2018 22:58:48 -0400
changeset 474606 9013597c936e9145244293c908fa4f3da1ec38fc
parent 474605 55a0726047bb1ce2b93f949047cbe38daa5b2aab
child 474607 4eb337cfade1b2e4247c08bc66aab488a9ccfe3d
push id9374
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:43:20 +0000
treeherdermozilla-beta@160e085dfb0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot
bugs1455676
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1455676 part 6. Remove nsIDOMNode usage from docshell/. r=qdot
docshell/base/nsDocShell.cpp
docshell/base/nsDocShell.h
docshell/base/nsDocShellTreeOwner.cpp
docshell/base/nsDocShellTreeOwner.h
docshell/base/nsIContentViewer.idl
docshell/base/nsIContentViewerEdit.idl
docshell/base/nsITooltipTextProvider.idl
layout/base/nsDocumentViewer.cpp
toolkit/components/browser/nsIWebBrowserChrome3.idl
xpfe/appshell/nsContentTreeOwner.cpp
xpfe/appshell/nsIXULBrowserWindow.idl
--- 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"
@@ -13377,20 +13376,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/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -2880,33 +2880,32 @@ NS_IMETHODIMP nsDocumentViewer::GetCanGe
 {
   NS_ENSURE_ARG_POINTER(aCanGetContents);
   *aCanGetContents = false;
   NS_ENSURE_STATE(mDocument);
   *aCanGetContents = nsCopySupport::CanCopy(mDocument);
   return NS_OK;
 }
 
-NS_IMETHODIMP nsDocumentViewer::SetCommandNode(nsIDOMNode* aNode)
+NS_IMETHODIMP nsDocumentViewer::SetCommandNode(nsINode* aNode)
 {
   nsIDocument* document = GetDocument();
   NS_ENSURE_STATE(document);
 
   nsCOMPtr<nsPIDOMWindowOuter> window(document->GetWindow());
   NS_ENSURE_TRUE(window, NS_ERROR_NOT_AVAILABLE);
 
   nsCOMPtr<nsPIWindowRoot> root = window->GetTopWindowRoot();
   NS_ENSURE_STATE(root);
 
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  root->SetPopupNode(node);
+  root->SetPopupNode(aNode);
   return NS_OK;
 }
 
-NS_IMETHODIMP nsDocumentViewer::ScrollToNode(nsIDOMNode* aNode)
+NS_IMETHODIMP nsDocumentViewer::ScrollToNode(nsINode* aNode)
 {
   NS_ENSURE_ARG(aNode);
   NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
   nsCOMPtr<nsIPresShell> presShell;
   NS_ENSURE_SUCCESS(GetPresShell(getter_AddRefs(presShell)), NS_ERROR_FAILURE);
 
   // Get the nsIContent interface, because that's what we need to
   // get the primary frame
--- a/toolkit/components/browser/nsIWebBrowserChrome3.idl
+++ b/toolkit/components/browser/nsIWebBrowserChrome3.idl
@@ -1,21 +1,22 @@
 /* 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 "nsIWebBrowserChrome2.idl"
 #include "nsIURI.idl"
-#include "nsIDOMNode.idl"
 
 interface nsIDocShell;
 interface nsIInputStream;
 interface nsIRunnable;
 interface nsIPrincipal;
 
+webidl Node;
+
 /**
  * nsIWebBrowserChrome3 is an extension to nsIWebBrowserChrome2.
  */
 [scriptable, uuid(542b6625-35a9-426a-8257-c12a345383b0)]
 interface nsIWebBrowserChrome3 : nsIWebBrowserChrome2
 {
   /**
    * Determines the appropriate target for a link.
@@ -28,17 +29,17 @@ interface nsIWebBrowserChrome3 : nsIWebB
    *        Link DOM node.
    * @param isAppTab
    *        Whether or not the link is in an app tab.
    * @returns A new link target, if appropriate.
    *          Otherwise returns originalTarget.
    */
   AString onBeforeLinkTraversal(in AString originalTarget,
                                 in nsIURI linkURI,
-                                in nsIDOMNode linkNode,
+                                in Node linkNode,
                                 in boolean isAppTab);
 
   /**
    * Determines whether a load should continue.
    *
    * @param aDocShell
    *        The docshell performing the load.
    * @param aURI
--- a/xpfe/appshell/nsContentTreeOwner.cpp
+++ b/xpfe/appshell/nsContentTreeOwner.cpp
@@ -364,17 +364,17 @@ nsContentTreeOwner::GetHasPrimaryContent
 }
 
 //*****************************************************************************
 // nsContentTreeOwner::nsIWebBrowserChrome3
 //*****************************************************************************
 
 NS_IMETHODIMP nsContentTreeOwner::OnBeforeLinkTraversal(const nsAString &originalTarget,
                                                         nsIURI *linkURI,
-                                                        nsIDOMNode *linkNode,
+                                                        nsINode *linkNode,
                                                         bool isAppTab,
                                                         nsAString &_retval)
 {
   NS_ENSURE_STATE(mXULWindow);
 
   nsCOMPtr<nsIXULBrowserWindow> xulBrowserWindow;
   mXULWindow->GetXULBrowserWindow(getter_AddRefs(xulBrowserWindow));
 
--- a/xpfe/appshell/nsIXULBrowserWindow.idl
+++ b/xpfe/appshell/nsIXULBrowserWindow.idl
@@ -1,28 +1,28 @@
 /* -*- 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"
 #include "nsIURI.idl"
-#include "nsIDOMNode.idl"
 
 interface nsIBrowser;
 interface nsIRequest;
 interface nsIInputStream;
 interface nsIDocShell;
 interface nsIFrameLoaderOwner;
 interface nsITabParent;
 interface nsIPrincipal;
 interface mozIDOMWindowProxy;
 
 webidl Element;
+webidl Node;
 
 /**
  * The nsIXULBrowserWindow supplies the methods that may be called from the
  * internals of the browser area to tell the containing xul window to update
  * its ui. 
  */
 [scriptable, uuid(a8675fa9-c8b4-4350-9803-c38f344a9e38)]
 interface nsIXULBrowserWindow : nsISupports
@@ -33,17 +33,17 @@ interface nsIXULBrowserWindow : nsISuppo
    */
   void setOverLink(in AString link, in Element element);
 
   /**
    * Determines the appropriate target for a link.
    */
   AString onBeforeLinkTraversal(in AString originalTarget,
                                 in nsIURI linkURI,
-                                in nsIDOMNode linkNode,
+                                in Node linkNode,
                                 in boolean isAppTab);
 
   /**
    * Find the initial browser of the window and set its remote attributes.
    * This can be used to ensure that there is a browser in a new window of the
    * correct type when it first spawns.
    */
   void forceInitialBrowserNonRemote(in mozIDOMWindowProxy openerWindow);