Bug 1492894 - part 1 - make the node hierarchy consistently constructed with NodeInfo&&; r=mccr8
authorNathan Froyd <froydnj@mozilla.com>
Fri, 21 Sep 2018 16:45:49 -0400
changeset 496222 a14c288aec85e9e772dbb5e118a16c16cb95cc83
parent 496221 df90cba2837365a34bcf33b87c1d143712b4ab49
child 496223 bb0e08fb9530dae213926269ec20495920bd2788
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1492894
milestone64.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 1492894 - part 1 - make the node hierarchy consistently constructed with NodeInfo&&; r=mccr8 Various places in dom/ use the pattern: already_AddRefed<NodeInfo> ni = ...; which is supposed to be disallowed by our static analysis code, but isn't, for whatever reason. To fix our static analysis code, we need to eliminate instances of the above pattern. Unfortunately, eliminating this pattern requires restructuring how Nodes are created. Most Node subclasses take `already_AddRefed<NodeInfo>&` in their constructors, and a few accept `already_AddRefed<NodeInfo>&&`. We need to enforce the latter pattern consistently, which requires changing dozens of source files.
dom/base/Attr.cpp
dom/base/CharacterData.cpp
dom/base/CharacterData.h
dom/base/Comment.h
dom/base/DocumentFragment.h
dom/base/DocumentType.cpp
dom/base/DocumentType.h
dom/base/Element.h
dom/base/FragmentOrElement.cpp
dom/base/GeneratedImageContent.cpp
dom/base/GeneratedImageContent.h
dom/base/ShadowRoot.cpp
dom/base/Text.h
dom/base/nsDocument.cpp
dom/base/nsIContent.h
dom/base/nsINode.cpp
dom/base/nsINode.h
dom/base/nsMappedAttributeElement.h
dom/base/nsStyledElement.h
dom/base/nsTextNode.cpp
dom/base/nsTextNode.h
dom/html/HTMLAnchorElement.h
dom/html/HTMLAreaElement.cpp
dom/html/HTMLAreaElement.h
dom/html/HTMLAudioElement.cpp
dom/html/HTMLAudioElement.h
dom/html/HTMLBRElement.cpp
dom/html/HTMLBRElement.h
dom/html/HTMLBodyElement.h
dom/html/HTMLButtonElement.cpp
dom/html/HTMLButtonElement.h
dom/html/HTMLCanvasElement.cpp
dom/html/HTMLCanvasElement.h
dom/html/HTMLDataElement.cpp
dom/html/HTMLDataElement.h
dom/html/HTMLDataListElement.h
dom/html/HTMLDetailsElement.h
dom/html/HTMLDialogElement.cpp
dom/html/HTMLDialogElement.h
dom/html/HTMLDivElement.h
dom/html/HTMLElement.cpp
dom/html/HTMLEmbedElement.cpp
dom/html/HTMLEmbedElement.h
dom/html/HTMLFieldSetElement.cpp
dom/html/HTMLFieldSetElement.h
dom/html/HTMLFontElement.h
dom/html/HTMLFormElement.cpp
dom/html/HTMLFormElement.h
dom/html/HTMLFrameElement.cpp
dom/html/HTMLFrameElement.h
dom/html/HTMLFrameSetElement.h
dom/html/HTMLHRElement.cpp
dom/html/HTMLHRElement.h
dom/html/HTMLHeadingElement.h
dom/html/HTMLIFrameElement.cpp
dom/html/HTMLIFrameElement.h
dom/html/HTMLImageElement.cpp
dom/html/HTMLImageElement.h
dom/html/HTMLInputElement.cpp
dom/html/HTMLInputElement.h
dom/html/HTMLLIElement.h
dom/html/HTMLLabelElement.h
dom/html/HTMLLegendElement.h
dom/html/HTMLLinkElement.cpp
dom/html/HTMLLinkElement.h
dom/html/HTMLMapElement.cpp
dom/html/HTMLMapElement.h
dom/html/HTMLMediaElement.cpp
dom/html/HTMLMediaElement.h
dom/html/HTMLMenuElement.cpp
dom/html/HTMLMenuElement.h
dom/html/HTMLMenuItemElement.cpp
dom/html/HTMLMenuItemElement.h
dom/html/HTMLMetaElement.cpp
dom/html/HTMLMetaElement.h
dom/html/HTMLMeterElement.cpp
dom/html/HTMLMeterElement.h
dom/html/HTMLModElement.cpp
dom/html/HTMLModElement.h
dom/html/HTMLObjectElement.cpp
dom/html/HTMLObjectElement.h
dom/html/HTMLOptGroupElement.cpp
dom/html/HTMLOptGroupElement.h
dom/html/HTMLOptionElement.cpp
dom/html/HTMLOptionElement.h
dom/html/HTMLOutputElement.cpp
dom/html/HTMLOutputElement.h
dom/html/HTMLParagraphElement.h
dom/html/HTMLPictureElement.cpp
dom/html/HTMLPictureElement.h
dom/html/HTMLPreElement.h
dom/html/HTMLProgressElement.cpp
dom/html/HTMLProgressElement.h
dom/html/HTMLScriptElement.cpp
dom/html/HTMLScriptElement.h
dom/html/HTMLSelectElement.cpp
dom/html/HTMLSelectElement.h
dom/html/HTMLSharedElement.h
dom/html/HTMLSharedListElement.h
dom/html/HTMLSlotElement.cpp
dom/html/HTMLSlotElement.h
dom/html/HTMLSourceElement.cpp
dom/html/HTMLSourceElement.h
dom/html/HTMLSpanElement.h
dom/html/HTMLStyleElement.cpp
dom/html/HTMLStyleElement.h
dom/html/HTMLSummaryElement.h
dom/html/HTMLTableCaptionElement.h
dom/html/HTMLTableCellElement.h
dom/html/HTMLTableColElement.h
dom/html/HTMLTableElement.cpp
dom/html/HTMLTableElement.h
dom/html/HTMLTableRowElement.h
dom/html/HTMLTableSectionElement.h
dom/html/HTMLTemplateElement.cpp
dom/html/HTMLTemplateElement.h
dom/html/HTMLTextAreaElement.cpp
dom/html/HTMLTextAreaElement.h
dom/html/HTMLTimeElement.cpp
dom/html/HTMLTimeElement.h
dom/html/HTMLTitleElement.cpp
dom/html/HTMLTitleElement.h
dom/html/HTMLTrackElement.cpp
dom/html/HTMLTrackElement.h
dom/html/HTMLUnknownElement.h
dom/html/HTMLVideoElement.cpp
dom/html/HTMLVideoElement.h
dom/html/nsGenericHTMLElement.cpp
dom/html/nsGenericHTMLElement.h
dom/html/nsGenericHTMLFrameElement.h
dom/mathml/nsMathMLElement.cpp
dom/svg/SVGAElement.cpp
dom/svg/SVGAElement.h
dom/svg/SVGAnimateElement.cpp
dom/svg/SVGAnimateElement.h
dom/svg/SVGAnimateMotionElement.cpp
dom/svg/SVGAnimateMotionElement.h
dom/svg/SVGAnimateTransformElement.cpp
dom/svg/SVGAnimateTransformElement.h
dom/svg/SVGAnimationElement.cpp
dom/svg/SVGAnimationElement.h
dom/svg/SVGCircleElement.cpp
dom/svg/SVGCircleElement.h
dom/svg/SVGClipPathElement.cpp
dom/svg/SVGClipPathElement.h
dom/svg/SVGComponentTransferFunctionElement.h
dom/svg/SVGDefsElement.cpp
dom/svg/SVGDefsElement.h
dom/svg/SVGDescElement.cpp
dom/svg/SVGDescElement.h
dom/svg/SVGEllipseElement.cpp
dom/svg/SVGEllipseElement.h
dom/svg/SVGFEBlendElement.h
dom/svg/SVGFEColorMatrixElement.h
dom/svg/SVGFEComponentTransferElement.h
dom/svg/SVGFECompositeElement.h
dom/svg/SVGFEConvolveMatrixElement.h
dom/svg/SVGFEDiffuseLightingElement.h
dom/svg/SVGFEDisplacementMapElement.h
dom/svg/SVGFEDistantLightElement.h
dom/svg/SVGFEDropShadowElement.h
dom/svg/SVGFEFloodElement.h
dom/svg/SVGFEGaussianBlurElement.h
dom/svg/SVGFEImageElement.cpp
dom/svg/SVGFEImageElement.h
dom/svg/SVGFEMergeElement.h
dom/svg/SVGFEMergeNodeElement.h
dom/svg/SVGFEMorphologyElement.h
dom/svg/SVGFEOffsetElement.h
dom/svg/SVGFEPointLightElement.h
dom/svg/SVGFESpecularLightingElement.h
dom/svg/SVGFESpotLightElement.h
dom/svg/SVGFETileElement.h
dom/svg/SVGFETurbulenceElement.h
dom/svg/SVGFilterElement.cpp
dom/svg/SVGFilterElement.h
dom/svg/SVGForeignObjectElement.cpp
dom/svg/SVGForeignObjectElement.h
dom/svg/SVGGElement.cpp
dom/svg/SVGGElement.h
dom/svg/SVGGeometryElement.cpp
dom/svg/SVGGeometryElement.h
dom/svg/SVGGradientElement.cpp
dom/svg/SVGGradientElement.h
dom/svg/SVGGraphicsElement.cpp
dom/svg/SVGGraphicsElement.h
dom/svg/SVGImageElement.cpp
dom/svg/SVGImageElement.h
dom/svg/SVGLineElement.cpp
dom/svg/SVGLineElement.h
dom/svg/SVGMPathElement.cpp
dom/svg/SVGMPathElement.h
dom/svg/SVGMarkerElement.cpp
dom/svg/SVGMarkerElement.h
dom/svg/SVGMaskElement.cpp
dom/svg/SVGMaskElement.h
dom/svg/SVGMetadataElement.cpp
dom/svg/SVGMetadataElement.h
dom/svg/SVGPathElement.cpp
dom/svg/SVGPathElement.h
dom/svg/SVGPatternElement.cpp
dom/svg/SVGPatternElement.h
dom/svg/SVGPolyElement.cpp
dom/svg/SVGPolyElement.h
dom/svg/SVGPolygonElement.cpp
dom/svg/SVGPolygonElement.h
dom/svg/SVGPolylineElement.cpp
dom/svg/SVGPolylineElement.h
dom/svg/SVGRectElement.cpp
dom/svg/SVGRectElement.h
dom/svg/SVGSVGElement.cpp
dom/svg/SVGSVGElement.h
dom/svg/SVGScriptElement.cpp
dom/svg/SVGScriptElement.h
dom/svg/SVGSetElement.cpp
dom/svg/SVGSetElement.h
dom/svg/SVGStopElement.cpp
dom/svg/SVGStopElement.h
dom/svg/SVGStyleElement.cpp
dom/svg/SVGStyleElement.h
dom/svg/SVGSwitchElement.cpp
dom/svg/SVGSwitchElement.h
dom/svg/SVGSymbolElement.cpp
dom/svg/SVGSymbolElement.h
dom/svg/SVGTSpanElement.cpp
dom/svg/SVGTSpanElement.h
dom/svg/SVGTextContentElement.h
dom/svg/SVGTextElement.cpp
dom/svg/SVGTextElement.h
dom/svg/SVGTextPathElement.cpp
dom/svg/SVGTextPathElement.h
dom/svg/SVGTextPositioningElement.h
dom/svg/SVGTitleElement.cpp
dom/svg/SVGTitleElement.h
dom/svg/SVGTransformableElement.h
dom/svg/SVGUseElement.cpp
dom/svg/SVGUseElement.h
dom/svg/SVGViewElement.cpp
dom/svg/SVGViewElement.h
dom/svg/SVGViewportElement.cpp
dom/svg/SVGViewportElement.h
dom/svg/nsSVGElement.cpp
dom/svg/nsSVGElement.h
dom/svg/nsSVGFilters.h
dom/xbl/XBLChildrenElement.h
dom/xml/CDATASection.h
dom/xml/nsXMLElement.cpp
dom/xml/nsXMLElement.h
dom/xul/XULFrameElement.h
dom/xul/XULMenuElement.h
dom/xul/XULPopupElement.cpp
dom/xul/XULPopupElement.h
dom/xul/XULScrollElement.h
dom/xul/nsXULElement.cpp
dom/xul/nsXULElement.h
layout/generic/DetailsFrame.cpp
--- a/dom/base/Attr.cpp
+++ b/dom/base/Attr.cpp
@@ -32,17 +32,17 @@ namespace mozilla {
 namespace dom {
 
 //----------------------------------------------------------------------
 bool Attr::sInitialized;
 
 Attr::Attr(nsDOMAttributeMap *aAttrMap,
            already_AddRefed<dom::NodeInfo>&& aNodeInfo,
            const nsAString& aValue)
-  : nsINode(aNodeInfo), mAttrMap(aAttrMap), mValue(aValue)
+  : nsINode(std::move(aNodeInfo)), mAttrMap(aAttrMap), mValue(aValue)
 {
   MOZ_ASSERT(mNodeInfo, "We must get a nodeinfo here!");
   MOZ_ASSERT(mNodeInfo->NodeType() == ATTRIBUTE_NODE,
              "Wrong nodeType");
 
   // We don't add a reference to our content. It will tell us
   // to drop our reference when it goes away.
 }
--- a/dom/base/CharacterData.cpp
+++ b/dom/base/CharacterData.cpp
@@ -36,29 +36,18 @@
 #include "PLDHashTable.h"
 #include "mozilla/Sprintf.h"
 #include "nsWindowSizes.h"
 #include "nsWrapperCacheInlines.h"
 
 namespace mozilla {
 namespace dom {
 
-CharacterData::CharacterData(already_AddRefed<dom::NodeInfo>& aNodeInfo)
-  : nsIContent(aNodeInfo)
-{
-  MOZ_ASSERT(mNodeInfo->NodeType() == TEXT_NODE ||
-             mNodeInfo->NodeType() == CDATA_SECTION_NODE ||
-             mNodeInfo->NodeType() == COMMENT_NODE ||
-             mNodeInfo->NodeType() == PROCESSING_INSTRUCTION_NODE ||
-             mNodeInfo->NodeType() == DOCUMENT_TYPE_NODE,
-             "Bad NodeType in aNodeInfo");
-}
-
 CharacterData::CharacterData(already_AddRefed<dom::NodeInfo>&& aNodeInfo)
-  : nsIContent(aNodeInfo)
+  : nsIContent(std::move(aNodeInfo))
 {
   MOZ_ASSERT(mNodeInfo->NodeType() == TEXT_NODE ||
              mNodeInfo->NodeType() == CDATA_SECTION_NODE ||
              mNodeInfo->NodeType() == COMMENT_NODE ||
              mNodeInfo->NodeType() == PROCESSING_INSTRUCTION_NODE ||
              mNodeInfo->NodeType() == DOCUMENT_TYPE_NODE,
              "Bad NodeType in aNodeInfo");
 }
--- a/dom/base/CharacterData.h
+++ b/dom/base/CharacterData.h
@@ -80,17 +80,16 @@ public:
   // We want to avoid the overhead of extra function calls for
   // refcounting when we're not doing refcount logging, so we can't
   // NS_DECL_ISUPPORTS_INHERITED.
   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
   NS_INLINE_DECL_REFCOUNTING_INHERITED(CharacterData, nsIContent);
 
   NS_DECL_ADDSIZEOFEXCLUDINGTHIS
 
-  explicit CharacterData(already_AddRefed<dom::NodeInfo>& aNodeInfo);
   explicit CharacterData(already_AddRefed<dom::NodeInfo>&& aNodeInfo);
 
   void MarkAsMaybeModifiedFrequently()
   {
     SetFlags(NS_MAYBE_MODIFIED_FREQUENTLY);
   }
 
   NS_IMPL_FROMNODE_HELPER(CharacterData, IsCharacterData())
--- a/dom/base/Comment.h
+++ b/dom/base/Comment.h
@@ -21,17 +21,17 @@ private:
     MOZ_ASSERT(mNodeInfo->NodeType() == COMMENT_NODE,
                "Bad NodeType in aNodeInfo");
   }
 
   virtual ~Comment();
 
 public:
   explicit Comment(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
-    : CharacterData(aNodeInfo)
+    : CharacterData(std::move(aNodeInfo))
   {
     Init();
   }
 
   explicit Comment(nsNodeInfoManager* aNodeInfoManager)
     : CharacterData(aNodeInfoManager->GetCommentNodeInfo())
   {
     Init();
--- a/dom/base/DocumentFragment.h
+++ b/dom/base/DocumentFragment.h
@@ -38,18 +38,18 @@ public:
   using nsINode::QuerySelectorAll;
   // Make sure bindings can see our superclass' protected GetElementById method.
   using nsINode::GetElementById;
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DocumentFragment, FragmentOrElement)
 
-  explicit DocumentFragment(already_AddRefed<dom::NodeInfo>& aNodeInfo)
-    : FragmentOrElement(aNodeInfo), mHost(nullptr)
+  explicit DocumentFragment(already_AddRefed<dom::NodeInfo>&& aNodeInfo)
+    : FragmentOrElement(std::move(aNodeInfo)), mHost(nullptr)
   {
     Init();
   }
 
   explicit DocumentFragment(nsNodeInfoManager* aNodeInfoManager)
     : FragmentOrElement(aNodeInfoManager->GetNodeInfo(
                                             nsGkAtoms::documentFragmentNodeName,
                                             nullptr, kNameSpaceID_None,
--- a/dom/base/DocumentType.cpp
+++ b/dom/base/DocumentType.cpp
@@ -22,40 +22,41 @@ already_AddRefed<mozilla::dom::DocumentT
 NS_NewDOMDocumentType(nsNodeInfoManager* aNodeInfoManager,
                       nsAtom *aName,
                       const nsAString& aPublicId,
                       const nsAString& aSystemId,
                       const nsAString& aInternalSubset)
 {
   MOZ_ASSERT(aName, "Must have a name");
 
-  already_AddRefed<mozilla::dom::NodeInfo> ni =
+  RefPtr<mozilla::dom::NodeInfo> ni =
     aNodeInfoManager->GetNodeInfo(nsGkAtoms::documentTypeNodeName, nullptr,
                                   kNameSpaceID_None,
                                   nsINode::DOCUMENT_TYPE_NODE, aName);
 
   RefPtr<mozilla::dom::DocumentType> docType =
-    new mozilla::dom::DocumentType(ni, aPublicId, aSystemId, aInternalSubset);
+    new mozilla::dom::DocumentType(ni.forget(), aPublicId, aSystemId,
+                                   aInternalSubset);
   return docType.forget();
 }
 
 namespace mozilla {
 namespace dom {
 
 JSObject*
 DocumentType::WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
 {
   return DocumentType_Binding::Wrap(cx, this, aGivenProto);
 }
 
-DocumentType::DocumentType(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+DocumentType::DocumentType(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                            const nsAString& aPublicId,
                            const nsAString& aSystemId,
                            const nsAString& aInternalSubset) :
-  CharacterData(aNodeInfo),
+  CharacterData(std::move(aNodeInfo)),
   mPublicId(aPublicId),
   mSystemId(aSystemId),
   mInternalSubset(aInternalSubset)
 {
   MOZ_ASSERT(mNodeInfo->NodeType() == DOCUMENT_TYPE_NODE,
              "Bad NodeType in aNodeInfo");
   MOZ_ASSERT(!IsCharacterData());
 }
@@ -96,15 +97,15 @@ void
 DocumentType::GetInternalSubset(nsAString& aInternalSubset) const
 {
   aInternalSubset = mInternalSubset;
 }
 
 already_AddRefed<CharacterData>
 DocumentType::CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo, bool aCloneText) const
 {
-  already_AddRefed<mozilla::dom::NodeInfo> ni = RefPtr<mozilla::dom::NodeInfo>(aNodeInfo).forget();
-  return do_AddRef(new DocumentType(ni, mPublicId, mSystemId, mInternalSubset));
+  return do_AddRef(new DocumentType(do_AddRef(aNodeInfo), mPublicId, mSystemId,
+                                    mInternalSubset));
 }
 
 } // namespace dom
 } // namespace mozilla
 
--- a/dom/base/DocumentType.h
+++ b/dom/base/DocumentType.h
@@ -23,17 +23,17 @@ 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:
-  DocumentType(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+  DocumentType(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                const nsAString& aPublicId,
                const nsAString& aSystemId,
                const nsAString& aInternalSubset);
 
   // nsISupports
   NS_INLINE_DECL_REFCOUNTING_INHERITED(DocumentType, CharacterData)
 
   // nsINode
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -143,18 +143,18 @@ class Grid;
 #define NS_ELEMENT_IID \
 { 0xc67ed254, 0xfd3b, 0x4b10, \
   { 0x96, 0xa2, 0xc5, 0x8b, 0x7b, 0x64, 0x97, 0xd1 } }
 
 class Element : public FragmentOrElement
 {
 public:
 #ifdef MOZILLA_INTERNAL_API
-  explicit Element(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo) :
-    FragmentOrElement(aNodeInfo),
+  explicit Element(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) :
+    FragmentOrElement(std::move(aNodeInfo)),
     mState(NS_EVENT_STATE_MOZ_READONLY | NS_EVENT_STATE_DEFINED)
   {
     MOZ_ASSERT(mNodeInfo->NodeType() == ELEMENT_NODE,
                "Bad NodeType in aNodeInfo");
     SetIsElement();
   }
 
   ~Element()
@@ -2096,19 +2096,18 @@ nsINode::GetNextElementSibling() const
  * Macros to implement Clone(). _elementName is the class for which to implement
  * Clone.
  */
 #define NS_IMPL_ELEMENT_CLONE(_elementName)                                 \
 nsresult                                                                    \
 _elementName::Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const \
 {                                                                           \
   *aResult = nullptr;                                                       \
-  already_AddRefed<mozilla::dom::NodeInfo> ni =                             \
-    RefPtr<mozilla::dom::NodeInfo>(aNodeInfo).forget();                     \
-  _elementName *it = new _elementName(ni);                                  \
+  RefPtr<mozilla::dom::NodeInfo> ni(aNodeInfo);                             \
+  _elementName *it = new _elementName(ni.forget());                         \
   if (!it) {                                                                \
     return NS_ERROR_OUT_OF_MEMORY;                                          \
   }                                                                         \
                                                                             \
   nsCOMPtr<nsINode> kungFuDeathGrip = it;                                   \
   nsresult rv = const_cast<_elementName*>(this)->CopyInnerTo(it);           \
   if (NS_SUCCEEDED(rv)) {                                                   \
     kungFuDeathGrip.swap(*aResult);                                         \
@@ -2119,19 +2118,18 @@ nsresult                                
 
 #define EXPAND(...) __VA_ARGS__
 #define NS_IMPL_ELEMENT_CLONE_WITH_INIT_HELPER(_elementName, extra_args_)   \
 nsresult                                                                    \
 _elementName::Clone(mozilla::dom::NodeInfo* aNodeInfo,                      \
                     nsINode** aResult) const                                \
 {                                                                           \
   *aResult = nullptr;                                                       \
-  already_AddRefed<mozilla::dom::NodeInfo> ni =                             \
-    RefPtr<mozilla::dom::NodeInfo>(aNodeInfo).forget();                     \
-  _elementName *it = new _elementName(ni EXPAND extra_args_);               \
+  RefPtr<mozilla::dom::NodeInfo> ni(aNodeInfo);                             \
+  _elementName *it = new _elementName(ni.forget() EXPAND extra_args_);      \
   if (!it) {                                                                \
     return NS_ERROR_OUT_OF_MEMORY;                                          \
   }                                                                         \
                                                                             \
   nsCOMPtr<nsINode> kungFuDeathGrip = it;                                   \
   nsresult rv = it->Init();                                                 \
   nsresult rv2 = const_cast<_elementName*>(this)->CopyInnerTo(it);          \
   if (NS_FAILED(rv2)) {                                                     \
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -852,23 +852,18 @@ FragmentOrElement::nsExtendedDOMSlots::S
 
   if (mCustomElementData) {
     n += mCustomElementData->SizeOfIncludingThis(aMallocSizeOf);
   }
 
   return n;
 }
 
-FragmentOrElement::FragmentOrElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsIContent(aNodeInfo)
-{
-}
-
 FragmentOrElement::FragmentOrElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
-  : nsIContent(aNodeInfo)
+  : nsIContent(std::move(aNodeInfo))
 {
 }
 
 FragmentOrElement::~FragmentOrElement()
 {
   MOZ_ASSERT(!IsInUncomposedDoc(),
              "Please remove this from the document properly");
   if (GetParent()) {
--- a/dom/base/GeneratedImageContent.cpp
+++ b/dom/base/GeneratedImageContent.cpp
@@ -23,24 +23,17 @@ GeneratedImageContent::Create(nsIDocumen
 {
   RefPtr<dom::NodeInfo> nodeInfo =
     aDocument.NodeInfoManager()->
       GetNodeInfo(nsGkAtoms::mozgeneratedcontentimage,
                   nullptr,
                   kNameSpaceID_XHTML,
                   nsINode::ELEMENT_NODE);
 
-  // Work around not being able to bind a non-const lvalue reference
-  // to an rvalue of non-reference type by just creating an rvalue
-  // reference.  And we can't change the constructor signature,
-  // because then the macro-generated Clone() method fails to compile.
-  already_AddRefed<dom::NodeInfo>&& rvalue = nodeInfo.forget();
-
-  auto image =
-    MakeRefPtr<GeneratedImageContent>(rvalue);
+  auto image = MakeRefPtr<GeneratedImageContent>(nodeInfo.forget());
   image->mIndex = aContentIndex;
   return image.forget();
 }
 
 JSObject*
 GeneratedImageContent::WrapNode(JSContext* aCx,
                                 JS::Handle<JSObject*> aGivenProto)
 {
--- a/dom/base/GeneratedImageContent.h
+++ b/dom/base/GeneratedImageContent.h
@@ -21,18 +21,18 @@ namespace dom {
 
 class GeneratedImageContent final
   : public nsGenericHTMLElement
 {
 public:
   static already_AddRefed<GeneratedImageContent>
     Create(nsIDocument&, uint32_t aContentIndex);
 
-  explicit GeneratedImageContent(already_AddRefed<dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit GeneratedImageContent(already_AddRefed<dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
     MOZ_ASSERT(IsInNamespace(kNameSpaceID_XHTML), "Someone messed up our nodeinfo");
   }
 
   nsresult Clone(dom::NodeInfo* aNodeInfo, nsINode** aResult) const final;
 
   nsresult CopyInnerTo(GeneratedImageContent* aDest)
   {
--- a/dom/base/ShadowRoot.cpp
+++ b/dom/base/ShadowRoot.cpp
@@ -59,17 +59,17 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
   NS_INTERFACE_MAP_ENTRY(nsIRadioGroupContainer)
 NS_INTERFACE_MAP_END_INHERITING(DocumentFragment)
 
 NS_IMPL_ADDREF_INHERITED(ShadowRoot, DocumentFragment)
 NS_IMPL_RELEASE_INHERITED(ShadowRoot, DocumentFragment)
 
 ShadowRoot::ShadowRoot(Element* aElement, ShadowRootMode aMode,
                        already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
-  : DocumentFragment(aNodeInfo)
+  : DocumentFragment(std::move(aNodeInfo))
   , DocumentOrShadowRoot(*this)
   , mMode(aMode)
   , mIsUAWidget(false)
 {
   SetHost(aElement);
 
   // Nodes in a shadow tree should never store a value
   // in the subtree root pointer, nodes in the shadow tree
--- a/dom/base/Text.h
+++ b/dom/base/Text.h
@@ -13,22 +13,18 @@
 namespace mozilla {
 namespace dom {
 
 class Text : public CharacterData
 {
 public:
   NS_IMPL_FROMNODE_HELPER(Text, IsText())
 
-  explicit Text(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : CharacterData(aNodeInfo)
-  {}
-
   explicit Text(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
-    : CharacterData(aNodeInfo)
+  : CharacterData(std::move(aNodeInfo))
   {}
 
   // WebIDL API
   already_AddRefed<Text> SplitText(uint32_t aOffset, ErrorResult& rv);
   void GetWholeText(nsAString& aWholeText, ErrorResult& rv);
 
   static already_AddRefed<Text>
   Constructor(const GlobalObject& aGlobal,
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -1344,23 +1344,21 @@ struct nsIDocument::FrameRequest
   bool operator<(int32_t aHandle) const {
     return mHandle < aHandle;
   }
 
   RefPtr<FrameRequestCallback> mCallback;
   int32_t mHandle;
 };
 
-static already_AddRefed<mozilla::dom::NodeInfo> nullNodeInfo;
-
 // ==================================================================
 // =
 // ==================================================================
 nsIDocument::nsIDocument()
-  : nsINode(nullNodeInfo),
+  : nsINode(nullptr),
     DocumentOrShadowRoot(*this),
     mReferrerPolicySet(false),
     mReferrerPolicy(mozilla::net::RP_Unset),
     mBlockAllMixedContent(false),
     mBlockAllMixedContentPreloads(false),
     mUpgradeInsecureRequests(false),
     mUpgradeInsecurePreloads(false),
     mCharacterSet(WINDOWS_1252_ENCODING),
--- a/dom/base/nsIContent.h
+++ b/dom/base/nsIContent.h
@@ -56,18 +56,18 @@ public:
   typedef mozilla::widget::IMEState IMEState;
 
   void ConstructUbiNode(void* storage) override;
 
 #ifdef MOZILLA_INTERNAL_API
   // If you're using the external API, the only thing you can know about
   // nsIContent is that it exists with an IID
 
-  explicit nsIContent(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsINode(aNodeInfo)
+  explicit nsIContent(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsINode(std::move(aNodeInfo))
   {
     MOZ_ASSERT(mNodeInfo);
     SetNodeIsContent();
   }
 #endif // MOZILLA_INTERNAL_API
 
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENT_IID)
 
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -147,18 +147,18 @@ nsINode::nsSlots::Unlink()
   if (mChildNodes) {
     mChildNodes->DropReference();
   }
 }
 
 //----------------------------------------------------------------------
 
 #ifdef MOZILLA_INTERNAL_API
-nsINode::nsINode(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : mNodeInfo(aNodeInfo)
+nsINode::nsINode(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : mNodeInfo(std::move(aNodeInfo))
   , mParent(nullptr)
 #ifndef BOOL_FLAGS_ON_WRAPPER_CACHE
   , mBoolFlags(0)
 #endif
   , mChildCount(0)
   , mPreviousOrLastSibling(nullptr)
   , mSubtreeRoot(this)
   , mSlots(nullptr)
--- a/dom/base/nsINode.h
+++ b/dom/base/nsINode.h
@@ -365,17 +365,17 @@ public:
   void AddSizeOfIncludingThis(nsWindowSizes& aSizes, size_t* aNodeSize) const;
 
   friend class nsNodeUtils;
   friend class nsNodeWeakReference;
   friend class nsNodeSupportsWeakRefTearoff;
   friend class AttrArray;
 
 #ifdef MOZILLA_INTERNAL_API
-  explicit nsINode(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit nsINode(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 #endif
 
   virtual ~nsINode();
 
   /**
    * Bit-flags to pass (or'ed together) to IsNodeOfType()
    */
   enum {
--- a/dom/base/nsMappedAttributeElement.h
+++ b/dom/base/nsMappedAttributeElement.h
@@ -27,18 +27,18 @@ typedef void (*nsMapRuleToAttributesFunc
 
 typedef nsStyledElement nsMappedAttributeElementBase;
 
 class nsMappedAttributeElement : public nsMappedAttributeElementBase
 {
 
 protected:
 
-  explicit nsMappedAttributeElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsMappedAttributeElementBase(aNodeInfo)
+  explicit nsMappedAttributeElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsMappedAttributeElementBase(std::move(aNodeInfo))
   {}
 
 public:
   virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
 
   static void MapNoAttributesInto(const nsMappedAttributes* aAttributes,
                                   mozilla::MappedDeclarations&);
 
--- a/dom/base/nsStyledElement.h
+++ b/dom/base/nsStyledElement.h
@@ -28,18 +28,18 @@ class DeclarationBlock;
 
 typedef mozilla::dom::Element nsStyledElementBase;
 
 class nsStyledElement : public nsStyledElementBase
 {
 
 protected:
 
-  inline explicit nsStyledElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsStyledElementBase(aNodeInfo)
+  inline explicit nsStyledElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsStyledElementBase(std::move(aNodeInfo))
   {}
 
 public:
   // We don't want to implement AddRef/Release because that would add an extra
   // function call for those on pretty much all elements.  But we do need QI, so
   // we can QI to nsStyledElement.
   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
 
--- a/dom/base/nsTextNode.cpp
+++ b/dom/base/nsTextNode.cpp
@@ -29,20 +29,20 @@ using namespace mozilla::dom;
  * class used to implement attr() generated content
  */
 class nsAttributeTextNode final : public nsTextNode,
                                   public nsStubMutationObserver
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
 
-  nsAttributeTextNode(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+  nsAttributeTextNode(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                       int32_t aNameSpaceID,
                       nsAtom* aAttrName) :
-    nsTextNode(aNodeInfo),
+    nsTextNode(std::move(aNodeInfo)),
     mGrandparent(nullptr),
     mNameSpaceID(aNameSpaceID),
     mAttrName(aAttrName)
   {
     NS_ASSERTION(mNameSpaceID != kNameSpaceID_Unknown, "Must know namespace");
     NS_ASSERTION(mAttrName, "Must have attr name");
   }
 
@@ -53,20 +53,18 @@ public:
 
   NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
   NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED
 
   virtual already_AddRefed<CharacterData>
     CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
                   bool aCloneText) const override
   {
-    already_AddRefed<mozilla::dom::NodeInfo> ni =
-      RefPtr<mozilla::dom::NodeInfo>(aNodeInfo).forget();
     RefPtr<nsAttributeTextNode> it =
-      new nsAttributeTextNode(ni, mNameSpaceID, mAttrName);
+      new nsAttributeTextNode(do_AddRef(aNodeInfo), mNameSpaceID, mAttrName);
     if (aCloneText) {
       it->mText = mText;
     }
 
     return it.forget();
   }
 
   // Public method for the event to run
@@ -110,18 +108,17 @@ bool
 nsTextNode::IsNodeOfType(uint32_t aFlags) const
 {
   return false;
 }
 
 already_AddRefed<CharacterData>
 nsTextNode::CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo, bool aCloneText) const
 {
-  already_AddRefed<mozilla::dom::NodeInfo> ni = RefPtr<mozilla::dom::NodeInfo>(aNodeInfo).forget();
-  RefPtr<nsTextNode> it = new nsTextNode(ni);
+  RefPtr<nsTextNode> it = new nsTextNode(do_AddRef(aNodeInfo));
   if (aCloneText) {
     it->mText = mText;
   }
 
   return it.forget();
 }
 
 nsresult
@@ -214,22 +211,22 @@ NS_NewAttributeContent(nsNodeInfoManager
                        nsIContent** aResult)
 {
   MOZ_ASSERT(aNodeInfoManager, "Missing nodeInfoManager");
   MOZ_ASSERT(aAttrName, "Must have an attr name");
   MOZ_ASSERT(aNameSpaceID != kNameSpaceID_Unknown, "Must know namespace");
 
   *aResult = nullptr;
 
-  already_AddRefed<mozilla::dom::NodeInfo> ni = aNodeInfoManager->GetTextNodeInfo();
+  RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfoManager->GetTextNodeInfo();
 
-  nsAttributeTextNode* textNode = new nsAttributeTextNode(ni,
-                                                          aNameSpaceID,
-                                                          aAttrName);
-  NS_ADDREF(*aResult = textNode);
+  RefPtr<nsAttributeTextNode> textNode = new nsAttributeTextNode(ni.forget(),
+                                                                 aNameSpaceID,
+                                                                 aAttrName);
+  textNode.forget(aResult);
 
   return NS_OK;
 }
 
 NS_IMPL_ISUPPORTS_INHERITED(nsAttributeTextNode, nsTextNode,
                             nsIMutationObserver)
 
 nsresult
--- a/dom/base/nsTextNode.h
+++ b/dom/base/nsTextNode.h
@@ -25,18 +25,18 @@ class nsTextNode : public mozilla::dom::
 private:
   void Init()
   {
     MOZ_ASSERT(mNodeInfo->NodeType() == TEXT_NODE,
                "Bad NodeType in aNodeInfo");
   }
 
 public:
-  explicit nsTextNode(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : mozilla::dom::Text(aNodeInfo)
+  explicit nsTextNode(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : mozilla::dom::Text(std::move(aNodeInfo))
   {
     Init();
   }
 
   explicit nsTextNode(nsNodeInfoManager* aNodeInfoManager)
     : mozilla::dom::Text(aNodeInfoManager->GetTextNodeInfo())
   {
     Init();
--- a/dom/html/HTMLAnchorElement.h
+++ b/dom/html/HTMLAnchorElement.h
@@ -18,18 +18,18 @@ class EventChainPreVisitor;
 namespace dom {
 
 class HTMLAnchorElement final : public nsGenericHTMLElement,
                                 public Link
 {
 public:
   using Element::GetText;
 
-  explicit HTMLAnchorElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLAnchorElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
     , Link(this)
   {
   }
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // CC
--- a/dom/html/HTMLAreaElement.cpp
+++ b/dom/html/HTMLAreaElement.cpp
@@ -14,18 +14,18 @@
 #include "mozilla/MemoryReporting.h"
 #include "nsWindowSizes.h"
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(Area)
 
 namespace mozilla {
 namespace dom {
 
-HTMLAreaElement::HTMLAreaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLAreaElement::HTMLAreaElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
   , Link(this)
 {
 }
 
 HTMLAreaElement::~HTMLAreaElement()
 {
 }
 
--- a/dom/html/HTMLAreaElement.h
+++ b/dom/html/HTMLAreaElement.h
@@ -19,17 +19,17 @@ namespace mozilla {
 class EventChainPostVisitor;
 class EventChainPreVisitor;
 namespace dom {
 
 class HTMLAreaElement final : public nsGenericHTMLElement,
                               public Link
 {
 public:
-  explicit HTMLAreaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLAreaElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // CC
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLAreaElement,
                                            nsGenericHTMLElement)
 
--- a/dom/html/HTMLAudioElement.cpp
+++ b/dom/html/HTMLAudioElement.cpp
@@ -22,18 +22,18 @@
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(Audio)
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_ELEMENT_CLONE(HTMLAudioElement)
 
-HTMLAudioElement::HTMLAudioElement(already_AddRefed<NodeInfo>& aNodeInfo)
-  : HTMLMediaElement(aNodeInfo)
+HTMLAudioElement::HTMLAudioElement(already_AddRefed<NodeInfo>&& aNodeInfo)
+: HTMLMediaElement(std::move(aNodeInfo))
 {
   DecoderDoctorLogger::LogConstruction(this);
 }
 
 HTMLAudioElement::~HTMLAudioElement()
 {
   DecoderDoctorLogger::LogDestruction(this);
 }
@@ -52,22 +52,22 @@ HTMLAudioElement::Audio(const GlobalObje
 {
   nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aGlobal.GetAsSupports());
   nsIDocument* doc;
   if (!win || !(doc = win->GetExtantDoc())) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
-  already_AddRefed<mozilla::dom::NodeInfo> nodeInfo =
+  RefPtr<mozilla::dom::NodeInfo> nodeInfo =
     doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::audio, nullptr,
                                         kNameSpaceID_XHTML,
                                         ELEMENT_NODE);
 
-  RefPtr<HTMLAudioElement> audio = new HTMLAudioElement(nodeInfo);
+  RefPtr<HTMLAudioElement> audio = new HTMLAudioElement(nodeInfo.forget());
   audio->SetHTMLAttr(nsGkAtoms::preload, NS_LITERAL_STRING("auto"), aRv);
   if (aRv.Failed()) {
     return nullptr;
   }
 
   if (aSrc.WasPassed()) {
     audio->SetSrc(aSrc.Value(), aRv);
   }
--- a/dom/html/HTMLAudioElement.h
+++ b/dom/html/HTMLAudioElement.h
@@ -18,17 +18,17 @@ namespace dom {
 
 class HTMLAudioElement final : public HTMLMediaElement
 {
 public:
   typedef mozilla::dom::NodeInfo NodeInfo;
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLAudioElement, audio)
 
-  explicit HTMLAudioElement(already_AddRefed<NodeInfo>& aNodeInfo);
+  explicit HTMLAudioElement(already_AddRefed<NodeInfo>&& aNodeInfo);
 
   // Element
   virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override;
 
   // nsIDOMHTMLMediaElement
   using HTMLMediaElement::GetPaused;
 
   virtual nsresult Clone(NodeInfo*, nsINode** aResult) const override;
--- a/dom/html/HTMLBRElement.cpp
+++ b/dom/html/HTMLBRElement.cpp
@@ -12,18 +12,18 @@
 #include "nsMappedAttributes.h"
 
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(BR)
 
 namespace mozilla {
 namespace dom {
 
-HTMLBRElement::HTMLBRElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLBRElement::HTMLBRElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
 {
 }
 
 HTMLBRElement::~HTMLBRElement()
 {
 }
 
 NS_IMPL_ELEMENT_CLONE(HTMLBRElement)
--- a/dom/html/HTMLBRElement.h
+++ b/dom/html/HTMLBRElement.h
@@ -12,17 +12,17 @@
 #include "nsGkAtoms.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLBRElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLBRElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLBRElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   virtual bool ParseAttribute(int32_t aNamespaceID,
                                 nsAtom* aAttribute,
                                 const nsAString& aValue,
                                 nsIPrincipal* aMaybeScriptedPrincipal,
                                 nsAttrValue& aResult) override;
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
   virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
--- a/dom/html/HTMLBodyElement.h
+++ b/dom/html/HTMLBodyElement.h
@@ -17,18 +17,18 @@ namespace dom {
 
 class OnBeforeUnloadEventHandlerNonNull;
 
 class HTMLBodyElement final : public nsGenericHTMLElement
 {
 public:
   using Element::GetText;
 
-  explicit HTMLBodyElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLBodyElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
   }
 
   // nsISupports
   NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLBodyElement, nsGenericHTMLElement)
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLBodyElement, body);
 
--- a/dom/html/HTMLButtonElement.cpp
+++ b/dom/html/HTMLButtonElement.cpp
@@ -48,19 +48,19 @@ static const nsAttrValue::EnumTable kBut
   { nullptr, 0 }
 };
 
 // Default type is 'submit'.
 static const nsAttrValue::EnumTable* kButtonDefaultType = &kButtonTypeTable[2];
 
 
 // Construction, destruction
-HTMLButtonElement::HTMLButtonElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+HTMLButtonElement::HTMLButtonElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                                      FromParser aFromParser)
-  : nsGenericHTMLFormElementWithState(aNodeInfo, kButtonDefaultType->value),
+  : nsGenericHTMLFormElementWithState(std::move(aNodeInfo), kButtonDefaultType->value),
     mDisabledChanged(false),
     mInInternalActivate(false),
     mInhibitStateRestoration(!!(aFromParser & FROM_PARSER_FRAGMENT))
 {
   // Set up our default state: enabled
   AddStatesSilently(NS_EVENT_STATE_ENABLED);
 }
 
--- a/dom/html/HTMLButtonElement.h
+++ b/dom/html/HTMLButtonElement.h
@@ -17,17 +17,17 @@ class EventChainPreVisitor;
 namespace dom {
 
 class HTMLButtonElement final : public nsGenericHTMLFormElementWithState,
                                 public nsIConstraintValidation
 {
 public:
   using nsIConstraintValidation::GetValidationMessage;
 
-  explicit HTMLButtonElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+  explicit HTMLButtonElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                              FromParser aFromParser = NOT_FROM_PARSER);
 
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLButtonElement,
                                            nsGenericHTMLFormElementWithState)
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
--- a/dom/html/HTMLCanvasElement.cpp
+++ b/dom/html/HTMLCanvasElement.cpp
@@ -388,18 +388,18 @@ HTMLCanvasElementObserver::HandleEvent(E
 
   return NS_OK;
 }
 
 NS_IMPL_ISUPPORTS(HTMLCanvasElementObserver, nsIObserver)
 
 // ---------------------------------------------------------------------------
 
-HTMLCanvasElement::HTMLCanvasElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo),
+HTMLCanvasElement::HTMLCanvasElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo)),
     mResetLayer(true) ,
     mWriteOnly(false)
 {}
 
 HTMLCanvasElement::~HTMLCanvasElement()
 {
   if (mContextObserver) {
     mContextObserver->Destroy();
--- a/dom/html/HTMLCanvasElement.h
+++ b/dom/html/HTMLCanvasElement.h
@@ -126,17 +126,17 @@ class HTMLCanvasElement final : public n
   typedef layers::AsyncCanvasRenderer AsyncCanvasRenderer;
   typedef layers::CanvasRenderer CanvasRenderer;
   typedef layers::CanvasLayer CanvasLayer;
   typedef layers::Layer Layer;
   typedef layers::LayerManager LayerManager;
   typedef layers::WebRenderCanvasData WebRenderCanvasData;
 
 public:
-  explicit HTMLCanvasElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLCanvasElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLCanvasElement, canvas)
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // CC
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLCanvasElement,
--- a/dom/html/HTMLDataElement.cpp
+++ b/dom/html/HTMLDataElement.cpp
@@ -8,18 +8,18 @@
 #include "mozilla/dom/HTMLDataElementBinding.h"
 #include "nsGenericHTMLElement.h"
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(Data)
 
 namespace mozilla {
 namespace dom {
 
-HTMLDataElement::HTMLDataElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLDataElement::HTMLDataElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
 {
 }
 
 HTMLDataElement::~HTMLDataElement()
 {
 }
 
 NS_IMPL_ELEMENT_CLONE(HTMLDataElement)
--- a/dom/html/HTMLDataElement.h
+++ b/dom/html/HTMLDataElement.h
@@ -12,17 +12,17 @@
 #include "nsGkAtoms.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLDataElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLDataElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLDataElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   // HTMLDataElement WebIDL
   void GetValue(DOMString& aValue)
   {
     GetHTMLAttr(nsGkAtoms::value, aValue);
   }
 
   void SetValue(const nsAString& aValue, ErrorResult& aError)
--- a/dom/html/HTMLDataListElement.h
+++ b/dom/html/HTMLDataListElement.h
@@ -11,18 +11,18 @@
 #include "nsContentList.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLDataListElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLDataListElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLDataListElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
   }
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   nsContentList* Options()
   {
--- a/dom/html/HTMLDetailsElement.h
+++ b/dom/html/HTMLDetailsElement.h
@@ -19,18 +19,18 @@ namespace dom {
 // controls. Please see the spec for more information.
 // https://html.spec.whatwg.org/multipage/forms.html#the-details-element
 //
 class HTMLDetailsElement final : public nsGenericHTMLElement
 {
 public:
   using NodeInfo = mozilla::dom::NodeInfo;
 
-  explicit HTMLDetailsElement(already_AddRefed<NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLDetailsElement(already_AddRefed<NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
   }
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLDetailsElement, details)
 
   nsIContent* GetFirstSummary() const;
 
   nsresult Clone(NodeInfo* aNodeInfo, nsINode** aResult) const override;
--- a/dom/html/HTMLDialogElement.cpp
+++ b/dom/html/HTMLDialogElement.cpp
@@ -10,20 +10,20 @@
 #include "mozilla/Preferences.h"
 
 // Expand NS_IMPL_NS_NEW_HTML_ELEMENT(Dialog) with pref check
 nsGenericHTMLElement*
 NS_NewHTMLDialogElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                          mozilla::dom::FromParser aFromParser)
 {
   if (!mozilla::dom::HTMLDialogElement::IsDialogEnabled()) {
-    return new mozilla::dom::HTMLUnknownElement(aNodeInfo);
+    return new mozilla::dom::HTMLUnknownElement(std::move(aNodeInfo));
   }
 
-  return new mozilla::dom::HTMLDialogElement(aNodeInfo);
+  return new mozilla::dom::HTMLDialogElement(std::move(aNodeInfo));
 }
 
 namespace mozilla {
 namespace dom {
 
 HTMLDialogElement::~HTMLDialogElement()
 {
 }
--- a/dom/html/HTMLDialogElement.h
+++ b/dom/html/HTMLDialogElement.h
@@ -13,17 +13,18 @@
 #include "nsGkAtoms.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLDialogElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLDialogElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo) : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLDialogElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
   }
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLDialogElement, dialog)
 
   nsresult Clone(dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
 
   static bool IsDialogEnabled();
--- a/dom/html/HTMLDivElement.h
+++ b/dom/html/HTMLDivElement.h
@@ -10,18 +10,18 @@
 #include "nsGenericHTMLElement.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLDivElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLDivElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLDivElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
   }
 
   void GetAlign(DOMString& aAlign)
   {
     GetHTMLAttr(nsGkAtoms::align, aAlign);
   }
   void SetAlign(const nsAString& aAlign, mozilla::ErrorResult& aError)
--- a/dom/html/HTMLElement.cpp
+++ b/dom/html/HTMLElement.cpp
@@ -9,27 +9,27 @@
 #include "nsContentUtils.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual ~HTMLElement();
 
   nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
 protected:
   JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 };
 
-HTMLElement::HTMLElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLElement::HTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
 {
   if (NodeInfo()->Equals(nsGkAtoms::bdi)) {
     AddStatesSilently(NS_EVENT_STATE_DIR_ATTR_LIKE_AUTO);
   }
 }
 
 HTMLElement::~HTMLElement()
 {
@@ -47,19 +47,19 @@ HTMLElement::WrapNode(JSContext *aCx, JS
 } // namespace mozilla
 
 // Here, we expand 'NS_IMPL_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)
 {
-  return new mozilla::dom::HTMLElement(aNodeInfo);
+  return new mozilla::dom::HTMLElement(std::move(aNodeInfo));
 }
 
 // Distinct from the above in order to have function pointer that compared unequal
 // to a function pointer to the above.
 nsGenericHTMLElement*
 NS_NewCustomElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                     mozilla::dom::FromParser aFromParser)
 {
-  return new mozilla::dom::HTMLElement(aNodeInfo);
+  return new mozilla::dom::HTMLElement(std::move(aNodeInfo));
 }
--- a/dom/html/HTMLEmbedElement.cpp
+++ b/dom/html/HTMLEmbedElement.cpp
@@ -22,19 +22,19 @@
 #include "mozilla/dom/HTMLObjectElement.h"
 
 
 NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Embed)
 
 namespace mozilla {
 namespace dom {
 
-HTMLEmbedElement::HTMLEmbedElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+HTMLEmbedElement::HTMLEmbedElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                                    FromParser aFromParser)
-  : nsGenericHTMLElement(aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
 {
   RegisterActivityObserver();
   SetIsNetworkCreated(aFromParser == FROM_PARSER_NETWORK);
 
   // By default we're in the loading state
   AddStatesSilently(NS_EVENT_STATE_LOADING);
 }
 
--- a/dom/html/HTMLEmbedElement.h
+++ b/dom/html/HTMLEmbedElement.h
@@ -15,17 +15,17 @@
 
 namespace mozilla {
 namespace dom {
 
 class HTMLEmbedElement final : public nsGenericHTMLElement
                              , public nsObjectLoadingContent
 {
 public:
-  explicit HTMLEmbedElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+  explicit HTMLEmbedElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                             mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLEmbedElement, embed)
   virtual int32_t TabIndexDefault() override;
 
 #ifdef XP_MACOSX
--- a/dom/html/HTMLFieldSetElement.cpp
+++ b/dom/html/HTMLFieldSetElement.cpp
@@ -12,18 +12,18 @@
 #include "nsContentList.h"
 #include "nsQueryObject.h"
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(FieldSet)
 
 namespace mozilla {
 namespace dom {
 
-HTMLFieldSetElement::HTMLFieldSetElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLFormElement(aNodeInfo, NS_FORM_FIELDSET)
+HTMLFieldSetElement::HTMLFieldSetElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLFormElement(std::move(aNodeInfo), NS_FORM_FIELDSET)
   , mElements(nullptr)
   , mFirstLegend(nullptr)
   , mInvalidElementsCount(0)
 {
   // <fieldset> is always barred from constraint validation.
   SetBarredFromConstraintValidation(true);
 
   // We start out enabled and valid.
--- a/dom/html/HTMLFieldSetElement.h
+++ b/dom/html/HTMLFieldSetElement.h
@@ -20,17 +20,17 @@ namespace dom {
 class HTMLFieldSetElement final : public nsGenericHTMLFormElement,
                                   public nsIConstraintValidation
 {
 public:
   using nsGenericHTMLFormElement::GetForm;
   using nsIConstraintValidation::GetValidationMessage;
   using nsIConstraintValidation::SetCustomValidity;
 
-  explicit HTMLFieldSetElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLFieldSetElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLFieldSetElement, fieldset)
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIContent
   void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
--- a/dom/html/HTMLFontElement.h
+++ b/dom/html/HTMLFontElement.h
@@ -10,18 +10,18 @@
 #include "nsGenericHTMLElement.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLFontElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLFontElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLFontElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
   }
 
   void GetColor(DOMString& aColor)
   {
     GetHTMLAttr(nsGkAtoms::color, aColor);
   }
   void SetColor(const nsAString& aColor, ErrorResult& aError)
--- a/dom/html/HTMLFormElement.cpp
+++ b/dom/html/HTMLFormElement.cpp
@@ -90,18 +90,18 @@ static const nsAttrValue::EnumTable kFor
   { nullptr, 0 }
 };
 // Default autocomplete value is 'on'.
 static const nsAttrValue::EnumTable* kFormDefaultAutocomplete = &kFormAutocompleteTable[0];
 
 bool HTMLFormElement::gFirstFormSubmitted = false;
 bool HTMLFormElement::gPasswordManagerInitialized = false;
 
-HTMLFormElement::HTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo),
+HTMLFormElement::HTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo)),
     mControls(new HTMLFormControlsCollection(this)),
     mSelectedRadioButtons(2),
     mRequiredRadioButtonCounts(2),
     mValueMissingRadioGroups(2),
     mPendingSubmission(nullptr),
     mSubmittingRequest(nullptr),
     mDefaultSubmitElement(nullptr),
     mFirstSubmitInElements(nullptr),
--- a/dom/html/HTMLFormElement.h
+++ b/dom/html/HTMLFormElement.h
@@ -39,17 +39,17 @@ class HTMLFormElement final : public nsG
                               public nsIForm,
                               public nsIRadioGroupContainer
 {
   friend class HTMLFormControlsCollection;
 
 public:
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLFormElement, form)
 
-  explicit HTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   enum {
     FORM_CONTROL_LIST_HASHTABLE_LENGTH = 8
   };
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
--- a/dom/html/HTMLFrameElement.cpp
+++ b/dom/html/HTMLFrameElement.cpp
@@ -7,19 +7,19 @@
 #include "mozilla/dom/HTMLFrameElement.h"
 #include "mozilla/dom/HTMLFrameElementBinding.h"
 
 NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Frame)
 
 namespace mozilla {
 namespace dom {
 
-HTMLFrameElement::HTMLFrameElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+HTMLFrameElement::HTMLFrameElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                                    FromParser aFromParser)
-  : nsGenericHTMLFrameElement(aNodeInfo, aFromParser)
+  : nsGenericHTMLFrameElement(std::move(aNodeInfo), aFromParser)
 {
 }
 
 HTMLFrameElement::~HTMLFrameElement()
 {
 }
 
 
--- a/dom/html/HTMLFrameElement.h
+++ b/dom/html/HTMLFrameElement.h
@@ -14,17 +14,17 @@
 namespace mozilla {
 namespace dom {
 
 class HTMLFrameElement final : public nsGenericHTMLFrameElement
 {
 public:
   using nsGenericHTMLFrameElement::SwapFrameLoaders;
 
-  explicit HTMLFrameElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+  explicit HTMLFrameElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                             FromParser aFromParser = NOT_FROM_PARSER);
 
   // nsISupports
   NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLFrameElement,
                                        nsGenericHTMLFrameElement)
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLFrameElement, frame)
 
--- a/dom/html/HTMLFrameSetElement.h
+++ b/dom/html/HTMLFrameSetElement.h
@@ -41,18 +41,18 @@ struct nsFramesetSpec {
 namespace mozilla {
 namespace dom {
 
 class OnBeforeUnloadEventHandlerNonNull;
 
 class HTMLFrameSetElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLFrameSetElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo),
+  explicit HTMLFrameSetElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo)),
       mNumRows(0),
       mNumCols(0),
       mCurrentRowColHint(NS_STYLE_HINT_REFLOW)
   {
     SetHasWeirdParserInsertionMode();
   }
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLFrameSetElement, frameset)
--- a/dom/html/HTMLHRElement.cpp
+++ b/dom/html/HTMLHRElement.cpp
@@ -9,18 +9,18 @@
 
 #include "nsCSSProps.h"
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(HR)
 
 namespace mozilla {
 namespace dom {
 
-HTMLHRElement::HTMLHRElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLHRElement::HTMLHRElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
 {
 }
 
 HTMLHRElement::~HTMLHRElement()
 {
 }
 
 NS_IMPL_ELEMENT_CLONE(HTMLHRElement)
--- a/dom/html/HTMLHRElement.h
+++ b/dom/html/HTMLHRElement.h
@@ -13,17 +13,17 @@
 #include "nsAttrValueInlines.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLHRElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLHRElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLHRElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   // nsISupports
   NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLHRElement, nsGenericHTMLElement)
 
   virtual bool ParseAttribute(int32_t aNamespaceID,
                               nsAtom* aAttribute,
                               const nsAString& aValue,
                               nsIPrincipal* aMaybeScriptedPrincipal,
--- a/dom/html/HTMLHeadingElement.h
+++ b/dom/html/HTMLHeadingElement.h
@@ -11,18 +11,18 @@
 #include "nsGenericHTMLElement.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLHeadingElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLHeadingElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLHeadingElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
   }
 
   virtual bool ParseAttribute(int32_t aNamespaceID,
                               nsAtom* aAttribute,
                               const nsAString& aValue,
                               nsIPrincipal* aMaybeScriptedPrincipal,
                               nsAttrValue& aResult) override;
--- a/dom/html/HTMLIFrameElement.cpp
+++ b/dom/html/HTMLIFrameElement.cpp
@@ -22,19 +22,19 @@ namespace dom {
 // static
 const DOMTokenListSupportedToken HTMLIFrameElement::sSupportedSandboxTokens[] = {
 #define SANDBOX_KEYWORD(string, atom, flags) string,
 #include "IframeSandboxKeywordList.h"
 #undef SANDBOX_KEYWORD
   nullptr
 };
 
-HTMLIFrameElement::HTMLIFrameElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+HTMLIFrameElement::HTMLIFrameElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                                      FromParser aFromParser)
-  : nsGenericHTMLFrameElement(aNodeInfo, aFromParser)
+  : nsGenericHTMLFrameElement(std::move(aNodeInfo), aFromParser)
 {
 }
 
 HTMLIFrameElement::~HTMLIFrameElement()
 {
 }
 
 NS_IMPL_ELEMENT_CLONE(HTMLIFrameElement)
--- a/dom/html/HTMLIFrameElement.h
+++ b/dom/html/HTMLIFrameElement.h
@@ -12,17 +12,17 @@
 #include "nsDOMTokenList.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLIFrameElement final : public nsGenericHTMLFrameElement
 {
 public:
-  explicit HTMLIFrameElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+  explicit HTMLIFrameElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                              FromParser aFromParser = NOT_FROM_PARSER);
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLIFrameElement, iframe)
 
   // nsISupports
   NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLIFrameElement,
                                        nsGenericHTMLFrameElement)
 
--- a/dom/html/HTMLImageElement.cpp
+++ b/dom/html/HTMLImageElement.cpp
@@ -112,18 +112,18 @@ private:
   nsCOMPtr<nsIDocument> mDocument;
   bool mAlwaysLoad;
 
   // True if we want to set nsIClassOfService::UrgentStart to the channel to
   // get the response ASAP for better user responsiveness.
   bool mUseUrgentStartForChannel;
 };
 
-HTMLImageElement::HTMLImageElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLImageElement::HTMLImageElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
   , mForm(nullptr)
   , mInDocResponsiveContent(false)
   , mCurrentDensity(1.0)
 {
   // We start out broken
   AddStatesSilently(NS_EVENT_STATE_BROKEN);
 }
 
@@ -729,22 +729,22 @@ HTMLImageElement::Image(const GlobalObje
 {
   nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aGlobal.GetAsSupports());
   nsIDocument* doc;
   if (!win || !(doc = win->GetExtantDoc())) {
     aError.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
-  already_AddRefed<mozilla::dom::NodeInfo> nodeInfo =
+  RefPtr<mozilla::dom::NodeInfo> nodeInfo =
     doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::img, nullptr,
                                         kNameSpaceID_XHTML,
                                         ELEMENT_NODE);
 
-  RefPtr<HTMLImageElement> img = new HTMLImageElement(nodeInfo);
+  RefPtr<HTMLImageElement> img = new HTMLImageElement(nodeInfo.forget());
 
   if (aWidth.WasPassed()) {
     img->SetWidth(aWidth.Value(), aError);
     if (aError.Failed()) {
       return nullptr;
     }
 
     if (aHeight.WasPassed()) {
--- a/dom/html/HTMLImageElement.h
+++ b/dom/html/HTMLImageElement.h
@@ -22,17 +22,17 @@ class ImageLoadTask;
 class ResponsiveImageSelector;
 class HTMLImageElement final : public nsGenericHTMLElement,
                                public nsImageLoadingContent
 {
   friend class HTMLSourceElement;
   friend class HTMLPictureElement;
   friend class ImageLoadTask;
 public:
-  explicit HTMLImageElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLImageElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   static already_AddRefed<HTMLImageElement>
     Image(const GlobalObject& aGlobal,
           const Optional<uint32_t>& aWidth,
           const Optional<uint32_t>& aHeight,
           ErrorResult& aError);
 
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLImageElement,
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -984,19 +984,19 @@ HTMLInputElement::Shutdown()
   delete sCachedTextEditorState;
   sCachedTextEditorState = nullptr;
 }
 
 //
 // construction, destruction
 //
 
-HTMLInputElement::HTMLInputElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+HTMLInputElement::HTMLInputElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                                    FromParser aFromParser, FromClone aFromClone)
-  : nsGenericHTMLFormElementWithState(aNodeInfo, kInputDefaultType->value)
+  : nsGenericHTMLFormElementWithState(std::move(aNodeInfo), kInputDefaultType->value)
   , mAutocompleteAttrState(nsContentUtils::eAutocompleteAttrState_Unknown)
   , mAutocompleteInfoState(nsContentUtils::eAutocompleteAttrState_Unknown)
   , mDisabledChanged(false)
   , mValueChanged(false)
   , mLastValueChangeWasInteractive(false)
   , mCheckedChanged(false)
   , mChecked(false)
   , mHandlingSelectEvent(false)
@@ -1126,18 +1126,18 @@ NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHER
 
 // nsINode
 
 nsresult
 HTMLInputElement::Clone(dom::NodeInfo* aNodeInfo, nsINode** aResult) const
 {
   *aResult = nullptr;
 
-  already_AddRefed<mozilla::dom::NodeInfo> ni = RefPtr<mozilla::dom::NodeInfo>(aNodeInfo).forget();
-  RefPtr<HTMLInputElement> it = new HTMLInputElement(ni, NOT_FROM_PARSER,
+  RefPtr<HTMLInputElement> it = new HTMLInputElement(do_AddRef(aNodeInfo),
+                                                     NOT_FROM_PARSER,
                                                      FromClone::yes);
 
   nsresult rv = const_cast<HTMLInputElement*>(this)->CopyInnerTo(it);
   NS_ENSURE_SUCCESS(rv, rv);
 
   switch (GetValueMode()) {
     case VALUE_MODE_VALUE:
       if (mValueChanged) {
--- a/dom/html/HTMLInputElement.h
+++ b/dom/html/HTMLInputElement.h
@@ -132,17 +132,17 @@ class HTMLInputElement final : public ns
 
 public:
   using nsIConstraintValidation::GetValidationMessage;
   using nsGenericHTMLFormElementWithState::GetForm;
   using nsGenericHTMLFormElementWithState::GetFormAction;
 
   enum class FromClone { no, yes };
 
-  HTMLInputElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+  HTMLInputElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                    mozilla::dom::FromParser aFromParser,
                    FromClone aFromClone = FromClone::no);
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLInputElement, input)
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
--- a/dom/html/HTMLLIElement.h
+++ b/dom/html/HTMLLIElement.h
@@ -12,18 +12,18 @@
 #include "nsGenericHTMLElement.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLLIElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLLIElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLLIElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
   }
 
   // nsISupports
   NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLLIElement, nsGenericHTMLElement)
 
   virtual bool ParseAttribute(int32_t aNamespaceID,
                                 nsAtom* aAttribute,
--- a/dom/html/HTMLLabelElement.h
+++ b/dom/html/HTMLLabelElement.h
@@ -15,18 +15,18 @@
 
 namespace mozilla {
 class EventChainPostVisitor;
 namespace dom {
 
 class HTMLLabelElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLLabelElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo),
+  explicit HTMLLabelElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo)),
       mHandlingEvent(false)
   {
   }
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLLabelElement, label)
 
   // nsISupports
   NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLLabelElement, nsGenericHTMLElement)
--- a/dom/html/HTMLLegendElement.h
+++ b/dom/html/HTMLLegendElement.h
@@ -12,18 +12,18 @@
 #include "mozilla/dom/HTMLFormElement.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLLegendElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLLegendElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLLegendElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
   }
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLLegendElement, legend)
 
   using nsGenericHTMLElement::Focus;
   virtual void Focus(ErrorResult& aError) override;
 
--- a/dom/html/HTMLLinkElement.cpp
+++ b/dom/html/HTMLLinkElement.cpp
@@ -53,18 +53,18 @@ enum {
 
 ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 2);
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(Link)
 
 namespace mozilla {
 namespace dom {
 
-HTMLLinkElement::HTMLLinkElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLLinkElement::HTMLLinkElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
   , Link(this)
 {
 }
 
 HTMLLinkElement::~HTMLLinkElement()
 {
 }
 
--- a/dom/html/HTMLLinkElement.h
+++ b/dom/html/HTMLLinkElement.h
@@ -17,17 +17,17 @@ class EventChainPostVisitor;
 class EventChainPreVisitor;
 namespace dom {
 
 class HTMLLinkElement final : public nsGenericHTMLElement,
                               public nsStyleLinkElement,
                               public Link
 {
 public:
-  explicit HTMLLinkElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLLinkElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // CC
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLLinkElement,
                                            nsGenericHTMLElement)
 
--- a/dom/html/HTMLMapElement.cpp
+++ b/dom/html/HTMLMapElement.cpp
@@ -11,18 +11,18 @@
 #include "nsContentList.h"
 #include "nsCOMPtr.h"
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(Map)
 
 namespace mozilla {
 namespace dom {
 
-HTMLMapElement::HTMLMapElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLMapElement::HTMLMapElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
 {
 }
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLMapElement)
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLMapElement,
                                                   nsGenericHTMLElement)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAreas)
--- a/dom/html/HTMLMapElement.h
+++ b/dom/html/HTMLMapElement.h
@@ -14,17 +14,17 @@
 class nsContentList;
 
 namespace mozilla {
 namespace dom {
 
 class HTMLMapElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLMapElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLMapElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(HTMLMapElement,
                                                      nsGenericHTMLElement)
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -3865,18 +3865,18 @@ private:
   // Guaranteed to be valid by HTMLMediaElement.
   HTMLMediaElement* mWeak = nullptr;
   Phase mPhase = Phase::Init;
 };
 
 NS_IMPL_ISUPPORTS(HTMLMediaElement::ShutdownObserver, nsIObserver)
 
 HTMLMediaElement::HTMLMediaElement(
-  already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+  already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
   , mWatchManager(this, OwnerDoc()->AbstractMainThreadFor(TaskCategory::Other))
   , mMainThreadEventTarget(OwnerDoc()->EventTargetFor(TaskCategory::Other))
   , mAbstractMainThread(OwnerDoc()->AbstractMainThreadFor(TaskCategory::Other))
   , mShutdownObserver(new ShutdownObserver)
   , mPlayed(new TimeRanges(ToSupports(OwnerDoc())))
   , mPaused(true, "HTMLMediaElement::mPaused")
   , mErrorSink(new ErrorSink(this))
   , mAudioChannelWrapper(new AudioChannelAgentCallback(this))
--- a/dom/html/HTMLMediaElement.h
+++ b/dom/html/HTMLMediaElement.h
@@ -117,17 +117,17 @@ public:
 
   MOZ_DECLARE_WEAKREFERENCE_TYPENAME(HTMLMediaElement)
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
 
   CORSMode GetCORSMode() {
     return mCORSMode;
   }
 
-  explicit HTMLMediaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLMediaElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   void ReportCanPlayTelemetry();
 
   /**
    * This is used when the browser is constructing a video element to play
    * a channel that we've already started loading. The src attribute and
    * <source> children are ignored.
    * @param aChannel the channel to use
--- a/dom/html/HTMLMenuElement.cpp
+++ b/dom/html/HTMLMenuElement.cpp
@@ -41,18 +41,18 @@ enum SeparatorType
 {
   ST_TRUE_INIT = -1,
   ST_FALSE = 0,
   ST_TRUE = 1
 };
 
 
 
-HTMLMenuElement::HTMLMenuElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo), mType(MENU_TYPE_TOOLBAR)
+HTMLMenuElement::HTMLMenuElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo)), mType(MENU_TYPE_TOOLBAR)
 {
 }
 
 HTMLMenuElement::~HTMLMenuElement()
 {
 }
 
 NS_IMPL_ELEMENT_CLONE(HTMLMenuElement)
--- a/dom/html/HTMLMenuElement.h
+++ b/dom/html/HTMLMenuElement.h
@@ -13,17 +13,17 @@
 class nsIMenuBuilder;
 
 namespace mozilla {
 namespace dom {
 
 class HTMLMenuElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLMenuElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLMenuElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLMenuElement, menu)
 
   // nsISupports
   NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLMenuElement, nsGenericHTMLElement)
 
   virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
                                 const nsAttrValue* aValue,
--- a/dom/html/HTMLMenuItemElement.cpp
+++ b/dom/html/HTMLMenuItemElement.cpp
@@ -152,18 +152,18 @@ protected:
   Visitor* mVisitor1;
   Visitor* mVisitor2;
   bool mContinue1;
   bool mContinue2;
 };
 
 
 HTMLMenuItemElement::HTMLMenuItemElement(
-  already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo, FromParser aFromParser)
-  : nsGenericHTMLElement(aNodeInfo),
+  already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, FromParser aFromParser)
+  : nsGenericHTMLElement(std::move(aNodeInfo)),
     mType(kMenuItemDefaultType->value),
     mParserCreating(false),
     mShouldInitChecked(false),
     mCheckedDirty(false),
     mChecked(false)
 {
   mParserCreating = aFromParser;
 }
@@ -174,19 +174,18 @@ HTMLMenuItemElement::~HTMLMenuItemElemen
 
 
 //NS_IMPL_ELEMENT_CLONE(HTMLMenuItemElement)
 
 nsresult
 HTMLMenuItemElement::Clone(dom::NodeInfo* aNodeInfo, nsINode** aResult) const
 {
   *aResult = nullptr;
-  already_AddRefed<mozilla::dom::NodeInfo> ni = RefPtr<mozilla::dom::NodeInfo>(aNodeInfo).forget();
   RefPtr<HTMLMenuItemElement> it =
-    new HTMLMenuItemElement(ni, NOT_FROM_PARSER);
+    new HTMLMenuItemElement(do_AddRef(aNodeInfo), NOT_FROM_PARSER);
   nsresult rv = const_cast<HTMLMenuItemElement*>(this)->CopyInnerTo(it);
   if (NS_SUCCEEDED(rv)) {
     switch (mType) {
       case CMD_TYPE_CHECKBOX:
       case CMD_TYPE_RADIO:
         if (mCheckedDirty) {
           // We no longer have our original checked state.  Set our
           // checked state on the clone.
--- a/dom/html/HTMLMenuItemElement.h
+++ b/dom/html/HTMLMenuItemElement.h
@@ -18,17 +18,17 @@ namespace dom {
 
 class Visitor;
 
 class HTMLMenuItemElement final : public nsGenericHTMLElement
 {
 public:
   using mozilla::dom::Element::GetText;
 
-  HTMLMenuItemElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+  HTMLMenuItemElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                       mozilla::dom::FromParser aFromParser);
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLMenuItemElement, menuitem)
 
   // nsISupports
   NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLMenuItemElement,
                                        nsGenericHTMLElement)
 
--- a/dom/html/HTMLMetaElement.cpp
+++ b/dom/html/HTMLMetaElement.cpp
@@ -17,18 +17,18 @@ static mozilla::LazyLogModule gMetaEleme
 #define LOG(msg) MOZ_LOG(gMetaElementLog, mozilla::LogLevel::Debug, msg)
 #define LOG_ENABLED() MOZ_LOG_TEST(gMetaElementLog, mozilla::LogLevel::Debug)
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(Meta)
 
 namespace mozilla {
 namespace dom {
 
-HTMLMetaElement::HTMLMetaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLMetaElement::HTMLMetaElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
 {
 }
 
 HTMLMetaElement::~HTMLMetaElement()
 {
 }
 
 
--- a/dom/html/HTMLMetaElement.h
+++ b/dom/html/HTMLMetaElement.h
@@ -11,17 +11,17 @@
 #include "nsGenericHTMLElement.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLMetaElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLMetaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLMetaElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   // nsISupports
   NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLMetaElement, nsGenericHTMLElement)
 
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent) override;
   virtual void UnbindFromTree(bool aDeep = true,
                               bool aNullParent = true) override;
--- a/dom/html/HTMLMeterElement.cpp
+++ b/dom/html/HTMLMeterElement.cpp
@@ -13,18 +13,18 @@ NS_IMPL_NS_NEW_HTML_ELEMENT(Meter)
 namespace mozilla {
 namespace dom {
 
 const double HTMLMeterElement::kDefaultValue =  0.0;
 const double HTMLMeterElement::kDefaultMin   =  0.0;
 const double HTMLMeterElement::kDefaultMax   =  1.0;
 
 
-HTMLMeterElement::HTMLMeterElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLMeterElement::HTMLMeterElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
 {
 }
 
 HTMLMeterElement::~HTMLMeterElement()
 {
 }
 
 NS_IMPL_ELEMENT_CLONE(HTMLMeterElement)
--- a/dom/html/HTMLMeterElement.h
+++ b/dom/html/HTMLMeterElement.h
@@ -15,17 +15,17 @@
 #include <algorithm>
 
 namespace mozilla {
 namespace dom {
 
 class HTMLMeterElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLMeterElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLMeterElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   virtual EventStates IntrinsicState() const override;
 
   nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
   virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
                               const nsAString& aValue,
                               nsIPrincipal* aMaybeScriptedPrincipal,
--- a/dom/html/HTMLModElement.cpp
+++ b/dom/html/HTMLModElement.cpp
@@ -8,18 +8,18 @@
 #include "mozilla/dom/HTMLModElementBinding.h"
 #include "nsStyleConsts.h"
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(Mod)
 
 namespace mozilla {
 namespace dom {
 
-HTMLModElement::HTMLModElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLModElement::HTMLModElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
 {
 }
 
 HTMLModElement::~HTMLModElement()
 {
 }
 
 NS_IMPL_ELEMENT_CLONE(HTMLModElement)
--- a/dom/html/HTMLModElement.h
+++ b/dom/html/HTMLModElement.h
@@ -12,17 +12,17 @@
 #include "nsGkAtoms.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLModElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLModElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLModElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
   void GetCite(nsString& aCite)
   {
     GetHTMLURIAttr(nsGkAtoms::cite, aCite);
   }
   void SetCite(const nsAString& aCite, ErrorResult& aRv)
--- a/dom/html/HTMLObjectElement.cpp
+++ b/dom/html/HTMLObjectElement.cpp
@@ -22,19 +22,19 @@
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/dom/Event.h"
 #include "nsFocusManager.h"
 #endif
 
 namespace mozilla {
 namespace dom {
 
-HTMLObjectElement::HTMLObjectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+HTMLObjectElement::HTMLObjectElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                                      FromParser aFromParser)
-  : nsGenericHTMLFormElement(aNodeInfo, NS_FORM_OBJECT),
+  : nsGenericHTMLFormElement(std::move(aNodeInfo), NS_FORM_OBJECT),
     mIsDoneAddingChildren(!aFromParser)
 {
   RegisterActivityObserver();
   SetIsNetworkCreated(aFromParser == FROM_PARSER_NETWORK);
 
   // <object> is always barred from constraint validation.
   SetBarredFromConstraintValidation(true);
 
--- a/dom/html/HTMLObjectElement.h
+++ b/dom/html/HTMLObjectElement.h
@@ -17,17 +17,17 @@ namespace dom {
 
 class HTMLFormSubmission;
 
 class HTMLObjectElement final : public nsGenericHTMLFormElement
                               , public nsObjectLoadingContent
                               , public nsIConstraintValidation
 {
 public:
-  explicit HTMLObjectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+  explicit HTMLObjectElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                              FromParser aFromParser = NOT_FROM_PARSER);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLObjectElement, object)
   virtual int32_t TabIndexDefault() override;
 
--- a/dom/html/HTMLOptGroupElement.cpp
+++ b/dom/html/HTMLOptGroupElement.cpp
@@ -20,18 +20,18 @@ namespace mozilla {
 namespace dom {
 
 /**
  * The implementation of &lt;optgroup&gt;
  */
 
 
 
-HTMLOptGroupElement::HTMLOptGroupElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLOptGroupElement::HTMLOptGroupElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
 {
   // We start off enabled
   AddStatesSilently(NS_EVENT_STATE_ENABLED);
 }
 
 HTMLOptGroupElement::~HTMLOptGroupElement()
 {
 }
--- a/dom/html/HTMLOptGroupElement.h
+++ b/dom/html/HTMLOptGroupElement.h
@@ -12,17 +12,17 @@
 
 namespace mozilla {
 class EventChainPreVisitor;
 namespace dom {
 
 class HTMLOptGroupElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLOptGroupElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLOptGroupElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLOptGroupElement, optgroup)
 
   // nsISupports
   NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLOptGroupElement,
                                        nsGenericHTMLElement)
 
   // nsINode
--- a/dom/html/HTMLOptionElement.cpp
+++ b/dom/html/HTMLOptionElement.cpp
@@ -27,18 +27,18 @@
  * Implementation of &lt;option&gt;
  */
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(Option)
 
 namespace mozilla {
 namespace dom {
 
-HTMLOptionElement::HTMLOptionElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo),
+HTMLOptionElement::HTMLOptionElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo)),
     mSelectedChanged(false),
     mIsSelected(false),
     mIsInSetDefaultSelected(false)
 {
   // We start off enabled
   AddStatesSilently(NS_EVENT_STATE_ENABLED);
 }
 
@@ -336,22 +336,22 @@ HTMLOptionElement::Option(const GlobalOb
 {
   nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aGlobal.GetAsSupports());
   nsIDocument* doc;
   if (!win || !(doc = win->GetExtantDoc())) {
     aError.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
-  already_AddRefed<mozilla::dom::NodeInfo> nodeInfo =
+  RefPtr<mozilla::dom::NodeInfo> nodeInfo =
     doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::option, nullptr,
                                         kNameSpaceID_XHTML,
                                         ELEMENT_NODE);
 
-  RefPtr<HTMLOptionElement> option = new HTMLOptionElement(nodeInfo);
+  RefPtr<HTMLOptionElement> option = new HTMLOptionElement(nodeInfo.forget());
 
   if (!aText.IsEmpty()) {
     // Create a new text node and append it to the option
     RefPtr<nsTextNode> textContent =
       new nsTextNode(option->NodeInfo()->NodeInfoManager());
 
     textContent->SetText(aText, false);
 
--- a/dom/html/HTMLOptionElement.h
+++ b/dom/html/HTMLOptionElement.h
@@ -14,17 +14,17 @@
 namespace mozilla {
 namespace dom {
 
 class HTMLSelectElement;
 
 class HTMLOptionElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLOptionElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLOptionElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   static already_AddRefed<HTMLOptionElement>
     Option(const GlobalObject& aGlobal,
            const nsAString& aText,
            const Optional<nsAString>& aValue,
            bool aDefaultSelected,
            bool aSelected,
            ErrorResult& aError);
--- a/dom/html/HTMLOutputElement.cpp
+++ b/dom/html/HTMLOutputElement.cpp
@@ -14,19 +14,19 @@
 #include "nsContentUtils.h"
 #include "nsDOMTokenList.h"
 
 NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Output)
 
 namespace mozilla {
 namespace dom {
 
-HTMLOutputElement::HTMLOutputElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+HTMLOutputElement::HTMLOutputElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                                      FromParser aFromParser)
-  : nsGenericHTMLFormElement(aNodeInfo, NS_FORM_OUTPUT)
+  : nsGenericHTMLFormElement(std::move(aNodeInfo), NS_FORM_OUTPUT)
   , mValueModeFlag(eModeDefault)
   , mIsDoneAddingChildren(!aFromParser)
 {
   AddMutationObserver(this);
 
   // We start out valid and ui-valid (since we have no form).
   AddStatesSilently(NS_EVENT_STATE_VALID | NS_EVENT_STATE_MOZ_UI_VALID);
 }
--- a/dom/html/HTMLOutputElement.h
+++ b/dom/html/HTMLOutputElement.h
@@ -19,17 +19,17 @@ class HTMLFormSubmission;
 
 class HTMLOutputElement final : public nsGenericHTMLFormElement,
                                 public nsStubMutationObserver,
                                 public nsIConstraintValidation
 {
 public:
   using nsIConstraintValidation::GetValidationMessage;
 
-  explicit HTMLOutputElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+  explicit HTMLOutputElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                              FromParser aFromParser = NOT_FROM_PARSER);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIFormControl
   NS_IMETHOD Reset() override;
   NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
--- a/dom/html/HTMLParagraphElement.h
+++ b/dom/html/HTMLParagraphElement.h
@@ -12,18 +12,18 @@
 #include "nsGenericHTMLElement.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLParagraphElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLParagraphElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLParagraphElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
   }
 
   // nsISupports
   NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLParagraphElement,
                                        nsGenericHTMLElement)
 
   virtual bool ParseAttribute(int32_t aNamespaceID,
--- a/dom/html/HTMLPictureElement.cpp
+++ b/dom/html/HTMLPictureElement.cpp
@@ -8,24 +8,24 @@
 #include "mozilla/dom/HTMLPictureElementBinding.h"
 #include "mozilla/dom/HTMLImageElement.h"
 
 // Expand NS_IMPL_NS_NEW_HTML_ELEMENT(Picture) to add pref check.
 nsGenericHTMLElement*
 NS_NewHTMLPictureElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                          mozilla::dom::FromParser aFromParser)
 {
-  return new mozilla::dom::HTMLPictureElement(aNodeInfo);
+  return new mozilla::dom::HTMLPictureElement(std::move(aNodeInfo));
 }
 
 namespace mozilla {
 namespace dom {
 
-HTMLPictureElement::HTMLPictureElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLPictureElement::HTMLPictureElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
 {
 }
 
 HTMLPictureElement::~HTMLPictureElement()
 {
 }
 
 NS_IMPL_ELEMENT_CLONE(HTMLPictureElement)
--- a/dom/html/HTMLPictureElement.h
+++ b/dom/html/HTMLPictureElement.h
@@ -11,17 +11,17 @@
 #include "nsGenericHTMLElement.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLPictureElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLPictureElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLPictureElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   // nsISupports
   NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLPictureElement, nsGenericHTMLElement)
 
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
   virtual void RemoveChildNode(nsIContent* aKid, bool aNotify) override;
   virtual nsresult InsertChildBefore(nsIContent* aKid, nsIContent* aBeforeThis,
                                      bool aNotify) override;
--- a/dom/html/HTMLPreElement.h
+++ b/dom/html/HTMLPreElement.h
@@ -12,18 +12,18 @@
 #include "nsGenericHTMLElement.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLPreElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLPreElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLPreElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
   }
 
   // nsISupports
   NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLPreElement, nsGenericHTMLElement)
 
   virtual bool ParseAttribute(int32_t aNamespaceID,
                                 nsAtom* aAttribute,
--- a/dom/html/HTMLProgressElement.cpp
+++ b/dom/html/HTMLProgressElement.cpp
@@ -13,18 +13,18 @@ NS_IMPL_NS_NEW_HTML_ELEMENT(Progress)
 namespace mozilla {
 namespace dom {
 
 const double HTMLProgressElement::kIndeterminatePosition = -1.0;
 const double HTMLProgressElement::kDefaultValue          =  0.0;
 const double HTMLProgressElement::kDefaultMax            =  1.0;
 
 
-HTMLProgressElement::HTMLProgressElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLProgressElement::HTMLProgressElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
 {
   // We start out indeterminate
   AddStatesSilently(NS_EVENT_STATE_INDETERMINATE);
 }
 
 HTMLProgressElement::~HTMLProgressElement()
 {
 }
--- a/dom/html/HTMLProgressElement.h
+++ b/dom/html/HTMLProgressElement.h
@@ -14,17 +14,17 @@
 #include <algorithm>
 
 namespace mozilla {
 namespace dom {
 
 class HTMLProgressElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLProgressElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLProgressElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   EventStates IntrinsicState() const override;
 
   nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
   virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
                               const nsAString& aValue,
                               nsIPrincipal* aMaybeScriptedPrincipal,
--- a/dom/html/HTMLScriptElement.cpp
+++ b/dom/html/HTMLScriptElement.cpp
@@ -30,19 +30,19 @@ namespace mozilla {
 namespace dom {
 
 JSObject*
 HTMLScriptElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return HTMLScriptElement_Binding::Wrap(aCx, this, aGivenProto);
 }
 
-HTMLScriptElement::HTMLScriptElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+HTMLScriptElement::HTMLScriptElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                                      FromParser aFromParser)
-  : nsGenericHTMLElement(aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
   , ScriptElement(aFromParser)
 {
   AddMutationObserver(this);
 }
 
 HTMLScriptElement::~HTMLScriptElement()
 {
 }
@@ -90,18 +90,18 @@ HTMLScriptElement::ParseAttribute(int32_
                                               aMaybeScriptedPrincipal, aResult);
 }
 
 nsresult
 HTMLScriptElement::Clone(dom::NodeInfo* aNodeInfo, nsINode** aResult) const
 {
   *aResult = nullptr;
 
-  already_AddRefed<mozilla::dom::NodeInfo> ni = RefPtr<mozilla::dom::NodeInfo>(aNodeInfo).forget();
-  HTMLScriptElement* it = new HTMLScriptElement(ni, NOT_FROM_PARSER);
+  HTMLScriptElement* it = new HTMLScriptElement(do_AddRef(aNodeInfo),
+                                                NOT_FROM_PARSER);
 
   nsCOMPtr<nsINode> kungFuDeathGrip = it;
   nsresult rv = const_cast<HTMLScriptElement*>(this)->CopyInnerTo(it);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // The clone should be marked evaluated if we are.
   it->mAlreadyStarted = mAlreadyStarted;
   it->mLineNumber = mLineNumber;
--- a/dom/html/HTMLScriptElement.h
+++ b/dom/html/HTMLScriptElement.h
@@ -15,17 +15,17 @@ namespace mozilla {
 namespace dom {
 
 class HTMLScriptElement final : public nsGenericHTMLElement,
                                 public ScriptElement
 {
 public:
   using Element::GetText;
 
-  HTMLScriptElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+  HTMLScriptElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                     FromParser aFromParser);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   void GetInnerHTML(nsAString& aInnerHTML, OOMReporter& aError) override;
   virtual void SetInnerHTML(const nsAString& aInnerHTML,
                             nsIPrincipal* aSubjectPrincipal,
--- a/dom/html/HTMLSelectElement.cpp
+++ b/dom/html/HTMLSelectElement.cpp
@@ -108,19 +108,19 @@ SafeOptionListMutation::~SafeOptionListM
 //----------------------------------------------------------------------
 //
 // HTMLSelectElement
 //
 
 // construction, destruction
 
 
-HTMLSelectElement::HTMLSelectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+HTMLSelectElement::HTMLSelectElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                                      FromParser aFromParser)
-  : nsGenericHTMLFormElementWithState(aNodeInfo, NS_FORM_SELECT),
+  : nsGenericHTMLFormElementWithState(std::move(aNodeInfo), NS_FORM_SELECT),
     mOptions(new HTMLOptionsCollection(this)),
     mAutocompleteAttrState(nsContentUtils::eAutocompleteAttrState_Unknown),
     mAutocompleteInfoState(nsContentUtils::eAutocompleteAttrState_Unknown),
     mIsDoneAddingChildren(!aFromParser),
     mDisabledChanged(false),
     mMutating(false),
     mInhibitStateRestoration(!!(aFromParser & FROM_PARSER_FRAGMENT)),
     mSelectionHasChanged(false),
--- a/dom/html/HTMLSelectElement.h
+++ b/dom/html/HTMLSelectElement.h
@@ -97,17 +97,17 @@ public:
     CLEAR_ALL     = 1 << 1,
     SET_DISABLED  = 1 << 2,
     NOTIFY        = 1 << 3,
     NO_RESELECT   = 1 << 4
   };
 
   using nsIConstraintValidation::GetValidationMessage;
 
-  explicit HTMLSelectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+  explicit HTMLSelectElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                              FromParser aFromParser = NOT_FROM_PARSER);
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLSelectElement, select)
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   virtual int32_t TabIndexDefault() override;
--- a/dom/html/HTMLSharedElement.h
+++ b/dom/html/HTMLSharedElement.h
@@ -15,18 +15,18 @@
 #include "mozilla/Assertions.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLSharedElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLSharedElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLSharedElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
     if (mNodeInfo->Equals(nsGkAtoms::head) ||
         mNodeInfo->Equals(nsGkAtoms::html)) {
       SetHasWeirdParserInsertionMode();
     }
   }
 
   // nsIContent
--- a/dom/html/HTMLSharedListElement.h
+++ b/dom/html/HTMLSharedListElement.h
@@ -12,18 +12,18 @@
 #include "nsGenericHTMLElement.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLSharedListElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLSharedListElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLSharedListElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
   }
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   virtual bool ParseAttribute(int32_t aNamespaceID,
                                 nsAtom* aAttribute,
--- a/dom/html/HTMLSlotElement.cpp
+++ b/dom/html/HTMLSlotElement.cpp
@@ -11,31 +11,29 @@
 #include "mozilla/dom/ShadowRoot.h"
 #include "nsGkAtoms.h"
 #include "nsDocument.h"
 
 nsGenericHTMLElement*
 NS_NewHTMLSlotElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                       mozilla::dom::FromParser aFromParser)
 {
-  RefPtr<mozilla::dom::NodeInfo> nodeInfo(aNodeInfo);
+  RefPtr<mozilla::dom::NodeInfo> nodeInfo(std::move(aNodeInfo));
   if (nsDocument::IsShadowDOMEnabled(nodeInfo->GetDocument())) {
-    already_AddRefed<mozilla::dom::NodeInfo> nodeInfoArg(nodeInfo.forget());
-    return new mozilla::dom::HTMLSlotElement(nodeInfoArg);
+    return new mozilla::dom::HTMLSlotElement(nodeInfo.forget());
   }
 
-  already_AddRefed<mozilla::dom::NodeInfo> nodeInfoArg(nodeInfo.forget());
-  return new mozilla::dom::HTMLUnknownElement(nodeInfoArg);
+  return new mozilla::dom::HTMLUnknownElement(nodeInfo.forget());
 }
 
 namespace mozilla {
 namespace dom {
 
-HTMLSlotElement::HTMLSlotElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLSlotElement::HTMLSlotElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
 {
 }
 
 HTMLSlotElement::~HTMLSlotElement() = default;
 
 NS_IMPL_ADDREF_INHERITED(HTMLSlotElement, nsGenericHTMLElement)
 NS_IMPL_RELEASE_INHERITED(HTMLSlotElement, nsGenericHTMLElement)
 
--- a/dom/html/HTMLSlotElement.h
+++ b/dom/html/HTMLSlotElement.h
@@ -13,17 +13,17 @@
 namespace mozilla {
 namespace dom {
 
 struct AssignedNodesOptions;
 
 class HTMLSlotElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLSlotElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLSlotElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLSlotElement, slot)
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLSlotElement, nsGenericHTMLElement)
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
   // nsIContent
   virtual nsresult BindToTree(nsIDocument* aDocument,
--- a/dom/html/HTMLSourceElement.cpp
+++ b/dom/html/HTMLSourceElement.cpp
@@ -18,18 +18,18 @@
 #include "mozilla/dom/BlobURLProtocolHandler.h"
 #include "mozilla/Preferences.h"
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(Source)
 
 namespace mozilla {
 namespace dom {
 
-HTMLSourceElement::HTMLSourceElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLSourceElement::HTMLSourceElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
 {
 }
 
 HTMLSourceElement::~HTMLSourceElement()
 {
 }
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLSourceElement, nsGenericHTMLElement,
--- a/dom/html/HTMLSourceElement.h
+++ b/dom/html/HTMLSourceElement.h
@@ -16,17 +16,17 @@ class nsAttrValue;
 namespace mozilla {
 namespace dom {
 
 class MediaList;
 
 class HTMLSourceElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLSourceElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLSourceElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLSourceElement,
                                            nsGenericHTMLElement)
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLSourceElement, source)
 
--- a/dom/html/HTMLSpanElement.h
+++ b/dom/html/HTMLSpanElement.h
@@ -14,18 +14,18 @@
 #include "nsAtom.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLSpanElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLSpanElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLSpanElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
   }
 
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
 protected:
   virtual ~HTMLSpanElement();
 
--- a/dom/html/HTMLStyleElement.cpp
+++ b/dom/html/HTMLStyleElement.cpp
@@ -13,18 +13,18 @@
 #include "nsContentUtils.h"
 #include "nsStubMutationObserver.h"
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(Style)
 
 namespace mozilla {
 namespace dom {
 
-HTMLStyleElement::HTMLStyleElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLStyleElement::HTMLStyleElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
 {
   AddMutationObserver(this);
 }
 
 HTMLStyleElement::~HTMLStyleElement()
 {
 }
 
--- a/dom/html/HTMLStyleElement.h
+++ b/dom/html/HTMLStyleElement.h
@@ -17,17 +17,17 @@ class nsIDocument;
 namespace mozilla {
 namespace dom {
 
 class HTMLStyleElement final : public nsGenericHTMLElement,
                                public nsStyleLinkElement,
                                public nsStubMutationObserver
 {
 public:
-  explicit HTMLStyleElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLStyleElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // CC
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLStyleElement,
                                            nsGenericHTMLElement)
 
--- a/dom/html/HTMLSummaryElement.h
+++ b/dom/html/HTMLSummaryElement.h
@@ -18,18 +18,18 @@ class HTMLDetailsElement;
 // or legend of the <details> tag. Please see the spec for more information.
 // https://html.spec.whatwg.org/multipage/forms.html#the-details-element
 //
 class HTMLSummaryElement final : public nsGenericHTMLElement
 {
 public:
   using NodeInfo = mozilla::dom::NodeInfo;
 
-  explicit HTMLSummaryElement(already_AddRefed<NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLSummaryElement(already_AddRefed<NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
   }
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLSummaryElement, summary)
 
   nsresult Clone(NodeInfo*, nsINode** aResult) const override;
 
   nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
--- a/dom/html/HTMLTableCaptionElement.h
+++ b/dom/html/HTMLTableCaptionElement.h
@@ -10,18 +10,18 @@
 #include "nsGenericHTMLElement.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLTableCaptionElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLTableCaptionElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLTableCaptionElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
     SetHasWeirdParserInsertionMode();
   }
 
   void GetAlign(DOMString& aAlign)
   {
     GetHTMLAttr(nsGkAtoms::align, aAlign);
   }
--- a/dom/html/HTMLTableCellElement.h
+++ b/dom/html/HTMLTableCellElement.h
@@ -12,18 +12,18 @@
 namespace mozilla {
 namespace dom {
 
 class HTMLTableElement;
 
 class HTMLTableCellElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLTableCellElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLTableCellElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
     SetHasWeirdParserInsertionMode();
   }
 
   // nsISupports
   NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLTableCellElement,
                                        nsGenericHTMLElement)
 
--- a/dom/html/HTMLTableColElement.h
+++ b/dom/html/HTMLTableColElement.h
@@ -10,18 +10,18 @@
 #include "nsGenericHTMLElement.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLTableColElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLTableColElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLTableColElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
     SetHasWeirdParserInsertionMode();
   }
 
   uint32_t Span() const
   {
     return GetIntAttr(nsGkAtoms::span, 1);
   }
--- a/dom/html/HTMLTableElement.cpp
+++ b/dom/html/HTMLTableElement.cpp
@@ -534,18 +534,18 @@ TableRowsCollection::NodeWillBeDestroyed
   // observer, as we're going away. CleanUp() will reset mInitialized to true as
   // it returns.
   mInitialized = false;
   CleanUp();
 }
 
 /* --------------------------- HTMLTableElement ---------------------------- */
 
-HTMLTableElement::HTMLTableElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo),
+HTMLTableElement::HTMLTableElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo)),
     mTableInheritedAttributes(nullptr)
 {
   SetHasWeirdParserInsertionMode();
 }
 
 HTMLTableElement::~HTMLTableElement()
 {
   if (mRows) {
--- a/dom/html/HTMLTableElement.h
+++ b/dom/html/HTMLTableElement.h
@@ -14,17 +14,17 @@
 namespace mozilla {
 namespace dom {
 
 class TableRowsCollection;
 
 class HTMLTableElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLTableElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLTableElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLTableElement, table)
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   HTMLTableCaptionElement* GetCaption() const
   {
--- a/dom/html/HTMLTableRowElement.h
+++ b/dom/html/HTMLTableRowElement.h
@@ -14,18 +14,18 @@ class nsContentList;
 namespace mozilla {
 namespace dom {
 
 class HTMLTableSectionElement;
 
 class HTMLTableRowElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLTableRowElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLTableRowElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
     SetHasWeirdParserInsertionMode();
   }
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLTableRowElement, tr)
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
--- a/dom/html/HTMLTableSectionElement.h
+++ b/dom/html/HTMLTableSectionElement.h
@@ -11,18 +11,18 @@
 #include "nsContentList.h" // For ctor.
 
 namespace mozilla {
 namespace dom {
 
 class HTMLTableSectionElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLTableSectionElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLTableSectionElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
     SetHasWeirdParserInsertionMode();
   }
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   nsIHTMLCollection* Rows();
--- a/dom/html/HTMLTemplateElement.cpp
+++ b/dom/html/HTMLTemplateElement.cpp
@@ -12,18 +12,18 @@
 #include "nsStyleConsts.h"
 #include "nsAtom.h"
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(Template)
 
 namespace mozilla {
 namespace dom {
 
-HTMLTemplateElement::HTMLTemplateElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLTemplateElement::HTMLTemplateElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
 {
   SetHasWeirdParserInsertionMode();
 
   nsIDocument* contentsOwner = OwnerDoc()->GetTemplateContentsOwner();
   if (!contentsOwner) {
     MOZ_CRASH("There should always be a template contents owner.");
   }
 
--- a/dom/html/HTMLTemplateElement.h
+++ b/dom/html/HTMLTemplateElement.h
@@ -12,17 +12,17 @@
 #include "mozilla/dom/DocumentFragment.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLTemplateElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLTemplateElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLTemplateElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLTemplateElement,
                                            nsGenericHTMLElement)
 
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
--- a/dom/html/HTMLTextAreaElement.cpp
+++ b/dom/html/HTMLTextAreaElement.cpp
@@ -45,19 +45,19 @@
 
 #define NS_NO_CONTENT_DISPATCH (1 << 0)
 
 NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(TextArea)
 
 namespace mozilla {
 namespace dom {
 
-HTMLTextAreaElement::HTMLTextAreaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+HTMLTextAreaElement::HTMLTextAreaElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                                          FromParser aFromParser)
-  : nsGenericHTMLFormElementWithState(aNodeInfo, NS_FORM_TEXTAREA),
+  : nsGenericHTMLFormElementWithState(std::move(aNodeInfo), NS_FORM_TEXTAREA),
     mValueChanged(false),
     mLastValueChangeWasInteractive(false),
     mHandlingSelect(false),
     mDoneAddingChildren(!aFromParser),
     mInhibitStateRestoration(!!(aFromParser & FROM_PARSER_FRAGMENT)),
     mDisabledChanged(false),
     mCanShowInvalidUI(true),
     mCanShowValidUI(true),
@@ -91,19 +91,18 @@ NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHER
                                              nsIConstraintValidation)
 
 // nsIDOMHTMLTextAreaElement
 
 nsresult
 HTMLTextAreaElement::Clone(dom::NodeInfo* aNodeInfo, nsINode** aResult) const
 {
   *aResult = nullptr;
-  already_AddRefed<mozilla::dom::NodeInfo> ni =
-    RefPtr<mozilla::dom::NodeInfo>(aNodeInfo).forget();
-  RefPtr<HTMLTextAreaElement> it = new HTMLTextAreaElement(ni);
+  RefPtr<HTMLTextAreaElement> it =
+    new HTMLTextAreaElement(do_AddRef(aNodeInfo));
 
   nsresult rv = const_cast<HTMLTextAreaElement*>(this)->CopyInnerTo(it);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (mValueChanged) {
     // Set our value on the clone.
     nsAutoString value;
     GetValueInternal(value, true);
--- a/dom/html/HTMLTextAreaElement.h
+++ b/dom/html/HTMLTextAreaElement.h
@@ -39,17 +39,17 @@ class HTMLFormSubmission;
 class HTMLTextAreaElement final : public nsGenericHTMLFormElementWithState,
                                   public nsITextControlElement,
                                   public nsStubMutationObserver,
                                   public nsIConstraintValidation
 {
 public:
   using nsIConstraintValidation::GetValidationMessage;
 
-  explicit HTMLTextAreaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+  explicit HTMLTextAreaElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                                FromParser aFromParser = NOT_FROM_PARSER);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLTextAreaElement, textarea)
 
   virtual int32_t TabIndexDefault() override;
--- a/dom/html/HTMLTimeElement.cpp
+++ b/dom/html/HTMLTimeElement.cpp
@@ -10,18 +10,18 @@
 #include "nsVariant.h"
 #include "nsGkAtoms.h"
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(Time)
 
 namespace mozilla {
 namespace dom {
 
-HTMLTimeElement::HTMLTimeElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLTimeElement::HTMLTimeElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
 {
 }
 
 HTMLTimeElement::~HTMLTimeElement()
 {
 }
 
 NS_IMPL_ELEMENT_CLONE(HTMLTimeElement)
--- a/dom/html/HTMLTimeElement.h
+++ b/dom/html/HTMLTimeElement.h
@@ -12,17 +12,17 @@
 #include "nsGkAtoms.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLTimeElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLTimeElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLTimeElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual ~HTMLTimeElement();
 
   // HTMLTimeElement WebIDL
   void GetDateTime(DOMString& aDateTime)
   {
     GetHTMLAttr(nsGkAtoms::datetime, aDateTime);
   }
 
--- a/dom/html/HTMLTitleElement.cpp
+++ b/dom/html/HTMLTitleElement.cpp
@@ -13,18 +13,18 @@
 #include "nsContentUtils.h"
 
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(Title)
 
 namespace mozilla {
 namespace dom {
 
-HTMLTitleElement::HTMLTitleElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLTitleElement::HTMLTitleElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
 {
   AddMutationObserver(this);
 }
 
 HTMLTitleElement::~HTMLTitleElement()
 {
 }
 
--- a/dom/html/HTMLTitleElement.h
+++ b/dom/html/HTMLTitleElement.h
@@ -17,17 +17,17 @@ class ErrorResult;
 namespace dom {
 
 class HTMLTitleElement final : public nsGenericHTMLElement,
                                public nsStubMutationObserver
 {
 public:
   using Element::GetText;
 
-  explicit HTMLTitleElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLTitleElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   //HTMLTitleElement
   void GetText(DOMString& aText, ErrorResult& aError);
   void SetText(const nsAString& aText, ErrorResult& aError);
 
--- a/dom/html/HTMLTrackElement.cpp
+++ b/dom/html/HTMLTrackElement.cpp
@@ -42,17 +42,17 @@ static mozilla::LazyLogModule gTrackElem
 #define LOG(type, msg) MOZ_LOG(gTrackElementLog, type, msg)
 
 // Replace the usual NS_IMPL_NS_NEW_HTML_ELEMENT(Track) so
 // we can return an UnknownElement instead when pref'd off.
 nsGenericHTMLElement*
 NS_NewHTMLTrackElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                        mozilla::dom::FromParser aFromParser)
 {
-  return new mozilla::dom::HTMLTrackElement(aNodeInfo);
+  return new mozilla::dom::HTMLTrackElement(std::move(aNodeInfo));
 }
 
 namespace mozilla {
 namespace dom {
 
 // Map html attribute string values to TextTrackKind enums.
 static constexpr nsAttrValue::EnumTable kKindTable[] = {
   { "subtitles", static_cast<int16_t>(TextTrackKind::Subtitles) },
@@ -115,18 +115,18 @@ public:
 private:
   ~WindowDestroyObserver() {};
   HTMLTrackElement* mTrackElement;
   uint64_t mInnerID;
 };
 NS_IMPL_ISUPPORTS(WindowDestroyObserver, nsIObserver);
 
 /** HTMLTrackElement */
-HTMLTrackElement::HTMLTrackElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
+HTMLTrackElement::HTMLTrackElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
   , mLoadResourceDispatched(false)
   , mWindowDestroyObserver(nullptr)
 {
   nsISupports* parentObject = OwnerDoc()->GetParentObject();
   NS_ENSURE_TRUE_VOID(parentObject);
   nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(parentObject);
   if (window) {
     mWindowDestroyObserver = new WindowDestroyObserver(this, window->WindowID());
--- a/dom/html/HTMLTrackElement.h
+++ b/dom/html/HTMLTrackElement.h
@@ -22,17 +22,17 @@ namespace mozilla {
 namespace dom {
 
 class WebVTTListener;
 class WindowDestroyObserver;
 
 class HTMLTrackElement final : public nsGenericHTMLElement
 {
 public:
-  explicit HTMLTrackElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit HTMLTrackElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLTrackElement,
                                            nsGenericHTMLElement)
 
   // HTMLTrackElement WebIDL
   void GetKind(DOMString& aKind) const;
--- a/dom/html/HTMLUnknownElement.h
+++ b/dom/html/HTMLUnknownElement.h
@@ -19,18 +19,18 @@ namespace dom {
 
 class HTMLUnknownElement final : public nsGenericHTMLElement
 {
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_HTMLUNKNOWNELEMENT_IID)
 
   NS_DECL_ISUPPORTS_INHERITED
 
-  explicit HTMLUnknownElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElement(aNodeInfo)
+  explicit HTMLUnknownElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
   {
   }
 
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
 protected:
   virtual ~HTMLUnknownElement() {}
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
--- a/dom/html/HTMLVideoElement.cpp
+++ b/dom/html/HTMLVideoElement.cpp
@@ -39,18 +39,18 @@ NS_IMPL_NS_NEW_HTML_ELEMENT(Video)
 
 namespace mozilla {
 namespace dom {
 
 static bool sVideoStatsEnabled;
 
 NS_IMPL_ELEMENT_CLONE(HTMLVideoElement)
 
-HTMLVideoElement::HTMLVideoElement(already_AddRefed<NodeInfo>& aNodeInfo)
-  : HTMLMediaElement(aNodeInfo)
+HTMLVideoElement::HTMLVideoElement(already_AddRefed<NodeInfo>&& aNodeInfo)
+  : HTMLMediaElement(std::move(aNodeInfo))
   , mIsOrientationLocked(false)
 {
   DecoderDoctorLogger::LogConstruction(this);
 }
 
 HTMLVideoElement::~HTMLVideoElement()
 {
   DecoderDoctorLogger::LogDestruction(this);
--- a/dom/html/HTMLVideoElement.h
+++ b/dom/html/HTMLVideoElement.h
@@ -20,17 +20,17 @@ namespace dom {
 class WakeLock;
 class VideoPlaybackQuality;
 
 class HTMLVideoElement final : public HTMLMediaElement
 {
 public:
   typedef mozilla::dom::NodeInfo NodeInfo;
 
-  explicit HTMLVideoElement(already_AddRefed<NodeInfo>& aNodeInfo);
+  explicit HTMLVideoElement(already_AddRefed<NodeInfo>&& aNodeInfo);
 
   NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLVideoElement, video)
 
   using HTMLMediaElement::GetPaused;
 
   virtual bool IsVideo() const override {
     return true;
   }
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -1615,19 +1615,19 @@ nsGenericHTMLElement::IsInteractiveHTMLC
 bool
 nsGenericHTMLElement::TouchEventsEnabled(JSContext* aCx, JSObject* aGlobal)
 {
   return TouchEvent::PrefEnabled(aCx, aGlobal);
 }
 
 //----------------------------------------------------------------------
 
-nsGenericHTMLFormElement::nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+nsGenericHTMLFormElement::nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                                                    uint8_t aType)
-  : nsGenericHTMLElement(aNodeInfo)
+  : nsGenericHTMLElement(std::move(aNodeInfo))
   , nsIFormControl(aType)
   , mForm(nullptr)
   , mFieldSet(nullptr)
 {
   // We should add the NS_EVENT_STATE_ENABLED bit here as needed, but
   // that depends on our type, which is not initialized yet.  So we
   // have to do this in subclasses.
 }
@@ -2695,19 +2695,19 @@ nsGenericHTMLElement::ChangeEditableStat
   nsAutoScriptBlocker scriptBlocker;
   MakeContentDescendantsEditable(this, document);
 }
 
 
 //----------------------------------------------------------------------
 
 nsGenericHTMLFormElementWithState::nsGenericHTMLFormElementWithState(
-    already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo, uint8_t aType
+    already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, uint8_t aType
   )
-  : nsGenericHTMLFormElement(aNodeInfo, aType)
+  : nsGenericHTMLFormElement(std::move(aNodeInfo), aType)
 {
   mStateKey.SetIsVoid(true);
 }
 
 nsresult
 nsGenericHTMLFormElementWithState::GenerateStateKey()
 {
   // Keep the key if already computed
@@ -3002,20 +3002,20 @@ nsGenericHTMLElement::SetInnerText(const
           new nsTextNode(NodeInfo()->NodeInfoManager());
         textContent->SetText(str, true);
         AppendChildTo(textContent, true);
       }
       if (s == end) {
         break;
       }
       str.Truncate();
-      already_AddRefed<mozilla::dom::NodeInfo> ni =
+      RefPtr<mozilla::dom::NodeInfo> ni =
         NodeInfo()->NodeInfoManager()->GetNodeInfo(nsGkAtoms::br,
           nullptr, kNameSpaceID_XHTML, ELEMENT_NODE);
-      RefPtr<HTMLBRElement> br = new HTMLBRElement(ni);
+      RefPtr<HTMLBRElement> br = new HTMLBRElement(ni.forget());
       AppendChildTo(br, true);
     } else {
       str.Append(*s);
     }
     ++s;
   }
 
   mb.NodesAdded();
--- a/dom/html/nsGenericHTMLElement.h
+++ b/dom/html/nsGenericHTMLElement.h
@@ -45,18 +45,18 @@ typedef nsMappedAttributeElement nsGener
 /**
  * A common superclass for HTML elements
  */
 class nsGenericHTMLElement : public nsGenericHTMLElementBase
 {
 public:
   using Element::SetTabIndex;
   using Element::Focus;
-  explicit nsGenericHTMLElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsGenericHTMLElementBase(aNodeInfo)
+  explicit nsGenericHTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsGenericHTMLElementBase(std::move(aNodeInfo))
   {
     NS_ASSERTION(mNodeInfo->NamespaceID() == kNameSpaceID_XHTML,
                  "Unexpected namespace");
     AddStatesSilently(NS_EVENT_STATE_LTR);
     SetFlags(NODE_HAS_DIRECTION_LTR);
   }
 
   NS_INLINE_DECL_REFCOUNTING_INHERITED(nsGenericHTMLElement,
@@ -971,17 +971,17 @@ ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPE
 
 /**
  * A helper class for form elements that can contain children
  */
 class nsGenericHTMLFormElement : public nsGenericHTMLElement,
                                  public nsIFormControl
 {
 public:
-  nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+  nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                            uint8_t aType);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   nsINode* GetScopeChainParent() const override;
 
   virtual bool IsNodeOfType(uint32_t aFlags) const override;
   virtual void SaveSubtreeState() override;
@@ -1154,17 +1154,17 @@ protected:
 
   /* This is a pointer to our closest fieldset parent if any */
   mozilla::dom::HTMLFieldSetElement* mFieldSet;
 };
 
 class nsGenericHTMLFormElementWithState : public nsGenericHTMLFormElement
 {
 public:
-  nsGenericHTMLFormElementWithState(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+  nsGenericHTMLFormElementWithState(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                                     uint8_t aType);
 
   /**
    * Get the presentation state for a piece of content, or create it if it does
    * not exist.  Generally used by SaveState().
    */
   mozilla::PresState* GetPrimaryPresState();
 
@@ -1241,25 +1241,25 @@ NS_NewHTML##_elementName##Element(alread
 /**
  * A macro to implement the NS_NewHTMLXXXElement() functions.
  */
 #define NS_IMPL_NS_NEW_HTML_ELEMENT(_elementName)                            \
 nsGenericHTMLElement*                                                        \
 NS_NewHTML##_elementName##Element(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, \
                                   mozilla::dom::FromParser aFromParser)      \
 {                                                                            \
-  return new mozilla::dom::HTML##_elementName##Element(aNodeInfo);           \
+  return new mozilla::dom::HTML##_elementName##Element(std::move(aNodeInfo)); \
 }
 
 #define NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(_elementName)               \
 nsGenericHTMLElement*                                                        \
 NS_NewHTML##_elementName##Element(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, \
                                   mozilla::dom::FromParser aFromParser)      \
 {                                                                            \
-  return new mozilla::dom::HTML##_elementName##Element(aNodeInfo,            \
+  return new mozilla::dom::HTML##_elementName##Element(std::move(aNodeInfo), \
                                                        aFromParser);         \
 }
 
 // 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);
--- a/dom/html/nsGenericHTMLFrameElement.h
+++ b/dom/html/nsGenericHTMLFrameElement.h
@@ -31,19 +31,19 @@ class XULFrameElement;
  * A helper class for frame elements
  */
 class nsGenericHTMLFrameElement : public nsGenericHTMLElement,
                                   public nsIFrameLoaderOwner,
                                   public mozilla::nsBrowserElement,
                                   public nsIMozBrowserFrame
 {
 public:
-  nsGenericHTMLFrameElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+  nsGenericHTMLFrameElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                             mozilla::dom::FromParser aFromParser)
-    : nsGenericHTMLElement(aNodeInfo)
+    : nsGenericHTMLElement(std::move(aNodeInfo))
     , nsBrowserElement()
     , mSrcLoadHappened(false)
     , mNetworkCreated(aFromParser == mozilla::dom::FROM_PARSER_NETWORK)
     , mBrowserFrameListenersRegistered(false)
     , mFrameLoaderCreationDisallowed(false)
     , mReallyIsBrowser(false)
   {
   }
--- a/dom/mathml/nsMathMLElement.cpp
+++ b/dom/mathml/nsMathMLElement.cpp
@@ -72,24 +72,24 @@ ReportParseErrorNoTag(const nsString& aV
   return nsContentUtils::
          ReportToConsole(nsIScriptError::errorFlag,
                          NS_LITERAL_CSTRING("MathML"), aDocument,
                          nsContentUtils::eMATHML_PROPERTIES,
                          "AttributeParsingErrorNoTag", argv, 2);
 }
 
 nsMathMLElement::nsMathMLElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-: nsMathMLElementBase(aNodeInfo),
+: nsMathMLElementBase(std::move(aNodeInfo)),
   ALLOW_THIS_IN_INITIALIZER_LIST(Link(this)),
   mIncrementScriptLevel(false)
 {
 }
 
 nsMathMLElement::nsMathMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
-: nsMathMLElementBase(aNodeInfo),
+ : nsMathMLElementBase(std::move(aNodeInfo)),
   ALLOW_THIS_IN_INITIALIZER_LIST(Link(this)),
   mIncrementScriptLevel(false)
 {
 }
 
 nsresult
 nsMathMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                             nsIContent* aBindingParent)
--- a/dom/svg/SVGAElement.cpp
+++ b/dom/svg/SVGAElement.cpp
@@ -54,18 +54,18 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED(SVGAE
                                    mRelList)
 
 NS_IMPL_ADDREF_INHERITED(SVGAElement, SVGAElementBase)
 NS_IMPL_RELEASE_INHERITED(SVGAElement, SVGAElementBase)
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGAElement::SVGAElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGAElementBase(aNodeInfo)
+SVGAElement::SVGAElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGAElementBase(std::move(aNodeInfo))
   , Link(this)
 {
 }
 
 SVGAElement::~SVGAElement()
 {
 }
 
--- a/dom/svg/SVGAElement.h
+++ b/dom/svg/SVGAElement.h
@@ -25,17 +25,17 @@ namespace dom {
 typedef SVGGraphicsElement SVGAElementBase;
 
 class SVGAElement final : public SVGAElementBase,
                           public Link
 {
 protected:
   using Element::GetText;
 
-  explicit SVGAElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGAElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   friend nsresult (::NS_NewSVGAElement(nsIContent **aResult,
                                        already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   NS_DECL_ISUPPORTS_INHERITED
 
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGAElement, SVGAElementBase)
--- a/dom/svg/SVGAnimateElement.cpp
+++ b/dom/svg/SVGAnimateElement.cpp
@@ -16,18 +16,18 @@ JSObject*
 SVGAnimateElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return SVGAnimateElement_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGAnimateElement::SVGAnimateElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGAnimationElement(aNodeInfo)
+SVGAnimateElement::SVGAnimateElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGAnimationElement(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAnimateElement)
 
--- a/dom/svg/SVGAnimateElement.h
+++ b/dom/svg/SVGAnimateElement.h
@@ -15,17 +15,17 @@ nsresult NS_NewSVGAnimateElement(nsICont
                                  already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
 class SVGAnimateElement final : public SVGAnimationElement
 {
 protected:
-  explicit SVGAnimateElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGAnimateElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   nsSMILAnimationFunction mAnimationFunction;
   friend nsresult
     (::NS_NewSVGAnimateElement(nsIContent **aResult,
                                already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
--- a/dom/svg/SVGAnimateMotionElement.cpp
+++ b/dom/svg/SVGAnimateMotionElement.cpp
@@ -16,18 +16,18 @@ JSObject*
 SVGAnimateMotionElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return SVGAnimateMotionElement_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGAnimateMotionElement::SVGAnimateMotionElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGAnimationElement(aNodeInfo)
+SVGAnimateMotionElement::SVGAnimateMotionElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGAnimationElement(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAnimateMotionElement)
 
--- a/dom/svg/SVGAnimateMotionElement.h
+++ b/dom/svg/SVGAnimateMotionElement.h
@@ -15,17 +15,17 @@ nsresult NS_NewSVGAnimateMotionElement(n
                                        already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
 class SVGAnimateMotionElement final : public SVGAnimationElement
 {
 protected:
-  explicit SVGAnimateMotionElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGAnimateMotionElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   SVGMotionSMILAnimationFunction mAnimationFunction;
   friend nsresult
     (::NS_NewSVGAnimateMotionElement(nsIContent **aResult,
                                      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
--- a/dom/svg/SVGAnimateTransformElement.cpp
+++ b/dom/svg/SVGAnimateTransformElement.cpp
@@ -16,18 +16,18 @@ JSObject*
 SVGAnimateTransformElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return SVGAnimateTransformElement_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGAnimateTransformElement::SVGAnimateTransformElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGAnimationElement(aNodeInfo)
+SVGAnimateTransformElement::SVGAnimateTransformElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGAnimationElement(std::move(aNodeInfo))
 {
 }
 
 bool
 SVGAnimateTransformElement::ParseAttribute(int32_t aNamespaceID,
                                            nsAtom* aAttribute,
                                            const nsAString& aValue,
                                            nsIPrincipal* aMaybeScriptedPrincipal,
--- a/dom/svg/SVGAnimateTransformElement.h
+++ b/dom/svg/SVGAnimateTransformElement.h
@@ -15,17 +15,17 @@ nsresult NS_NewSVGAnimateTransformElemen
                                           already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
 class SVGAnimateTransformElement final : public SVGAnimationElement
 {
 protected:
-  explicit SVGAnimateTransformElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGAnimateTransformElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   nsSMILAnimationFunction mAnimationFunction;
   friend nsresult
     (::NS_NewSVGAnimateTransformElement(nsIContent **aResult,
                                         already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
--- a/dom/svg/SVGAnimationElement.cpp
+++ b/dom/svg/SVGAnimationElement.cpp
@@ -30,18 +30,18 @@ NS_INTERFACE_MAP_END_INHERITING(SVGAnima
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(SVGAnimationElement,
                                    SVGAnimationElementBase,
                                    mHrefTarget, mTimedElement)
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGAnimationElement::SVGAnimationElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGAnimationElementBase(aNodeInfo),
+SVGAnimationElement::SVGAnimationElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGAnimationElementBase(std::move(aNodeInfo)),
     mHrefTarget(this)
 {
 }
 
 SVGAnimationElement::~SVGAnimationElement()
 {
 }
 
--- a/dom/svg/SVGAnimationElement.h
+++ b/dom/svg/SVGAnimationElement.h
@@ -23,17 +23,17 @@ enum nsSMILTargetAttrType {
   eSMILTargetAttrType_CSS,
   eSMILTargetAttrType_XML
 };
 
 class SVGAnimationElement : public SVGAnimationElementBase,
                             public SVGTests
 {
 protected:
-  explicit SVGAnimationElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGAnimationElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   nsresult Init();
   virtual ~SVGAnimationElement();
 
 public:
   // interfaces:
   NS_DECL_ISUPPORTS_INHERITED
 
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGAnimationElement,
--- a/dom/svg/SVGCircleElement.cpp
+++ b/dom/svg/SVGCircleElement.cpp
@@ -28,18 +28,18 @@ nsSVGElement::LengthInfo SVGCircleElemen
   { &nsGkAtoms::cx, 0, SVGLength_Binding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
   { &nsGkAtoms::cy, 0, SVGLength_Binding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
   { &nsGkAtoms::r, 0, SVGLength_Binding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::XY }
 };
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGCircleElement::SVGCircleElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGCircleElementBase(aNodeInfo)
+SVGCircleElement::SVGCircleElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGCircleElementBase(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGCircleElement)
 
--- a/dom/svg/SVGCircleElement.h
+++ b/dom/svg/SVGCircleElement.h
@@ -16,17 +16,17 @@ nsresult NS_NewSVGCircleElement(nsIConte
 namespace mozilla {
 namespace dom {
 
 typedef SVGGeometryElement SVGCircleElementBase;
 
 class SVGCircleElement final : public SVGCircleElementBase
 {
 protected:
-  explicit SVGCircleElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGCircleElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
   friend nsresult (::NS_NewSVGCircleElement(nsIContent **aResult,
                                             already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
 public:
   // nsSVGSVGElement methods:
   virtual bool HasValidDimensions() const override;
 
--- a/dom/svg/SVGClipPathElement.cpp
+++ b/dom/svg/SVGClipPathElement.cpp
@@ -30,18 +30,18 @@ nsSVGElement::EnumInfo SVGClipPathElemen
     sSVGUnitTypesMap,
     SVG_UNIT_TYPE_USERSPACEONUSE
   }
 };
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGClipPathElement::SVGClipPathElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGClipPathElementBase(aNodeInfo)
+SVGClipPathElement::SVGClipPathElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGClipPathElementBase(std::move(aNodeInfo))
 {
 }
 
 already_AddRefed<SVGAnimatedEnumeration>
 SVGClipPathElement::ClipPathUnits()
 {
   return mEnumAttributes[CLIPPATHUNITS].ToDOMAnimatedEnum(this);
 }
--- a/dom/svg/SVGClipPathElement.h
+++ b/dom/svg/SVGClipPathElement.h
@@ -22,17 +22,17 @@ typedef SVGTransformableElement SVGClipP
 
 class SVGClipPathElement final : public SVGClipPathElementBase
 {
   friend class ::nsSVGClipPathFrame;
 
 protected:
   friend nsresult (::NS_NewSVGClipPathElement(nsIContent **aResult,
                                               already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGClipPathElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGClipPathElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
   // WebIDL
   already_AddRefed<SVGAnimatedEnumeration> ClipPathUnits();
 
--- a/dom/svg/SVGComponentTransferFunctionElement.h
+++ b/dom/svg/SVGComponentTransferFunctionElement.h
@@ -23,18 +23,18 @@ class DOMSVGAnimatedNumberList;
 
 namespace dom {
 
 typedef SVGFEUnstyledElement SVGComponentTransferFunctionElementBase;
 
 class SVGComponentTransferFunctionElement : public SVGComponentTransferFunctionElementBase
 {
 protected:
-  explicit SVGComponentTransferFunctionElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGComponentTransferFunctionElementBase(aNodeInfo)
+  explicit SVGComponentTransferFunctionElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGComponentTransferFunctionElementBase(std::move(aNodeInfo))
   {
   }
 
   virtual ~SVGComponentTransferFunctionElement() {}
 
 public:
   typedef gfx::ComponentTransferAttributes ComponentTransferAttributes;
 
@@ -90,18 +90,18 @@ nsresult NS_NewSVGFEFuncRElement(
 namespace mozilla {
 namespace dom {
 
 class SVGFEFuncRElement : public SVGComponentTransferFunctionElement
 {
   friend nsresult (::NS_NewSVGFEFuncRElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFEFuncRElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGComponentTransferFunctionElement(aNodeInfo) {}
+  explicit SVGFEFuncRElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGComponentTransferFunctionElement(std::move(aNodeInfo)) {}
 
 public:
   virtual int32_t GetChannel() override { return 0; }
 
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 };
@@ -115,18 +115,18 @@ nsresult NS_NewSVGFEFuncGElement(
 namespace mozilla {
 namespace dom {
 
 class SVGFEFuncGElement : public SVGComponentTransferFunctionElement
 {
   friend nsresult (::NS_NewSVGFEFuncGElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFEFuncGElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGComponentTransferFunctionElement(aNodeInfo) {}
+  explicit SVGFEFuncGElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGComponentTransferFunctionElement(std::move(aNodeInfo)) {}
 
 public:
   virtual int32_t GetChannel() override { return 1; }
 
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 };
@@ -140,18 +140,18 @@ nsresult NS_NewSVGFEFuncBElement(
 namespace mozilla {
 namespace dom {
 
 class SVGFEFuncBElement : public SVGComponentTransferFunctionElement
 {
   friend nsresult (::NS_NewSVGFEFuncBElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFEFuncBElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGComponentTransferFunctionElement(aNodeInfo) {}
+  explicit SVGFEFuncBElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGComponentTransferFunctionElement(std::move(aNodeInfo)) {}
 
 public:
   virtual int32_t GetChannel() override { return 2; }
 
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 };
@@ -165,18 +165,18 @@ nsresult NS_NewSVGFEFuncAElement(
 namespace mozilla {
 namespace dom {
 
 class SVGFEFuncAElement : public SVGComponentTransferFunctionElement
 {
   friend nsresult (::NS_NewSVGFEFuncAElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFEFuncAElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGComponentTransferFunctionElement(aNodeInfo) {}
+  explicit SVGFEFuncAElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGComponentTransferFunctionElement(std::move(aNodeInfo)) {}
 
 public:
   virtual int32_t GetChannel() override { return 3; }
 
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 };
--- a/dom/svg/SVGDefsElement.cpp
+++ b/dom/svg/SVGDefsElement.cpp
@@ -16,18 +16,18 @@ JSObject*
 SVGDefsElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return SVGDefsElement_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGDefsElement::SVGDefsElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGGraphicsElement(aNodeInfo)
+SVGDefsElement::SVGDefsElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGGraphicsElement(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGDefsElement)
--- a/dom/svg/SVGDefsElement.h
+++ b/dom/svg/SVGDefsElement.h
@@ -15,17 +15,17 @@ nsresult NS_NewSVGDefsElement(nsIContent
 namespace mozilla {
 namespace dom {
 
 class SVGDefsElement final : public SVGGraphicsElement
 {
 protected:
   friend nsresult (::NS_NewSVGDefsElement(nsIContent **aResult,
                                           already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGDefsElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGDefsElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   // nsIContent
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
 
   virtual nsresult Clone(dom::NodeInfo*, nsINode **aResult) const override;
 };
--- a/dom/svg/SVGDescElement.cpp
+++ b/dom/svg/SVGDescElement.cpp
@@ -16,18 +16,18 @@ JSObject*
 SVGDescElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return SVGDescElement_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGDescElement::SVGDescElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGDescElementBase(aNodeInfo)
+SVGDescElement::SVGDescElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGDescElementBase(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGDescElement)
 
--- a/dom/svg/SVGDescElement.h
+++ b/dom/svg/SVGDescElement.h
@@ -18,17 +18,17 @@ typedef nsSVGElement SVGDescElementBase;
 namespace mozilla {
 namespace dom {
 
 class SVGDescElement final : public SVGDescElementBase
 {
 protected:
   friend nsresult (::NS_NewSVGDescElement(nsIContent **aResult,
                                           already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGDescElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGDescElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 };
 
 } // namespace dom
--- a/dom/svg/SVGEllipseElement.cpp
+++ b/dom/svg/SVGEllipseElement.cpp
@@ -30,18 +30,18 @@ nsSVGElement::LengthInfo SVGEllipseEleme
   { &nsGkAtoms::cy, 0, SVGLength_Binding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
   { &nsGkAtoms::rx, 0, SVGLength_Binding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
   { &nsGkAtoms::ry, 0, SVGLength_Binding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
 };
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGEllipseElement::SVGEllipseElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGEllipseElementBase(aNodeInfo)
+SVGEllipseElement::SVGEllipseElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGEllipseElementBase(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGEllipseElement)
 
--- a/dom/svg/SVGEllipseElement.h
+++ b/dom/svg/SVGEllipseElement.h
@@ -16,17 +16,17 @@ nsresult NS_NewSVGEllipseElement(nsICont
 namespace mozilla {
 namespace dom {
 
 typedef SVGGeometryElement SVGEllipseElementBase;
 
 class SVGEllipseElement final : public SVGEllipseElementBase
 {
 protected:
-  explicit SVGEllipseElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGEllipseElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
   friend nsresult (::NS_NewSVGEllipseElement(nsIContent **aResult,
                                              already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
 public:
   // nsSVGSVGElement methods:
   virtual bool HasValidDimensions() const override;
 
--- a/dom/svg/SVGFEBlendElement.h
+++ b/dom/svg/SVGFEBlendElement.h
@@ -17,18 +17,18 @@ namespace dom {
 
 typedef nsSVGFE SVGFEBlendElementBase;
 
 class SVGFEBlendElement : public SVGFEBlendElementBase
 {
   friend nsresult (::NS_NewSVGFEBlendElement(nsIContent **aResult,
                                              already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFEBlendElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFEBlendElementBase(aNodeInfo)
+  explicit SVGFEBlendElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFEBlendElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual FilterPrimitiveDescription
     GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
                             const IntRect& aFilterSubregion,
--- a/dom/svg/SVGFEColorMatrixElement.h
+++ b/dom/svg/SVGFEColorMatrixElement.h
@@ -19,18 +19,18 @@ namespace dom {
 
 typedef nsSVGFE SVGFEColorMatrixElementBase;
 
 class SVGFEColorMatrixElement : public SVGFEColorMatrixElementBase
 {
   friend nsresult (::NS_NewSVGFEColorMatrixElement(nsIContent **aResult,
                                                    already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFEColorMatrixElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFEColorMatrixElementBase(aNodeInfo)
+  explicit SVGFEColorMatrixElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFEColorMatrixElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual FilterPrimitiveDescription
     GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
                             const IntRect& aFilterSubregion,
--- a/dom/svg/SVGFEComponentTransferElement.h
+++ b/dom/svg/SVGFEComponentTransferElement.h
@@ -17,18 +17,18 @@ nsresult NS_NewSVGFEComponentTransferEle
 namespace mozilla {
 namespace dom {
 
 class SVGFEComponentTransferElement : public SVGFEComponentTransferElementBase
 {
   friend nsresult (::NS_NewSVGFEComponentTransferElement(nsIContent **aResult,
                                                          already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFEComponentTransferElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFEComponentTransferElementBase(aNodeInfo)
+  explicit SVGFEComponentTransferElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFEComponentTransferElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual FilterPrimitiveDescription
     GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
                             const IntRect& aFilterSubregion,
--- a/dom/svg/SVGFECompositeElement.h
+++ b/dom/svg/SVGFECompositeElement.h
@@ -19,18 +19,18 @@ namespace dom {
 
 typedef nsSVGFE SVGFECompositeElementBase;
 
 class SVGFECompositeElement : public SVGFECompositeElementBase
 {
   friend nsresult (::NS_NewSVGFECompositeElement(nsIContent **aResult,
                                                  already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFECompositeElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFECompositeElementBase(aNodeInfo)
+  explicit SVGFECompositeElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFECompositeElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual FilterPrimitiveDescription
     GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
                             const IntRect& aFilterSubregion,
--- a/dom/svg/SVGFEConvolveMatrixElement.h
+++ b/dom/svg/SVGFEConvolveMatrixElement.h
@@ -27,18 +27,18 @@ class SVGAnimatedBoolean;
 
 typedef nsSVGFE SVGFEConvolveMatrixElementBase;
 
 class SVGFEConvolveMatrixElement : public SVGFEConvolveMatrixElementBase
 {
   friend nsresult (::NS_NewSVGFEConvolveMatrixElement(nsIContent **aResult,
                                                       already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFEConvolveMatrixElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFEConvolveMatrixElementBase(aNodeInfo)
+  explicit SVGFEConvolveMatrixElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFEConvolveMatrixElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual FilterPrimitiveDescription
     GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
                             const IntRect& aFilterSubregion,
--- a/dom/svg/SVGFEDiffuseLightingElement.h
+++ b/dom/svg/SVGFEDiffuseLightingElement.h
@@ -17,18 +17,18 @@ namespace dom {
 
 typedef nsSVGFELightingElement SVGFEDiffuseLightingElementBase;
 
 class SVGFEDiffuseLightingElement : public SVGFEDiffuseLightingElementBase
 {
   friend nsresult (::NS_NewSVGFEDiffuseLightingElement(nsIContent **aResult,
                                                        already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFEDiffuseLightingElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFEDiffuseLightingElementBase(aNodeInfo)
+  explicit SVGFEDiffuseLightingElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFEDiffuseLightingElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual FilterPrimitiveDescription
     GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
                             const IntRect& aFilterSubregion,
--- a/dom/svg/SVGFEDisplacementMapElement.h
+++ b/dom/svg/SVGFEDisplacementMapElement.h
@@ -18,18 +18,18 @@ namespace dom {
 
 typedef nsSVGFE SVGFEDisplacementMapElementBase;
 
 class SVGFEDisplacementMapElement : public SVGFEDisplacementMapElementBase
 {
 protected:
   friend nsresult (::NS_NewSVGFEDisplacementMapElement(nsIContent **aResult,
                                                        already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGFEDisplacementMapElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFEDisplacementMapElementBase(aNodeInfo)
+  explicit SVGFEDisplacementMapElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFEDisplacementMapElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual FilterPrimitiveDescription
     GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
                             const IntRect& aFilterSubregion,
--- a/dom/svg/SVGFEDistantLightElement.h
+++ b/dom/svg/SVGFEDistantLightElement.h
@@ -18,18 +18,18 @@ namespace dom {
 
 typedef SVGFELightElement SVGFEDistantLightElementBase;
 
 class SVGFEDistantLightElement : public SVGFEDistantLightElementBase
 {
   friend nsresult (::NS_NewSVGFEDistantLightElement(nsIContent **aResult,
                                                     already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFEDistantLightElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFEDistantLightElementBase(aNodeInfo)
+  explicit SVGFEDistantLightElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFEDistantLightElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
 
   virtual mozilla::gfx::LightType ComputeLightAttributes(nsSVGFilterInstance* aInstance,
                                                          nsTArray<float>& aFloatAttributes) override;
--- a/dom/svg/SVGFEDropShadowElement.h
+++ b/dom/svg/SVGFEDropShadowElement.h
@@ -20,18 +20,18 @@ namespace dom {
 
 typedef nsSVGFE SVGFEDropShadowElementBase;
 
 class SVGFEDropShadowElement : public SVGFEDropShadowElementBase
 {
   friend nsresult (::NS_NewSVGFEDropShadowElement(nsIContent **aResult,
                                                   already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFEDropShadowElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFEDropShadowElementBase(aNodeInfo)
+  explicit SVGFEDropShadowElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFEDropShadowElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual FilterPrimitiveDescription
     GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
                             const IntRect& aFilterSubregion,
--- a/dom/svg/SVGFEFloodElement.h
+++ b/dom/svg/SVGFEFloodElement.h
@@ -17,18 +17,18 @@ namespace dom {
 
 typedef nsSVGFE SVGFEFloodElementBase;
 
 class SVGFEFloodElement : public SVGFEFloodElementBase
 {
   friend nsresult (::NS_NewSVGFEFloodElement(nsIContent **aResult,
                                              already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFEFloodElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFEFloodElementBase(aNodeInfo)
+  explicit SVGFEFloodElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFEFloodElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual bool SubregionIsUnionOfRegions() override { return false; }
 
   virtual FilterPrimitiveDescription
--- a/dom/svg/SVGFEGaussianBlurElement.h
+++ b/dom/svg/SVGFEGaussianBlurElement.h
@@ -19,18 +19,18 @@ namespace dom {
 
 typedef nsSVGFE SVGFEGaussianBlurElementBase;
 
 class SVGFEGaussianBlurElement : public SVGFEGaussianBlurElementBase
 {
   friend nsresult (::NS_NewSVGFEGaussianBlurElement(nsIContent **aResult,
                                                     already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFEGaussianBlurElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFEGaussianBlurElementBase(aNodeInfo)
+  explicit SVGFEGaussianBlurElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFEGaussianBlurElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual FilterPrimitiveDescription
     GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
                             const IntRect& aFilterSubregion,
--- a/dom/svg/SVGFEImageElement.cpp
+++ b/dom/svg/SVGFEImageElement.cpp
@@ -43,18 +43,18 @@ nsSVGElement::StringInfo SVGFEImageEleme
 // nsISupports methods
 
 NS_IMPL_ISUPPORTS_INHERITED(SVGFEImageElement, SVGFEImageElementBase,
                             imgINotificationObserver, nsIImageLoadingContent)
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGFEImageElement::SVGFEImageElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGFEImageElementBase(aNodeInfo)
+SVGFEImageElement::SVGFEImageElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGFEImageElementBase(std::move(aNodeInfo))
 {
   // We start out broken
   AddStatesSilently(NS_EVENT_STATE_BROKEN);
 }
 
 SVGFEImageElement::~SVGFEImageElement()
 {
   DestroyImageLoadingContent();
--- a/dom/svg/SVGFEImageElement.h
+++ b/dom/svg/SVGFEImageElement.h
@@ -23,17 +23,17 @@ typedef nsSVGFE SVGFEImageElementBase;
 class SVGFEImageElement final : public SVGFEImageElementBase,
                                 public nsImageLoadingContent
 {
   friend class ::SVGFEImageFrame;
 
 protected:
   friend nsresult (::NS_NewSVGFEImageElement(nsIContent **aResult,
                                              already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGFEImageElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGFEImageElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual ~SVGFEImageElement();
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual bool SubregionIsUnionOfRegions() override { return false; }
 
   // interfaces:
   NS_DECL_ISUPPORTS_INHERITED
--- a/dom/svg/SVGFEMergeElement.h
+++ b/dom/svg/SVGFEMergeElement.h
@@ -17,18 +17,18 @@ namespace dom {
 
 typedef nsSVGFE SVGFEMergeElementBase;
 
 class SVGFEMergeElement : public SVGFEMergeElementBase
 {
   friend nsresult (::NS_NewSVGFEMergeElement(nsIContent **aResult,
                                              already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFEMergeElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFEMergeElementBase(aNodeInfo)
+  explicit SVGFEMergeElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFEMergeElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual FilterPrimitiveDescription
     GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
                             const IntRect& aFilterSubregion,
--- a/dom/svg/SVGFEMergeNodeElement.h
+++ b/dom/svg/SVGFEMergeNodeElement.h
@@ -17,18 +17,18 @@ namespace dom {
 
 typedef SVGFEUnstyledElement SVGFEMergeNodeElementBase;
 
 class SVGFEMergeNodeElement : public SVGFEMergeNodeElementBase
 {
   friend nsresult (::NS_NewSVGFEMergeNodeElement(nsIContent **aResult,
                                                  already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFEMergeNodeElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFEMergeNodeElementBase(aNodeInfo)
+  explicit SVGFEMergeNodeElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFEMergeNodeElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
   virtual bool AttributeAffectsRendering(
--- a/dom/svg/SVGFEMorphologyElement.h
+++ b/dom/svg/SVGFEMorphologyElement.h
@@ -20,18 +20,18 @@ namespace dom {
 
 typedef nsSVGFE SVGFEMorphologyElementBase;
 
 class SVGFEMorphologyElement : public SVGFEMorphologyElementBase
 {
   friend nsresult (::NS_NewSVGFEMorphologyElement(nsIContent **aResult,
                                                   already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFEMorphologyElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFEMorphologyElementBase(aNodeInfo)
+  explicit SVGFEMorphologyElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFEMorphologyElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual FilterPrimitiveDescription
     GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
                             const IntRect& aFilterSubregion,
--- a/dom/svg/SVGFEOffsetElement.h
+++ b/dom/svg/SVGFEOffsetElement.h
@@ -19,18 +19,18 @@ namespace dom {
 
 typedef nsSVGFE SVGFEOffsetElementBase;
 
 class SVGFEOffsetElement : public SVGFEOffsetElementBase
 {
   friend nsresult (::NS_NewSVGFEOffsetElement(nsIContent **aResult,
                                               already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFEOffsetElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFEOffsetElementBase(aNodeInfo)
+  explicit SVGFEOffsetElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFEOffsetElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual FilterPrimitiveDescription
     GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
                             const IntRect& aFilterSubregion,
--- a/dom/svg/SVGFEPointLightElement.h
+++ b/dom/svg/SVGFEPointLightElement.h
@@ -18,18 +18,18 @@ namespace dom {
 
 typedef SVGFELightElement SVGFEPointLightElementBase;
 
 class SVGFEPointLightElement : public SVGFEPointLightElementBase
 {
   friend nsresult (::NS_NewSVGFEPointLightElement(nsIContent **aResult,
                                                   already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFEPointLightElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFEPointLightElementBase(aNodeInfo)
+  explicit SVGFEPointLightElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFEPointLightElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual mozilla::gfx::LightType ComputeLightAttributes(nsSVGFilterInstance* aInstance,
                                                          nsTArray<float>& aFloatAttributes) override;
   virtual bool AttributeAffectsRendering(
--- a/dom/svg/SVGFESpecularLightingElement.h
+++ b/dom/svg/SVGFESpecularLightingElement.h
@@ -19,18 +19,18 @@ namespace dom {
 
 typedef nsSVGFELightingElement SVGFESpecularLightingElementBase;
 
 class SVGFESpecularLightingElement : public SVGFESpecularLightingElementBase
 {
   friend nsresult (::NS_NewSVGFESpecularLightingElement(nsIContent **aResult,
                                                         already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFESpecularLightingElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFESpecularLightingElementBase(aNodeInfo)
+  explicit SVGFESpecularLightingElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFESpecularLightingElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
   virtual FilterPrimitiveDescription
--- a/dom/svg/SVGFESpotLightElement.h
+++ b/dom/svg/SVGFESpotLightElement.h
@@ -19,18 +19,18 @@ namespace dom {
 typedef SVGFELightElement SVGFESpotLightElementBase;
 
 class SVGFESpotLightElement : public SVGFESpotLightElementBase
 {
   friend nsresult (::NS_NewSVGFESpotLightElement(nsIContent **aResult,
                                                  already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
   friend class ::nsSVGFELightingElement;
 protected:
-  explicit SVGFESpotLightElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFESpotLightElementBase(aNodeInfo)
+  explicit SVGFESpotLightElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFESpotLightElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual mozilla::gfx::LightType ComputeLightAttributes(nsSVGFilterInstance* aInstance,
                                                          nsTArray<float>& aFloatAttributes) override;
   virtual bool AttributeAffectsRendering(
--- a/dom/svg/SVGFETileElement.h
+++ b/dom/svg/SVGFETileElement.h
@@ -17,18 +17,18 @@ namespace dom {
 
 typedef nsSVGFE SVGFETileElementBase;
 
 class SVGFETileElement : public SVGFETileElementBase
 {
   friend nsresult (::NS_NewSVGFETileElement(nsIContent **aResult,
                                             already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFETileElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFETileElementBase(aNodeInfo)
+  explicit SVGFETileElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFETileElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual bool SubregionIsUnionOfRegions() override { return false; }
 
   virtual FilterPrimitiveDescription
--- a/dom/svg/SVGFETurbulenceElement.h
+++ b/dom/svg/SVGFETurbulenceElement.h
@@ -21,18 +21,18 @@ namespace dom {
 
 typedef nsSVGFE SVGFETurbulenceElementBase;
 
 class SVGFETurbulenceElement : public SVGFETurbulenceElementBase
 {
   friend nsresult (::NS_NewSVGFETurbulenceElement(nsIContent **aResult,
                                                   already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 protected:
-  explicit SVGFETurbulenceElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFETurbulenceElementBase(aNodeInfo)
+  explicit SVGFETurbulenceElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFETurbulenceElementBase(std::move(aNodeInfo))
   {
   }
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual bool SubregionIsUnionOfRegions() override { return false; }
 
   virtual FilterPrimitiveDescription
--- a/dom/svg/SVGFilterElement.cpp
+++ b/dom/svg/SVGFilterElement.cpp
@@ -53,18 +53,18 @@ nsSVGElement::StringInfo SVGFilterElemen
 {
   { &nsGkAtoms::href, kNameSpaceID_None, true },
   { &nsGkAtoms::href, kNameSpaceID_XLink, true }
 };
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGFilterElement::SVGFilterElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGFilterElementBase(aNodeInfo)
+SVGFilterElement::SVGFilterElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGFilterElementBase(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFilterElement)
--- a/dom/svg/SVGFilterElement.h
+++ b/dom/svg/SVGFilterElement.h
@@ -28,17 +28,17 @@ class SVGAnimatedLength;
 class SVGFilterElement : public SVGFilterElementBase
 {
   friend class ::nsSVGFilterFrame;
   friend class ::nsSVGFilterInstance;
 
 protected:
   friend nsresult (::NS_NewSVGFilterElement(nsIContent **aResult,
                                             already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGFilterElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGFilterElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   // nsIContent
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
 
   // Invalidate users of this filter
--- a/dom/svg/SVGForeignObjectElement.cpp
+++ b/dom/svg/SVGForeignObjectElement.cpp
@@ -29,18 +29,18 @@ nsSVGElement::LengthInfo SVGForeignObjec
   { &nsGkAtoms::y, 0, SVGLength_Binding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
   { &nsGkAtoms::width, 0, SVGLength_Binding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
   { &nsGkAtoms::height, 0, SVGLength_Binding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
 };
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGForeignObjectElement::SVGForeignObjectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGGraphicsElement(aNodeInfo)
+SVGForeignObjectElement::SVGForeignObjectElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGGraphicsElement(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGForeignObjectElement)
 
--- a/dom/svg/SVGForeignObjectElement.h
+++ b/dom/svg/SVGForeignObjectElement.h
@@ -20,17 +20,17 @@ namespace dom {
 
 class SVGForeignObjectElement final : public SVGGraphicsElement
 {
   friend class ::nsSVGForeignObjectFrame;
 
 protected:
   friend nsresult (::NS_NewSVGForeignObjectElement(nsIContent **aResult,
                                                    already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGForeignObjectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGForeignObjectElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   // nsSVGElement specializations:
   virtual gfxMatrix PrependLocalTransformsTo(
     const gfxMatrix &aMatrix,
     SVGTransformTypes aWhich = eAllTransforms) const override;
   virtual bool HasValidDimensions() const override;
--- a/dom/svg/SVGGElement.cpp
+++ b/dom/svg/SVGGElement.cpp
@@ -16,18 +16,18 @@ JSObject*
 SVGGElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return SVGGElement_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGGElement::SVGGElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGGraphicsElement(aNodeInfo)
+SVGGElement::SVGGElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGGraphicsElement(std::move(aNodeInfo))
 {
 }
 
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 
--- a/dom/svg/SVGGElement.h
+++ b/dom/svg/SVGGElement.h
@@ -13,17 +13,17 @@ nsresult NS_NewSVGGElement(nsIContent **
                            already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
 class SVGGElement final : public SVGGraphicsElement
 {
 protected:
-  explicit SVGGElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGGElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
   friend nsresult (::NS_NewSVGGElement(nsIContent **aResult,
                                        already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
 public:
   // nsIContent
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
 
--- a/dom/svg/SVGGeometryElement.cpp
+++ b/dom/svg/SVGGeometryElement.cpp
@@ -20,18 +20,18 @@ using namespace mozilla::gfx;
 using namespace mozilla::dom;
 
 nsSVGElement::NumberInfo SVGGeometryElement::sNumberInfo =
 { &nsGkAtoms::pathLength, 0, false };
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGGeometryElement::SVGGeometryElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGGeometryElementBase(aNodeInfo)
+SVGGeometryElement::SVGGeometryElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGGeometryElementBase(std::move(aNodeInfo))
 {
 }
 
 nsSVGElement::NumberAttributesInfo
 SVGGeometryElement::GetNumberInfo()
 {
   return NumberAttributesInfo(&mPathLength, &sNumberInfo, 1);
 }
--- a/dom/svg/SVGGeometryElement.h
+++ b/dom/svg/SVGGeometryElement.h
@@ -44,17 +44,17 @@ protected:
   typedef mozilla::gfx::Matrix Matrix;
   typedef mozilla::gfx::Path Path;
   typedef mozilla::gfx::Point Point;
   typedef mozilla::gfx::PathBuilder PathBuilder;
   typedef mozilla::gfx::Rect Rect;
   typedef mozilla::gfx::StrokeOptions StrokeOptions;
 
 public:
-  explicit SVGGeometryElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGGeometryElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
                                 const nsAttrValue* aValue,
                                 const nsAttrValue* aOldValue,
                                 nsIPrincipal* aSubjectPrincipal,
                                 bool aNotify) override;
   bool IsNodeOfType(uint32_t aFlags) const override;
 
--- a/dom/svg/SVGGradientElement.cpp
+++ b/dom/svg/SVGGradientElement.cpp
@@ -51,18 +51,18 @@ nsSVGElement::StringInfo SVGGradientElem
 {
   { &nsGkAtoms::href, kNameSpaceID_None, true },
   { &nsGkAtoms::href, kNameSpaceID_XLink, true }
 };
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGGradientElement::SVGGradientElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGGradientElementBase(aNodeInfo)
+SVGGradientElement::SVGGradientElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGGradientElementBase(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsSVGElement methods
 
 nsSVGElement::EnumAttributesInfo
 SVGGradientElement::GetEnumInfo()
@@ -136,18 +136,18 @@ nsSVGElement::LengthInfo SVGLinearGradie
   { &nsGkAtoms::y1, 0, SVGLength_Binding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
   { &nsGkAtoms::x2, 100, SVGLength_Binding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
   { &nsGkAtoms::y2, 0, SVGLength_Binding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
 };
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGLinearGradientElement::SVGLinearGradientElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGLinearGradientElementBase(aNodeInfo)
+SVGLinearGradientElement::SVGLinearGradientElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGLinearGradientElementBase(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGLinearGradientElement)
 
@@ -212,18 +212,18 @@ nsSVGElement::LengthInfo SVGRadialGradie
   { &nsGkAtoms::fx, 50, SVGLength_Binding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
   { &nsGkAtoms::fy, 50, SVGLength_Binding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
   { &nsGkAtoms::fr, 0, SVGLength_Binding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::XY },
 };
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGRadialGradientElement::SVGRadialGradientElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGRadialGradientElementBase(aNodeInfo)
+SVGRadialGradientElement::SVGRadialGradientElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGRadialGradientElementBase(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGRadialGradientElement)
 
--- a/dom/svg/SVGGradientElement.h
+++ b/dom/svg/SVGGradientElement.h
@@ -34,17 +34,17 @@ class SVGAnimatedTransformList;
 
 typedef nsSVGElement SVGGradientElementBase;
 
 class SVGGradientElement : public SVGGradientElementBase
 {
   friend class ::nsSVGGradientFrame;
 
 protected:
-  explicit SVGGradientElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGGradientElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override = 0;
 
 public:
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override = 0;
 
   // nsIContent
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
 
@@ -84,17 +84,17 @@ typedef SVGGradientElement SVGLinearGrad
 class SVGLinearGradientElement : public SVGLinearGradientElementBase
 {
   friend class ::nsSVGLinearGradientFrame;
   friend nsresult
     (::NS_NewSVGLinearGradientElement(nsIContent** aResult,
                                       already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
 protected:
-  explicit SVGLinearGradientElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGLinearGradientElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
   // WebIDL
   already_AddRefed<SVGAnimatedLength> X1();
   already_AddRefed<SVGAnimatedLength> Y1();
@@ -117,17 +117,17 @@ typedef SVGGradientElement SVGRadialGrad
 class SVGRadialGradientElement : public SVGRadialGradientElementBase
 {
   friend class ::nsSVGRadialGradientFrame;
   friend nsresult
     (::NS_NewSVGRadialGradientElement(nsIContent** aResult,
                                       already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
 protected:
-  explicit SVGRadialGradientElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGRadialGradientElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
   // WebIDL
   already_AddRefed<SVGAnimatedLength> Cx();
   already_AddRefed<SVGAnimatedLength> Cy();
--- a/dom/svg/SVGGraphicsElement.cpp
+++ b/dom/svg/SVGGraphicsElement.cpp
@@ -17,18 +17,18 @@ NS_IMPL_RELEASE_INHERITED(SVGGraphicsEle
 
 NS_INTERFACE_MAP_BEGIN(SVGGraphicsElement)
   NS_INTERFACE_MAP_ENTRY(mozilla::dom::SVGTests)
 NS_INTERFACE_MAP_END_INHERITING(SVGGraphicsElementBase)
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGGraphicsElement::SVGGraphicsElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGGraphicsElementBase(aNodeInfo)
+SVGGraphicsElement::SVGGraphicsElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+: SVGGraphicsElementBase(std::move(aNodeInfo))
 {
 }
 
 SVGGraphicsElement::~SVGGraphicsElement()
 {
 }
 
 } // namespace dom
--- a/dom/svg/SVGGraphicsElement.h
+++ b/dom/svg/SVGGraphicsElement.h
@@ -14,17 +14,17 @@ namespace mozilla {
 namespace dom {
 
 typedef SVGTransformableElement SVGGraphicsElementBase;
 
 class SVGGraphicsElement : public SVGGraphicsElementBase,
                            public SVGTests
 {
 protected:
-  explicit SVGGraphicsElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGGraphicsElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   ~SVGGraphicsElement();
 
 public:
   // interfaces:
   NS_DECL_ISUPPORTS_INHERITED
 
   nsSVGElement* AsSVGElement() final { return this; }
 };
--- a/dom/svg/SVGImageElement.cpp
+++ b/dom/svg/SVGImageElement.cpp
@@ -50,18 +50,18 @@ nsSVGElement::StringInfo SVGImageElement
 
 NS_IMPL_ISUPPORTS_INHERITED(SVGImageElement, SVGImageElementBase,
                             imgINotificationObserver,
                             nsIImageLoadingContent)
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGImageElement::SVGImageElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGImageElementBase(aNodeInfo)
+SVGImageElement::SVGImageElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGImageElementBase(std::move(aNodeInfo))
 {
   // We start out broken
   AddStatesSilently(NS_EVENT_STATE_BROKEN);
 }
 
 SVGImageElement::~SVGImageElement()
 {
   DestroyImageLoadingContent();
--- a/dom/svg/SVGImageElement.h
+++ b/dom/svg/SVGImageElement.h
@@ -25,17 +25,17 @@ class DOMSVGAnimatedPreserveAspectRatio;
 typedef SVGGeometryElement SVGImageElementBase;
 
 class SVGImageElement : public SVGImageElementBase,
                         public nsImageLoadingContent
 {
   friend class ::nsSVGImageFrame;
 
 protected:
-  explicit SVGImageElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGImageElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual ~SVGImageElement();
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
   friend nsresult (::NS_NewSVGImageElement(nsIContent **aResult,
                                            already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
 public:
   // interfaces:
 
--- a/dom/svg/SVGLineElement.cpp
+++ b/dom/svg/SVGLineElement.cpp
@@ -28,18 +28,18 @@ nsSVGElement::LengthInfo SVGLineElement:
   { &nsGkAtoms::y1, 0, SVGLength_Binding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
   { &nsGkAtoms::x2, 0, SVGLength_Binding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
   { &nsGkAtoms::y2, 0, SVGLength_Binding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
 };
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGLineElement::SVGLineElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGLineElementBase(aNodeInfo)
+SVGLineElement::SVGLineElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGLineElementBase(std::move(aNodeInfo))
 {
 }
 
 void
 SVGLineElement::MaybeAdjustForZeroLength(float aX1, float aY1,
                                          float& aX2, float aY2)
 {
   if (aX1 == aX2 && aY1 == aY2) {
--- a/dom/svg/SVGLineElement.h
+++ b/dom/svg/SVGLineElement.h
@@ -16,17 +16,17 @@ nsresult NS_NewSVGLineElement(nsIContent
 namespace mozilla {
 namespace dom {
 
 typedef SVGGeometryElement SVGLineElementBase;
 
 class SVGLineElement final : public SVGLineElementBase
 {
 protected:
-  explicit SVGLineElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGLineElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
   friend nsresult (::NS_NewSVGLineElement(nsIContent **aResult,
                                           already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
   // If the input line has length zero and linecaps aren't butt, adjust |aX2| by
   // a tiny amount to a barely-nonzero-length line that all of our draw targets
   // will render
   void MaybeAdjustForZeroLength(float aX1, float aY1, float& aX2, float aY2);
 
--- a/dom/svg/SVGMPathElement.cpp
+++ b/dom/svg/SVGMPathElement.cpp
@@ -47,18 +47,18 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 //----------------------------------------------------------------------
 // nsISupports methods
 
 NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(SVGMPathElement,
                                              SVGMPathElementBase,
                                              nsIMutationObserver)
 
 // Constructor
-SVGMPathElement::SVGMPathElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGMPathElementBase(aNodeInfo)
+SVGMPathElement::SVGMPathElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGMPathElementBase(std::move(aNodeInfo))
   , mPathTracker(this)
 {
 }
 
 SVGMPathElement::~SVGMPathElement()
 {
   UnlinkHrefTarget(false);
 }
--- a/dom/svg/SVGMPathElement.h
+++ b/dom/svg/SVGMPathElement.h
@@ -22,17 +22,17 @@ namespace dom {
 class SVGPathElement;
 
 class SVGMPathElement final : public SVGMPathElementBase,
                               public nsStubMutationObserver
 {
 protected:
   friend nsresult (::NS_NewSVGMPathElement(nsIContent **aResult,
                                            already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGMPathElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGMPathElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   ~SVGMPathElement();
 
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   // interfaces:
   NS_DECL_ISUPPORTS_INHERITED
 
--- a/dom/svg/SVGMarkerElement.cpp
+++ b/dom/svg/SVGMarkerElement.cpp
@@ -88,18 +88,18 @@ nsSVGOrientType::SetBaseValue(uint16_t a
 already_AddRefed<SVGAnimatedEnumeration>
 nsSVGOrientType::ToDOMAnimatedEnum(nsSVGElement *aSVGElement)
 {
   RefPtr<SVGAnimatedEnumeration> toReturn =
     new DOMAnimatedEnum(this, aSVGElement);
   return toReturn.forget();
 }
 
-SVGMarkerElement::SVGMarkerElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGMarkerElementBase(aNodeInfo), mCoordCtx(nullptr)
+SVGMarkerElement::SVGMarkerElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGMarkerElementBase(std::move(aNodeInfo)), mCoordCtx(nullptr)
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGMarkerElement)
 
--- a/dom/svg/SVGMarkerElement.h
+++ b/dom/svg/SVGMarkerElement.h
@@ -96,17 +96,17 @@ typedef nsSVGElement SVGMarkerElementBas
 
 class SVGMarkerElement : public SVGMarkerElementBase
 {
   friend class ::nsSVGMarkerFrame;
 
 protected:
   friend nsresult (::NS_NewSVGMarkerElement(nsIContent **aResult,
                                             already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGMarkerElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGMarkerElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   // nsIContent interface
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* name) const override;
 
   virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
                                 const nsAttrValue* aValue,
--- a/dom/svg/SVGMaskElement.cpp
+++ b/dom/svg/SVGMaskElement.cpp
@@ -46,18 +46,18 @@ nsSVGElement::EnumInfo SVGMaskElement::s
     sSVGUnitTypesMap,
     SVG_UNIT_TYPE_USERSPACEONUSE
   }
 };
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGMaskElement::SVGMaskElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGMaskElementBase(aNodeInfo)
+SVGMaskElement::SVGMaskElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGMaskElementBase(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode method
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGMaskElement)
 
--- a/dom/svg/SVGMaskElement.h
+++ b/dom/svg/SVGMaskElement.h
@@ -25,17 +25,17 @@ typedef nsSVGElement SVGMaskElementBase;
 
 class SVGMaskElement final : public SVGMaskElementBase
 {
   friend class ::nsSVGMaskFrame;
 
 protected:
   friend nsresult (::NS_NewSVGMaskElement(nsIContent **aResult,
                                           already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGMaskElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGMaskElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   // nsIContent interface
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
 
   // nsSVGSVGElement methods:
--- a/dom/svg/SVGMetadataElement.cpp
+++ b/dom/svg/SVGMetadataElement.cpp
@@ -16,18 +16,18 @@ JSObject*
 SVGMetadataElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return SVGMetadataElement_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGMetadataElement::SVGMetadataElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGMetadataElementBase(aNodeInfo)
+SVGMetadataElement::SVGMetadataElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGMetadataElementBase(std::move(aNodeInfo))
 {
 }
 
 
 nsresult
 SVGMetadataElement::Init()
 {
   return NS_OK;
--- a/dom/svg/SVGMetadataElement.h
+++ b/dom/svg/SVGMetadataElement.h
@@ -18,17 +18,17 @@ typedef nsSVGElement SVGMetadataElementB
 namespace mozilla {
 namespace dom {
 
 class SVGMetadataElement final : public SVGMetadataElementBase
 {
 protected:
   friend nsresult (::NS_NewSVGMetadataElement(nsIContent **aResult,
                                               already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGMetadataElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGMetadataElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
   nsresult Init();
 
 public:
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 };
 
--- a/dom/svg/SVGPathElement.cpp
+++ b/dom/svg/SVGPathElement.cpp
@@ -34,18 +34,18 @@ JSObject*
 SVGPathElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return SVGPathElement_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGPathElement::SVGPathElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGPathElementBase(aNodeInfo)
+SVGPathElement::SVGPathElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGPathElementBase(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // memory reporting methods
 
 void
 SVGPathElement::AddSizeOfExcludingThis(nsWindowSizes& aSizes,
--- a/dom/svg/SVGPathElement.h
+++ b/dom/svg/SVGPathElement.h
@@ -27,17 +27,17 @@ typedef SVGGeometryElement SVGPathElemen
 class SVGPathElement final : public SVGPathElementBase
 {
   typedef mozilla::gfx::Path Path;
 
 protected:
   friend nsresult (::NS_NewSVGPathElement(nsIContent **aResult,
                                           already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
-  explicit SVGPathElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGPathElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 public:
   NS_DECL_ADDSIZEOFEXCLUDINGTHIS
 
   // nsIContent interface
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* name) const override;
 
   // nsSVGSVGElement methods:
--- a/dom/svg/SVGPatternElement.cpp
+++ b/dom/svg/SVGPatternElement.cpp
@@ -53,18 +53,18 @@ nsSVGElement::StringInfo SVGPatternEleme
 {
   { &nsGkAtoms::href, kNameSpaceID_None, true },
   { &nsGkAtoms::href, kNameSpaceID_XLink, true }
 };
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGPatternElement::SVGPatternElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGPatternElementBase(aNodeInfo)
+SVGPatternElement::SVGPatternElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGPatternElementBase(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode method
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPatternElement)
 
--- a/dom/svg/SVGPatternElement.h
+++ b/dom/svg/SVGPatternElement.h
@@ -29,17 +29,17 @@ typedef nsSVGElement SVGPatternElementBa
 
 class SVGPatternElement final : public SVGPatternElementBase
 {
   friend class ::nsSVGPatternFrame;
 
 protected:
   friend nsresult (::NS_NewSVGPatternElement(nsIContent **aResult,
                                              already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGPatternElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGPatternElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   typedef mozilla::SVGAnimatedPreserveAspectRatio SVGAnimatedPreserveAspectRatio;
 
   // nsIContent interface
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* name) const override;
 
--- a/dom/svg/SVGPolyElement.cpp
+++ b/dom/svg/SVGPolyElement.cpp
@@ -10,18 +10,18 @@
 #include "SVGContentUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGPolyElement::SVGPolyElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGPolyElementBase(aNodeInfo)
+SVGPolyElement::SVGPolyElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGPolyElementBase(std::move(aNodeInfo))
 {
 }
 
 SVGPolyElement::~SVGPolyElement()
 {
 }
 
 already_AddRefed<DOMSVGPointList>
--- a/dom/svg/SVGPolyElement.h
+++ b/dom/svg/SVGPolyElement.h
@@ -16,17 +16,17 @@ class DOMSVGPointList;
 
 namespace dom {
 
 typedef SVGGeometryElement SVGPolyElementBase;
 
 class SVGPolyElement : public SVGPolyElementBase
 {
 protected:
-  explicit SVGPolyElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGPolyElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   virtual ~SVGPolyElement();
 
 public:
   //interfaces
 
   NS_INLINE_DECL_REFCOUNTING_INHERITED(SVGPolyElement, SVGPolyElementBase)
 
--- a/dom/svg/SVGPolygonElement.cpp
+++ b/dom/svg/SVGPolygonElement.cpp
@@ -21,18 +21,18 @@ JSObject*
 SVGPolygonElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return SVGPolygonElement_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGPolygonElement::SVGPolygonElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGPolygonElementBase(aNodeInfo)
+SVGPolygonElement::SVGPolygonElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGPolygonElementBase(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPolygonElement)
 
--- a/dom/svg/SVGPolygonElement.h
+++ b/dom/svg/SVGPolygonElement.h
@@ -16,17 +16,17 @@ nsresult NS_NewSVGPolygonElement(nsICont
 namespace mozilla {
 namespace dom {
 
 typedef SVGPolyElement SVGPolygonElementBase;
 
 class SVGPolygonElement final : public SVGPolygonElementBase
 {
 protected:
-  explicit SVGPolygonElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGPolygonElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
   friend nsresult (::NS_NewSVGPolygonElement(nsIContent **aResult,
                                              already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
 public:
   // SVGGeometryElement methods:
   virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) override;
   virtual already_AddRefed<Path> BuildPath(PathBuilder* aBuilder) override;
--- a/dom/svg/SVGPolylineElement.cpp
+++ b/dom/svg/SVGPolylineElement.cpp
@@ -20,18 +20,18 @@ JSObject*
 SVGPolylineElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return SVGPolylineElement_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGPolylineElement::SVGPolylineElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGPolylineElementBase(aNodeInfo)
+SVGPolylineElement::SVGPolylineElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGPolylineElementBase(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPolylineElement)
 
--- a/dom/svg/SVGPolylineElement.h
+++ b/dom/svg/SVGPolylineElement.h
@@ -15,17 +15,17 @@ nsresult NS_NewSVGPolylineElement(nsICon
 namespace mozilla {
 namespace dom {
 
 typedef SVGPolyElement SVGPolylineElementBase;
 
 class SVGPolylineElement final : public SVGPolylineElementBase
 {
 protected:
-  explicit SVGPolylineElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGPolylineElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
   friend nsresult (::NS_NewSVGPolylineElement(nsIContent **aResult,
                                               already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
   // SVGGeometryElement methods:
   virtual already_AddRefed<Path> BuildPath(PathBuilder* aBuilder) override;
 
 public:
--- a/dom/svg/SVGRectElement.cpp
+++ b/dom/svg/SVGRectElement.cpp
@@ -37,18 +37,18 @@ nsSVGElement::LengthInfo SVGRectElement:
   { &nsGkAtoms::height, 0, SVGLength_Binding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
   { &nsGkAtoms::rx, 0, SVGLength_Binding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
   { &nsGkAtoms::ry, 0, SVGLength_Binding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y }
 };
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGRectElement::SVGRectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGRectElementBase(aNodeInfo)
+SVGRectElement::SVGRectElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGRectElementBase(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGRectElement)
 
--- a/dom/svg/SVGRectElement.h
+++ b/dom/svg/SVGRectElement.h
@@ -16,17 +16,17 @@ nsresult NS_NewSVGRectElement(nsIContent
 namespace mozilla {
 namespace dom {
 
 typedef SVGGeometryElement SVGRectElementBase;
 
 class SVGRectElement final : public SVGRectElementBase
 {
 protected:
-  explicit SVGRectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGRectElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
   friend nsresult (::NS_NewSVGRectElement(nsIContent **aResult,
                                           already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
 public:
   // nsSVGSVGElement methods:
   virtual bool HasValidDimensions() const override;
 
--- a/dom/svg/SVGSVGElement.cpp
+++ b/dom/svg/SVGSVGElement.cpp
@@ -132,19 +132,19 @@ SVGView::SVGView()
                    SVG_ZOOMANDPAN_MAGNIFY);
   mViewBox.Init();
   mPreserveAspectRatio.Init();
 }
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGSVGElement::SVGSVGElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+SVGSVGElement::SVGSVGElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                              FromParser aFromParser)
-  : SVGSVGElementBase(aNodeInfo),
+  : SVGSVGElementBase(std::move(aNodeInfo)),
     mCurrentTranslate(0.0f, 0.0f),
     mCurrentScale(1.0f),
     mPreviousTranslate(0.0f, 0.0f),
     mPreviousScale(1.0f),
     mStartAnimationOnBindToTree(aFromParser == NOT_FROM_PARSER ||
                                 aFromParser == FROM_PARSER_FRAGMENT ||
                                 aFromParser == FROM_PARSER_XSLT),
     mImageNeedsTransformInvalidation(false)
--- a/dom/svg/SVGSVGElement.h
+++ b/dom/svg/SVGSVGElement.h
@@ -73,17 +73,17 @@ class SVGSVGElement final : public SVGSV
 {
   friend class ::nsSVGOuterSVGFrame;
   friend class mozilla::SVGFragmentIdentifier;
   friend class mozilla::AutoSVGViewHandler;
   friend class mozilla::AutoPreserveAspectRatioOverride;
   friend class mozilla::dom::SVGView;
 
 protected:
-  SVGSVGElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+  SVGSVGElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                 FromParser aFromParser);
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   friend nsresult (::NS_NewSVGSVGElement(nsIContent **aResult,
                                          already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                                          mozilla::dom::FromParser aFromParser));
 
   ~SVGSVGElement();
--- a/dom/svg/SVGScriptElement.cpp
+++ b/dom/svg/SVGScriptElement.cpp
@@ -33,19 +33,19 @@ nsSVGElement::StringInfo SVGScriptElemen
 
 NS_IMPL_ISUPPORTS_INHERITED(SVGScriptElement, SVGScriptElementBase,
                             nsIScriptLoaderObserver,
                             nsIScriptElement, nsIMutationObserver)
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGScriptElement::SVGScriptElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+SVGScriptElement::SVGScriptElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                                    FromParser aFromParser)
-  : SVGScriptElementBase(aNodeInfo)
+  : SVGScriptElementBase(std::move(aNodeInfo))
   , ScriptElement(aFromParser)
 {
   AddMutationObserver(this);
 }
 
 SVGScriptElement::~SVGScriptElement()
 {
 }
@@ -53,18 +53,18 @@ SVGScriptElement::~SVGScriptElement()
 //----------------------------------------------------------------------
 // nsINode methods
 
 nsresult
 SVGScriptElement::Clone(dom::NodeInfo* aNodeInfo, nsINode** aResult) const
 {
   *aResult = nullptr;
 
-  already_AddRefed<mozilla::dom::NodeInfo> ni = RefPtr<mozilla::dom::NodeInfo>(aNodeInfo).forget();
-  SVGScriptElement* it = new SVGScriptElement(ni, NOT_FROM_PARSER);
+  SVGScriptElement* it =
+    new SVGScriptElement(do_AddRef(aNodeInfo), NOT_FROM_PARSER);
 
   nsCOMPtr<nsINode> kungFuDeathGrip = it;
   nsresult rv1 = it->Init();
   nsresult rv2 = const_cast<SVGScriptElement*>(this)->CopyInnerTo(it);
   NS_ENSURE_SUCCESS(rv1, rv1);
   NS_ENSURE_SUCCESS(rv2, rv2);
 
   // The clone should be marked evaluated if we are.
--- a/dom/svg/SVGScriptElement.h
+++ b/dom/svg/SVGScriptElement.h
@@ -25,17 +25,17 @@ typedef nsSVGElement SVGScriptElementBas
 
 class SVGScriptElement final : public SVGScriptElementBase,
                                public ScriptElement
 {
 protected:
   friend nsresult (::NS_NewSVGScriptElement(nsIContent **aResult,
                                             already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                                             mozilla::dom::FromParser aFromParser));
-  SVGScriptElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+  SVGScriptElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                    FromParser aFromParser);
 
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   // interfaces:
 
   NS_DECL_ISUPPORTS_INHERITED
--- a/dom/svg/SVGSetElement.cpp
+++ b/dom/svg/SVGSetElement.cpp
@@ -16,18 +16,18 @@ JSObject*
 SVGSetElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return SVGSetElement_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGSetElement::SVGSetElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGAnimationElement(aNodeInfo)
+SVGSetElement::SVGSetElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGAnimationElement(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGSetElement)
 
--- a/dom/svg/SVGSetElement.h
+++ b/dom/svg/SVGSetElement.h
@@ -15,17 +15,17 @@ nsresult NS_NewSVGSetElement(nsIContent 
                              already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
 class SVGSetElement final : public SVGAnimationElement
 {
 protected:
-  explicit SVGSetElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGSetElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
   nsSMILSetAnimationFunction mAnimationFunction;
 
   friend nsresult (::NS_NewSVGSetElement(nsIContent **aResult,
                                          already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
--- a/dom/svg/SVGStopElement.cpp
+++ b/dom/svg/SVGStopElement.cpp
@@ -19,18 +19,18 @@ SVGStopElement::WrapNode(JSContext *aCx,
 }
 
 nsSVGElement::NumberInfo SVGStopElement::sNumberInfo =
 { &nsGkAtoms::offset, 0, true };
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGStopElement::SVGStopElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGStopElementBase(aNodeInfo)
+SVGStopElement::SVGStopElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGStopElementBase(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGStopElement)
 
--- a/dom/svg/SVGStopElement.h
+++ b/dom/svg/SVGStopElement.h
@@ -18,17 +18,17 @@ typedef nsSVGElement SVGStopElementBase;
 namespace mozilla {
 namespace dom {
 
 class SVGStopElement final : public SVGStopElementBase
 {
 protected:
   friend nsresult (::NS_NewSVGStopElement(nsIContent **aResult,
                                           already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGStopElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGStopElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   // nsIContent interface
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
 
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
--- a/dom/svg/SVGStyleElement.cpp
+++ b/dom/svg/SVGStyleElement.cpp
@@ -38,18 +38,18 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(SVGStyleElement,
                                                 SVGStyleElementBase)
   tmp->nsStyleLinkElement::Unlink();
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGStyleElement::SVGStyleElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGStyleElementBase(aNodeInfo)
+SVGStyleElement::SVGStyleElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGStyleElementBase(std::move(aNodeInfo))
 {
   AddMutationObserver(this);
 }
 
 SVGStyleElement::~SVGStyleElement()
 {
 }
 
--- a/dom/svg/SVGStyleElement.h
+++ b/dom/svg/SVGStyleElement.h
@@ -22,17 +22,17 @@ namespace dom {
 
 class SVGStyleElement final : public SVGStyleElementBase,
                               public nsStyleLinkElement,
                               public nsStubMutationObserver
 {
 protected:
   friend nsresult (::NS_NewSVGStyleElement(nsIContent **aResult,
                                            already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGStyleElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGStyleElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   ~SVGStyleElement();
 
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   NS_DECL_ISUPPORTS_INHERITED
 
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGStyleElement,
--- a/dom/svg/SVGSwitchElement.cpp
+++ b/dom/svg/SVGSwitchElement.cpp
@@ -34,18 +34,18 @@ NS_IMPL_ADDREF_INHERITED(SVGSwitchElemen
 NS_IMPL_RELEASE_INHERITED(SVGSwitchElement,SVGSwitchElementBase)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SVGSwitchElement)
 NS_INTERFACE_MAP_END_INHERITING(SVGSwitchElementBase)
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGSwitchElement::SVGSwitchElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGSwitchElementBase(aNodeInfo)
+SVGSwitchElement::SVGSwitchElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+: SVGSwitchElementBase(std::move(aNodeInfo))
 {
 }
 
 SVGSwitchElement::~SVGSwitchElement()
 {
 }
 
 void
--- a/dom/svg/SVGSwitchElement.h
+++ b/dom/svg/SVGSwitchElement.h
@@ -20,17 +20,17 @@ namespace dom {
 typedef SVGGraphicsElement SVGSwitchElementBase;
 
 class SVGSwitchElement final : public SVGSwitchElementBase
 {
   friend class ::nsSVGSwitchFrame;
 protected:
   friend nsresult (::NS_NewSVGSwitchElement(nsIContent **aResult,
                                             already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGSwitchElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGSwitchElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   ~SVGSwitchElement();
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   nsIContent * GetActiveChild() const
   { return mActiveChild; }
   void MaybeInvalidate();
 
--- a/dom/svg/SVGSymbolElement.cpp
+++ b/dom/svg/SVGSymbolElement.cpp
@@ -22,18 +22,18 @@ SVGSymbolElement::WrapNode(JSContext *aC
 // nsISupports methods
 
 NS_IMPL_ISUPPORTS_INHERITED(SVGSymbolElement, SVGSymbolElementBase,
                             mozilla::dom::SVGTests)
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGSymbolElement::SVGSymbolElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGSymbolElementBase(aNodeInfo)
+SVGSymbolElement::SVGSymbolElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGSymbolElementBase(std::move(aNodeInfo))
 {
 }
 
 SVGSymbolElement::~SVGSymbolElement()
 {
 }
 
 //----------------------------------------------------------------------
--- a/dom/svg/SVGSymbolElement.h
+++ b/dom/svg/SVGSymbolElement.h
@@ -17,17 +17,17 @@ namespace dom {
 
 typedef SVGViewportElement SVGSymbolElementBase;
 
 class SVGSymbolElement final : public SVGSymbolElementBase
 {
 protected:
   friend nsresult (::NS_NewSVGSymbolElement(nsIContent **aResult,
                                             already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGSymbolElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGSymbolElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   ~SVGSymbolElement();
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   // interfaces:
   NS_DECL_ISUPPORTS_INHERITED
 
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
--- a/dom/svg/SVGTSpanElement.cpp
+++ b/dom/svg/SVGTSpanElement.cpp
@@ -17,18 +17,18 @@ SVGTSpanElement::WrapNode(JSContext *aCx
 {
   return SVGTSpanElement_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGTSpanElement::SVGTSpanElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGTSpanElementBase(aNodeInfo)
+SVGTSpanElement::SVGTSpanElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGTSpanElementBase(std::move(aNodeInfo))
 {
 }
 
 nsSVGElement::EnumAttributesInfo
 SVGTSpanElement::GetEnumInfo()
 {
   return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
                             ArrayLength(sEnumInfo));
--- a/dom/svg/SVGTSpanElement.h
+++ b/dom/svg/SVGTSpanElement.h
@@ -17,17 +17,17 @@ namespace dom {
 
 typedef SVGTextPositioningElement SVGTSpanElementBase;
 
 class SVGTSpanElement final : public SVGTSpanElementBase
 {
 protected:
   friend nsresult (::NS_NewSVGTSpanElement(nsIContent **aResult,
                                            already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGTSpanElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGTSpanElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   // nsIContent interface
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
 
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
--- a/dom/svg/SVGTextContentElement.h
+++ b/dom/svg/SVGTextContentElement.h
@@ -44,18 +44,18 @@ public:
   already_AddRefed<nsISVGPoint> GetEndPositionOfChar(uint32_t charnum, ErrorResult& rv);
   MOZ_CAN_RUN_SCRIPT
   already_AddRefed<SVGIRect> GetExtentOfChar(uint32_t charnum, ErrorResult& rv);
   MOZ_CAN_RUN_SCRIPT float GetRotationOfChar(uint32_t charnum, ErrorResult& rv);
   MOZ_CAN_RUN_SCRIPT int32_t GetCharNumAtPosition(nsISVGPoint& point);
 
 protected:
 
-  explicit SVGTextContentElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGTextContentElementBase(aNodeInfo)
+  explicit SVGTextContentElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGTextContentElementBase(std::move(aNodeInfo))
   {}
 
   MOZ_CAN_RUN_SCRIPT SVGTextFrame* GetSVGTextFrame();
   MOZ_CAN_RUN_SCRIPT SVGTextFrame* GetSVGTextFrameForNonLayoutDependentQuery();
   MOZ_CAN_RUN_SCRIPT mozilla::Maybe<int32_t> GetNonLayoutDependentNumberOfChars();
 
   enum { LENGTHADJUST };
   virtual nsSVGEnum* EnumAttributes() = 0;
--- a/dom/svg/SVGTextElement.cpp
+++ b/dom/svg/SVGTextElement.cpp
@@ -16,18 +16,18 @@ JSObject*
 SVGTextElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return SVGTextElement_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGTextElement::SVGTextElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGTextElementBase(aNodeInfo)
+SVGTextElement::SVGTextElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGTextElementBase(std::move(aNodeInfo))
 {
 }
 
 nsSVGElement::EnumAttributesInfo
 SVGTextElement::GetEnumInfo()
 {
   return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
                             ArrayLength(sEnumInfo));
--- a/dom/svg/SVGTextElement.h
+++ b/dom/svg/SVGTextElement.h
@@ -15,17 +15,17 @@ nsresult NS_NewSVGTextElement(nsIContent
 namespace mozilla {
 namespace dom {
 
 typedef SVGTextPositioningElement SVGTextElementBase;
 
 class SVGTextElement final : public SVGTextElementBase
 {
 protected:
-  explicit SVGTextElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGTextElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
   friend nsresult (::NS_NewSVGTextElement(nsIContent **aResult,
                                           already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
 public:
   // nsIContent interface
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
--- a/dom/svg/SVGTextPathElement.cpp
+++ b/dom/svg/SVGTextPathElement.cpp
@@ -80,18 +80,18 @@ nsSVGElement::StringInfo SVGTextPathElem
 {
   { &nsGkAtoms::href, kNameSpaceID_None, true },
   { &nsGkAtoms::href, kNameSpaceID_XLink, true }
 };
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGTextPathElement::SVGTextPathElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGTextPathElementBase(aNodeInfo)
+SVGTextPathElement::SVGTextPathElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGTextPathElementBase(std::move(aNodeInfo))
 {
 }
 
 void
 SVGTextPathElement::HrefAsString(nsAString& aHref)
 {
   if (mStringAttributes[SVGTextPathElement::HREF].IsExplicitlySet()) {
     mStringAttributes[SVGTextPathElement::HREF]
--- a/dom/svg/SVGTextPathElement.h
+++ b/dom/svg/SVGTextPathElement.h
@@ -30,17 +30,17 @@ typedef SVGTextContentElement SVGTextPat
 
 class SVGTextPathElement final : public SVGTextPathElementBase
 {
 friend class ::SVGTextFrame;
 
 protected:
   friend nsresult (::NS_NewSVGTextPathElement(nsIContent **aResult,
                                               already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGTextPathElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGTextPathElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   // nsIContent interface
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
 
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
--- a/dom/svg/SVGTextPositioningElement.h
+++ b/dom/svg/SVGTextPositioningElement.h
@@ -26,18 +26,18 @@ public:
   already_AddRefed<DOMSVGAnimatedLengthList> X();
   already_AddRefed<DOMSVGAnimatedLengthList> Y();
   already_AddRefed<DOMSVGAnimatedLengthList> Dx();
   already_AddRefed<DOMSVGAnimatedLengthList> Dy();
   already_AddRefed<DOMSVGAnimatedNumberList> Rotate();
 
 protected:
 
-  explicit SVGTextPositioningElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGTextPositioningElementBase(aNodeInfo)
+  explicit SVGTextPositioningElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGTextPositioningElementBase(std::move(aNodeInfo))
   {}
 
   virtual LengthListAttributesInfo GetLengthListInfo() override;
   virtual NumberListAttributesInfo GetNumberListInfo() override;
 
   enum { ATTR_X, ATTR_Y, ATTR_DX, ATTR_DY };
   SVGAnimatedLengthList mLengthListAttributes[4];
   static LengthListInfo sLengthListInfo[4];
--- a/dom/svg/SVGTitleElement.cpp
+++ b/dom/svg/SVGTitleElement.cpp
@@ -22,18 +22,18 @@ SVGTitleElement::WrapNode(JSContext *aCx
 // nsISupports methods
 
 NS_IMPL_ISUPPORTS_INHERITED(SVGTitleElement, SVGTitleElementBase,
                             nsIMutationObserver)
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGTitleElement::SVGTitleElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGTitleElementBase(aNodeInfo)
+SVGTitleElement::SVGTitleElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGTitleElementBase(std::move(aNodeInfo))
 {
   AddMutationObserver(this);
 }
 
 SVGTitleElement::~SVGTitleElement()
 {
 }
 
--- a/dom/svg/SVGTitleElement.h
+++ b/dom/svg/SVGTitleElement.h
@@ -19,17 +19,17 @@ namespace mozilla {
 namespace dom {
 
 class SVGTitleElement final : public SVGTitleElementBase,
                               public nsStubMutationObserver
 {
 protected:
   friend nsresult (::NS_NewSVGTitleElement(nsIContent **aResult,
                                            already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGTitleElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGTitleElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   ~SVGTitleElement();
 
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   // interfaces:
 
   NS_DECL_ISUPPORTS_INHERITED
--- a/dom/svg/SVGTransformableElement.h
+++ b/dom/svg/SVGTransformableElement.h
@@ -21,18 +21,18 @@ class SVGAnimatedTransformList;
 class SVGGraphicsElement;
 class SVGMatrix;
 class SVGIRect;
 struct SVGBoundingBoxOptions;
 
 class SVGTransformableElement : public nsSVGElement
 {
 public:
-  explicit SVGTransformableElement(already_AddRefed<dom::NodeInfo>& aNodeInfo)
-    : nsSVGElement(aNodeInfo) {}
+  explicit SVGTransformableElement(already_AddRefed<dom::NodeInfo>&& aNodeInfo)
+    : nsSVGElement(std::move(aNodeInfo)) {}
   virtual ~SVGTransformableElement() {}
 
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override = 0;
 
   // WebIDL
   already_AddRefed<SVGAnimatedTransformList> Transform();
   nsSVGElement* GetNearestViewportElement();
   nsSVGElement* GetFarthestViewportElement();
--- a/dom/svg/SVGUseElement.cpp
+++ b/dom/svg/SVGUseElement.cpp
@@ -69,18 +69,18 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(SVGUseElement,
                                              SVGUseElementBase,
                                              nsIMutationObserver)
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGUseElement::SVGUseElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGUseElementBase(aNodeInfo)
+SVGUseElement::SVGUseElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGUseElementBase(std::move(aNodeInfo))
   , mReferencedElementTracker(this)
 {
 }
 
 SVGUseElement::~SVGUseElement()
 {
   UnlinkSource();
   MOZ_DIAGNOSTIC_ASSERT(
@@ -91,18 +91,17 @@ SVGUseElement::~SVGUseElement()
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 nsresult
 SVGUseElement::Clone(dom::NodeInfo* aNodeInfo, nsINode** aResult) const
 {
   *aResult = nullptr;
-  already_AddRefed<mozilla::dom::NodeInfo> ni = RefPtr<mozilla::dom::NodeInfo>(aNodeInfo).forget();
-  SVGUseElement *it = new SVGUseElement(ni);
+  SVGUseElement *it = new SVGUseElement(do_AddRef(aNodeInfo));
 
   nsCOMPtr<nsINode> kungFuDeathGrip(it);
   nsresult rv1 = it->Init();
   nsresult rv2 = const_cast<SVGUseElement*>(this)->CopyInnerTo(it);
 
   // SVGUseElement specific portion - record who we cloned from
   it->mOriginal = const_cast<SVGUseElement*>(this);
 
--- a/dom/svg/SVGUseElement.h
+++ b/dom/svg/SVGUseElement.h
@@ -34,17 +34,17 @@ typedef SVGGraphicsElement SVGUseElement
 
 class SVGUseElement final : public SVGUseElementBase,
                             public nsStubMutationObserver
 {
   friend class ::nsSVGUseFrame;
 protected:
   friend nsresult (::NS_NewSVGUseElement(nsIContent **aResult,
                                          already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
-  explicit SVGUseElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGUseElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   virtual ~SVGUseElement();
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   NS_IMPL_FROMNODE_WITH_TAG(SVGUseElement, kNameSpaceID_SVG, use)
 
   nsresult BindToTree(nsIDocument* aDocument,
                       nsIContent* aParent,
--- a/dom/svg/SVGViewElement.cpp
+++ b/dom/svg/SVGViewElement.cpp
@@ -32,18 +32,18 @@ nsSVGElement::EnumInfo SVGViewElement::s
     sZoomAndPanMap,
     SVG_ZOOMANDPAN_MAGNIFY
   }
 };
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGViewElement::SVGViewElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGViewElementBase(aNodeInfo)
+SVGViewElement::SVGViewElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGViewElementBase(std::move(aNodeInfo))
 {
 }
 
 //----------------------------------------------------------------------
 // nsINode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGViewElement)
 
--- a/dom/svg/SVGViewElement.h
+++ b/dom/svg/SVGViewElement.h
@@ -28,17 +28,17 @@ class SVGViewportElement;
 
 class SVGViewElement : public SVGViewElementBase
 {
 protected:
   friend class mozilla::SVGFragmentIdentifier;
   friend class SVGSVGElement;
   friend class SVGViewportElement;
   friend class ::nsSVGOuterSVGFrame;
-  explicit SVGViewElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  explicit SVGViewElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   friend nsresult (::NS_NewSVGViewElement(nsIContent **aResult,
                                           already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
 public:
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
   // WebIDL
--- a/dom/svg/SVGViewportElement.cpp
+++ b/dom/svg/SVGViewportElement.cpp
@@ -44,18 +44,18 @@ nsSVGElement::LengthInfo SVGViewportElem
   { &nsGkAtoms::y, 0, SVGLength_Binding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
   { &nsGkAtoms::width, 100, SVGLength_Binding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
   { &nsGkAtoms::height, 100, SVGLength_Binding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
 };
 
 //----------------------------------------------------------------------
 // Implementation
 
-SVGViewportElement::SVGViewportElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : SVGGraphicsElement(aNodeInfo),
+SVGViewportElement::SVGViewportElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : SVGGraphicsElement(std::move(aNodeInfo)),
     mViewportWidth(0),
     mViewportHeight(0),
     mHasChildrenOnlyTransform(false)
 {
 }
 
 SVGViewportElement::~SVGViewportElement()
 {
--- a/dom/svg/SVGViewportElement.h
+++ b/dom/svg/SVGViewportElement.h
@@ -48,17 +48,17 @@ public:
 
 class SVGViewportElement : public SVGGraphicsElement
 {
   friend class ::nsSVGOuterSVGFrame;
   friend class ::nsSVGViewportFrame;
 
 protected:
 
-  SVGViewportElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  SVGViewportElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
   ~SVGViewportElement();
 
 public:
 
   // nsIContent interface
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
 
   // nsSVGElement specializations:
--- a/dom/svg/nsSVGElement.cpp
+++ b/dom/svg/nsSVGElement.cpp
@@ -65,17 +65,17 @@ using namespace mozilla::dom::SVGUnitTyp
 //   nsSVGElement::GetAnimated{Length,Number,Integer}Values
 // See bug 547964 for details:
 static_assert(sizeof(void*) == sizeof(nullptr),
               "nullptr should be the correct size");
 
 nsresult
 NS_NewSVGElement(Element **aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
 {
-  RefPtr<nsSVGElement> it = new nsSVGElement(aNodeInfo);
+  RefPtr<nsSVGElement> it = new nsSVGElement(std::move(aNodeInfo));
   nsresult rv = it->Init();
 
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   it.forget(aResult);
   return rv;
@@ -84,18 +84,18 @@ NS_NewSVGElement(Element **aResult, alre
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGElement)
 
 nsSVGEnumMapping nsSVGElement::sSVGUnitTypesMap[] = {
   {&nsGkAtoms::userSpaceOnUse, SVG_UNIT_TYPE_USERSPACEONUSE},
   {&nsGkAtoms::objectBoundingBox, SVG_UNIT_TYPE_OBJECTBOUNDINGBOX},
   {nullptr, 0}
 };
 
-nsSVGElement::nsSVGElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsSVGElementBase(aNodeInfo)
+nsSVGElement::nsSVGElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+  : nsSVGElementBase(std::move(aNodeInfo))
 {
 }
 
 nsSVGElement::~nsSVGElement()
 {
   OwnerDoc()->UnscheduleSVGForPresAttrEvaluation(this);
 }
 
--- a/dom/svg/nsSVGElement.h
+++ b/dom/svg/nsSVGElement.h
@@ -62,17 +62,17 @@ class DOMSVGStringList;
 
 struct nsSVGEnumMapping;
 
 typedef nsStyledElement nsSVGElementBase;
 
 class nsSVGElement : public nsSVGElementBase    // nsIContent
 {
 protected:
-  explicit nsSVGElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  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();
 
 public:
 
   virtual nsresult Clone(mozilla::dom::NodeInfo*, nsINode** aResult) const
@@ -636,18 +636,18 @@ private:
 /**
  * A macro to implement the NS_NewSVGXXXElement() functions.
  */
 #define NS_IMPL_NS_NEW_SVG_ELEMENT(_elementName)                             \
 nsresult                                                                     \
 NS_NewSVG##_elementName##Element(nsIContent **aResult,                       \
                                  already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)  \
 {                                                                            \
-  RefPtr<nsSVG##_elementName##Element> it =                                \
-    new nsSVG##_elementName##Element(aNodeInfo);                             \
+  RefPtr<nsSVG##_elementName##Element> it =                                  \
+    new nsSVG##_elementName##Element(std::move(aNodeInfo));                  \
                                                                              \
   nsresult rv = it->Init();                                                  \
                                                                              \
   if (NS_FAILED(rv)) {                                                       \
     return rv;                                                               \
   }                                                                          \
                                                                              \
   it.forget(aResult);                                                        \
@@ -655,18 +655,18 @@ NS_NewSVG##_elementName##Element(nsICont
   return rv;                                                                 \
 }
 
 #define NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(_elementName)                  \
 nsresult                                                                     \
 NS_NewSVG##_elementName##Element(nsIContent **aResult,                       \
                                  already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)  \
 {                                                                            \
-  RefPtr<mozilla::dom::SVG##_elementName##Element> it =                    \
-    new mozilla::dom::SVG##_elementName##Element(aNodeInfo);                 \
+  RefPtr<mozilla::dom::SVG##_elementName##Element> it =                      \
+    new mozilla::dom::SVG##_elementName##Element(std::move(aNodeInfo));      \
                                                                              \
   nsresult rv = it->Init();                                                  \
                                                                              \
   if (NS_FAILED(rv)) {                                                       \
     return rv;                                                               \
   }                                                                          \
                                                                              \
   it.forget(aResult);                                                        \
@@ -675,18 +675,19 @@ NS_NewSVG##_elementName##Element(nsICont
 }
 
 #define NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT_CHECK_PARSER(_elementName)     \
 nsresult                                                                     \
 NS_NewSVG##_elementName##Element(nsIContent **aResult,                       \
                                  already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,  \
                                  mozilla::dom::FromParser aFromParser)       \
 {                                                                            \
-  RefPtr<mozilla::dom::SVG##_elementName##Element> it =                    \
-    new mozilla::dom::SVG##_elementName##Element(aNodeInfo, aFromParser);    \
+  RefPtr<mozilla::dom::SVG##_elementName##Element> it =                      \
+    new mozilla::dom::SVG##_elementName##Element(std::move(aNodeInfo),       \
+                                                 aFromParser);               \
                                                                              \
   nsresult rv = it->Init();                                                  \
                                                                              \
   if (NS_FAILED(rv)) {                                                       \
     return rv;                                                               \
   }                                                                          \
                                                                              \
   it.forget(aResult);                                                        \
--- a/dom/svg/nsSVGFilters.h
+++ b/dom/svg/nsSVGFilters.h
@@ -45,18 +45,18 @@ class nsSVGFE : public nsSVGFEBase
 
 protected:
   typedef mozilla::gfx::SourceSurface SourceSurface;
   typedef mozilla::gfx::Size Size;
   typedef mozilla::gfx::IntRect IntRect;
   typedef mozilla::gfx::ColorSpace ColorSpace;
   typedef mozilla::gfx::FilterPrimitiveDescription FilterPrimitiveDescription;
 
-  explicit nsSVGFE(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsSVGFEBase(aNodeInfo) {}
+  explicit nsSVGFE(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsSVGFEBase(std::move(aNodeInfo)) {}
   virtual ~nsSVGFE() {}
 
 public:
   typedef mozilla::gfx::PrimitiveAttributes PrimitiveAttributes;
 
   ColorSpace
   GetInputColorSpace(int32_t aInputIndex, ColorSpace aUnchangedInputColorSpace) {
     return OperatesOnSRGB(aInputIndex, aUnchangedInputColorSpace == ColorSpace::SRGB) ?
@@ -150,18 +150,18 @@ protected:
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsSVGFE, NS_SVG_FE_CID)
 
 typedef nsSVGElement SVGFEUnstyledElementBase;
 
 class SVGFEUnstyledElement : public SVGFEUnstyledElementBase
 {
 protected:
-  explicit SVGFEUnstyledElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFEUnstyledElementBase(aNodeInfo) {}
+  explicit SVGFEUnstyledElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFEUnstyledElementBase(std::move(aNodeInfo)) {}
 
 public:
   virtual nsresult Clone(mozilla::dom::NodeInfo*, nsINode** aResult) const override = 0;
 
   // returns true if changes to the attribute should cause us to
   // repaint the filter
   virtual bool AttributeAffectsRendering(
           int32_t aNameSpaceID, nsAtom* aAttribute) const = 0;
@@ -169,18 +169,18 @@ public:
 
 //------------------------------------------------------------
 
 typedef nsSVGFE nsSVGFELightingElementBase;
 
 class nsSVGFELightingElement : public nsSVGFELightingElementBase
 {
 protected:
-  explicit nsSVGFELightingElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsSVGFELightingElementBase(aNodeInfo) {}
+  explicit nsSVGFELightingElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsSVGFELightingElementBase(std::move(aNodeInfo)) {}
 
   virtual ~nsSVGFELightingElement() {}
 
 public:
   // interfaces:
   NS_INLINE_DECL_REFCOUNTING_INHERITED(nsSVGFELightingElement,
                                        nsSVGFELightingElementBase)
 
@@ -220,18 +220,18 @@ protected:
 namespace mozilla {
 namespace dom {
 
 typedef SVGFEUnstyledElement SVGFELightElementBase;
 
 class SVGFELightElement : public SVGFELightElementBase
 {
 protected:
-  explicit SVGFELightElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : SVGFELightElementBase(aNodeInfo) {}
+  explicit SVGFELightElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : SVGFELightElementBase(std::move(aNodeInfo)) {}
 
 public:
   typedef gfx::PrimitiveAttributes PrimitiveAttributes;
 
   virtual mozilla::gfx::LightType ComputeLightAttributes(nsSVGFilterInstance* aInstance,
                                                          nsTArray<float>& aFloatAttributes) = 0;
 };
 
--- a/dom/xbl/XBLChildrenElement.h
+++ b/dom/xbl/XBLChildrenElement.h
@@ -14,22 +14,18 @@
 class nsAnonymousContentList;
 
 namespace mozilla {
 namespace dom {
 
 class XBLChildrenElement : public nsXMLElement
 {
 public:
-  explicit XBLChildrenElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsXMLElement(aNodeInfo)
-  {
-  }
   explicit XBLChildrenElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
-    : nsXMLElement(aNodeInfo)
+    : nsXMLElement(std::move(aNodeInfo))
   {
   }
 
   // nsISupports
   NS_INLINE_DECL_REFCOUNTING_INHERITED(XBLChildrenElement, nsXMLElement)
 
   // nsINode interface methods
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
--- a/dom/xml/CDATASection.h
+++ b/dom/xml/CDATASection.h
@@ -20,18 +20,18 @@ private:
   {
     MOZ_ASSERT(mNodeInfo->NodeType() == CDATA_SECTION_NODE,
                "Bad NodeType in aNodeInfo");
   }
 
   virtual ~CDATASection();
 
 public:
-  explicit CDATASection(already_AddRefed<mozilla::dom::NodeInfo> aNodeInfo)
-    : Text(aNodeInfo)
+  explicit CDATASection(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : Text(std::move(aNodeInfo))
   {
     Init();
   }
 
   explicit CDATASection(nsNodeInfoManager* aNodeInfoManager)
     : Text(aNodeInfoManager->GetNodeInfo(nsGkAtoms::cdataTagName,
                                          nullptr, kNameSpaceID_None,
                                          CDATA_SECTION_NODE))
--- a/dom/xml/nsXMLElement.cpp
+++ b/dom/xml/nsXMLElement.cpp
@@ -11,18 +11,18 @@
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 nsresult
 NS_NewXMLElement(Element** aInstancePtrResult,
                  already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
 {
-  nsXMLElement* it = new nsXMLElement(aNodeInfo);
-  NS_ADDREF(*aInstancePtrResult = it);
+  RefPtr<nsXMLElement> it = new nsXMLElement(std::move(aNodeInfo));
+  it.forget(aInstancePtrResult);
   return NS_OK;
 }
 
 JSObject*
 nsXMLElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return Element_Binding::Wrap(aCx, this, aGivenProto);
 }
--- a/dom/xml/nsXMLElement.h
+++ b/dom/xml/nsXMLElement.h
@@ -9,18 +9,18 @@
 
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/DOMRect.h"
 
 class nsXMLElement : public mozilla::dom::Element
 {
 public:
-  explicit nsXMLElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : mozilla::dom::Element(aNodeInfo)
+  explicit nsXMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : mozilla::dom::Element(std::move(aNodeInfo))
   {
   }
 
   // nsISupports
   NS_INLINE_DECL_REFCOUNTING_INHERITED(nsXMLElement, mozilla::dom::Element)
 
   // nsINode interface methods
   virtual nsresult Clone(mozilla::dom::NodeInfo*, nsINode **aResult) const override;
--- a/dom/xul/XULFrameElement.h
+++ b/dom/xul/XULFrameElement.h
@@ -20,18 +20,18 @@ class nsFrameLoader;
 
 namespace mozilla {
 namespace dom {
 
 class XULFrameElement final : public nsXULElement,
                               public nsIFrameLoaderOwner
 {
 public:
-  explicit XULFrameElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsXULElement(aNodeInfo)
+  explicit XULFrameElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsXULElement(std::move(aNodeInfo))
   {
   }
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULFrameElement, nsXULElement)
 
   // XULFrameElement.webidl
   nsIDocShell* GetDocShell();
--- a/dom/xul/XULMenuElement.h
+++ b/dom/xul/XULMenuElement.h
@@ -13,18 +13,18 @@ namespace mozilla {
 namespace dom {
 
 class KeyboardEvent;
 
 class XULMenuElement final : public nsXULElement
 {
 public:
 
-  explicit XULMenuElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsXULElement(aNodeInfo)
+  explicit XULMenuElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsXULElement(std::move(aNodeInfo))
   {
   }
 
   MOZ_CAN_RUN_SCRIPT already_AddRefed<Element> GetActiveChild();
   MOZ_CAN_RUN_SCRIPT void SetActiveChild(Element* arg);
   MOZ_CAN_RUN_SCRIPT bool HandleKeyPress(KeyboardEvent& keyEvent);
   MOZ_CAN_RUN_SCRIPT bool OpenedWithKey();
 
--- a/dom/xul/XULPopupElement.cpp
+++ b/dom/xul/XULPopupElement.cpp
@@ -19,17 +19,17 @@
 #include "mozilla/dom/XULPopupElementBinding.h"
 
 namespace mozilla {
 namespace dom {
 
 nsXULElement*
 NS_NewXULPopupElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
 {
-  return new XULPopupElement(aNodeInfo);
+  return new XULPopupElement(std::move(aNodeInfo));
 }
 
 JSObject*
 XULPopupElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return XULPopupElement_Binding::Wrap(aCx, this, aGivenProto);
 }
 
--- a/dom/xul/XULPopupElement.h
+++ b/dom/xul/XULPopupElement.h
@@ -28,18 +28,18 @@ nsXULElement*
 NS_NewXULPopupElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 class XULPopupElement final : public nsXULElement
 {
 private:
   nsIFrame* GetFrame(bool aFlushLayout);
 
 public:
-  explicit XULPopupElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsXULElement(aNodeInfo)
+  explicit XULPopupElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsXULElement(std::move(aNodeInfo))
   {
   }
 
   void GetLabel(DOMString& aValue) const
   {
       GetXULAttr(nsGkAtoms::label, aValue);
   }
   void SetLabel(const nsAString& aValue, ErrorResult& rv)
--- a/dom/xul/XULScrollElement.h
+++ b/dom/xul/XULScrollElement.h
@@ -12,17 +12,18 @@
 
 namespace mozilla {
 namespace dom {
 
 
 class XULScrollElement final : public nsXULElement
 {
 public:
-  explicit XULScrollElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo): nsXULElement(aNodeInfo)
+  explicit XULScrollElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsXULElement(std::move(aNodeInfo))
   {
   }
 
   MOZ_CAN_RUN_SCRIPT void ScrollByIndex(int32_t aIndex, ErrorResult& aRv);
   MOZ_CAN_RUN_SCRIPT void EnsureElementIsVisible(Element& aChild, ErrorResult& aRv);
   MOZ_CAN_RUN_SCRIPT void ScrollToElement(Element& child, ErrorResult& aRv);
 
 protected:
--- a/dom/xul/nsXULElement.cpp
+++ b/dom/xul/nsXULElement.cpp
@@ -98,18 +98,18 @@ uint32_t             nsXULPrototypeAttri
 #endif
 
 #define NS_DISPATCH_XUL_COMMAND     (1 << 0)
 
 //----------------------------------------------------------------------
 // nsXULElement
 //
 
-nsXULElement::nsXULElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-    : nsStyledElement(aNodeInfo),
+nsXULElement::nsXULElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
+    : nsStyledElement(std::move(aNodeInfo)),
       mBindingParent(nullptr)
 {
     XUL_PROTOTYPE_ATTRIBUTE_METER(gNumElements);
 
     // We may be READWRITE by default; check.
     if (IsReadWriteTextElement()) {
         AddStatesSilently(NS_EVENT_STATE_MOZ_READWRITE);
         RemoveStatesSilently(NS_EVENT_STATE_MOZ_READONLY);
@@ -134,46 +134,43 @@ nsXULElement::MaybeUpdatePrivateLifetime
     if (docShell) {
         docShell->SetAffectPrivateSessionLifetime(false);
     }
 }
 
 /* static */
 nsXULElement* NS_NewBasicXULElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
 {
-  return new nsXULElement(aNodeInfo);
+    return new nsXULElement(std::move(aNodeInfo));
 }
 
  /* static */
 nsXULElement* nsXULElement::Construct(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
 {
   RefPtr<mozilla::dom::NodeInfo> nodeInfo = aNodeInfo;
   if (nodeInfo->Equals(nsGkAtoms::menupopup) ||
       nodeInfo->Equals(nsGkAtoms::popup) ||
       nodeInfo->Equals(nsGkAtoms::panel) ||
       nodeInfo->Equals(nsGkAtoms::tooltip)) {
     return NS_NewXULPopupElement(nodeInfo.forget());
   }
 
   if (nodeInfo->Equals(nsGkAtoms::iframe) ||
       nodeInfo->Equals(nsGkAtoms::browser) ||
       nodeInfo->Equals(nsGkAtoms::editor)) {
-    already_AddRefed<mozilla::dom::NodeInfo> frameni = nodeInfo.forget();
-    return new XULFrameElement(frameni);
+    return new XULFrameElement(nodeInfo.forget());
   }
 
   if (nodeInfo->Equals(nsGkAtoms::menu) ||
       nodeInfo->Equals(nsGkAtoms::menulist)) {
-    already_AddRefed<mozilla::dom::NodeInfo> menuni = nodeInfo.forget();
-    return new XULMenuElement(menuni);
+    return new XULMenuElement(nodeInfo.forget());
   }
 
   if (nodeInfo->Equals(nsGkAtoms::scrollbox)) {
-    already_AddRefed<mozilla::dom::NodeInfo> scrollni = nodeInfo.forget();
-    return new XULScrollElement(scrollni);
+    return new XULScrollElement(nodeInfo.forget());
   }
 
   return NS_NewBasicXULElement(nodeInfo.forget());
 }
 
 /* static */
 already_AddRefed<nsXULElement>
 nsXULElement::CreateFromPrototype(nsXULPrototypeElement* aPrototype,
--- a/dom/xul/nsXULElement.h
+++ b/dom/xul/nsXULElement.h
@@ -330,17 +330,17 @@ enum {
 ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 2);
 
 #undef XUL_ELEMENT_FLAG_BIT
 
 class nsXULElement : public nsStyledElement
 {
 protected:
     // Use Construct to construct elements instead of this constructor.
-    explicit nsXULElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+    explicit nsXULElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 public:
     using Element::Blur;
     using Element::Focus;
 
     static nsresult
     CreateFromPrototype(nsXULPrototypeElement* aPrototype,
                         nsIDocument* aDocument,
--- a/layout/generic/DetailsFrame.cpp
+++ b/layout/generic/DetailsFrame.cpp
@@ -96,20 +96,20 @@ DetailsFrame::CreateAnonymousContent(nsT
     return NS_OK;
   }
 
   // The <details> element lacks any direct <summary> child. Create a default
   // <summary> element as an anonymous content.
   nsNodeInfoManager* nodeInfoManager =
     GetContent()->NodeInfo()->NodeInfoManager();
 
-  already_AddRefed<NodeInfo> nodeInfo =
+  RefPtr<NodeInfo> nodeInfo =
     nodeInfoManager->GetNodeInfo(nsGkAtoms::summary, nullptr, kNameSpaceID_XHTML,
                                  nsINode::ELEMENT_NODE);
-  mDefaultSummary = new HTMLSummaryElement(nodeInfo);
+  mDefaultSummary = new HTMLSummaryElement(nodeInfo.forget());
 
   nsAutoString defaultSummaryText;
   nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
                                      "DefaultSummary", defaultSummaryText);
   RefPtr<nsTextNode> description = new nsTextNode(nodeInfoManager);
   description->SetText(defaultSummaryText, false);
   mDefaultSummary->AppendChildTo(description, false);