Bug 1321516 - Remove old Marionette click implementation
This change removes the old element click implementation used for in
Selenium conformance mode when the specificationLevel capability was 0.
This effectively makes the WebDriver Element Click command implementation
the default.
MozReview-Commit-ID: HBHTSNJeAtF
ge for your changes. Lines starting
--- a/testing/marionette/interaction.js
+++ b/testing/marionette/interaction.js
@@ -95,40 +95,30 @@ this.interaction = {};
*
* When |el| is not enabled, an {@code InvalidElementStateError}
* is returned.
*
* @param {DOMElement|XULElement} el
* Element to click.
* @param {boolean=} strict
* Enforce strict accessibility tests.
- * @param {boolean=} specCompat
- * Use WebDriver specification compatible interactability definition.
*
* @throws {ElementNotInteractableError}
* If either Selenium-style visibility check or
* pointer-interactability check fails.
* @throws {ElementClickInterceptedError}
* If |el| is obscured by another element and a click would not hit,
* in |specCompat| mode.
* @throws {ElementNotAccessibleError}
* If |strict| is true and element is not accessible.
* @throws {InvalidElementStateError}
* If |el| is not enabled.
*/
-interaction.clickElement = function* (el, strict = false, specCompat = false) {
+interaction.clickElement = function* (el, strict = false) {
const a11y = accessibility.get(strict);
- if (specCompat) {
- yield webdriverClickElement(el, a11y);
- } else {
- yield seleniumClickElement(el, a11y);
- }
-};
-
-function* webdriverClickElement (el, a11y) {
const win = getWindow(el);
const doc = win.document;
// step 3
if (el.localName == "input" && el.type == "file") {
throw new InvalidArgumentError(
"Cannot click <input type=file> elements");
}
@@ -185,59 +175,16 @@ function* webdriverClickElement (el, a11
}
// step 9
yield interaction.flushEventLoop(win);
// step 10
// TODO(ato): if the click causes navigation,
// run post-navigation checks
-}
-
-function* seleniumClickElement (el, a11y) {
- let win = getWindow(el);
-
- let visibilityCheckEl = el;
- if (el.localName == "option") {
- visibilityCheckEl = element.getContainer(el);
- }
-
- if (!element.isVisible(visibilityCheckEl)) {
- throw new ElementNotInteractableError();
- }
-
- if (!atom.isElementEnabled(el)) {
- throw new InvalidElementStateError("Element is not enabled");
- }
-
- yield a11y.getAccessible(el, true).then(acc => {
- a11y.assertVisible(acc, el, true);
- a11y.assertEnabled(acc, el, true);
- a11y.assertActionable(acc, el);
- });
-
- // chrome elements
- if (element.isXULElement(el)) {
- if (el.localName == "option") {
- interaction.selectOption(el);
- } else {
- el.click();
- }
-
- // content elements
- } else {
- if (el.localName == "option") {
- interaction.selectOption(el);
- } else {
- let rects = el.getClientRects();
- let centre = element.getInViewCentrePoint(rects[0], win);
- let opts = {};
- event.synthesizeMouseAtPoint(centre.x, centre.y, opts, win);
- }
- }
};
/**
* Select <option> element in a <select> list.
*
* Because the dropdown list of select elements are implemented using
* native widget technology, our trusted synthesised events are not able
* to reach them. Dropdowns are instead handled mimicking DOM events,