Bug 1387184 - Remove nsIDOMHTMLEmbedElement; r?bz draft
authorKyle Machulis <kyle@nonpolynomial.com>
Wed, 09 Aug 2017 12:05:08 -0700
changeset 645060 84647c0240f4fce9a26c52dcf31d92f1f1ba40c0
parent 645059 fce0b08bf07cc8dc6349ddef7dba4fede8d1b4b0
child 725806 6444ecdc746dd52cf7b0fa119a47debeb5c4bdf4
push id73649
push userbmo:kyle@nonpolynomial.com
push dateFri, 11 Aug 2017 20:58:14 +0000
reviewersbz
bugs1387184
milestone57.0a1
Bug 1387184 - Remove nsIDOMHTMLEmbedElement; r?bz Removes nsIDOMHTMLEmbedElement and all references. HTML elements are now handled by WebIDL. With the deprecation of extensions, XPCOM interfaces to HTML elements are no longer needed. MozReview-Commit-ID: DI4XVvdgPDI
docshell/base/nsDocShellTreeOwner.cpp
dom/html/HTMLEmbedElement.cpp
dom/html/HTMLEmbedElement.h
dom/interfaces/html/moz.build
dom/interfaces/html/nsIDOMHTMLEmbedElement.idl
dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
editor/libeditor/HTMLEditorDataTransfer.cpp
layout/printing/nsPrintEngine.cpp
xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
--- a/docshell/base/nsDocShellTreeOwner.cpp
+++ b/docshell/base/nsDocShellTreeOwner.cpp
@@ -38,17 +38,16 @@
 #include "nsIDOMEvent.h"
 #include "nsIDOMFileList.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIFormControl.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMHTMLTextAreaElement.h"
 #include "nsIDOMHTMLHtmlElement.h"
 #include "nsIDOMHTMLObjectElement.h"
-#include "nsIDOMHTMLEmbedElement.h"
 #include "nsIDOMHTMLDocument.h"
 #include "nsIImageLoadingContent.h"
 #include "nsIWebNavigation.h"
 #include "nsIDOMHTMLElement.h"
 #include "nsIPresShell.h"
 #include "nsIStringBundle.h"
 #include "nsPIDOMWindow.h"
 #include "nsPIWindowRoot.h"
@@ -1540,20 +1539,20 @@ ChromeContextMenuListener::HandleEvent(n
   // XXX test for selected text
 
   uint16_t nodeType;
   nsresult res = node->GetNodeType(&nodeType);
   NS_ENSURE_SUCCESS(res, res);
 
   // First, checks for nodes that never have children.
   if (nodeType == nsIDOMNode::ELEMENT_NODE) {
-    nsCOMPtr<nsIImageLoadingContent> content(do_QueryInterface(node));
-    if (content) {
+    nsCOMPtr<nsIImageLoadingContent> imageContent(do_QueryInterface(node));
+    if (imageContent) {
       nsCOMPtr<nsIURI> imgUri;
-      content->GetCurrentURI(getter_AddRefs(imgUri));
+      imageContent->GetCurrentURI(getter_AddRefs(imgUri));
       if (imgUri) {
         flags |= nsIContextMenuListener::CONTEXT_IMAGE;
         flags2 |= nsIContextMenuListener2::CONTEXT_IMAGE;
         targetDOMnode = node;
       }
     }
 
     nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(node));
@@ -1582,19 +1581,19 @@ ChromeContextMenuListener::HandleEvent(n
 
     // always consume events for plugins who may throw their own context menus
     // but not for image objects. Document objects will never be targets or
     // ancestors of targets, so that's OK.
     nsCOMPtr<nsIDOMHTMLObjectElement> objectElement;
     if (!(flags & nsIContextMenuListener::CONTEXT_IMAGE)) {
       objectElement = do_QueryInterface(node);
     }
-    nsCOMPtr<nsIDOMHTMLEmbedElement> embedElement(do_QueryInterface(node));
 
-    if (objectElement || embedElement) {
+    nsCOMPtr<nsIContent> content = do_QueryInterface(node);
+    if (objectElement || (content && content->IsHTMLElement(nsGkAtoms::embed))) {
       return NS_OK;
     }
   }
 
   // Bubble out, looking for items of interest
   do {
     uint16_t nodeType;
     res = node->GetNodeType(&nodeType);
--- a/dom/html/HTMLEmbedElement.cpp
+++ b/dom/html/HTMLEmbedElement.cpp
@@ -64,17 +64,16 @@ NS_INTERFACE_TABLE_INHERITED(HTMLEmbedEl
                              nsIStreamListener,
                              nsIFrameLoaderOwner,
                              nsIObjectLoadingContent,
                              imgINotificationObserver,
                              nsIImageLoadingContent,
                              imgIOnloadBlocker,
                              nsIChannelEventSink)
 NS_INTERFACE_TABLE_TO_MAP_SEGUE
-  NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLEmbedElement)
 NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement)
 
 NS_IMPL_ELEMENT_CLONE(HTMLEmbedElement)
 
 #ifdef XP_MACOSX
 
 NS_IMETHODIMP
 HTMLEmbedElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
@@ -349,17 +348,10 @@ HTMLEmbedElement::WrapNode(JSContext* aC
 }
 
 nsContentPolicyType
 HTMLEmbedElement::GetContentPolicyType() const
 {
   return nsIContentPolicy::TYPE_INTERNAL_EMBED;
 }
 
-NS_IMPL_STRING_ATTR(HTMLEmbedElement, Align, align)
-NS_IMPL_STRING_ATTR(HTMLEmbedElement, Width, width)
-NS_IMPL_STRING_ATTR(HTMLEmbedElement, Height, height)
-NS_IMPL_STRING_ATTR(HTMLEmbedElement, Name, name)
-NS_IMPL_URI_ATTR(HTMLEmbedElement, Src, src)
-NS_IMPL_STRING_ATTR(HTMLEmbedElement, Type, type)
-
 } // namespace dom
 } // namespace mozilla
--- a/dom/html/HTMLEmbedElement.h
+++ b/dom/html/HTMLEmbedElement.h
@@ -7,30 +7,27 @@
 #ifndef mozilla_dom_HTMLEmbedElement_h
 #define mozilla_dom_HTMLEmbedElement_h
 
 #include "mozilla/Attributes.h"
 #include "nsGenericHTMLElement.h"
 #include "nsObjectLoadingContent.h"
 #include "nsGkAtoms.h"
 #include "nsError.h"
-#include "nsIDOMHTMLEmbedElement.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLEmbedElement final : public nsGenericHTMLElement
                              , public nsObjectLoadingContent
-                             , public nsIDOMHTMLEmbedElement
 {
 public:
   explicit HTMLEmbedElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
                             mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
 
-  NS_DECL_NSIDOMHTMLEMBEDELEMENT
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
   NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLEmbedElement, embed)
   virtual int32_t TabIndexDefault() override;
 
 #ifdef XP_MACOSX
   // nsIDOMEventTarget
   NS_IMETHOD PostHandleEvent(EventChainPostVisitor& aVisitor) override;
@@ -99,17 +96,20 @@ public:
   {
     GetHTMLAttr(nsGkAtoms::width, aValue);
   }
   void SetWidth(const nsAString& aValue, ErrorResult& aRv)
   {
     SetHTMLAttr(nsGkAtoms::width, aValue, aRv);
   }
   // WebIDL <embed> api
-  // XPCOM GetSrc is ok; note that it's a URI attribute
+  void GetSrc(DOMString& aValue)
+  {
+    GetURIAttr(nsGkAtoms::src, nullptr, aValue);
+  }
   void SetSrc(const nsAString& aValue, ErrorResult& aRv)
   {
     SetHTMLAttr(nsGkAtoms::src, aValue, aRv);
   }
   void GetType(DOMString& aValue)
   {
     GetHTMLAttr(nsGkAtoms::type, aValue);
   }
--- a/dom/interfaces/html/moz.build
+++ b/dom/interfaces/html/moz.build
@@ -13,17 +13,16 @@ XPIDL_SOURCES += [
     'nsIDOMHTMLBaseElement.idl',
     'nsIDOMHTMLBodyElement.idl',
     'nsIDOMHTMLButtonElement.idl',
     'nsIDOMHTMLCanvasElement.idl',
     'nsIDOMHTMLCollection.idl',
     'nsIDOMHTMLDirectoryElement.idl',
     'nsIDOMHTMLDocument.idl',
     'nsIDOMHTMLElement.idl',
-    'nsIDOMHTMLEmbedElement.idl',
     'nsIDOMHTMLFieldSetElement.idl',
     'nsIDOMHTMLFormElement.idl',
     'nsIDOMHTMLFrameElement.idl',
     'nsIDOMHTMLFrameSetElement.idl',
     'nsIDOMHTMLHeadElement.idl',
     'nsIDOMHTMLHRElement.idl',
     'nsIDOMHTMLHtmlElement.idl',
     'nsIDOMHTMLIFrameElement.idl',
deleted file mode 100644
--- a/dom/interfaces/html/nsIDOMHTMLEmbedElement.idl
+++ /dev/null
@@ -1,25 +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 "nsIDOMHTMLElement.idl"
-
-/**
- * The nsIDOMHTMLEmbedElement interface is the interface to a [X]HTML
- * embed element.
- *
- * For more information on this interface, please see
- * http://www.whatwg.org/specs/web-apps/current-work/#the-embed-element
- */
-
-[uuid(adae53da-713d-4570-81ad-dabdd6d46241)]
-interface nsIDOMHTMLEmbedElement : nsISupports
-{
-           attribute DOMString        align;
-           attribute DOMString        height;
-           attribute DOMString        name;
-           attribute DOMString        src;
-           attribute DOMString        type;
-           attribute DOMString        width;
-};
--- a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
+++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
@@ -19,17 +19,16 @@
 #include "nsIDOMAttr.h"
 #include "nsIDOMComment.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMHTMLAnchorElement.h"
 #include "nsIDOMHTMLAreaElement.h"
 #include "nsIDOMHTMLBaseElement.h"
 #include "nsIDOMHTMLCollection.h"
 #include "nsIDOMHTMLDocument.h"
-#include "nsIDOMHTMLEmbedElement.h"
 #include "nsIDOMHTMLFrameElement.h"
 #include "nsIDOMHTMLIFrameElement.h"
 #include "nsIDOMHTMLImageElement.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMHTMLLinkElement.h"
 #include "nsIDOMHTMLMediaElement.h"
 #include "nsIDOMHTMLObjectElement.h"
 #include "nsIDOMHTMLOptionElement.h"
@@ -524,18 +523,17 @@ ResourceReader::OnWalkDOMNode(nsIDOMNode
     if (nodeAsScript) {
         return OnWalkAttribute(aNode, "src");
     }
 
     if (content->IsSVGElement(nsGkAtoms::script)) {
         return OnWalkAttribute(aNode, "href", "http://www.w3.org/1999/xlink");
     }
 
-    nsCOMPtr<nsIDOMHTMLEmbedElement> nodeAsEmbed = do_QueryInterface(aNode);
-    if (nodeAsEmbed) {
+    if (content->IsHTMLElement(nsGkAtoms::embed)) {
         return OnWalkAttribute(aNode, "src");
     }
 
     nsCOMPtr<nsIDOMHTMLObjectElement> nodeAsObject = do_QueryInterface(aNode);
     if (nodeAsObject) {
         return OnWalkAttribute(aNode, "data");
     }
 
@@ -1055,18 +1053,17 @@ PersistNodeFixup::FixupNode(nsIDOMNode *
     if (content->IsSVGElement(nsGkAtoms::script)) {
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut) {
             FixupAttribute(*aNodeOut, "href", "http://www.w3.org/1999/xlink");
         }
         return rv;
     }
 
-        nsCOMPtr<nsIDOMHTMLEmbedElement> nodeAsEmbed = do_QueryInterface(aNodeIn);
-    if (nodeAsEmbed) {
+    if (content->IsHTMLElement(nsGkAtoms::embed)) {
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut) {
             FixupAttribute(*aNodeOut, "src");
         }
         return rv;
     }
 
     nsCOMPtr<nsIDOMHTMLObjectElement> nodeAsObject = do_QueryInterface(aNodeIn);
--- a/editor/libeditor/HTMLEditorDataTransfer.cpp
+++ b/editor/libeditor/HTMLEditorDataTransfer.cpp
@@ -35,17 +35,16 @@
 #include "nsIClipboard.h"
 #include "nsIContent.h"
 #include "nsIContentFilter.h"
 #include "nsIDOMComment.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMDocumentFragment.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMHTMLAnchorElement.h"
-#include "nsIDOMHTMLEmbedElement.h"
 #include "nsIDOMHTMLFrameElement.h"
 #include "nsIDOMHTMLIFrameElement.h"
 #include "nsIDOMHTMLImageElement.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMHTMLLinkElement.h"
 #include "nsIDOMHTMLObjectElement.h"
 #include "nsIDOMHTMLScriptElement.h"
 #include "nsIDOMNode.h"
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -39,17 +39,16 @@ static const char sPrintSettingsServiceC
 #include "nsThreadUtils.h"
 
 // Printing
 #include "nsIWebBrowserPrint.h"
 #include "nsIDOMHTMLFrameElement.h"
 #include "nsIDOMHTMLFrameSetElement.h"
 #include "nsIDOMHTMLIFrameElement.h"
 #include "nsIDOMHTMLObjectElement.h"
-#include "nsIDOMHTMLEmbedElement.h"
 
 // Print Preview
 #include "imgIContainer.h" // image animation mode constants
 #include "nsIWebBrowserPrint.h" // needed for PrintPreview Navigation constants
 
 // Print Progress
 #include "nsIPrintProgress.h"
 #include "nsIPrintProgressParams.h"
--- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
@@ -51,17 +51,16 @@
 #include "nsIDOMHTMLBaseElement.h"
 #include "nsIDOMHTMLBodyElement.h"
 #include "nsIDOMHTMLButtonElement.h"
 #include "nsIDOMHTMLCanvasElement.h"
 #include "nsIDOMHTMLCollection.h"
 #include "nsIDOMHTMLDirectoryElement.h"
 #include "nsIDOMHTMLDocument.h"
 #include "nsIDOMHTMLElement.h"
-#include "nsIDOMHTMLEmbedElement.h"
 #include "nsIDOMHTMLFieldSetElement.h"
 #include "nsIDOMHTMLFormElement.h"
 #include "nsIDOMHTMLFrameElement.h"
 #include "nsIDOMHTMLFrameSetElement.h"
 #include "nsIDOMHTMLHRElement.h"
 #include "nsIDOMHTMLHeadElement.h"
 #include "nsIDOMHTMLHtmlElement.h"
 #include "nsIDOMHTMLIFrameElement.h"
@@ -178,17 +177,16 @@
 #include "mozilla/dom/HTMLBaseElementBinding.h"
 #include "mozilla/dom/HTMLBodyElementBinding.h"
 #include "mozilla/dom/HTMLButtonElementBinding.h"
 #include "mozilla/dom/HTMLCanvasElementBinding.h"
 #include "mozilla/dom/HTMLCollectionBinding.h"
 #include "mozilla/dom/HTMLDirectoryElementBinding.h"
 #include "mozilla/dom/HTMLDocumentBinding.h"
 #include "mozilla/dom/HTMLElementBinding.h"
-#include "mozilla/dom/HTMLEmbedElementBinding.h"
 #include "mozilla/dom/HTMLFieldSetElementBinding.h"
 #include "mozilla/dom/HTMLFormElementBinding.h"
 #include "mozilla/dom/HTMLFrameElementBinding.h"
 #include "mozilla/dom/HTMLFrameSetElementBinding.h"
 #include "mozilla/dom/HTMLHRElementBinding.h"
 #include "mozilla/dom/HTMLHeadElementBinding.h"
 #include "mozilla/dom/HTMLHtmlElementBinding.h"
 #include "mozilla/dom/HTMLIFrameElementBinding.h"
@@ -364,17 +362,16 @@ const ComponentsInterfaceShimEntry kComp
   DEFINE_SHIM(HTMLBaseElement),
   DEFINE_SHIM(HTMLBodyElement),
   DEFINE_SHIM(HTMLButtonElement),
   DEFINE_SHIM(HTMLCanvasElement),
   DEFINE_SHIM(HTMLCollection),
   DEFINE_SHIM(HTMLDirectoryElement),
   DEFINE_SHIM(HTMLDocument),
   DEFINE_SHIM(HTMLElement),
-  DEFINE_SHIM(HTMLEmbedElement),
   DEFINE_SHIM(HTMLFieldSetElement),
   DEFINE_SHIM(HTMLFormElement),
   DEFINE_SHIM(HTMLFrameElement),
   DEFINE_SHIM(HTMLFrameSetElement),
   DEFINE_SHIM(HTMLHRElement),
   DEFINE_SHIM(HTMLHeadElement),
   DEFINE_SHIM(HTMLHtmlElement),
   DEFINE_SHIM(HTMLIFrameElement),