Bug 1432944 part 1. Stop returning NS_EDITOR_ELEMENT_NOT_FOUND from nsIHTMLEditor::GetSelectedElement. r=m_kato
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 29 Jan 2018 23:27:58 -0500
changeset 401398 93c1d149d757d49da158cc64f6eb21fb3406da18
parent 401397 49142eb85e3c75c3e2b7bc3db147932042187232
child 401399 15f093275a0df22eca0c4692c1fbc02fa783d593
push id33343
push userrgurzau@mozilla.com
push dateTue, 30 Jan 2018 10:03:41 +0000
treeherdermozilla-central@9746e0a0a81c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1432944
milestone60.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 1432944 part 1. Stop returning NS_EDITOR_ELEMENT_NOT_FOUND from nsIHTMLEditor::GetSelectedElement. r=m_kato The only C++ caller doesn't care, and JS callers can't tell that a non-NS_OK success code was returned anyway. MozReview-Commit-ID: FNhQYR0a9ur
editor/libeditor/HTMLEditor.cpp
editor/nsIHTMLEditor.idl
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -2489,20 +2489,16 @@ HTMLEditor::GetSelectedElement(const nsA
       } else {
         // Should never get here?
         isCollapsed = true;
         NS_WARNING("isCollapsed was FALSE, but no elements found in selection\n");
       }
     }
   }
 
-  if (!bNodeFound) {
-    return NS_SUCCESS_EDITOR_ELEMENT_NOT_FOUND;
-  }
-
   *aReturn = selectedElement;
   if (selectedElement) {
     // Getters must addref
     NS_ADDREF(*aReturn);
   }
   return NS_OK;
 }
 
--- a/editor/nsIHTMLEditor.idl
+++ b/editor/nsIHTMLEditor.idl
@@ -371,18 +371,17 @@ interface nsIHTMLEditor : nsISupports
    *
    * @param aTagName  The HTML tagname or and empty string
    *       to get any element (but only if it is the only element selected)
    *    Special input values for Links and Named anchors:
    *    Use "href" to get a link node
    *      (an "A" tag with the "href" attribute set)
    *    Use "anchor" or "namedanchor" to get a named anchor node
    *      (an "A" tag with the "name" attribute set)
-   * @return          NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found
-   *                  (passes NS_SUCCEEDED macro)
+   * @return the element as described above
    */
   nsIDOMElement getSelectedElement(in AString aTagName);
 
   /**
    * Replace all children of <HEAD> with string of HTML source
    */
   void replaceHeadContentsWithHTML(in AString aSourceToInsert);