Commit f2ba08ad authored by James Teh's avatar James Teh
Browse files

Bug 1828816: Marionette accessibility.getAccessible: If the requested...

Bug 1828816: Marionette accessibility.getAccessible: If the requested Accessible doesn't exist, force refresh driver ticks and retry. r=whimboo,webdriver-reviewers

Some tests dynamically add elements to the DOM.
Since accessibility updates occur in refresh driver ticks, the Accessible often wasn't created yet when WebDriver requested it, causing intermittent WPT failures.
Now, we force refresh driver ticks to give accessibility a chance to update.

Differential Revision: https://phabricator.services.mozilla.com/D177851
parent 1348250b
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -141,6 +141,22 @@ accessibility.getAccessible = async function(element) {

  // First, wait for accessibility to be ready for the element's document.
  await waitForDocumentAccessibility(element.ownerDocument);

  const acc = accessibility.service.getAccessibleFor(element);
  if (acc) {
    return acc;
  }

  // The Accessible doesn't exist yet. This can happen because a11y tree
  // mutations happen during refresh driver ticks. Stop the refresh driver from
  // doing its regular ticks and force two refresh driver ticks: the first to
  // let layout update and notify a11y, and the second to let a11y process
  // updates.
  const windowUtils = element.ownerGlobal.windowUtils;
  windowUtils.advanceTimeAndRefresh(0);
  windowUtils.advanceTimeAndRefresh(0);
  // Go back to normal refresh driver ticks.
  windowUtils.restoreNormalRefresh();
  return accessibility.service.getAccessibleFor(element);
};

+2 −1
Original line number Diff line number Diff line
@@ -318,7 +318,8 @@ export class MarionetteCommandsChild extends JSWindowActorChild {

    const accessible = await lazy.accessibility.getAccessible(elem);
    if (!accessible) {
      return null;
      // If it's not in the a11y tree, it's probably presentational.
      return "none";
    }

    return accessible.computedARIARole;
+0 −6
Original line number Diff line number Diff line
@@ -20,9 +20,6 @@
  [el-search]
    expected: FAIL

  [el-img-empty-alt]
    expected: FAIL

  [el-u]
    expected: FAIL

@@ -35,9 +32,6 @@
  [el-time]
    expected: FAIL

  [el-img-alt-no-value]
    expected: FAIL

  [el-img]
    expected: FAIL

+0 −147
Original line number Diff line number Diff line
[roles.html]
  [role: alertdialog]
    expected: [PASS, FAIL]

  [role: application]
    expected: [PASS, FAIL]

  [role: article]
    expected: [PASS, FAIL]

  [role: banner]
    expected: [PASS, FAIL]

  [role: button]
    expected: [PASS, FAIL]

  [role: checkbox]
    expected: [PASS, FAIL]

  [role: combobox]
    expected: [PASS, FAIL]

  [role: complementary]
    expected: [PASS, FAIL]

  [role: contentinfo]
    expected: [PASS, FAIL]

  [role: definition]
    expected: FAIL
    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1829028

  [role: deletion]
    expected: [PASS, FAIL]

  [role: document]
    expected: [PASS, FAIL]

  [role: emphasis]
    expected: FAIL
    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1732306

  [role: feed]
    expected: [PASS, FAIL]

  [role: generic]
    expected: [PASS, FAIL]

  [role: group]
    expected: [PASS, FAIL]

  [role: insertion]
    expected: [PASS, FAIL]

  [role: log]
    expected: [PASS, FAIL]

  [role: main]
    expected: [PASS, FAIL]

  [role: marquee]
    expected: [PASS, FAIL]

  [role: math]
    expected: [PASS, FAIL]

  [role: navigation]
    expected: [PASS, FAIL]

  [role: radio]
    expected: [PASS, FAIL]

  [role: radiogroup]
    expected: [PASS, FAIL]

  [role: search]
    expected: [PASS, FAIL]

  [role: searchbox]
    expected: [PASS, FAIL]

  [role: status]
    expected: [PASS, FAIL]

  [role: strong]
    expected: FAIL
    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1732306

  [role: textbox]
    expected: [PASS, FAIL]

  [role: time]
    expected: FAIL
    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1732306

  [role: timer]
    expected: [PASS, FAIL]

  [role: blockquote]
    expected: [PASS, FAIL]

  [role: caption]
    expected: [PASS, FAIL]

  [role: code]
    expected: [PASS, FAIL]

  [role: dialog]
    expected: [PASS, FAIL]

  [role: figure]
    expected: [PASS, FAIL]

  [role: form]
    expected: [PASS, FAIL]

  [role: heading]
    expected: [PASS, FAIL]

  [role: link]
    expected: [PASS, FAIL]

  [role: meter]
    expected: [PASS, FAIL]

  [role: note]
    expected: [PASS, FAIL]

  [role: paragraph]
    expected: [PASS, FAIL]

  [role: progressbar]
    expected: [PASS, FAIL]

  [role: scrollbar]
    expected: [PASS, FAIL]

  [role: separator]
    expected: [PASS, FAIL]

  [role: slider]
    expected: [PASS, FAIL]

  [role: spinbutton]
    expected: [PASS, FAIL]

  [role: subscript]
    expected: [PASS, FAIL]

  [role: suggestion]
    expected: [PASS, FAIL]

  [role: superscript]
    expected: [PASS, FAIL]

  [role: switch]
    expected: [PASS, FAIL]

  [role: term]
    expected: FAIL
    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1829028

  [role: toolbar]
    expected: [PASS, FAIL]

  [role: tooltip]
    expected: [PASS, FAIL]
+2 −8
Original line number Diff line number Diff line
[synonym-roles.html]
  [none role == computedrole none]
    expected: FAIL
    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1828600

  [synonym presentation role == computedrole none]
    expected: FAIL
    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1828600

  [image role == computedrole image]
    expected: FAIL
    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1829269

  [synonym img role == computedrole image]
    expected: FAIL
    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1829269