Bug 1155703: Correct Marionette to use NoSuchWindowError
authorAndreas Tolfsen <ato@mozilla.com>
Wed, 29 Apr 2015 12:00:43 +0100
changeset 242772 d00a52f922ed4e5107cba4a48331a009678118ab
parent 242771 98a6cb62aeff1381d235673f0b63da27c1757614
child 242773 f171cc700c5ddbeef64a5d2baac54033acf1dc45
push id59501
push useratolfsen@mozilla.com
push dateThu, 07 May 2015 15:50:29 +0000
treeherdermozilla-inbound@d00a52f922ed [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1155703, 1159674
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1155703: Correct Marionette to use NoSuchWindowError FrameSendFailureError and FrameSendNotInitializedError are not compatible with the W3C WebDriver specification and we should use NoSuchWindowError instead. Bug 1159674 has prepared Gaia for this change. r=davehunt
testing/marionette/driver.js
testing/marionette/error.js
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -228,19 +228,18 @@ GeckoDriver.prototype.sendAsync = functi
     });
   } else {
     let remoteFrameId = curRemoteFrame.targetFrameId;
     try {
       this.mm.sendAsyncMessage(name + remoteFrameId, msg);
     } catch (e) {
       switch(e.result) {
         case Components.results.NS_ERROR_FAILURE:
-          throw new FrameSendFailureError(curRemoteFrame);
         case Components.results.NS_ERROR_NOT_INITIALIZED:
-          throw new FrameSendNotInitializedError(curRemoteFrame);
+          throw new NoSuchWindowError();
         default:
           throw new WebDriverError(e.toString());
       }
     }
   }
 };
 
 /**
@@ -278,18 +277,17 @@ GeckoDriver.prototype.getWinEnumerator =
 };
 
 GeckoDriver.prototype.addFrameCloseListener = function(action) {
   let win = this.getCurrentWindow();
   this.mozBrowserClose = e => {
     if (e.target.id == this.oopFrameId) {
       win.removeEventListener("mozbrowserclose", this.mozBrowserClose, true);
       this.switchToGlobalMessageManager();
-      throw new FrameSendFailureError(
-          `The frame closed during the ${action}, recovering to allow further communications`);
+      throw new NoSuchWindowError("The window closed during action: " + action);
     }
   };
   win.addEventListener("mozbrowserclose", this.mozBrowserClose, true);
 };
 
 /**
  * Create a new BrowserObj for window and add to known browsers.
  *
--- a/testing/marionette/error.js
+++ b/testing/marionette/error.js
@@ -4,18 +4,16 @@
 
 "use strict";
 
 const {results: Cr, utils: Cu} = Components;
 
 const errors = [
   "ElementNotAccessibleError",
   "ElementNotVisibleError",
-  "FrameSendFailureError",
-  "FrameSendNotInitializedError",
   "InvalidArgumentError",
   "InvalidElementStateError",
   "InvalidSelectorError",
   "InvalidSessionIdError",
   "JavaScriptError",
   "NoAlertOpenError",
   "NoSuchElementError",
   "NoSuchFrameError",
@@ -164,36 +162,16 @@ ElementNotAccessibleError.prototype = Ob
 
 this.ElementNotVisibleError = function(msg) {
   WebDriverError.call(this, msg);
   this.name = "ElementNotVisibleError";
   this.status = "element not visible";
 };
 ElementNotVisibleError.prototype = Object.create(WebDriverError.prototype);
 
-this.FrameSendFailureError = function(frame) {
-  this.message = "Error sending message to frame (NS_ERROR_FAILURE)";
-  WebDriverError.call(this, this.message);
-  this.name = "FrameSendFailureError";
-  this.status = "frame send failure error";
-  this.frame = frame;
-  this.errMsg = `${this.message} ${this.frame}; frame not responding.`;
-};
-FrameSendFailureError.prototype = Object.create(WebDriverError.prototype);
-
-this.FrameSendNotInitializedError = function(frame) {
-  this.message = "Error sending message to frame (NS_ERROR_NOT_INITIALIZED)";
-  WebDriverError.call(this, this.message);
-  this.name = "FrameSendNotInitializedError";
-  this.status = "frame send not initialized error";
-  this.frame = frame;
-  this.errMsg = `${this.message} ${this.frame}; frame has closed.`;
-};
-FrameSendNotInitializedError.prototype = Object.create(WebDriverError.prototype);
-
 this.InvalidArgumentError = function(msg) {
   WebDriverError.call(this, msg);
   this.name = "InvalidArgumentError";
   this.status = "invalid argument";
 };
 InvalidArgumentError.prototype = Object.create(WebDriverError.prototype);
 
 this.InvalidElementStateError = function(msg) {