Bug 1451627 - Don't use SelectionActionDelegate in Fennec; r=esawin
authorJim Chen <nchen@mozilla.com>
Mon, 09 Apr 2018 10:13:02 -0400
changeset 412391 8141ec5c350fe729be7a3a65319da423632324c4
parent 412390 9daab48cb181e45db80d3ee9a4970abef5d18c48
child 412392 3f4e7771b85c150636f4a1f57ee11a04a2fc5cf4
push id62376
push usernchen@mozilla.com
push dateMon, 09 Apr 2018 14:24:49 +0000
treeherderautoland@8141ec5c350f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersesawin
bugs1451627
milestone61.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 1451627 - Don't use SelectionActionDelegate in Fennec; r=esawin Prevent the mozcaretstatechanged event from reaching GeckoViewSelectionActionContent.js in Fennec, because ActionBarHandler.jsm already handles the event for Fennec. MozReview-Commit-ID: GoLhfz4qrtM
mobile/android/chrome/geckoview/GeckoViewSelectionActionContent.js
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/BasicSelectionActionDelegate.java
mobile/android/modules/ActionBarHandler.jsm
--- a/mobile/android/chrome/geckoview/GeckoViewSelectionActionContent.js
+++ b/mobile/android/chrome/geckoview/GeckoViewSelectionActionContent.js
@@ -113,22 +113,22 @@ class GeckoViewSelectionActionContent ex
       }
     }
 
     return offset;
   }
 
   register() {
     debug("register");
-    addEventListener("mozcaretstatechanged", this);
+    addEventListener("mozcaretstatechanged", this, { mozSystemGroup: true });
   }
 
   unregister() {
     debug("unregister");
-    removeEventListener("mozcaretstatechanged", this);
+    removeEventListener("mozcaretstatechanged", this, { mozSystemGroup: true });
   }
 
   /**
    * Receive and act on AccessibleCarets caret state-change
    * (mozcaretstatechanged) events.
    */
   handleEvent(aEvent) {
     let reason = aEvent.reason;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/BasicSelectionActionDelegate.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/BasicSelectionActionDelegate.java
@@ -128,16 +128,19 @@ public class BasicSelectionActionDelegat
 
     /**
      * Perform the specified action. Override to perform custom actions.
      *
      * @param id Action ID.
      * @return True if the action was performed.
      */
     protected boolean performAction(final String id) {
+        if (mResponse == null) {
+            return false;
+        }
         mResponse.respond(id);
 
         // Android behavior is to clear selection on copy.
         if (ACTION_COPY.equals(id)) {
             if (mUseFloatingToolbar) {
                 clearSelection();
             } else {
                 mActionMode.finish();
--- a/mobile/android/modules/ActionBarHandler.jsm
+++ b/mobile/android/modules/ActionBarHandler.jsm
@@ -45,16 +45,18 @@ var ActionBarHandler = {
   _boundingClientRect: null, // Current selections boundingClientRect.
   _actionBarActions: null, // Most-recent set of actions sent to ActionBar.
 
   /**
    * Receive and act on AccessibleCarets caret state-change
    * (mozcaretstatechanged) events.
    */
   handleEvent: function(e) {
+    e.stopImmediatePropagation();
+
     // Close an open ActionBar, if carets no longer logically visible.
     if (this._selectionID && !e.caretVisible) {
       this._uninit(false);
       return;
     }
 
     if (!this._selectionID && e.collapsed) {
       switch (e.reason) {