Bug 1439995 - Add user prompt checks for script execution commands. r?automatedtester draft
authorAndreas Tolfsen <ato@sny.no>
Thu, 22 Feb 2018 12:00:33 +0000
changeset 758425 eef22afbcb5ef33240be721cd1b7afc0b67f76d8
parent 758396 ea3da643422c58d65335f1778dd6c89c09911585
push id100047
push userbmo:ato@sny.no
push dateThu, 22 Feb 2018 12:02:35 +0000
reviewersautomatedtester
bugs1439995
milestone60.0a1
Bug 1439995 - Add user prompt checks for script execution commands. r?automatedtester WebDriver:{ExecuteScript,ExecuteAsyncScript} were missing user prompt checks. This patch does not add any tests because Marionette does not yet implement the user prompt handler as described in the specification, which means that the relevant tests in WPT are incorrect for this behaviour. MozReview-Commit-ID: BRTAm1ptsQw
testing/marionette/driver.js
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -868,16 +868,17 @@ GeckoDriver.prototype.getContext = funct
  * @throws {ScriptTimeoutError}
  *     If the script was interrupted due to reaching the
  *     <var>scriptTimeout</var> or default timeout.
  * @throws {JavaScriptError}
  *     If an {@link Error} was thrown whilst evaluating the script.
  */
 GeckoDriver.prototype.executeScript = async function(cmd, resp) {
   assert.open(this.getCurrentWindow());
+  this._assertAndDismissModal();
 
   let {script, args, scriptTimeout} = cmd.parameters;
   scriptTimeout = scriptTimeout || this.timeouts.script;
 
   let opts = {
     sandboxName: cmd.parameters.sandbox,
     newSandbox: !!(typeof cmd.parameters.newSandbox == "undefined") ||
         cmd.parameters.newSandbox,
@@ -945,16 +946,17 @@ GeckoDriver.prototype.executeScript = as
  * @throws {ScriptTimeoutError}
  *     If the script was interrupted due to reaching the
  *     <var>scriptTimeout</var> or default timeout.
  * @throws {JavaScriptError}
  *     If an Error was thrown whilst evaluating the script.
  */
 GeckoDriver.prototype.executeAsyncScript = async function(cmd, resp) {
   assert.open(this.getCurrentWindow());
+  this._assertAndDismissModal();
 
   let {script, args, scriptTimeout} = cmd.parameters;
   scriptTimeout = scriptTimeout || this.timeouts.script;
 
   let opts = {
     sandboxName: cmd.parameters.sandbox,
     newSandbox: !!(typeof cmd.parameters.newSandbox == "undefined") ||
         cmd.parameters.newSandbox,