Bug 1155658: Rename "illegal argument" error to "invalid argument"
authorAndreas Tolfsen <ato@mozilla.com>
Fri, 17 Apr 2015 18:43:05 +0100
changeset 259334 8c56a1c8e458cd175784a940d85ae368ac82c2df
parent 259333 db2bf088e4f83bdc69254ef930f76060da8e1437
child 259335 889f95f88740618239b8d4c83de090b8a69656e8
push id1728
push usermartin.thomson@gmail.com
push dateFri, 24 Apr 2015 18:56:35 +0000
bugs1155658
milestone40.0a1
Bug 1155658: Rename "illegal argument" error to "invalid argument" r=chmanchester
testing/marionette/driver.js
testing/marionette/error.js
testing/marionette/listener.js
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -2303,17 +2303,17 @@ GeckoDriver.prototype.getElementRect = f
  *     Reference ID to the element that will be checked.
  * @param {string} value
  *     Value to send to the element.
  */
 GeckoDriver.prototype.sendKeysToElement = function(cmd, resp) {
   let {id, value} = cmd.parameters;
 
   if (!value) {
-    throw new IllegalArgumentError(`Expected character sequence: ${value}`);
+    throw new InvalidArgumentError(`Expected character sequence: ${value}`);
   }
 
   switch (this.context) {
     case Context.CHROME:
       let win = this.getCurrentWindow();
       let el = this.curBrowser.elementManager.getKnownElement(id, win);
       utils.sendKeysToElement(
           win,
@@ -2336,17 +2336,17 @@ GeckoDriver.prototype.sendKeysToElement 
 
         if (el.type == "file") {
           Cu.importGlobalProperties(["File"]);
           let fs = Array.prototype.slice.call(el.files);
           let file;
           try {
             file = new File(val);
           } catch (e) {
-            err = new IllegalArgumentError(`File not found: ${val}`);
+            err = new InvalidArgumentError(`File not found: ${val}`);
           }
           fs.push(file);
           el.mozSetFileArray(fs);
         } else {
           el.value = val;
         }
       }.bind(this);
 
--- a/testing/marionette/error.js
+++ b/testing/marionette/error.js
@@ -6,17 +6,17 @@
 
 const {results: Cr, utils: Cu} = Components;
 
 const errors = [
   "ElementNotAccessibleError",
   "ElementNotVisibleError",
   "FrameSendFailureError",
   "FrameSendNotInitializedError",
-  "IllegalArgumentError",
+  "InvalidArgumentError",
   "InvalidElementStateError",
   "InvalidSelectorError",
   "InvalidSessionIdError",
   "JavaScriptError",
   "NoAlertOpenError",
   "NoSuchElementError",
   "NoSuchFrameError",
   "NoSuchWindowError",
@@ -166,22 +166,22 @@ this.FrameSendNotInitializedError = func
   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.IllegalArgumentError = function(msg) {
+this.InvalidArgumentError = function(msg) {
   WebDriverError.call(this, msg);
-  this.name = "IllegalArgumentError";
-  this.status = "illegal argument";
+  this.name = "InvalidArgumentError";
+  this.status = "invalid argument";
 };
-IllegalArgumentError.prototype = Object.create(WebDriverError.prototype);
+InvalidArgumentError.prototype = Object.create(WebDriverError.prototype);
 
 this.InvalidElementStateError = function(msg) {
   WebDriverError.call(this, msg);
   this.name = "InvalidElementStateError";
   this.status = "invalid element state";
 };
 InvalidElementStateError.prototype = Object.create(WebDriverError.prototype);
 
--- a/testing/marionette/listener.js
+++ b/testing/marionette/listener.js
@@ -1557,17 +1557,17 @@ function sendKeysToElement(msg) {
     //
     // this extra branch can be removed when the e10s bug 1149998 is fixed
     if (isRemoteBrowser()) {
       let fs = Array.prototype.slice.call(el.files);
       let file;
       try {
         file = new File(p);
       } catch (e) {
-        let err = new IllegalArgumentError(`File not found: ${val}`);
+        let err = new InvalidArgumentError(`File not found: ${val}`);
         sendError(err, command_id);
         return;
       }
       fs.push(file);
 
       let wel = new SpecialPowers(utils.window).wrap(el);
       wel.mozSetFileArray(fs);
     } else {