Bug 1387678 - Allow traversing to the parent if switchToShadowDom is given null; r?ato
MozReview-Commit-ID: KO1UwTyhf1R
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -2571,30 +2571,34 @@ GeckoDriver.prototype.clearElement = asy
await this.listener.clearElement(webEl);
break;
}
};
/**
* Switch to shadow root of the given host element.
*
- * @param {string} id
+ * @param {string=} id
* Reference ID to the element.
*
* @throws {InvalidArgumentError}
* If <var>id</var> is not a string.
* @throws {NoSuchElementError}
* If element represented by reference <var>id</var> is unknown.
*/
GeckoDriver.prototype.switchToShadowRoot = async function(cmd) {
assert.content(this.context);
assert.open(this.getCurrentWindow());
- let id = assert.string(cmd.parameters.id);
- let webEl = WebElement.fromUUID(id, this.context);
+ let id = cmd.parameters.id;
+ let webEl = null;
+ if (id != null) {
+ assert.string(id);
+ webEl = WebElement.fromUUID(id, this.context);
+ }
await this.listener.switchToShadowRoot(webEl);
};
/**
* Add a single cookie to the cookie store associated with the active
* document's address.
*
* @param {Map.<string, (string|number|boolean)> cookie