Backout d8159e66db6c (Bug 1191432) on suspicion of Gij bustage on CLOSED TREE
authorNigel Babu <nigelbabu@gmail.com>
Mon, 24 Aug 2015 07:48:47 +0530
changeset 258957 8a6045d14d6bd348a3b5bfeb55a9321e680cc93e
parent 258941 4ccdd06e51d7209ba429196df7cab97bf66962db
child 258965 205427533c567b7b67bf2df3937e851f16204668
push id64092
push usernigelbabu@gmail.com
push dateMon, 24 Aug 2015 12:12:09 +0000
treeherdermozilla-inbound@3bbe8780ca62 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1191432
milestone43.0a1
backs outd8159e66db6c29c98dc7a8643defdb321adefbc9
first release with
nightly linux32
8a6045d14d6b / 43.0a1 / 20150824030206 / files
nightly linux64
8a6045d14d6b / 43.0a1 / 20150824030206 / files
nightly mac
8a6045d14d6b / 43.0a1 / 20150824030206 / files
nightly win32
8a6045d14d6b / 43.0a1 / 20150824030206 / files
nightly win64
8a6045d14d6b / 43.0a1 / 20150824030206 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backout d8159e66db6c (Bug 1191432) on suspicion of Gij bustage on CLOSED TREE
testing/marionette/client/marionette/tests/unit/test_accessibility.py
testing/marionette/client/marionette/www/test_accessibility.html
testing/marionette/elements.js
testing/marionette/listener.js
--- a/testing/marionette/client/marionette/tests/unit/test_accessibility.py
+++ b/testing/marionette/client/marionette/tests/unit/test_accessibility.py
@@ -1,33 +1,27 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from marionette import MarionetteTestCase
 from marionette_driver.errors import (ElementNotAccessibleException,
-                                      ElementNotVisibleException)
+                                     ElementNotVisibleException)
 
 
 class TestAccessibility(MarionetteTestCase):
 
     # Elements that are accessible with and without the accessibliity API
     valid_elementIDs = [
         # Button1 is an accessible button with a valid accessible name
         # computed from subtree
         "button1",
         # Button2 is an accessible button with a valid accessible name
         # computed from aria-label
-        "button2",
-        # Button13 is an accessible button that is implemented via role="button"
-        # and is explorable using tabindex="0"
-        "button13",
-        # button17 is an accessible button that overrides parent's
-        # pointer-events:none; property with its own pointer-events:all;
-        "button17"
+        "button2"
     ]
 
     # Elements that are not accessible with the accessibility API
     invalid_elementIDs = [
         # Button3 does not have an accessible object
         "button3",
         # Button4 does not support any accessible actions
         "button4",
@@ -36,20 +30,17 @@ class TestAccessibility(MarionetteTestCa
         "button5",
         # Button6 is missing an accesible name
         "button6",
         # Button7 is not currently visible via the accessibility API and may
         # not be manipulated by it
         "button7",
         # Button8 is not currently visible via the accessibility API and may
         # not be manipulated by it (in hidden subtree)
-        "button8",
-        # Button14 is accessible button but is not explorable because of lack
-        # of tabindex that would make it focusable.
-        "button14"
+        "button8"
     ]
 
     # Elements that are either accessible to accessibility API or not accessible
     # at all
     falsy_elements = [
         # Element is only visible to the accessibility API and may be
         # manipulated by it
         "button9",
@@ -61,22 +52,16 @@ class TestAccessibility(MarionetteTestCa
         "button1", "button2", "button3", "button4", "button5", "button6",
         "button9", "no_accessible_but_displayed"
     ]
 
     displayed_but_a11y_hidden_elementIDs = ["button7", "button8"]
 
     disabled_elementIDs = ["button11", "no_accessible_but_disabled"]
 
-    # Elements that are enabled but otherwise disabled or not explorable via the accessibility API
-    disabled_accessibility_elementIDs = ["button12", "button15", "button16"]
-
-    # Elements that are reporting selected state
-    valid_option_elementIDs = ["option1", "option2"]
-
     def run_element_test(self, ids, testFn):
         for id in ids:
             element = self.marionette.find_element("id", id)
             testFn(element)
 
     def setup_accessibility(self, raisesAccessibilityExceptions=True, navigate=True):
         self.marionette.delete_session()
         self.marionette.start_session(
@@ -139,55 +124,18 @@ class TestAccessibility(MarionetteTestCa
                               lambda element: self.assertRaises(ElementNotAccessibleException,
                                                                 element.is_displayed))
 
     def test_element_is_visible_to_accessibility(self):
         self.setup_accessibility()
         # No exception should be raised
         self.run_element_test(self.displayed_elementIDs, lambda element: element.is_displayed())
 
-    def test_element_is_not_enabled_to_accessbility(self):
+    def test_is_element_is_not_enabled_to_accessbility(self):
         self.setup_accessibility()
-        # Buttons are enabled but disabled/not-explorable via the accessibility API
-        self.run_element_test(self.disabled_accessibility_elementIDs,
-                              lambda element: self.assertRaises(ElementNotAccessibleException,
-                                                                element.is_enabled))
-
-        # Buttons are enabled but disabled/not-explorable via the accessibility API and thus are not
-        # clickable via the accessibility API
-        self.run_element_test(self.disabled_accessibility_elementIDs,
-                              lambda element: self.assertRaises(ElementNotAccessibleException,
-                                                                element.click))
-
-        self.setup_accessibility(False, False)
-        self.run_element_test(self.disabled_accessibility_elementIDs,
-                              lambda element: element.is_enabled())
-        self.run_element_test(self.disabled_accessibility_elementIDs,
-                              lambda element: element.click())
+        # Button is enabled but disabled via the accessibility API
+        self.assertRaises(ElementNotAccessibleException,
+                          self.marionette.find_element("id", "button12").is_enabled)
 
     def test_element_is_enabled_to_accessibility(self):
         self.setup_accessibility()
         # No exception should be raised
         self.run_element_test(self.disabled_elementIDs, lambda element: element.is_enabled())
-
-    def test_send_keys_raises_no_exception(self):
-        self.setup_accessibility()
-        # Sending keys to valid input should not raise any exceptions
-        self.run_element_test(['input1'], lambda element: element.send_keys("a"))
-
-        self.setup_accessibility(False, False)
-        # Sending keys to invalid element should not raise any exceptions when raising accessibility
-        # exceptions is disabled
-        self.run_element_test(['button5'], lambda element: element.send_keys("abc"))
-
-    def test_send_keys_raises_element_not_accessible(self):
-        self.setup_accessibility()
-        # Sending keys to invalid element should raise an exception
-        self.run_element_test(['button5'],
-                              lambda element: self.assertRaises(ElementNotAccessibleException,
-                                                                element.send_keys))
-
-    def test_is_selected_raises_no_exception(self):
-        self.setup_accessibility()
-        # No exception should be raised for valid options
-        self.run_element_test(self.valid_option_elementIDs, lambda element: element.is_selected())
-        # No exception should be raised for non-selectable elements
-        self.run_element_test(self.valid_elementIDs, lambda element: element.is_selected())
--- a/testing/marionette/client/marionette/www/test_accessibility.html
+++ b/testing/marionette/client/marionette/www/test_accessibility.html
@@ -27,31 +27,16 @@
   </button>
   <button id="button10" style="visibility:hidden;">
     button10
   </button>
   <span id="no_accessible_but_displayed">I have no accessible object</span>
   <button id="button11" disabled>button11</button>
   <button id="button12" aria-disabled="true">button12</button>
   <span id="no_accessible_but_disabled" disabled>I have no accessible object</span>
-  <span id="button13" tabindex="0" role="button" aria-label="Span button">Span button</span>
-  <span id="button14" role="button" aria-label="Span button">Unexplorable Span button</span>
-  <button id="button15" style="pointer-events:none;">button15</button>
-  <div style="pointer-events:none;">
-    <button id="button16">button16</button>
-  </div>
-  <div style="pointer-events:none;">
-    <button style="pointer-events:all;" id="button17">button17</button>
-  </div>
-  <input id="input1" title="My Input 1" name="myInput1" type="text" value="asdf"/>
-  <select>
-    <option id="option1" value="val1">Val1</option>
-    <option id="option2" value="val2" selected>Val2</option>
-  </select>
   <script>
-      'use strict';
       document.getElementById('button5').addEventListener('click', function() {
         // A pseudo button that has a listener but is missing button semantics.
         return true;
       });
   </script>
 </body>
 </html>
--- a/testing/marionette/elements.js
+++ b/testing/marionette/elements.js
@@ -74,18 +74,16 @@ Accessibility.prototype = {
     'combobox',
     'key',
     'link',
     'menuitem',
     'check menu item',
     'radio menu item',
     'option',
     'radiobutton',
-    'rowheader',
-    'switch',
     'slider',
     'spinbutton',
     'pagetab',
     'entry',
     'outlineitem'
   ]),
 
   /**
--- a/testing/marionette/listener.js
+++ b/testing/marionette/listener.js
@@ -923,38 +923,26 @@ function singleTap(msg) {
     sendError(e, command_id);
   }
 }
 
 /**
  * Check if the element's unavailable accessibility state matches the enabled
  * state
  * @param nsIAccessible object
- * @param WebElement corresponding to nsIAccessible object
  * @param Boolean enabled element's enabled state
  */
-function checkEnabledAccessibility(accesible, element, enabled) {
+function checkEnabledStateAccessibility(accesible, enabled) {
   if (!accesible) {
     return;
   }
-  let disabledAccessibility = accessibility.matchState(
-    accesible, 'STATE_UNAVAILABLE');
-  let explorable = curFrame.document.defaultView.getComputedStyle(
-    element, null).getPropertyValue('pointer-events') !== 'none';
-  let message;
-
-  if (!explorable && !disabledAccessibility) {
-    message = 'Element is enabled but is not explorable via the ' +
-      'accessibility API';
-  } else if (enabled && disabledAccessibility) {
-    message = 'Element is enabled but disabled via the accessibility API';
-  } else if (!enabled && !disabledAccessibility) {
-    message = 'Element is disabled but enabled via the accessibility API';
+  if (enabled && accessibility.matchState(accesible, 'STATE_UNAVAILABLE')) {
+    accessibility.handleErrorMessage('Element is enabled but disabled via ' +
+      'the accessibility API');
   }
-  accessibility.handleErrorMessage(message);
 }
 
 /**
  * Check if the element's visible state corresponds to its accessibility API
  * visibility
  * @param nsIAccessible object
  * @param Boolean visible element's visibility state
  */
@@ -985,44 +973,16 @@ function checkActionableAccessibility(ac
   let message;
   if (!accessibility.hasActionCount(accesible)) {
     message = 'Element does not support any accessible actions';
   } else if (!accessibility.isActionableRole(accesible)) {
     message = 'Element does not have a correct accessibility role ' +
       'and may not be manipulated via the accessibility API';
   } else if (!accessibility.hasValidName(accesible)) {
     message = 'Element is missing an accesible name';
-  } else if (!accessibility.matchState(accesible, 'STATE_FOCUSABLE')) {
-    message = 'Element is not focusable via the accessibility API';
-  }
-  accessibility.handleErrorMessage(message);
-}
-
-/**
- * Check if element's selected state corresponds to its accessibility API
- * selected state.
- * @param nsIAccessible object
- * @param Boolean selected element's selected state
- */
-function checkSelectedAccessibility(accessible, selected) {
-  if (!accessible) {
-    return;
-  }
-  if (!accessibility.matchState(accessible, 'STATE_SELECTABLE')) {
-    // Element is not selectable via the accessibility API
-    return;
-  }
-
-  let selectedAccessibility = accessibility.matchState(
-    accessible, 'STATE_SELECTED');
-  let message;
-  if (selected && !selectedAccessibility) {
-    message = 'Element is selected but not selected via the accessibility API';
-  } else if (!selected && selectedAccessibility) {
-    message = 'Element is not selected but selected via the accessibility API';
   }
   accessibility.handleErrorMessage(message);
 }
 
 
 /**
  * Function to create a touch based on the element
  * corx and cory are relative to the viewport, id is the touchId
@@ -1430,17 +1390,16 @@ function clickElement(id) {
   let acc = accessibility.getAccessibleObject(el, true);
   let visible = checkVisible(el);
   checkVisibleAccessibility(acc, visible);
   if (!visible) {
     throw new ElementNotVisibleError("Element is not visible");
   }
   checkActionableAccessibility(acc);
   if (utils.isElementEnabled(el)) {
-    checkEnabledAccessibility(acc, el, true);
     utils.synthesizeMouseAtCenter(el, {}, el.ownerDocument.defaultView);
   } else {
     throw new InvalidElementStateError("Element is not Enabled");
   }
 }
 
 /**
  * Get a given attribute of an element.
@@ -1563,61 +1522,51 @@ function getElementRect(id) {
  *     Reference to web element.
  *
  * @return {boolean}
  *     True if enabled, false otherwise.
  */
 function isElementEnabled(id) {
   let el = elementManager.getKnownElement(id, curFrame);
   let enabled = utils.isElementEnabled(el);
-  checkEnabledAccessibility(
-    accessibility.getAccessibleObject(el), el, enabled);
+  checkEnabledStateAccessibility(accessibility.getAccessibleObject(el), enabled);
   return enabled;
 }
 
 /**
  * Check if element is selected
  */
 function isElementSelected(msg) {
   let command_id = msg.json.command_id;
   try {
     let el = elementManager.getKnownElement(msg.json.id, curFrame);
-    let selected = utils.isElementSelected(el);
-    checkSelectedAccessibility(accessibility.getAccessibleObject(el), selected);
-    sendResponse({value: selected}, command_id);
+    sendResponse({value: utils.isElementSelected(el)}, command_id);
   } catch (e) {
     sendError(e, command_id);
   }
 }
 
 /**
  * Send keys to element
  */
 function sendKeysToElement(msg) {
   let command_id = msg.json.command_id;
   let val = msg.json.value;
 
-  try {
-    let el = elementManager.getKnownElement(msg.json.id, curFrame);
-    // Element should be actionable from the accessibility standpoint to be able
-    // to send keys to it.
-    checkActionableAccessibility(accessibility.getAccessibleObject(el, true));
-    if (el.type == "file") {
-      let p = val.join("");
-      fileInputElement = el;
-      // In e10s, we can only construct File objects in the parent process,
-      // so pass the filename to driver.js, which in turn passes them back
-      // to this frame script in receiveFiles.
-      sendSyncMessage("Marionette:getFiles",
-                      {value: p, command_id: command_id});
-    } else {
-      utils.sendKeysToElement(curFrame, el, val, sendOk, sendError, command_id);
-    }
-  } catch (e) {
-    sendError(e, command_id);
+  let el = elementManager.getKnownElement(msg.json.id, curFrame);
+  if (el.type == "file") {
+    let p = val.join("");
+    fileInputElement = el;
+    // In e10s, we can only construct File objects in the parent process,
+    // so pass the filename to driver.js, which in turn passes them back
+    // to this frame script in receiveFiles.
+    sendSyncMessage("Marionette:getFiles",
+                    {value: p, command_id: command_id});
+  } else {
+    utils.sendKeysToElement(curFrame, el, val, sendOk, sendError, command_id);
   }
 }
 
 /**
  * Get the element's top left-hand corner point.
  */
 function getElementLocation(msg) {
   let command_id = msg.json.command_id;