Bug 1564449, ensure the right body element is used throughout the method call, r=mccr8 a=pascalc
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Tue, 06 Aug 2019 16:43:01 +0300
changeset 544991 f31f9a54b70eaf33787e07774b0172900c8b43dd
parent 544990 04b175b789280543e5fbc6fe00d3fe22a9d93d3f
child 544992 8055f364e2cc60f0f721ec2694f684b715a2c037
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8, pascalc
bugs1564449
milestone69.0
Bug 1564449, ensure the right body element is used throughout the method call, r=mccr8 a=pascalc
dom/html/ImageDocument.cpp
dom/html/PluginDocument.cpp
dom/html/VideoDocument.cpp
--- a/dom/html/ImageDocument.cpp
+++ b/dom/html/ImageDocument.cpp
@@ -652,17 +652,17 @@ void ImageDocument::UpdateSizeFromLayout
 }
 
 nsresult ImageDocument::CreateSyntheticDocument() {
   // Synthesize an html document that refers to the image
   nsresult rv = MediaDocument::CreateSyntheticDocument();
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Add the image element
-  Element* body = GetBodyElement();
+  RefPtr<Element> body = GetBodyElement();
   if (!body) {
     NS_WARNING("no body on image document!");
     return NS_ERROR_FAILURE;
   }
 
   RefPtr<mozilla::dom::NodeInfo> nodeInfo;
   nodeInfo = mNodeInfoManager->GetNodeInfo(
       nsGkAtoms::img, nullptr, kNameSpaceID_XHTML, nsINode::ELEMENT_NODE);
--- a/dom/html/PluginDocument.cpp
+++ b/dom/html/PluginDocument.cpp
@@ -185,17 +185,17 @@ nsresult PluginDocument::CreateSynthetic
   NS_ASSERTION(!GetPresShell() || !GetPresShell()->DidInitialize(),
                "Creating synthetic plugin document content too late");
 
   // make our generic document
   nsresult rv = MediaDocument::CreateSyntheticDocument();
   NS_ENSURE_SUCCESS(rv, rv);
   // then attach our plugin
 
-  Element* body = GetBodyElement();
+  RefPtr<Element> body = GetBodyElement();
   if (!body) {
     NS_WARNING("no body on plugin document!");
     return NS_ERROR_FAILURE;
   }
 
   // remove margins from body
   NS_NAMED_LITERAL_STRING(zero, "0");
   body->SetAttr(kNameSpaceID_None, nsGkAtoms::marginwidth, zero, false);
--- a/dom/html/VideoDocument.cpp
+++ b/dom/html/VideoDocument.cpp
@@ -97,17 +97,17 @@ void VideoDocument::SetScriptGlobalObjec
       LinkScript(NS_LITERAL_STRING(
           "chrome://global/content/TopLevelVideoDocument.js"));
     }
     InitialSetupDone();
   }
 }
 
 nsresult VideoDocument::CreateVideoElement() {
-  Element* body = GetBodyElement();
+  RefPtr<Element> body = GetBodyElement();
   if (!body) {
     NS_WARNING("no body on video document!");
     return NS_ERROR_FAILURE;
   }
 
   // make content
   RefPtr<mozilla::dom::NodeInfo> nodeInfo;
   nodeInfo = mNodeInfoManager->GetNodeInfo(