Bug 1465875 followup. Fix some Android code that ends up with null elements and was getting false from instanceof as a result. r=bzbarsky
authorBoris Zbarsky <bzbarsky@mit.edu>
Sat, 02 Jun 2018 00:53:22 -0400
changeset 420968 3398f70632d6afa9c6de0ec89903fe5833573761
parent 420967 5aebceb74c3a300842742f0dcc2cbee67da31d97
child 420969 4aed3a8d30d84131ff5af1900ea4e2d6a6fc7d1d
push id34083
push userapavel@mozilla.com
push dateSat, 02 Jun 2018 23:03:25 +0000
treeherdermozilla-central@1f62ecdf59b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1465875
milestone62.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 1465875 followup. Fix some Android code that ends up with null elements and was getting false from instanceof as a result. r=bzbarsky
mobile/android/chrome/geckoview/GeckoViewSelectionActionContent.js
mobile/android/modules/ActionBarHandler.jsm
--- a/mobile/android/chrome/geckoview/GeckoViewSelectionActionContent.js
+++ b/mobile/android/chrome/geckoview/GeckoViewSelectionActionContent.js
@@ -72,17 +72,17 @@ class GeckoViewSelectionActionContent ex
     return win && win.HTMLInputElement &&
            focus instanceof win.HTMLInputElement &&
            !focus.mozIsTextField(/* excludePassword */ true);
   }
 
   _getSelectionController(aEvent) {
     if (aEvent.selectionEditable) {
       const focus = aEvent.target.activeElement;
-      if (focus.editor) {
+      if (focus && focus.editor) {
         return focus.editor.selectionController;
       }
     }
 
     return aEvent.target.defaultView
                  .QueryInterface(Ci.nsIInterfaceRequestor)
                  .getInterface(Ci.nsIDocShell)
                  .QueryInterface(Ci.nsIInterfaceRequestor)
--- a/mobile/android/modules/ActionBarHandler.jsm
+++ b/mobile/android/modules/ActionBarHandler.jsm
@@ -755,16 +755,19 @@ var ActionBarHandler = {
     // Return explicitly selected text.
     return selection.toString();
   },
 
   /**
    * Tests whether a given element is editable.
    */
   _isElementEditable: function(element) {
+    if (!element) {
+      return false;
+    }
     let elementClass = ChromeUtils.getClassName(element);
     return elementClass === "HTMLInputElement" ||
            elementClass === "HTMLTextAreaElement";
   },
 
   /**
    * Provides the Selection for either an editor, or from the
    * default window.