Bug 1337743 - Return error if quit request is cancelled; r?whimboo
MozReview-Commit-ID: 37iWDxDL6ah
--- 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()