Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
fix: issue with url being 'undefined' after disconnect
Browse files Browse the repository at this point in the history
Now storing the URL and if session is started with an undefined URL, we reuse the previous URL

Fixes #63
  • Loading branch information
shirish87 committed Feb 18, 2016
1 parent 66f4240 commit e746ecd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,12 @@ var BrowserStackBrowser = function (
var captureTimeout = config.captureTimeout || 0
var captureTimeoutId
var retryLimit = bsConfig.retryLimit || 3
var previousUrl = null

this.start = function (url) {
url = url || previousUrl
previousUrl = url

// TODO(vojta): handle non os/browser/version
var settings = {
os: args.os,
Expand Down Expand Up @@ -177,7 +181,6 @@ var BrowserStackBrowser = function (
settings.real_mobile = args.real_mobile
}

this.url = url
tunnel.then(function () {
client.createWorker(settings, function (error, worker) {
var sessionUrlShowed = false
Expand Down Expand Up @@ -289,7 +292,7 @@ var BrowserStackBrowser = function (
log.warn('%s has not captured in %d ms, killing.', browserName, captureTimeout)
self.kill(function () {
if (retryLimit--) {
self.start(self.url)
self.start(previousUrl)
} else {
emitter.emit('browser_process_failure', self)
}
Expand Down

0 comments on commit e746ecd

Please sign in to comment.