This repository has been archived by the owner on Sep 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #579 from gemini-testing/fix-abort-session
Fix abort session
- Loading branch information
Showing
7 changed files
with
225 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
'use strict'; | ||
|
||
var inherit = require('inherit'); | ||
module.exports = class BrowserAgent { | ||
static create(browserId, pool) { | ||
return new BrowserAgent(browserId, pool); | ||
} | ||
|
||
var BrowserAgent = inherit({ | ||
__constructor: function(browserId, pool) { | ||
constructor(browserId, pool) { | ||
this.browserId = browserId; | ||
this._pool = pool; | ||
}, | ||
this._force = false; | ||
} | ||
|
||
invalidateSession() { | ||
this._force = true; | ||
} | ||
|
||
getBrowser: function() { | ||
getBrowser() { | ||
return this._pool.getBrowser(this.browserId); | ||
}, | ||
} | ||
|
||
freeBrowser(browser, opts) { | ||
opts = opts || {}; | ||
opts.force = this._force; | ||
|
||
freeBrowser: function(browser, opts) { | ||
return this._pool.freeBrowser(browser, opts); | ||
} | ||
}, { | ||
create: function(browserId, pool) { | ||
return new BrowserAgent(browserId, pool); | ||
} | ||
}); | ||
|
||
module.exports = BrowserAgent; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.