Bug 1448367 - Remove some b2g leftover in accessible/ draft
authorSylvestre Ledru <sledru@mozilla.com>
Sat, 24 Mar 2018 00:25:41 +0100
changeset 771948 fb36e78ec88299371ee83d99ad3a8b4245f3b2cf
parent 771947 5729c49dded588867abfab793c54ca2522a8e16e
push id103801
push usersledru@mozilla.com
push dateFri, 23 Mar 2018 23:26:29 +0000
bugs1448367
milestone61.0a1
Bug 1448367 - Remove some b2g leftover in accessible/ MozReview-Commit-ID: JAfOY1bNbvk
accessible/jsat/Presentation.jsm
accessible/jsat/Utils.jsm
accessible/tests/mochitest/hittest/a11y.ini
accessible/tests/mochitest/jsat/jsatcommon.js
accessible/tests/mochitest/jsat/test_content_integration.html
--- a/accessible/jsat/Presentation.jsm
+++ b/accessible/jsat/Presentation.jsm
@@ -467,179 +467,16 @@ AndroidPresenter.prototype.noMove =
       { eventType: this.ANDROID_VIEW_ACCESSIBILITY_FOCUSED,
         exitView: aMoveMethod,
         text: [""]
       }]
     };
   };
 
 /**
- * A B2G presenter for Gaia.
- */
-function B2GPresenter() {}
-
-B2GPresenter.prototype = Object.create(Presenter.prototype);
-
-B2GPresenter.prototype.type = "B2G";
-
-B2GPresenter.prototype.keyboardEchoSetting =
-  new PrefCache("accessibility.accessfu.keyboard_echo");
-B2GPresenter.prototype.NO_ECHO = 0;
-B2GPresenter.prototype.CHARACTER_ECHO = 1;
-B2GPresenter.prototype.WORD_ECHO = 2;
-B2GPresenter.prototype.CHARACTER_AND_WORD_ECHO = 3;
-
-/**
- * A pattern used for haptic feedback.
- * @type {Array}
- */
-B2GPresenter.prototype.PIVOT_CHANGE_HAPTIC_PATTERN = [40];
-
-/**
- * Pivot move reasons.
- * @type {Array}
- */
-B2GPresenter.prototype.pivotChangedReasons = ["none", "next", "prev", "first",
-                                              "last", "text", "point"];
-
-B2GPresenter.prototype.pivotChanged =
-  function B2GPresenter_pivotChanged(aContext, aReason, aIsUserInput) {
-    if (!aContext.accessible) {
-      return null;
-    }
-
-    return {
-      type: this.type,
-      details: {
-        eventType: "vc-change",
-        data: UtteranceGenerator.genForContext(aContext),
-        options: {
-          pattern: this.PIVOT_CHANGE_HAPTIC_PATTERN,
-          isKey: Utils.isActivatableOnFingerUp(aContext.accessible),
-          reason: this.pivotChangedReasons[aReason],
-          isUserInput: aIsUserInput,
-          hints: aContext.interactionHints
-        }
-      }
-    };
-  };
-
-B2GPresenter.prototype.nameChanged =
-  function B2GPresenter_nameChanged(aAccessible, aIsPolite = true) {
-    return {
-      type: this.type,
-      details: {
-        eventType: "name-change",
-        data: aAccessible.name,
-        options: {enqueue: aIsPolite}
-      }
-    };
-  };
-
-B2GPresenter.prototype.valueChanged =
-  function B2GPresenter_valueChanged(aAccessible, aIsPolite = true) {
-
-    // the editable value changes are handled in the text changed presenter
-    if (Utils.getState(aAccessible).contains(States.EDITABLE)) {
-      return null;
-    }
-
-    return {
-      type: this.type,
-      details: {
-        eventType: "value-change",
-        data: aAccessible.value,
-        options: {enqueue: aIsPolite}
-      }
-    };
-  };
-
-B2GPresenter.prototype.textChanged = function B2GPresenter_textChanged(
-  aAccessible, aIsInserted, aStart, aLength, aText, aModifiedText) {
-    let echoSetting = this.keyboardEchoSetting.value;
-    let text = "";
-
-    if (echoSetting == this.CHARACTER_ECHO ||
-        echoSetting == this.CHARACTER_AND_WORD_ECHO) {
-      text = aModifiedText;
-    }
-
-    // add word if word boundary is added
-    if ((echoSetting == this.WORD_ECHO ||
-        echoSetting == this.CHARACTER_AND_WORD_ECHO) &&
-        aIsInserted && aLength === 1) {
-      let accText = aAccessible.QueryInterface(Ci.nsIAccessibleText);
-      let startBefore = {}, endBefore = {};
-      let startAfter = {}, endAfter = {};
-      accText.getTextBeforeOffset(aStart,
-        Ci.nsIAccessibleText.BOUNDARY_WORD_END, startBefore, endBefore);
-      let maybeWord = accText.getTextBeforeOffset(aStart + 1,
-        Ci.nsIAccessibleText.BOUNDARY_WORD_END, startAfter, endAfter);
-      if (endBefore.value !== endAfter.value) {
-        text += maybeWord;
-      }
-    }
-
-    return {
-      type: this.type,
-      details: {
-        eventType: "text-change",
-        data: text
-      }
-    };
-
-  };
-
-B2GPresenter.prototype.actionInvoked =
-  function B2GPresenter_actionInvoked(aObject, aActionName) {
-    return {
-      type: this.type,
-      details: {
-        eventType: "action",
-        data: UtteranceGenerator.genForAction(aObject, aActionName)
-      }
-    };
-  };
-
-B2GPresenter.prototype.liveRegion = function B2GPresenter_liveRegion(aContext,
-  aIsPolite, aIsHide, aModifiedText) {
-    return {
-      type: this.type,
-      details: {
-        eventType: "liveregion-change",
-        data: UtteranceGenerator.genForLiveRegion(aContext, aIsHide,
-          aModifiedText),
-        options: {enqueue: aIsPolite}
-      }
-    };
-  };
-
-B2GPresenter.prototype.announce =
-  function B2GPresenter_announce(aAnnouncement) {
-    return {
-      type: this.type,
-      details: {
-        eventType: "announcement",
-        data: aAnnouncement
-      }
-    };
-  };
-
-B2GPresenter.prototype.noMove =
-  function B2GPresenter_noMove(aMoveMethod) {
-    return {
-      type: this.type,
-      details: {
-        eventType: "no-move",
-        data: aMoveMethod
-      }
-    };
-  };
-
-/**
  * A braille presenter
  */
 function BraillePresenter() {}
 
 BraillePresenter.prototype = Object.create(Presenter.prototype);
 
 BraillePresenter.prototype.type = "Braille";
 
@@ -671,18 +508,17 @@ BraillePresenter.prototype.textSelection
     };
   };
 
 var Presentation = { // jshint ignore:line
   get presenters() {
     delete this.presenters;
     let presenterMap = {
       "mobile/android": [VisualPresenter, AndroidPresenter],
-      "b2g": [VisualPresenter, B2GPresenter],
-      "browser": [VisualPresenter, B2GPresenter, AndroidPresenter]
+      "browser": [VisualPresenter, AndroidPresenter]
     };
     this.presenters = presenterMap[Utils.MozBuildApp].map(P => new P());
     return this.presenters;
   },
 
   get displayedAccessibles() {
     delete this.displayedAccessibles;
     this.displayedAccessibles = new WeakMap();
--- a/accessible/jsat/Utils.jsm
+++ b/accessible/jsat/Utils.jsm
@@ -21,18 +21,16 @@ ChromeUtils.defineModuleGetter(this, "St
   "resource://gre/modules/accessibility/Constants.jsm");
 ChromeUtils.defineModuleGetter(this, "PluralForm", // jshint ignore:line
   "resource://gre/modules/PluralForm.jsm");
 
 var EXPORTED_SYMBOLS = ["Utils", "Logger", "PivotContext", "PrefCache"]; // jshint ignore:line
 
 var Utils = { // jshint ignore:line
   _buildAppMap: {
-    "{3c2e2abc-06d4-11e1-ac3b-374f68613e61}": "b2g",
-    "{d1bfe7d9-c01e-4237-998b-7b5f960a4314}": "graphene",
     "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}": "browser",
     "{aa3c5121-dab2-40e2-81ca-7ea25febc110}": "mobile/android"
   },
 
   init: function Utils_init(aWindow) {
     if (this._win) {
       // XXX: only supports attaching to one window now.
       throw new Error("Only one top-level window could used with AccessFu");
@@ -127,30 +125,25 @@ var Utils = { // jshint ignore:line
     if (!this.win) {
       return null;
     }
     switch (this.MozBuildApp) {
       case "mobile/android":
         return this.win.BrowserApp;
       case "browser":
         return this.win.gBrowser;
-      case "b2g":
-        return this.win.shell;
       default:
         return null;
     }
   },
 
   get CurrentBrowser() {
     if (!this.BrowserApp) {
       return null;
     }
-    if (this.MozBuildApp == "b2g") {
-      return this.BrowserApp.contentBrowser;
-    }
     return this.BrowserApp.selectedBrowser;
   },
 
   get CurrentContentDoc() {
     let browser = this.CurrentBrowser;
     return browser ? browser.contentDocument : null;
   },
 
@@ -169,23 +162,16 @@ var Utils = { // jshint ignore:line
       }
     }
 
     collectLeafMessageManagers(this.win.messageManager);
 
     let document = this.CurrentContentDoc;
 
     if (document) {
-      if (document.location.host === "b2g") {
-        // The document is a b2g app chrome (ie. Mulet).
-        let contentBrowser = this.win.content.shell.contentBrowser;
-        messageManagers.add(this.getMessageManager(contentBrowser));
-        document = contentBrowser.contentDocument;
-      }
-
       let remoteframes = document.querySelectorAll("iframe");
 
       for (let i = 0; i < remoteframes.length; ++i) {
         let mm = this.getMessageManager(remoteframes[i]);
         if (mm) {
           messageManagers.add(mm);
         }
       }
--- a/accessible/tests/mochitest/hittest/a11y.ini
+++ b/accessible/tests/mochitest/hittest/a11y.ini
@@ -1,15 +1,15 @@
 [DEFAULT]
 support-files = zoom_tree.xul
   !/accessible/tests/mochitest/*.js
   !/accessible/tests/mochitest/letters.gif
 
 [test_browser.html]
 [test_canvas_hitregion.html]
-skip-if = (os == "android" || appname == "b2g")
+skip-if = (os == "android")
 [test_general.html]
 [test_menu.xul]
 [test_shadowroot.html]
 support-files = test_shadowroot_subframe.html
 [test_zoom.html]
 [test_zoom_text.html]
 [test_zoom_tree.xul]
--- a/accessible/tests/mochitest/jsat/jsatcommon.js
+++ b/accessible/tests/mochitest/jsat/jsatcommon.js
@@ -529,33 +529,30 @@ ExpectedMessage.prototype.is_correct_foc
     [ doc.activeElement, doc.querySelector(this.options.focused),
       "Correct element is focused: " + this.options.focused + " -- " + aInfo ]);
 };
 
 ExpectedMessage.prototype.ignore = function(aMessage) {
   return aMessage.name !== this.name;
 };
 
-function ExpectedPresent(aB2g, aAndroid, aOptions) {
+function ExpectedPresent(aAndroid, aOptions) {
   ExpectedMessage.call(this, "AccessFu:Present", aOptions);
-  if (aB2g) {
-    this.json.b2g = aB2g;
-  }
 
   if (aAndroid) {
     this.json.android = aAndroid;
   }
 }
 
 ExpectedPresent.prototype = Object.create(ExpectedMessage.prototype);
 
 ExpectedPresent.prototype.is = function(aReceived, aInfo) {
   var received = this.extract_presenters(aReceived);
 
-  for (var presenter of ["b2g", "android"]) {
+  for (var presenter of ["android"]) {
     if (!this.options["no_" + presenter]) {
       var todo = this.options.todo || this.options[presenter + "_todo"];
       SimpleTest[todo ? "todo" : "ok"].apply(
         SimpleTest, this.lazyCompare(received[presenter],
           this.json[presenter], aInfo + " (" + presenter + ")"));
     }
   }
 };
@@ -600,18 +597,16 @@ function ExpectedCursorTextChange(aSpeec
     eventType: "vc-change",
     data: aSpeech
   }, [{
     eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
     fromIndex: aStartOffset,
     toIndex: aEndOffset
   }], aOptions);
 
-  // bug 980509
-  this.options.b2g_todo = true;
 }
 
 ExpectedCursorTextChange.prototype =
   Object.create(ExpectedCursorChange.prototype);
 
 function ExpectedClickAction(aOptions) {
   ExpectedPresent.call(this, {
     eventType: "action",
--- a/accessible/tests/mochitest/jsat/test_content_integration.html
+++ b/accessible/tests/mochitest/jsat/test_content_integration.html
@@ -105,17 +105,17 @@
           // Moving to the absolute last item from an embedded document
           // fails. Bug 972035.
           [ContentMessages.simpleMoveNext,
            new ExpectedCursorChange(
             ["such app", "wow", {"string": "headingLevel", "args": [1]}])],
           // Move from an inner frame to the last element in the parent doc
           [ContentMessages.simpleMoveLast,
             new ExpectedCursorChange(
-              ["slider", "0", {"string": "slider"}], { b2g_todo: true })],
+              ["slider", "0", {"string": "slider"}])],
 
           [ContentMessages.clearCursor, "AccessFu:CursorCleared"],
 
           [ContentMessages.simpleMoveNext,
            new ExpectedCursorChange(["Traversal Rule test document", "Phone status bar"])],
           [ContentMessages.moveOrAdjustDown("FormElement"),
            new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
           [ContentMessages.moveOrAdjustDown("FormElement"),
@@ -148,17 +148,17 @@
            new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
           [ContentMessages.simpleMoveNext,
            new ExpectedCursorChange(["such app", "wow", {"string": "headingLevel", "args": [1]}])],
           [ContentMessages.simpleMoveNext, new ExpectedCursorChange(
             ["many option", {"string": "stateNotChecked"},
              {"string": "checkbutton"}, {"string": "listStart"},
              {"string": "list"}, {"string": "listItemsCount", "count": 1}])],
           [ContentMessages.simpleMoveFirst,
-            new ExpectedCursorChange(["Phone status bar"], { b2g_todo: true })],
+            new ExpectedCursorChange(["Phone status bar"])],
 
           // Reset cursors
           [ContentMessages.clearCursor, "AccessFu:CursorCleared"],
 
           // Current virtual cursor's position's name changes
           [ContentMessages.simpleMoveNext,
            new ExpectedCursorChange(["Traversal Rule test document", "Phone status bar"])],
           [ContentMessages.focusSelector("button#fruit", false),