Bug 1337743 - Return error if quit request is cancelled; r?whimboo draft
authorAndreas Tolfsen <ato@mozilla.com>
Fri, 10 Feb 2017 20:15:48 +0000
changeset 490536 aedbcba9b45ac715ed42d1a969b26e78ee388bac
parent 490535 7e3954ee27289d562b7ca0b324992057e5a15648
child 490537 dfe115e2787daccae2fce5fdd2677683ce807aeb
push id47120
push userbmo:ato@mozilla.com
push dateTue, 28 Feb 2017 17:29:55 +0000
reviewerswhimboo
bugs1337743
milestone54.0a1
Bug 1337743 - Return error if quit request is cancelled; r?whimboo MozReview-Commit-ID: 37iWDxDL6ah
testing/marionette/client/marionette_driver/marionette.py
testing/marionette/driver.js
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -1142,17 +1142,17 @@ class Marionette(object):
 
         :throws InvalidArgumentException: If there are multiple
             `shutdown_flags` ending with `"Quit"`.
 
         """
 
         # The vast majority of this function was implemented inside
         # the quitApplication command as part of bug 1337743, and can be
-        # removed from here in Firefox 54 at the latest.
+        # removed from here in Firefox 55 at the earliest.
 
         # remove duplicates
         flags = set(shutdown_flags)
 
         # add eAttemptQuit if there are no *Quits
         if not any(flag.endswith("Quit") for flag in flags):
             flags = flags | set(("eAttemptQuit",))
 
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -2585,16 +2585,21 @@ GeckoDriver.prototype.acceptConnections 
  *
  * @throws {InvalidArgumentError}
  *     If |flags| contains unknown or incompatible flags, for example
  *     multiple Quit flags.
  */
 GeckoDriver.prototype.quitApplication = function* (cmd, resp) {
   const quits = ["eConsiderQuit", "eAttemptQuit", "eForceQuit"];
 
+  // return error if the quit request is cancelled
+  Services.obs.addObserver(() => {
+    throw new UnknownError("Quit was aborted");
+  }, "quit-application-requested", false);
+
   let flags = [];
   if (typeof cmd.parameters.flags != "undefined") {
     flags = assert.array(cmd.parameters.flags);
   }
 
   // bug 1298921
   assert.firefox()