Bug 1154757: Correct unable to set cookie error
authorAndreas Tolfsen <ato@mozilla.com>
Mon, 20 Apr 2015 13:53:51 +0100
changeset 240414 695f93953c01e3bd65a53b1c13d0b817a540e74f
parent 240413 c30371e57ddf4a5d8f0b62abaa11f0431756cacc
child 240415 9cfeed1582a3545bc29ad4f4455636363507a7a0
push id28636
push userkwierso@gmail.com
push dateThu, 23 Apr 2015 00:16:12 +0000
treeherdermozilla-central@a5af73b32ac8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1154757
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 1154757: Correct unable to set cookie error r=dburns
testing/marionette/error.js
testing/marionette/listener.js
--- a/testing/marionette/error.js
+++ b/testing/marionette/error.js
@@ -19,16 +19,17 @@ const errors = [
   "NoAlertOpenError",
   "NoSuchElementError",
   "NoSuchFrameError",
   "NoSuchWindowError",
   "ScriptTimeoutError",
   "SessionNotCreatedError",
   "StaleElementReferenceError",
   "TimeoutError",
+  "UnableToSetCookieError",
   "UnknownCommandError",
   "UnknownError",
   "UnsupportedOperationError",
   "WebDriverError",
 ];
 
 this.EXPORTED_SYMBOLS = ["error"].concat(errors);
 
@@ -328,16 +329,24 @@ StaleElementReferenceError.prototype = O
 this.TimeoutError = function(msg) {
   WebDriverError.call(this, msg);
   this.name = "TimeoutError";
   this.status = "timeout";
   this.code = 21;
 };
 TimeoutError.prototype = Object.create(WebDriverError.prototype);
 
+this.UnableToSetCookieError = function(msg) {
+  WebDriverError.call(this, msg);
+  this.name = "UnableToSetCookieError";
+  this.status = "unable to set cookie";
+  this.code = 25;
+};
+UnableToSetCookieError.prototype = Object.create(WebDriverError.prototype);
+
 this.UnknownCommandError = function(msg) {
   WebDriverError.call(this, msg);
   this.name = "UnknownCommandError";
   this.status = "unknown command";
   this.code = 9;
 };
 UnknownCommandError.prototype = Object.create(WebDriverError.prototype);
 
--- a/testing/marionette/listener.js
+++ b/testing/marionette/listener.js
@@ -1793,17 +1793,17 @@ function addCookie(msg) {
 
   var document = curFrame.document;
   if (!document || !document.contentType.match(/html/i)) {
     sendError(new UnableToSetCookie("You may only set cookies on html documents"), msg.json.command_id);
   }
 
   let added = sendSyncMessage("Marionette:addCookie", {value: cookie});
   if (added[0] !== true) {
-    sendError(new UnknownError("Error setting cookie"), msg.json.command_id);
+    sendError(new UnableToSetCookieError(), msg.json.command_id);
     return;
   }
   sendOk(msg.json.command_id);
 }
 
 /**
  * Get all cookies for the current domain.
  */