Backed out 2 changesets (bug 1471951) for eslint failure at accessible/jsat/ContentControl.jsm:25. CLOSED TREE
authorSebastian Hengst <archaeopteryx@coole-files.de>
Thu, 12 Jul 2018 20:30:43 +0300
changeset 426400 b8c11e672239fa18067c71b6aebb69e0d2abd4d2
parent 426399 78356edc6a51aa44e8ebe92a6c8a1e5f5bdf2798
child 426401 6ee592ecc6ac8016040b5ed3651e1f6a0e5f6e41
push id34271
push userapavel@mozilla.com
push dateThu, 12 Jul 2018 21:52:15 +0000
treeherdermozilla-central@96c61b1dd0a1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1471951
milestone63.0a1
backs out78356edc6a51aa44e8ebe92a6c8a1e5f5bdf2798
a682e5c249b83a550e36e2fa55a8f5b8976f4676
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
Backed out 2 changesets (bug 1471951) for eslint failure at accessible/jsat/ContentControl.jsm:25. CLOSED TREE Backed out changeset 78356edc6a51 (bug 1471951) Backed out changeset a682e5c249b8 (bug 1471951)
accessible/jsat/AccessFu.jsm
accessible/jsat/ContentControl.jsm
accessible/jsat/EventManager.jsm
accessible/jsat/Presentation.jsm
accessible/jsat/Utils.jsm
accessible/tests/mochitest/jsat/test_text_editable_navigation.html
mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/AccessibilityTest.kt
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java
--- a/accessible/jsat/AccessFu.jsm
+++ b/accessible/jsat/AccessFu.jsm
@@ -19,19 +19,17 @@ const GECKOVIEW_MESSAGE = {
   ACTIVATE: "GeckoView:AccessibilityActivate",
   VIEW_FOCUSED: "GeckoView:AccessibilityViewFocused",
   LONG_PRESS: "GeckoView:AccessibilityLongPress",
   BY_GRANULARITY: "GeckoView:AccessibilityByGranularity",
   NEXT: "GeckoView:AccessibilityNext",
   PREVIOUS: "GeckoView:AccessibilityPrevious",
   SCROLL_BACKWARD: "GeckoView:AccessibilityScrollBackward",
   SCROLL_FORWARD: "GeckoView:AccessibilityScrollForward",
-  EXPLORE_BY_TOUCH: "GeckoView:AccessibilityExploreByTouch",
-  SET_SELECTION: "GeckoView:AccessibilitySetSelection",
-  CLIPBOARD: "GeckoView:AccessibilityClipboard",
+  EXPLORE_BY_TOUCH: "GeckoView:AccessibilityExploreByTouch"
 };
 
 var AccessFu = {
   /**
    * A lazy getter for event handler that binds the scope to AccessFu object.
    */
   get handleEvent() {
     delete this.handleEvent;
@@ -264,22 +262,16 @@ var AccessFu = {
         }
         break;
       case GECKOVIEW_MESSAGE.BY_GRANULARITY:
         this.Input.moveByGranularity(data);
         break;
       case GECKOVIEW_MESSAGE.EXPLORE_BY_TOUCH:
         this.Input.moveToPoint("Simple", ...data.coordinates);
         break;
-      case GECKOVIEW_MESSAGE.SET_SELECTION:
-        this.Input.setSelection(data);
-        break;
-      case GECKOVIEW_MESSAGE.CLIPBOARD:
-        this.Input.clipboard(data);
-        break;
     }
   },
 
   observe: function observe(aSubject, aTopic, aData) {
     switch (aTopic) {
       case "remote-browser-shown":
       case "inprocess-browser-shown":
       {
@@ -331,17 +323,17 @@ var AccessFu = {
         break;
       }
       default:
         break;
     }
   },
 
   autoMove: function autoMove(aOptions) {
-    const mm = Utils.getMessageManager();
+    let mm = Utils.getMessageManager();
     mm.sendAsyncMessage("AccessFu:AutoMove", aOptions);
   },
 
   announce: function announce(aAnnouncement) {
     this._output(Presentation.announce(aAnnouncement), Utils.getCurrentBrowser());
   },
 
   // So we don't enable/disable twice
@@ -369,66 +361,56 @@ var AccessFu = {
       bounds = bounds.scale(1 / devicePixelRatio, 1 / devicePixelRatio);
       bounds = bounds.translate(-mozInnerScreenX, -mozInnerScreenY);
       return bounds.expandToIntegers();
     }
 };
 
 var Input = {
   moveToPoint: function moveToPoint(aRule, aX, aY) {
-    const mm = Utils.getMessageManager();
+    let mm = Utils.getMessageManager();
     mm.sendAsyncMessage("AccessFu:MoveToPoint",
       {rule: aRule, x: aX, y: aY, origin: "top"});
   },
 
   moveCursor: function moveCursor(aAction, aRule, aInputType, aAdjustRange) {
-    const mm = Utils.getMessageManager();
+    let mm = Utils.getMessageManager();
     mm.sendAsyncMessage("AccessFu:MoveCursor",
                         { action: aAction, rule: aRule,
                           origin: "top", inputType: aInputType,
                           adjustRange: aAdjustRange });
   },
 
   androidScroll: function androidScroll(aDirection) {
-    const mm = Utils.getMessageManager();
+    let mm = Utils.getMessageManager();
     mm.sendAsyncMessage("AccessFu:AndroidScroll",
                         { direction: aDirection, origin: "top" });
   },
 
   moveByGranularity: function moveByGranularity(aDetails) {
-    const mm = Utils.getMessageManager();
+    let mm = Utils.getMessageManager();
     mm.sendAsyncMessage("AccessFu:MoveByGranularity", aDetails);
   },
 
-  setSelection: function setSelection(aDetails) {
-    const mm = Utils.getMessageManager();
-    mm.sendAsyncMessage("AccessFu:SetSelection", aDetails);
-  },
-
-  clipboard: function clipboard(aDetails) {
-    const mm = Utils.getMessageManager();
-    mm.sendAsyncMessage("AccessFu:Clipboard", aDetails);
-  },
-
   activateCurrent: function activateCurrent(aData, aActivateIfKey = false) {
     let mm = Utils.getMessageManager();
     let offset = 0;
 
     mm.sendAsyncMessage("AccessFu:Activate",
                         {offset, activateIfKey: aActivateIfKey});
   },
 
   // XXX: This is here for backwards compatability with screen reader simulator
   // it should be removed when the extension is updated on amo.
   scroll: function scroll(aPage, aHorizontal) {
     this.sendScrollMessage(aPage, aHorizontal);
   },
 
   sendScrollMessage: function sendScrollMessage(aPage, aHorizontal) {
-    const mm = Utils.getMessageManager();
+    let mm = Utils.getMessageManager();
     mm.sendAsyncMessage("AccessFu:Scroll",
       {page: aPage, horizontal: aHorizontal, origin: "top"});
   },
 
   doScroll: function doScroll(aDetails, aBrowser) {
     let horizontal = aDetails.horizontal;
     let page = aDetails.page;
     let win = aBrowser.ownerGlobal;
--- a/accessible/jsat/ContentControl.jsm
+++ b/accessible/jsat/ContentControl.jsm
@@ -19,35 +19,29 @@ ChromeUtils.defineModuleGetter(this, "Pr
   "resource://gre/modules/accessibility/Presentation.jsm");
 
 var EXPORTED_SYMBOLS = ["ContentControl"];
 
 const MOVEMENT_GRANULARITY_CHARACTER = 1;
 const MOVEMENT_GRANULARITY_WORD = 2;
 const MOVEMENT_GRANULARITY_PARAGRAPH = 8;
 
-const CLIPBOARD_COPY = 0x4000;
-const CLIPBOARD_PASTE = 0x8000;
-const CLIPBOARD_CUT = 0x10000;
-
 function ContentControl(aContentScope) {
   this._contentScope = Cu.getWeakReference(aContentScope);
   this._childMessageSenders = new WeakMap();
 }
 
 this.ContentControl.prototype = {
   messagesOfInterest: ["AccessFu:MoveCursor",
                        "AccessFu:ClearCursor",
                        "AccessFu:MoveToPoint",
                        "AccessFu:AutoMove",
                        "AccessFu:Activate",
                        "AccessFu:MoveByGranularity",
-                       "AccessFu:AndroidScroll",
-                       "AccessFu:SetSelection",
-                       "AccessFu:Clipboard"],
+                       "AccessFu:AndroidScroll"],
 
   start: function cc_start() {
     let cs = this._contentScope.get();
     for (let message of this.messagesOfInterest) {
       cs.addMessageListener(message, this);
     }
   },
 
@@ -302,26 +296,21 @@ this.ContentControl.prototype = {
         "keypress", false, true, null, false, false, false, false, keycode, 0);
       elem.dispatchEvent(evt);
     }
 
     return true;
   },
 
   handleMoveByGranularity: function cc_handleMoveByGranularity(aMessage) {
-    const { direction, granularity, select } = aMessage.json;
-    const focusedAcc =
-      Utils.AccService.getAccessibleFor(this.document.activeElement);
-    const editable =
-      focusedAcc && Utils.getState(focusedAcc).contains(States.EDITABLE) ?
-      focusedAcc.QueryInterface(Ci.nsIAccessibleText) : null;
-
-    if (editable) {
-      const caretOffset = editable.caretOffset;
-      this.vc.setTextRange(editable, caretOffset, caretOffset, false);
+    let { direction, granularity } = aMessage.json;
+    let focusedAcc = Utils.AccService.getAccessibleFor(this.document.activeElement);
+    if (focusedAcc && Utils.getState(focusedAcc).contains(States.EDITABLE)) {
+      this.moveCaret(focusedAcc, direction, granularity);
+      return;
     }
 
     let pivotGranularity;
     switch (granularity) {
       case MOVEMENT_GRANULARITY_CHARACTER:
         pivotGranularity = Ci.nsIAccessiblePivot.CHAR_BOUNDARY;
         break;
       case MOVEMENT_GRANULARITY_WORD:
@@ -331,84 +320,68 @@ this.ContentControl.prototype = {
         return;
     }
 
     if (direction === "Previous") {
       this.vc.movePreviousByText(pivotGranularity);
     } else if (direction === "Next") {
       this.vc.moveNextByText(pivotGranularity);
     }
-
-    if (editable) {
-      const newOffset = direction === "Next" ?
-        this.vc.endOffset : this.vc.startOffset;
-      if (select) {
-        let anchor = editable.caretOffset;
-        if (editable.selectionCount) {
-          const [startSel, endSel] = Utils.getTextSelection(editable);
-          anchor = startSel == anchor ? endSel : startSel;
-        }
-        editable.setSelectionBounds(0, anchor, newOffset);
-      } else {
-        editable.caretOffset = newOffset;
-      }
-    }
-  },
-
-  handleSetSelection: function cc_handleSetSelection(aMessage) {
-    const { start, end } = aMessage.json;
-    const focusedAcc =
-      Utils.AccService.getAccessibleFor(this.document.activeElement);
-    if (focusedAcc) {
-      const accText = focusedAcc.QueryInterface(Ci.nsIAccessibleText);
-      if (start == end) {
-        accText.caretOffset = start;
-      } else {
-        accText.setSelectionBounds(0, start, end);
-      }
-    }
-  },
-
-  handleClipboard: function cc_handleClipboard(aMessage) {
-    const { action } = aMessage.json;
-    const focusedAcc =
-      Utils.AccService.getAccessibleFor(this.document.activeElement);
-    if (focusedAcc) {
-      const [startSel, endSel] = Utils.getTextSelection(focusedAcc);
-      const editText = focusedAcc.QueryInterface(Ci.nsIAccessibleEditableText);
-      switch (action) {
-        case CLIPBOARD_COPY:
-          if (startSel != endSel) {
-            editText.copyText(startSel, endSel);
-          }
-          break;
-        case CLIPBOARD_PASTE:
-          if (startSel != endSel) {
-            editText.deleteText(startSel, endSel);
-          }
-          editText.pasteText(startSel);
-          break;
-        case CLIPBOARD_CUT:
-          if (startSel != endSel) {
-            editText.cutText(startSel, endSel);
-          }
-          break;
-      }
-    }
   },
 
   presentCaretChange: function cc_presentCaretChange(
     aText, aOldOffset, aNewOffset) {
     if (aOldOffset !== aNewOffset) {
       let msg = Presentation.textSelectionChanged(aText, aNewOffset, aNewOffset,
         aOldOffset, aOldOffset, true);
       this._contentScope.get().sendAsyncMessage("AccessFu:Present", msg);
     }
   },
 
+  moveCaret: function cc_moveCaret(accessible, direction, granularity) {
+    let accText = accessible.QueryInterface(Ci.nsIAccessibleText);
+    let oldOffset = accText.caretOffset;
+    let text = accText.getText(0, accText.characterCount);
+
+    let start = {}, end = {};
+    if (direction === "Previous" && oldOffset > 0) {
+      switch (granularity) {
+        case MOVEMENT_GRANULARITY_CHARACTER:
+          accText.caretOffset--;
+          break;
+        case MOVEMENT_GRANULARITY_WORD:
+          accText.getTextBeforeOffset(accText.caretOffset,
+            Ci.nsIAccessibleText.BOUNDARY_WORD_START, start, end);
+          accText.caretOffset = end.value === accText.caretOffset ?
+            start.value : end.value;
+          break;
+        case MOVEMENT_GRANULARITY_PARAGRAPH:
+          let startOfParagraph = text.lastIndexOf("\n", accText.caretOffset - 1);
+          accText.caretOffset = startOfParagraph !== -1 ? startOfParagraph : 0;
+          break;
+      }
+    } else if (direction === "Next" && oldOffset < accText.characterCount) {
+      switch (granularity) {
+        case MOVEMENT_GRANULARITY_CHARACTER:
+          accText.caretOffset++;
+          break;
+        case MOVEMENT_GRANULARITY_WORD:
+          accText.getTextAtOffset(accText.caretOffset,
+                                  Ci.nsIAccessibleText.BOUNDARY_WORD_END, start, end);
+          accText.caretOffset = end.value;
+          break;
+        case MOVEMENT_GRANULARITY_PARAGRAPH:
+          accText.caretOffset = text.indexOf("\n", accText.caretOffset + 1);
+          break;
+      }
+    }
+
+    this.presentCaretChange(text, oldOffset, accText.caretOffset);
+  },
+
   getChildCursor: function cc_getChildCursor(aAccessible) {
     let acc = aAccessible || this.vc.position;
     if (Utils.isAliveAndVisible(acc) && acc.role === Roles.INTERNAL_FRAME) {
       let domNode = acc.DOMNode;
       let mm = this._childMessageSenders.get(domNode, null);
       if (!mm) {
         mm = Utils.getMessageManager(domNode);
         mm.addWeakMessageListener("AccessFu:MoveCursor", this);
@@ -471,17 +444,17 @@ this.ContentControl.prototype = {
       let acc = aAnchor;
       let rule = aOptions.onScreenOnly ?
         TraversalRules.SimpleOnScreen : TraversalRules.Simple;
       let forcePresentFunc = () => {
         if (aOptions.forcePresent) {
           this._contentScope.get().sendAsyncMessage(
             "AccessFu:Present", Presentation.pivotChanged(
               vc.position, null, Ci.nsIAccessiblePivot.REASON_NONE,
-              vc.startOffset, vc.endOffset));
+              vc.startOffset, vc.endOffset, false));
         }
       };
 
       if (aOptions.noOpIfOnScreen &&
         Utils.isAliveAndVisible(vc.position, true)) {
         forcePresentFunc();
         return;
       }
@@ -492,21 +465,21 @@ this.ContentControl.prototype = {
       }
 
       let moved = false;
       let moveMethod = aOptions.moveMethod || "moveNext"; // default is moveNext
       let moveFirstOrLast = moveMethod in ["moveFirst", "moveLast"];
       if (!moveFirstOrLast || acc) {
         // We either need next/previous or there is an anchor we need to use.
         moved = vc[moveFirstOrLast ? "moveNext" : moveMethod](rule, acc, true,
-                                                              true);
+                                                              false);
       }
       if (moveFirstOrLast && !moved) {
         // We move to first/last after no anchor move happened or succeeded.
-        moved = vc[moveMethod](rule, true);
+        moved = vc[moveMethod](rule, false);
       }
 
       let sentToChild = this.sendToChild(vc, {
         name: "AccessFu:AutoMove",
         json: {
           moveMethod: aOptions.moveMethod,
           moveToFocused: aOptions.moveToFocused,
           noOpIfOnScreen: true,
--- a/accessible/jsat/EventManager.jsm
+++ b/accessible/jsat/EventManager.jsm
@@ -131,37 +131,33 @@ this.EventManager.prototype = {
         (aEvent.accessibleDocument.DOMDocument.doctype &&
          aEvent.accessibleDocument.DOMDocument.doctype.name === "window")) {
       return;
     }
 
     switch (aEvent.eventType) {
       case Events.VIRTUALCURSOR_CHANGED:
       {
-        if (!aEvent.isFromUserInput) {
+        let pivot = aEvent.accessible.
+          QueryInterface(Ci.nsIAccessibleDocument).virtualCursor;
+        let position = pivot.position;
+        if (position && position.role == Roles.INTERNAL_FRAME)
           break;
-        }
-
-        const event = aEvent.
+        let event = aEvent.
           QueryInterface(Ci.nsIAccessibleVirtualCursorChangeEvent);
-        const position = event.newAccessible;
+        let reason = event.reason;
+        let oldAccessible = event.oldAccessible;
 
-        // We pass control to the vc in the embedded frame.
-        if (position && position.role == Roles.INTERNAL_FRAME) {
-          break;
-        }
-
-        // Blur to document if new position is not explicitly focused.
         if (!Utils.getState(position).contains(States.FOCUSED)) {
           aEvent.accessibleDocument.takeFocus();
         }
-
         this.present(
-          Presentation.pivotChanged(position, event.oldAccessible, event.reason,
-                                    event.newStartOffset, event.newEndOffset));
+          Presentation.pivotChanged(position, oldAccessible, reason,
+                                    pivot.startOffset, pivot.endOffset,
+                                    aEvent.isFromUserInput));
 
         break;
       }
       case Events.STATE_CHANGE:
       {
         let event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
         let state = Utils.getState(event);
         if (state.contains(States.CHECKED)) {
@@ -209,24 +205,18 @@ this.EventManager.prototype = {
         let caretOffset = aEvent.
           QueryInterface(Ci.nsIAccessibleCaretMoveEvent).caretOffset;
 
         // We could get a caret move in an accessible that is not focused,
         // it doesn't mean we are not on any editable accessible. just not
         // on this one..
         let state = Utils.getState(acc);
         if (state.contains(States.FOCUSED) && state.contains(States.EDITABLE)) {
-          let fromIndex = caretOffset;
-          if (acc.selectionCount) {
-            const [startSel, endSel] = Utils.getTextSelection(acc);
-            fromIndex = startSel == caretOffset ? endSel : startSel;
-          }
-          this.present(Presentation.textSelectionChanged(
-            acc.getText(0, -1), fromIndex, caretOffset, 0, 0,
-            aEvent.isFromUserInput));
+          this.present(Presentation.textSelectionChanged(acc.getText(0, -1),
+            caretOffset, caretOffset, 0, 0, aEvent.isFromUserInput));
         }
         break;
       }
       case Events.SHOW:
       {
         this._handleShow(aEvent);
         break;
       }
--- a/accessible/jsat/Presentation.jsm
+++ b/accessible/jsat/Presentation.jsm
@@ -33,17 +33,17 @@ class AndroidPresentor {
   /**
    * The virtual cursor's position changed.
    * @param {PivotContext} aContext the context object for the new pivot
    *   position.
    * @param {int} aReason the reason for the pivot change.
    *   See nsIAccessiblePivot.
    * @param {bool} aIsFromUserInput the pivot change was invoked by the user
    */
-  pivotChanged(aPosition, aOldPosition, aReason, aStartOffset, aEndOffset) {
+  pivotChanged(aPosition, aOldPosition, aReason, aStartOffset, aEndOffset, aIsUserInput) {
     let context = new PivotContext(
       aPosition, aOldPosition, aStartOffset, aEndOffset);
     if (!context.accessible) {
       return null;
     }
 
     let androidEvents = [];
 
--- a/accessible/jsat/Utils.jsm
+++ b/accessible/jsat/Utils.jsm
@@ -229,28 +229,16 @@ var Utils = { // jshint ignore:line
 
   getBounds: function getBounds(aAccessible) {
     let objX = {}, objY = {}, objW = {}, objH = {};
     aAccessible.getBounds(objX, objY, objW, objH);
 
     return new Rect(objX.value, objY.value, objW.value, objH.value);
   },
 
-  getTextSelection: function getTextSelection(aAccessible) {
-    const accText = aAccessible.QueryInterface(Ci.nsIAccessibleText);
-    const start = {}, end = {};
-    if (accText.selectionCount) {
-      accText.getSelectionBounds(0, start, end);
-    } else {
-      start.value = end.value = accText.caretOffset;
-    }
-
-    return [start.value, end.value];
-  },
-
   getTextBounds: function getTextBounds(aAccessible, aStart, aEnd,
                                         aPreserveContentScale) {
     let accText = aAccessible.QueryInterface(Ci.nsIAccessibleText);
     let objX = {}, objY = {}, objW = {}, objH = {};
     accText.getRangeExtents(aStart, aEnd, objX, objY, objW, objH,
       Ci.nsIAccessibleCoordinateType.COORDTYPE_SCREEN_RELATIVE);
 
     return new Rect(objX.value, objY.value, objW.value, objH.value);
--- a/accessible/tests/mochitest/jsat/test_text_editable_navigation.html
+++ b/accessible/tests/mochitest/jsat/test_text_editable_navigation.html
@@ -60,28 +60,38 @@
       evt = await runner.moveNextByGranularity(MovementGranularity.WORD,
         AndroidEvents.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
         AndroidEvents.VIEW_TEXT_SELECTION_CHANGED);
       checkMoveCaret(...evt, 20, 29);
 
       evt = await runner.moveNextByGranularity(MovementGranularity.WORD,
         AndroidEvents.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
         AndroidEvents.VIEW_TEXT_SELECTION_CHANGED);
-      checkMoveCaret(...evt, 30, 36);
+      checkMoveCaret(...evt, 29, 36);
 
       evt = await runner.moveNextByGranularity(MovementGranularity.CHARACTER,
         AndroidEvents.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
         AndroidEvents.VIEW_TEXT_SELECTION_CHANGED);
       checkMoveCaret(...evt, 36, 37);
 
       evt = await runner.moveNextByGranularity(MovementGranularity.CHARACTER,
         AndroidEvents.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
         AndroidEvents.VIEW_TEXT_SELECTION_CHANGED);
       checkMoveCaret(...evt, 37, 38);
 
+      evt = await runner.moveNextByGranularity(MovementGranularity.PARAGRAPH,
+        AndroidEvents.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
+        AndroidEvents.VIEW_TEXT_SELECTION_CHANGED);
+      checkMoveCaret(...evt, 38, 59);
+
+      evt = await runner.movePreviousByGranularity(MovementGranularity.WORD,
+        AndroidEvents.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
+        AndroidEvents.VIEW_TEXT_SELECTION_CHANGED);
+      checkMoveCaret(...evt, 59, 53);
+
       evt = await runner.blur(AndroidEvents.VIEW_FOCUSED);
       is(evt.editable, false, "Focused out of editable");
     }
 
     function doTest() {
       var doc = currentTabDocument();
 
       addA11yLoadEvent(async function() {
--- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/AccessibilityTest.kt
+++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/AccessibilityTest.kt
@@ -4,17 +4,16 @@
 
 package org.mozilla.geckoview.test
 
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.AssertCalled
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.WithDisplay
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.WithDevToolsAPI
 
 import android.os.Build
-import android.os.Bundle
 
 import android.support.test.filters.MediumTest
 import android.support.test.InstrumentationRegistry
 import android.support.test.runner.AndroidJUnit4
 
 import android.view.accessibility.AccessibilityNodeInfo
 import android.view.accessibility.AccessibilityNodeProvider
 import android.view.accessibility.AccessibilityEvent
@@ -164,89 +163,9 @@ class AccessibilityTest : BaseSessionTes
                 if (Build.VERSION.SDK_INT >= 19) {
                     assertThat("Hint has field name",
                             node.extras.getString("AccessibilityNodeInfo.hint"),
                             equalTo("Name"))
                 }
             }
         })
     }
-
-    private fun waitUntilCaretMoved(fromIndex: Int, toIndex: Int) {
-        sessionRule.waitUntilCalled(object : EventDelegate {
-            @AssertCalled(count = 1)
-            override fun onTextSelectionChanged(event: AccessibilityEvent) {
-                assertThat("fromIndex matches", event.fromIndex, equalTo(fromIndex))
-                assertThat("toIndex matches", event.toIndex, equalTo(toIndex))
-            }
-        })
-    }
-
-    private fun setSelectionArguments(start: Int, end: Int): Bundle {
-        val arguments = Bundle(2)
-        arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, start)
-        arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, end)
-        return arguments
-    }
-
-    @Test fun testClipboard() {
-        var nodeId = AccessibilityNodeProvider.HOST_VIEW_ID;
-        sessionRule.session.loadString("<input value='hello cruel world' id='input'>", "text/html")
-        sessionRule.waitForPageStop()
-
-        mainSession.evaluateJS("$('input').focus()")
-
-        sessionRule.waitUntilCalled(object : EventDelegate {
-            @AssertCalled(count = 1)
-            override fun onAccessibilityFocused(event: AccessibilityEvent) {
-                nodeId = getSourceId(event)
-                val node = provider.createAccessibilityNodeInfo(nodeId)
-                assertThat("Focused EditBox", node.className.toString(),
-                        equalTo("android.widget.EditText"))
-            }
-
-            @AssertCalled(count = 1)
-            override fun onTextSelectionChanged(event: AccessibilityEvent) {
-                assertThat("fromIndex should be at start", event.fromIndex, equalTo(0))
-                assertThat("toIndex should be at start", event.toIndex, equalTo(0))
-            }
-        })
-
-        provider.performAction(nodeId, AccessibilityNodeInfo.ACTION_SET_SELECTION, setSelectionArguments(5, 11))
-        waitUntilCaretMoved(5, 11)
-
-        provider.performAction(nodeId, AccessibilityNodeInfo.ACTION_COPY, null)
-
-        provider.performAction(nodeId, AccessibilityNodeInfo.ACTION_SET_SELECTION, setSelectionArguments(11, 11))
-        waitUntilCaretMoved(11, 11)
-
-        provider.performAction(nodeId, AccessibilityNodeInfo.ACTION_PASTE, null)
-        sessionRule.waitUntilCalled(object : EventDelegate {
-            @AssertCalled(count = 1)
-            override fun onTextChanged(event: AccessibilityEvent) {
-                assertThat("text should be pasted", event.text[0].toString(), equalTo("hello cruel cruel world"))
-            }
-
-            @AssertCalled(count = 1)
-            override fun onTextSelectionChanged(event: AccessibilityEvent) {
-                assertThat("fromIndex should be at end of paste", event.fromIndex, equalTo(17))
-                assertThat("toIndex should be at end of paste", event.toIndex, equalTo(17))
-            }
-        })
-
-        provider.performAction(nodeId, AccessibilityNodeInfo.ACTION_SET_SELECTION, setSelectionArguments(17, 23))
-        waitUntilCaretMoved(17, 23)
-
-        provider.performAction(nodeId, AccessibilityNodeInfo.ACTION_PASTE, null)
-        sessionRule.waitUntilCalled(object : EventDelegate {
-            @AssertCalled
-            override fun onTextChanged(event: AccessibilityEvent) {
-                assertThat("text should be pasted", event.text[0].toString(), equalTo("hello cruel cruel cruel"))
-            }
-
-            @AssertCalled(count = 1)
-            override fun onTextSelectionChanged(event: AccessibilityEvent) {
-                assertThat("fromIndex should be at end of paste", event.fromIndex, equalTo(23))
-                assertThat("toIndex should be at end of paste", event.toIndex, equalTo(23))
-            }
-        })
-    }
-}
+}
\ No newline at end of file
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java
@@ -216,42 +216,22 @@ public class SessionAccessibility {
                             // FAKE_GRANULARITY_CHANGE_SHIFTER = -4
                             int granularity = arguments.getInt(AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT);
                             if (granularity <= BRAILLE_CLICK_BASE_INDEX) {
                                 int keyIndex = BRAILLE_CLICK_BASE_INDEX - granularity;
                                 data = new GeckoBundle(1);
                                 data.putInt("keyIndex", keyIndex);
                                 mSession.getEventDispatcher().dispatch("GeckoView:AccessibilityActivate", data);
                             } else if (granularity > 0) {
-                                boolean extendSelection = arguments.getBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN);
-                                data = new GeckoBundle(3);
+                                data = new GeckoBundle(2);
                                 data.putString("direction", action == AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY ? "Next" : "Previous");
                                 data.putInt("granularity", granularity);
-                                data.putBoolean("select", extendSelection);
                                 mSession.getEventDispatcher().dispatch("GeckoView:AccessibilityByGranularity", data);
                             }
                             return true;
-                        case AccessibilityNodeInfo.ACTION_SET_SELECTION:
-                            if (arguments == null) {
-                                return false;
-                            }
-                            int selectionStart = arguments.getInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT);
-                            int selectionEnd = arguments.getInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT);
-                            data = new GeckoBundle(2);
-                            data.putInt("start", selectionStart);
-                            data.putInt("end", selectionEnd);
-                            mSession.getEventDispatcher().dispatch("GeckoView:AccessibilitySetSelection", data);
-                            return true;
-                        case AccessibilityNodeInfo.ACTION_CUT:
-                        case AccessibilityNodeInfo.ACTION_COPY:
-                        case AccessibilityNodeInfo.ACTION_PASTE:
-                            data = new GeckoBundle(1);
-                            data.putInt("action", action);
-                            mSession.getEventDispatcher().dispatch("GeckoView:AccessibilityClipboard", data);
-                            return true;
                         }
 
                         return mView.performAccessibilityAction(action, arguments);
                     }
 
                     private void assertAttachedView(final View view) {
                         if (view != mView) {
                             throw new AssertionError("delegate used with wrong view.");
@@ -375,38 +355,33 @@ public class SessionAccessibility {
 
     private void populateNodeInfoFromJSON(AccessibilityNodeInfo node, final GeckoBundle message) {
         node.setEnabled(message.getBoolean("enabled", true));
         node.setCheckable(message.getBoolean("checkable"));
         node.setChecked(message.getBoolean("checked"));
         node.setPassword(message.getBoolean("password"));
         node.setFocusable(message.getBoolean("focusable"));
         node.setFocused(message.getBoolean("focused"));
+        if (Build.VERSION.SDK_INT >= 18) {
+            node.setEditable(message.getBoolean("editable"));
+        }
 
         node.setClassName(message.getString("className", "android.view.View"));
 
         final String[] textArray = message.getStringArray("text");
         StringBuilder sb = new StringBuilder();
         if (textArray != null && textArray.length > 0) {
             sb.append(textArray[0] != null ? textArray[0] : "");
             for (int i = 1; i < textArray.length; i++) {
                 sb.append(' ').append(textArray[i] != null ? textArray[i] : "");
             }
             node.setText(sb.toString());
         }
         node.setContentDescription(message.getString("description", ""));
 
-        if (Build.VERSION.SDK_INT >= 18 && message.getBoolean("editable")) {
-            node.addAction(AccessibilityNodeInfo.ACTION_SET_SELECTION);
-            node.addAction(AccessibilityNodeInfo.ACTION_CUT);
-            node.addAction(AccessibilityNodeInfo.ACTION_COPY);
-            node.addAction(AccessibilityNodeInfo.ACTION_PASTE);
-            node.setEditable(true);
-        }
-
         if (message.getBoolean("clickable")) {
             node.setClickable(true);
             node.addAction(AccessibilityNodeInfo.ACTION_CLICK);
         }
 
         if (Build.VERSION.SDK_INT >= 19 && message.containsKey("hint")) {
             Bundle bundle = node.getExtras();
             bundle.putCharSequence("AccessibilityNodeInfo.hint", message.getString("hint"));