Skip to content

Commit

Permalink
js: Explicitly kill Firefox on quit
Browse files Browse the repository at this point in the history
The FirefoxDriver will kill the browser when it receives the quit command, but
we still need to explicitly kill the subprocess so we can be notified when the
process has died. Only then should we delete the profile directory. This should
eliminate the race condition for issue 8564.
  • Loading branch information
jleyba committed Mar 5, 2015
1 parent fa4b165 commit 5fa53a4
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions javascript/node/selenium-webdriver/firefox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ var Driver = function(opt_config, opt_flow) {
/** @private {?string} */
this.profilePath_ = null;

/** @private {!Binary} */
this.binary_ = binary;

var self = this;
var serverUrl = portprober.findFreePort().then(function(port) {
var prepareProfile;
Expand Down Expand Up @@ -289,11 +292,15 @@ Driver.prototype.setFileDetector = function() {
Driver.prototype.quit = function() {
return this.call(function() {
var self = this;
return Driver.super_.prototype.quit.call(this).thenFinally(function() {
if (self.profilePath_) {
return io.rmDir(self.profilePath_);
}
});
return Driver.super_.prototype.quit.call(this)
.thenFinally(function() {
return self.binary_.kill();
})
.thenFinally(function() {
if (self.profilePath_) {
return io.rmDir(self.profilePath_);
}
});
}, this);
};

Expand Down

0 comments on commit 5fa53a4

Please sign in to comment.