Bug 1433193 - Follow-up: misc. code improvements in nsMsgCompose.cpp. r=bz
authorJorg K <jorgk@jorgk.com>
Wed, 31 Jan 2018 01:30:37 +0100
changeset 31007 702ee21341981524ced85e7510a7a9dc67adc3ff
parent 31006 22d78d1bbe82d8a2038cbb104386c8e7363c13b0
child 31008 bf44c504950025c237732469d7d6fa76bb98ee78
push id383
push userclokep@gmail.com
push dateMon, 07 May 2018 21:52:48 +0000
reviewersbz
bugs1433193
Bug 1433193 - Follow-up: misc. code improvements in nsMsgCompose.cpp. r=bz
mailnews/compose/src/nsMsgCompose.cpp
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -313,17 +313,16 @@ nsresult nsMsgCompose::ResetUrisForEmbed
 
   nsresult rv = mailEditor->GetEmbeddedObjects(getter_AddRefs(aNodeList));
   if (NS_FAILED(rv) || !aNodeList)
     return NS_ERROR_FAILURE;
 
   if (NS_FAILED(aNodeList->GetLength(&numNodes)))
     return NS_ERROR_FAILURE;
 
-  nsCOMPtr<nsIDOMNode> node;
   nsCString curDraftIdURL;
 
   rv = m_compFields->GetDraftId(getter_Copies(curDraftIdURL));
 
   // Skip if no draft id (probably a new draft msg).
   if (NS_SUCCEEDED(rv) && mMsgSend && !curDraftIdURL.IsEmpty())
   {
     nsCOMPtr <nsIMsgDBHdr> msgDBHdr;
@@ -528,18 +527,16 @@ nsMsgCompose::InsertDivWrappedTextAtSele
   nsCOMPtr<nsIDOMElement> divElem;
   nsCOMPtr<nsIHTMLEditor> htmlEditor(do_QueryInterface(m_editor));
 
   nsresult rv = htmlEditor->CreateElementWithDefaults(NS_LITERAL_STRING("div"),
                                                       getter_AddRefs(divElem));
 
   NS_ENSURE_SUCCESS_VOID(rv);
 
-  nsCOMPtr<nsIDOMNode> divNode (do_QueryInterface(divElem));
-
   // We need the document
   nsCOMPtr<nsIDOMDocument> doc;
   rv = m_editor->GetDocument(getter_AddRefs(doc));
   NS_ENSURE_SUCCESS_VOID(rv);
 
   // Break up the text by newlines, and then insert text nodes followed
   // by <br> nodes.
   int32_t start = 0;
@@ -581,17 +578,17 @@ nsMsgCompose::InsertDivWrappedTextAtSele
     if (start == end)
       break;
   }
 
   htmlEditor->InsertElementAtSelection(divElem, true);
   nsCOMPtr<nsINode> parent;
   int32_t offset;
 
-  rv = GetNodeLocation(divNode, address_of(parent), &offset);
+  rv = GetNodeLocation(divElem, address_of(parent), &offset);
   if (NS_SUCCEEDED(rv))
   {
     nsCOMPtr<nsISelection> selection;
     m_editor->GetSelection(getter_AddRefs(selection));
 
     if (selection)
       selection->CollapseNative(parent, offset + 1);
   }
@@ -5350,18 +5347,16 @@ nsMsgCompose::DetermineHTMLAction(int32_
 // Helper function. Parameters are not checked.
 nsresult nsMsgCompose::TagConvertible(Element *node,  int32_t *_retval)
 {
     *_retval = nsIMsgCompConvertible::No;
 
     nsAutoString element;
     element = node->NodeName();
 
-    nsCOMPtr<nsIDOMNode> pItem;
-
     // A style attribute on any element can change layout in any way,
     // so that is not convertible.
     nsAutoString attribValue;
     node->GetAttribute(NS_LITERAL_STRING("style"), attribValue);
     if (!attribValue.IsEmpty())
     {
       *_retval = nsIMsgCompConvertible::No;
       return NS_OK;