Skip to content

Commit 5fa53a4

Browse files
committed
js: Explicitly kill Firefox on quit
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.
1 parent fa4b165 commit 5fa53a4

File tree

1 file changed

+12
-5
lines changed
  • javascript/node/selenium-webdriver/firefox

1 file changed

+12
-5
lines changed

javascript/node/selenium-webdriver/firefox/index.js

+12-5
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ var Driver = function(opt_config, opt_flow) {
237237
/** @private {?string} */
238238
this.profilePath_ = null;
239239

240+
/** @private {!Binary} */
241+
this.binary_ = binary;
242+
240243
var self = this;
241244
var serverUrl = portprober.findFreePort().then(function(port) {
242245
var prepareProfile;
@@ -289,11 +292,15 @@ Driver.prototype.setFileDetector = function() {
289292
Driver.prototype.quit = function() {
290293
return this.call(function() {
291294
var self = this;
292-
return Driver.super_.prototype.quit.call(this).thenFinally(function() {
293-
if (self.profilePath_) {
294-
return io.rmDir(self.profilePath_);
295-
}
296-
});
295+
return Driver.super_.prototype.quit.call(this)
296+
.thenFinally(function() {
297+
return self.binary_.kill();
298+
})
299+
.thenFinally(function() {
300+
if (self.profilePath_) {
301+
return io.rmDir(self.profilePath_);
302+
}
303+
});
297304
}, this);
298305
};
299306

0 commit comments

Comments
 (0)