Bug 1279218 - Rename HTMLSharedObjectElement to HTMLEmbedElement; r?bz draft
authorKyle Machulis <kyle@nonpolynomial.com>
Fri, 28 Jul 2017 21:35:43 -0700
changeset 618005 fd8de5da5630b9bb9f9a24825279da267a0dd445
parent 617914 523eb0af58b6835f7c7acdfc1f535b1f2a83c9a1
child 639933 e74c037019962b1582921d87050fd7207de5aa2b
push id71181
push userkmachulis@mozilla.com
push dateSat, 29 Jul 2017 04:45:51 +0000
reviewersbz
bugs1279218
milestone56.0a1
Bug 1279218 - Rename HTMLSharedObjectElement to HTMLEmbedElement; r?bz MozReview-Commit-ID: KkvRkFXAX30
dom/base/nsObjectLoadingContent.cpp
dom/bindings/BindingUtils.cpp
dom/bindings/Bindings.conf
dom/html/HTMLEmbedElement.cpp
dom/html/HTMLEmbedElement.h
dom/html/HTMLSharedObjectElement.cpp
dom/html/HTMLSharedObjectElement.h
dom/html/moz.build
dom/html/nsGenericHTMLElement.h
dom/tests/browser/browser_bug396843.js
dom/tests/mochitest/bugs/test_bug396843.html
dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
dom/webbrowserpersist/nsWebBrowserPersist.cpp
parser/htmlparser/nsHTMLTagList.h
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -84,17 +84,17 @@
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/PluginCrashedEvent.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/IntegerPrintfMacros.h"
 #include "mozilla/dom/HTMLObjectElementBinding.h"
-#include "mozilla/dom/HTMLSharedObjectElement.h"
+#include "mozilla/dom/HTMLEmbedElement.h"
 #include "mozilla/dom/HTMLObjectElement.h"
 #include "nsChannelClassifier.h"
 
 #ifdef XP_WIN
 // Thanks so much, Microsoft! :(
 #ifdef CreateEvent
 #undef CreateEvent
 #endif
@@ -2952,18 +2952,17 @@ nsObjectLoadingContent::LoadFallback(Fal
       // those subtrees themselves if they end up falling back.
       bool skipChildDescendants = false;
       if (aType != eFallbackAlternate &&
           !child->IsHTMLElement(nsGkAtoms::param) &&
           nsStyleUtil::IsSignificantChild(child, true, false)) {
         aType = eFallbackAlternate;
       }
       if (thisIsObject) {
-        if (child->IsHTMLElement(nsGkAtoms::embed)) {
-          HTMLSharedObjectElement* embed = static_cast<HTMLSharedObjectElement*>(child);
+        if (auto embed = HTMLEmbedElement::FromContent(child)) {
           embed->StartObjectLoad(true, true);
           skipChildDescendants = true;
         } else if (auto object = HTMLObjectElement::FromContent(child)) {
           object->StartObjectLoad(true, true);
           skipChildDescendants = true;
         }
       }
 
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -40,17 +40,17 @@
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/CustomElementRegistry.h"
 #include "mozilla/dom/DOMError.h"
 #include "mozilla/dom/DOMErrorBinding.h"
 #include "mozilla/dom/DOMException.h"
 #include "mozilla/dom/ElementBinding.h"
 #include "mozilla/dom/HTMLObjectElement.h"
 #include "mozilla/dom/HTMLObjectElementBinding.h"
-#include "mozilla/dom/HTMLSharedObjectElement.h"
+#include "mozilla/dom/HTMLEmbedElement.h"
 #include "mozilla/dom/HTMLElementBinding.h"
 #include "mozilla/dom/HTMLEmbedElementBinding.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/ResolveSystemBinding.h"
 #include "mozilla/dom/WebIDLGlobalNameHash.h"
 #include "mozilla/dom/WorkerPrivate.h"
 #include "mozilla/dom/WorkerScope.h"
 #include "mozilla/dom/XrayExpandoClass.h"
@@ -2304,18 +2304,17 @@ ReparentWrapper(JSContext* aCx, JS::Hand
       MOZ_CRASH();
     }
   }
 
   JS::Rooted<JSObject*> maybeObjLC(aCx, aObj);
   nsObjectLoadingContent* htmlobject;
   nsresult rv = UNWRAP_OBJECT(HTMLObjectElement, &maybeObjLC, htmlobject);
   if (NS_FAILED(rv)) {
-    rv = UnwrapObject<prototypes::id::HTMLEmbedElement,
-                      HTMLSharedObjectElement>(&maybeObjLC, htmlobject);
+    rv = UNWRAP_OBJECT(HTMLEmbedElement, &maybeObjLC, htmlobject);
     if (NS_FAILED(rv)) {
       htmlobject = nullptr;
     }
   }
   if (htmlobject) {
     htmlobject->SetupProtoChain(aCx, aObj);
   }
 
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -419,20 +419,16 @@ DOMInterfaces = {
     'nativeType': 'nsHTMLDocument',
     'implicitJSContext': [ 'open', 'write', 'writeln' ]
 },
 
 'HTMLElement': {
     'nativeType': 'nsGenericHTMLElement',
 },
 
-'HTMLEmbedElement': {
-    'nativeType': 'mozilla::dom::HTMLSharedObjectElement'
-},
-
 'HTMLHeadElement': {
     'nativeType': 'mozilla::dom::HTMLSharedElement'
 },
 
 'HTMLHtmlElement': {
     'nativeType': 'mozilla::dom::HTMLSharedElement'
 },
 
rename from dom/html/HTMLSharedObjectElement.cpp
rename to dom/html/HTMLEmbedElement.cpp
--- a/dom/html/HTMLSharedObjectElement.cpp
+++ b/dom/html/HTMLEmbedElement.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/EventStates.h"
-#include "mozilla/dom/HTMLSharedObjectElement.h"
+#include "mozilla/dom/HTMLEmbedElement.h"
 #include "mozilla/dom/HTMLEmbedElementBinding.h"
 #include "mozilla/dom/ElementInlines.h"
 
 #include "nsIDocument.h"
 #include "nsIPluginDocument.h"
 #include "nsIDOMDocument.h"
 #include "nsThreadUtils.h"
 #include "nsIScriptError.h"
@@ -18,248 +18,221 @@
 #include "nsContentUtils.h"
 #ifdef XP_MACOSX
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/dom/Event.h"
 #endif
 #include "mozilla/dom/HTMLObjectElement.h"
 
 
-NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(SharedObject)
+NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Embed)
 
 namespace mozilla {
 namespace dom {
 
-HTMLSharedObjectElement::HTMLSharedObjectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
-                                                 FromParser aFromParser)
-  : nsGenericHTMLElement(aNodeInfo),
-    mIsDoneAddingChildren(mNodeInfo->Equals(nsGkAtoms::embed) || !aFromParser)
+HTMLEmbedElement::HTMLEmbedElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+                                   FromParser aFromParser)
+  : nsGenericHTMLElement(aNodeInfo)
 {
   RegisterActivityObserver();
   SetIsNetworkCreated(aFromParser == FROM_PARSER_NETWORK);
 
   // By default we're in the loading state
   AddStatesSilently(NS_EVENT_STATE_LOADING);
 }
 
-HTMLSharedObjectElement::~HTMLSharedObjectElement()
+HTMLEmbedElement::~HTMLEmbedElement()
 {
 #ifdef XP_MACOSX
   HTMLObjectElement::OnFocusBlurPlugin(this, false);
 #endif
   UnregisterActivityObserver();
   DestroyImageLoadingContent();
 }
 
-bool
-HTMLSharedObjectElement::IsDoneAddingChildren()
-{
-  return mIsDoneAddingChildren;
-}
-
-void
-HTMLSharedObjectElement::DoneAddingChildren(bool aHaveNotified)
-{
-  if (!mIsDoneAddingChildren) {
-    mIsDoneAddingChildren = true;
+NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLEmbedElement)
 
-    // If we're already in a document, we need to trigger the load
-    // Otherwise, BindToTree takes care of that.
-    if (IsInComposedDoc()) {
-      StartObjectLoad(aHaveNotified, false);
-    }
-  }
-}
-
-NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLSharedObjectElement)
-
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLSharedObjectElement,
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLEmbedElement,
                                                   nsGenericHTMLElement)
-  nsObjectLoadingContent::Traverse(tmp, cb);
+nsObjectLoadingContent::Traverse(tmp, cb);
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
-NS_IMPL_ADDREF_INHERITED(HTMLSharedObjectElement, Element)
-NS_IMPL_RELEASE_INHERITED(HTMLSharedObjectElement, Element)
+NS_IMPL_ADDREF_INHERITED(HTMLEmbedElement, Element)
+NS_IMPL_RELEASE_INHERITED(HTMLEmbedElement, Element)
 
-NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLSharedObjectElement)
-  NS_INTERFACE_TABLE_INHERITED(HTMLSharedObjectElement,
-                               nsIRequestObserver,
-                               nsIStreamListener,
-                               nsIFrameLoaderOwner,
-                               nsIObjectLoadingContent,
-                               imgINotificationObserver,
-                               nsIImageLoadingContent,
-                               imgIOnloadBlocker,
-                               nsIChannelEventSink)
-  NS_INTERFACE_TABLE_TO_MAP_SEGUE
+NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLEmbedElement)
+NS_INTERFACE_TABLE_INHERITED(HTMLEmbedElement,
+                             nsIRequestObserver,
+                             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(HTMLSharedObjectElement)
+NS_IMPL_ELEMENT_CLONE(HTMLEmbedElement)
 
 #ifdef XP_MACOSX
 
 NS_IMETHODIMP
-HTMLSharedObjectElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
+HTMLEmbedElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
 {
   HTMLObjectElement::HandleFocusBlurPlugin(this, aVisitor.mEvent);
   return NS_OK;
 }
 
 #endif // #ifdef XP_MACOSX
 
 void
-HTMLSharedObjectElement::AsyncEventRunning(AsyncEventDispatcher* aEvent)
+HTMLEmbedElement::AsyncEventRunning(AsyncEventDispatcher* aEvent)
 {
   nsImageLoadingContent::AsyncEventRunning(aEvent);
 }
 
 nsresult
-HTMLSharedObjectElement::BindToTree(nsIDocument *aDocument,
-                                    nsIContent *aParent,
-                                    nsIContent *aBindingParent,
-                                    bool aCompileEventHandlers)
+HTMLEmbedElement::BindToTree(nsIDocument *aDocument,
+                             nsIContent *aParent,
+                             nsIContent *aBindingParent,
+                             bool aCompileEventHandlers)
 {
   nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
                                                  aBindingParent,
                                                  aCompileEventHandlers);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = nsObjectLoadingContent::BindToTree(aDocument, aParent,
                                           aBindingParent,
                                           aCompileEventHandlers);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Don't kick off load from being bound to a plugin document - the plugin
   // document will call nsObjectLoadingContent::InitializeFromChannel() for the
   // initial load.
   nsCOMPtr<nsIPluginDocument> pluginDoc = do_QueryInterface(aDocument);
 
-  // If we already have all the children, start the load.
-  if (mIsDoneAddingChildren && !pluginDoc) {
-    void (HTMLSharedObjectElement::*start)() =
-      &HTMLSharedObjectElement::StartObjectLoad;
+  if (!pluginDoc) {
+    void (HTMLEmbedElement::*start)() = &HTMLEmbedElement::StartObjectLoad;
     nsContentUtils::AddScriptRunner(NewRunnableMethod(
-      "dom::HTMLSharedObjectElement::BindToTree", this, start));
+                                      "dom::HTMLEmbedElement::BindToTree", this, start));
   }
 
   return NS_OK;
 }
 
 void
-HTMLSharedObjectElement::UnbindFromTree(bool aDeep,
-                                        bool aNullParent)
+HTMLEmbedElement::UnbindFromTree(bool aDeep,
+                                 bool aNullParent)
 {
 #ifdef XP_MACOSX
   // When a page is reloaded (when an nsIDocument's content is removed), the
   // focused element isn't necessarily sent an eBlur event. See
   // nsFocusManager::ContentRemoved(). This means that a widget may think it
   // still contains a focused plugin when it doesn't -- which in turn can
   // disable text input in the browser window. See bug 1137229.
   HTMLObjectElement::OnFocusBlurPlugin(this, false);
 #endif
   nsObjectLoadingContent::UnbindFromTree(aDeep, aNullParent);
   nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
 }
 
 nsresult
-HTMLSharedObjectElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
-                                      const nsAttrValue* aValue,
-                                      const nsAttrValue* aOldValue,
-                                      bool aNotify)
+HTMLEmbedElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
+                               const nsAttrValue* aValue,
+                               const nsAttrValue* aOldValue,
+                               bool aNotify)
 {
   if (aValue) {
     nsresult rv = AfterMaybeChangeAttr(aNamespaceID, aName, aNotify);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return nsGenericHTMLElement::AfterSetAttr(aNamespaceID, aName, aValue,
                                             aOldValue, aNotify);
 }
 
 nsresult
-HTMLSharedObjectElement::OnAttrSetButNotChanged(int32_t aNamespaceID,
-                                                nsIAtom* aName,
-                                                const nsAttrValueOrString& aValue,
-                                                bool aNotify)
+HTMLEmbedElement::OnAttrSetButNotChanged(int32_t aNamespaceID,
+                                         nsIAtom* aName,
+                                         const nsAttrValueOrString& aValue,
+                                         bool aNotify)
 {
   nsresult rv = AfterMaybeChangeAttr(aNamespaceID, aName, aNotify);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return nsGenericHTMLElement::OnAttrSetButNotChanged(aNamespaceID, aName,
                                                       aValue, aNotify);
 }
 
 nsresult
-HTMLSharedObjectElement::AfterMaybeChangeAttr(int32_t aNamespaceID,
-                                              nsIAtom* aName,
-                                              bool aNotify)
+HTMLEmbedElement::AfterMaybeChangeAttr(int32_t aNamespaceID,
+                                       nsIAtom* aName,
+                                       bool aNotify)
 {
   if (aNamespaceID == kNameSpaceID_None) {
     if (aName == nsGkAtoms::src) {
       // If aNotify is false, we are coming from the parser or some such place;
       // we'll get bound after all the attributes have been set, so we'll do the
-      // object load from BindToTree/DoneAddingChildren.
+      // object load from BindToTree.
       // Skip the LoadObject call in that case.
       // We also don't want to start loading the object when we're not yet in
       // a document, just in case that the caller wants to set additional
       // attributes before inserting the node into the document.
-      if (aNotify && IsInComposedDoc() && mIsDoneAddingChildren &&
+      if (aNotify && IsInComposedDoc() &&
           !BlockEmbedOrObjectContentLoading()) {
         nsresult rv = LoadObject(aNotify, true);
         NS_ENSURE_SUCCESS(rv, rv);
       }
     }
   }
 
   return NS_OK;
 }
 
 bool
-HTMLSharedObjectElement::IsHTMLFocusable(bool aWithMouse,
-                                         bool *aIsFocusable,
-                                         int32_t *aTabIndex)
+HTMLEmbedElement::IsHTMLFocusable(bool aWithMouse,
+                                  bool *aIsFocusable,
+                                  int32_t *aTabIndex)
 {
-  if (mNodeInfo->Equals(nsGkAtoms::embed) || Type() == eType_Plugin) {
-    // Has plugin content: let the plugin decide what to do in terms of
-    // internal focus from mouse clicks
-    if (aTabIndex) {
-      *aTabIndex = TabIndex();
-    }
-
-    *aIsFocusable = true;
-
-    // Let the plugin decide, so override.
-    return true;
+  // Has plugin content: let the plugin decide what to do in terms of
+  // internal focus from mouse clicks
+  if (aTabIndex) {
+    *aTabIndex = TabIndex();
   }
 
-  return nsGenericHTMLElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex);
+  *aIsFocusable = true;
+
+  // Let the plugin decide, so override.
+  return true;
 }
 
 nsIContent::IMEState
-HTMLSharedObjectElement::GetDesiredIMEState()
+HTMLEmbedElement::GetDesiredIMEState()
 {
   if (Type() == eType_Plugin) {
     return IMEState(IMEState::PLUGIN);
   }
 
   return nsGenericHTMLElement::GetDesiredIMEState();
 }
 
 int32_t
-HTMLSharedObjectElement::TabIndexDefault()
+HTMLEmbedElement::TabIndexDefault()
 {
   return -1;
 }
 
 bool
-HTMLSharedObjectElement::ParseAttribute(int32_t aNamespaceID,
-                                        nsIAtom *aAttribute,
-                                        const nsAString &aValue,
-                                        nsAttrValue &aResult)
+HTMLEmbedElement::ParseAttribute(int32_t aNamespaceID,
+                                 nsIAtom *aAttribute,
+                                 const nsAString &aValue,
+                                 nsAttrValue &aResult)
 {
   if (aNamespaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::align) {
       return ParseAlignValue(aValue, aResult);
     }
     if (ParseImageAttribute(aAttribute, aValue, aResult)) {
       return true;
     }
@@ -283,120 +256,110 @@ static void
 MapAttributesIntoRuleExceptHidden(const nsMappedAttributes *aAttributes,
                                   GenericSpecifiedValues* aData)
 {
   MapAttributesIntoRuleBase(aAttributes, aData);
   nsGenericHTMLElement::MapCommonAttributesIntoExceptHidden(aAttributes, aData);
 }
 
 void
-HTMLSharedObjectElement::MapAttributesIntoRule(const nsMappedAttributes *aAttributes,
-                                               GenericSpecifiedValues* aData)
+HTMLEmbedElement::MapAttributesIntoRule(const nsMappedAttributes *aAttributes,
+                                        GenericSpecifiedValues* aData)
 {
   MapAttributesIntoRuleBase(aAttributes, aData);
   nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
 }
 
 NS_IMETHODIMP_(bool)
-HTMLSharedObjectElement::IsAttributeMapped(const nsIAtom *aAttribute) const
+HTMLEmbedElement::IsAttributeMapped(const nsIAtom *aAttribute) const
 {
   static const MappedAttributeEntry* const map[] = {
     sCommonAttributeMap,
     sImageMarginSizeAttributeMap,
     sImageBorderAttributeMap,
     sImageAlignAttributeMap,
   };
 
   return FindAttributeDependence(aAttribute, map);
 }
 
 
 nsMapRuleToAttributesFunc
-HTMLSharedObjectElement::GetAttributeMappingFunction() const
+HTMLEmbedElement::GetAttributeMappingFunction() const
 {
-  if (mNodeInfo->Equals(nsGkAtoms::embed)) {
-    return &MapAttributesIntoRuleExceptHidden;
-  }
-
-  return &MapAttributesIntoRule;
+  return &MapAttributesIntoRuleExceptHidden;
 }
 
 void
-HTMLSharedObjectElement::StartObjectLoad(bool aNotify, bool aForceLoad)
+HTMLEmbedElement::StartObjectLoad(bool aNotify, bool aForceLoad)
 {
   // BindToTree can call us asynchronously, and we may be removed from the tree
   // in the interim
   if (!IsInComposedDoc() || !OwnerDoc()->IsActive() ||
       BlockEmbedOrObjectContentLoading()) {
     return;
   }
 
   LoadObject(aNotify, aForceLoad);
   SetIsNetworkCreated(false);
 }
 
 EventStates
-HTMLSharedObjectElement::IntrinsicState() const
+HTMLEmbedElement::IntrinsicState() const
 {
   return nsGenericHTMLElement::IntrinsicState() | ObjectState();
 }
 
 uint32_t
-HTMLSharedObjectElement::GetCapabilities() const
+HTMLEmbedElement::GetCapabilities() const
 {
-  uint32_t capabilities = eSupportPlugins | eAllowPluginSkipChannel;
-  if (mNodeInfo->Equals(nsGkAtoms::embed)) {
-    capabilities |= eSupportImages | eSupportDocuments;
-  }
-
-  return capabilities;
+  return eSupportPlugins | eAllowPluginSkipChannel | eSupportImages | eSupportDocuments;
 }
 
 void
-HTMLSharedObjectElement::DestroyContent()
+HTMLEmbedElement::DestroyContent()
 {
   nsObjectLoadingContent::DestroyContent();
   nsGenericHTMLElement::DestroyContent();
 }
 
 nsresult
-HTMLSharedObjectElement::CopyInnerTo(Element* aDest, bool aPreallocateChildren)
+HTMLEmbedElement::CopyInnerTo(Element* aDest, bool aPreallocateChildren)
 {
   nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest, aPreallocateChildren);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (aDest->OwnerDoc()->IsStaticDocument()) {
-    CreateStaticClone(static_cast<HTMLSharedObjectElement*>(aDest));
+    CreateStaticClone(static_cast<HTMLEmbedElement*>(aDest));
   }
 
   return rv;
 }
 
 JSObject*
-HTMLSharedObjectElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
+HTMLEmbedElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   JSObject* obj;
-  MOZ_ASSERT(mNodeInfo->Equals(nsGkAtoms::embed));
   obj = HTMLEmbedElementBinding::Wrap(aCx, this, aGivenProto);
 
   if (!obj) {
     return nullptr;
   }
   JS::Rooted<JSObject*> rootedObj(aCx, obj);
   SetupProtoChain(aCx, rootedObj);
   return rootedObj;
 }
 
 nsContentPolicyType
-HTMLSharedObjectElement::GetContentPolicyType() const
+HTMLEmbedElement::GetContentPolicyType() const
 {
   return nsIContentPolicy::TYPE_INTERNAL_EMBED;
 }
 
-NS_IMPL_STRING_ATTR(HTMLSharedObjectElement, Align, align)
-NS_IMPL_STRING_ATTR(HTMLSharedObjectElement, Width, width)
-NS_IMPL_STRING_ATTR(HTMLSharedObjectElement, Height, height)
-NS_IMPL_STRING_ATTR(HTMLSharedObjectElement, Name, name)
-NS_IMPL_URI_ATTR(HTMLSharedObjectElement, Src, src)
-NS_IMPL_STRING_ATTR(HTMLSharedObjectElement, Type, type)
+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
rename from dom/html/HTMLSharedObjectElement.h
rename to dom/html/HTMLEmbedElement.h
--- a/dom/html/HTMLSharedObjectElement.h
+++ b/dom/html/HTMLEmbedElement.h
@@ -1,39 +1,39 @@
 /* -*- 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/. */
 
-#ifndef mozilla_dom_HTMLSharedObjectElement_h
-#define mozilla_dom_HTMLSharedObjectElement_h
+#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 HTMLSharedObjectElement final : public nsGenericHTMLElement
-                                    , public nsObjectLoadingContent
-                                    , public nsIDOMHTMLEmbedElement
+class HTMLEmbedElement final : public nsGenericHTMLElement
+                             , public nsObjectLoadingContent
+                             , public nsIDOMHTMLEmbedElement
 {
 public:
-  explicit HTMLSharedObjectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
-                                   mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
+  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;
 #endif
 
   // EventTarget
@@ -43,39 +43,36 @@ public:
                               nsIContent *aBindingParent,
                               bool aCompileEventHandlers) override;
   virtual void UnbindFromTree(bool aDeep = true,
                               bool aNullParent = true) override;
 
   virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex) override;
   virtual IMEState GetDesiredIMEState() override;
 
-  virtual void DoneAddingChildren(bool aHaveNotified) override;
-  virtual bool IsDoneAddingChildren() override;
-
   virtual bool ParseAttribute(int32_t aNamespaceID,
-                                nsIAtom *aAttribute,
-                                const nsAString &aValue,
-                                nsAttrValue &aResult) override;
+                              nsIAtom *aAttribute,
+                              const nsAString &aValue,
+                              nsAttrValue &aResult) override;
   virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
   NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom *aAttribute) const override;
   virtual EventStates IntrinsicState() const override;
   virtual void DestroyContent() override;
 
   // nsObjectLoadingContent
   virtual uint32_t GetCapabilities() const override;
 
   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
                          bool aPreallocateChildren) const override;
 
   nsresult CopyInnerTo(Element* aDest, bool aPreallocateChildren);
 
   void StartObjectLoad() { StartObjectLoad(true, false); }
 
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(HTMLSharedObjectElement,
+  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(HTMLEmbedElement,
                                                      nsGenericHTMLElement)
 
   // WebIDL <embed> api
   void GetAlign(DOMString& aValue)
   {
     GetHTMLAttr(nsGkAtoms::align, aValue);
   }
   void SetAlign(const nsAString& aValue, ErrorResult& aRv)
@@ -139,24 +136,20 @@ protected:
                                 const nsAttrValue* aValue,
                                 const nsAttrValue* aOldValue,
                                 bool aNotify) override;
   virtual nsresult OnAttrSetButNotChanged(int32_t aNamespaceID, nsIAtom* aName,
                                           const nsAttrValueOrString& aValue,
                                           bool aNotify) override;
 
 private:
-  ~HTMLSharedObjectElement();
+  ~HTMLEmbedElement();
 
   nsContentPolicyType GetContentPolicyType() const override;
 
-  // mIsDoneAddingChildren is only really used for <applet>.  This boolean is
-  // always true for <embed>, per the documentation in nsIContent.h.
-  bool mIsDoneAddingChildren;
-
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
                                     GenericSpecifiedValues* aGenericData);
 
   /**
    * This function is called by AfterSetAttr and OnAttrSetButNotChanged.
    * It will not be called if the value is being unset.
@@ -167,9 +160,9 @@ private:
    */
   nsresult AfterMaybeChangeAttr(int32_t aNamespaceID, nsIAtom* aName,
                                 bool aNotify);
 };
 
 } // namespace dom
 } // namespace mozilla
 
-#endif // mozilla_dom_HTMLSharedObjectElement_h
+#endif // mozilla_dom_HTMLEmbedElement_h
--- a/dom/html/moz.build
+++ b/dom/html/moz.build
@@ -55,16 +55,17 @@ EXPORTS.mozilla.dom += [
     'HTMLButtonElement.h',
     'HTMLCanvasElement.h',
     'HTMLContentElement.h',
     'HTMLDataElement.h',
     'HTMLDataListElement.h',
     'HTMLDetailsElement.h',
     'HTMLDialogElement.h',
     'HTMLDivElement.h',
+    'HTMLEmbedElement.h',
     'HTMLFieldSetElement.h',
     'HTMLFontElement.h',
     'HTMLFormControlsCollection.h',
     'HTMLFormElement.h',
     'HTMLFormSubmission.h',
     'HTMLFrameElement.h',
     'HTMLFrameSetElement.h',
     'HTMLHeadingElement.h',
@@ -92,17 +93,16 @@ EXPORTS.mozilla.dom += [
     'HTMLPictureElement.h',
     'HTMLPreElement.h',
     'HTMLProgressElement.h',
     'HTMLScriptElement.h',
     'HTMLSelectElement.h',
     'HTMLShadowElement.h',
     'HTMLSharedElement.h',
     'HTMLSharedListElement.h',
-    'HTMLSharedObjectElement.h',
     'HTMLSourceElement.h',
     'HTMLSpanElement.h',
     'HTMLStyleElement.h',
     'HTMLSummaryElement.h',
     'HTMLTableCaptionElement.h',
     'HTMLTableCellElement.h',
     'HTMLTableColElement.h',
     'HTMLTableElement.h',
@@ -135,16 +135,17 @@ UNIFIED_SOURCES += [
     'HTMLCanvasElement.cpp',
     'HTMLContentElement.cpp',
     'HTMLDataElement.cpp',
     'HTMLDataListElement.cpp',
     'HTMLDetailsElement.cpp',
     'HTMLDialogElement.cpp',
     'HTMLDivElement.cpp',
     'HTMLElement.cpp',
+    'HTMLEmbedElement.cpp',
     'HTMLFieldSetElement.cpp',
     'HTMLFontElement.cpp',
     'HTMLFormControlsCollection.cpp',
     'HTMLFormElement.cpp',
     'HTMLFormSubmission.cpp',
     'HTMLFrameElement.cpp',
     'HTMLFrameSetElement.cpp',
     'HTMLHeadingElement.cpp',
@@ -172,17 +173,16 @@ UNIFIED_SOURCES += [
     'HTMLPictureElement.cpp',
     'HTMLPreElement.cpp',
     'HTMLProgressElement.cpp',
     'HTMLScriptElement.cpp',
     'HTMLSelectElement.cpp',
     'HTMLShadowElement.cpp',
     'HTMLSharedElement.cpp',
     'HTMLSharedListElement.cpp',
-    'HTMLSharedObjectElement.cpp',
     'HTMLSourceElement.cpp',
     'HTMLSpanElement.cpp',
     'HTMLStyleElement.cpp',
     'HTMLSummaryElement.cpp',
     'HTMLTableCaptionElement.cpp',
     'HTMLTableCellElement.cpp',
     'HTMLTableColElement.cpp',
     'HTMLTableElement.cpp',
--- a/dom/html/nsGenericHTMLElement.h
+++ b/dom/html/nsGenericHTMLElement.h
@@ -1512,32 +1512,32 @@ NS_NewHTML##_elementName##Element(alread
 // Here, we expand 'NS_DECLARE_NS_NEW_HTML_ELEMENT()' by hand.
 // (Calling the macro directly (with no args) produces compiler warnings.)
 nsGenericHTMLElement*
 NS_NewHTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                   mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
 
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Shared)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedList)
-NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedObject)
 
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Anchor)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Area)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Audio)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(BR)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Body)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Button)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Canvas)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Content)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Mod)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Data)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(DataList)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Details)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Dialog)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Div)
+NS_DECLARE_NS_NEW_HTML_ELEMENT(Embed)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(FieldSet)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Font)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Form)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Frame)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(FrameSet)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(HR)
 NS_DECLARE_NS_NEW_HTML_ELEMENT_AS_SHARED(Head)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Heading)
--- a/dom/tests/browser/browser_bug396843.js
+++ b/dom/tests/browser/browser_bug396843.js
@@ -10,17 +10,17 @@ function testInDocument(doc, documentID)
         allNodes.push(doc.createElement(name));
     }
 
     /* List copy/pasted from nsHTMLTagList.h */
     HTML_TAG("a", "Anchor")
     HTML_TAG("abbr", "Span")
     HTML_TAG("acronym", "Span")
     HTML_TAG("address", "Span")
-    HTML_TAG("applet", "SharedObject")
+    HTML_TAG("applet", "Unknown")
     HTML_TAG("area", "Area")
     HTML_TAG("b", "Span")
     HTML_TAG("base", "Shared")
     HTML_TAG("basefont", "Span")
     HTML_TAG("bdo", "Span")
     HTML_TAG("bgsound", "Span")
     HTML_TAG("big", "Span")
     HTML_TAG("blockquote", "Shared")
@@ -37,17 +37,17 @@ function testInDocument(doc, documentID)
     HTML_TAG("dd", "Span")
     HTML_TAG("del", "Mod")
     HTML_TAG("dfn", "Span")
     HTML_TAG("dir", "Shared")
     HTML_TAG("div", "Div")
     HTML_TAG("dl", "SharedList")
     HTML_TAG("dt", "Span")
     HTML_TAG("em", "Span")
-    HTML_TAG("embed", "SharedObject")
+    HTML_TAG("embed", "Embed")
     HTML_TAG("fieldset", "FieldSet")
     HTML_TAG("font", "Font")
     HTML_TAG("form", "Form")
     HTML_TAG("frame", "Frame")
     HTML_TAG("frameset", "FrameSet")
     HTML_TAG("h1", "Heading")
     HTML_TAG("h2", "Heading")
     HTML_TAG("h3", "Heading")
--- a/dom/tests/mochitest/bugs/test_bug396843.html
+++ b/dom/tests/mochitest/bugs/test_bug396843.html
@@ -30,17 +30,17 @@ function HTML_TAG(name) {
   allNodes.push(document.createElement(name));
 }
 
 /* List copy/pasted from nsHTMLTagList.h */
 HTML_TAG("a", "Anchor")
 HTML_TAG("abbr", "Span")
 HTML_TAG("acronym", "Span")
 HTML_TAG("address", "Span")
-HTML_TAG("applet", "SharedObject")
+HTML_TAG("applet", "Unknown")
 HTML_TAG("area", "Area")
 HTML_TAG("b", "Span")
 HTML_TAG("base", "Shared")
 HTML_TAG("basefont", "Span")
 HTML_TAG("bdo", "Span")
 HTML_TAG("bgsound", "Unknown")
 HTML_TAG("big", "Span")
 HTML_TAG("blockquote", "Shared")
@@ -57,17 +57,17 @@ HTML_TAG("colgroup", "TableCol")
 HTML_TAG("dd", "Span")
 HTML_TAG("del", "Mod")
 HTML_TAG("dfn", "Span")
 HTML_TAG("dir", "Shared")
 HTML_TAG("div", "Div")
 HTML_TAG("dl", "SharedList")
 HTML_TAG("dt", "Span")
 HTML_TAG("em", "Span")
-HTML_TAG("embed", "SharedObject")
+HTML_TAG("embed", "Embed")
 HTML_TAG("fieldset", "FieldSet")
 HTML_TAG("font", "Font")
 HTML_TAG("form", "Form")
 HTML_TAG("frame", "Frame")
 HTML_TAG("frameset", "FrameSet")
 HTML_TAG("h1", "Heading")
 HTML_TAG("h2", "Heading")
 HTML_TAG("h3", "Heading")
--- a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
+++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
@@ -3,17 +3,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 "WebBrowserPersistLocalDocument.h"
 #include "WebBrowserPersistDocumentParent.h"
 
 #include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/dom/HTMLSharedElement.h"
-#include "mozilla/dom/HTMLSharedObjectElement.h"
 #include "mozilla/dom/TabParent.h"
 #include "nsComponentManagerUtils.h"
 #include "nsContentUtils.h"
 #include "nsContentCID.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsFrameLoader.h"
 #include "nsIComponentRegistrar.h"
 #include "nsIContent.h"
--- a/dom/webbrowserpersist/nsWebBrowserPersist.cpp
+++ b/dom/webbrowserpersist/nsWebBrowserPersist.cpp
@@ -56,17 +56,16 @@
 #include "nsIWebBrowserPersistable.h"
 #include "nsWebBrowserPersist.h"
 #include "WebBrowserPersistLocalDocument.h"
 
 #include "nsIContent.h"
 #include "nsIMIMEInfo.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/dom/HTMLSharedElement.h"
-#include "mozilla/dom/HTMLSharedObjectElement.h"
 #include "mozilla/Printf.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 // Buffer file writes in 32kb chunks
 #define BUFFERED_OUTPUT_SIZE (1024 * 32)
 
--- a/parser/htmlparser/nsHTMLTagList.h
+++ b/parser/htmlparser/nsHTMLTagList.h
@@ -74,17 +74,17 @@ HTML_TAG(del, Mod, Mod)
 HTML_TAG(details, Details, Details)
 HTML_HTMLELEMENT_TAG(dfn)
 HTML_TAG(dialog, Dialog, Dialog)
 HTML_TAG(dir, Shared, Directory)
 HTML_TAG(div, Div, Div)
 HTML_TAG(dl, SharedList, DList)
 HTML_HTMLELEMENT_TAG(dt)
 HTML_HTMLELEMENT_TAG(em)
-HTML_TAG(embed, SharedObject, Embed)
+HTML_TAG(embed, Embed, Embed)
 HTML_TAG(fieldset, FieldSet, FieldSet)
 HTML_HTMLELEMENT_TAG(figcaption)
 HTML_HTMLELEMENT_TAG(figure)
 HTML_TAG(font, Font, Font)
 HTML_HTMLELEMENT_TAG(footer)
 HTML_TAG(form, Form, Form)
 HTML_TAG(frame, Frame, Frame)
 HTML_TAG(frameset, FrameSet, FrameSet)