browserless 10.0.2 → 10.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -7
- package/src/index.js +6 -3
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "browserless",
|
|
3
3
|
"description": "The headless Chrome/Chromium performance driver for Node.js",
|
|
4
4
|
"homepage": "https://browserless.js.org",
|
|
5
|
-
"version": "10.
|
|
5
|
+
"version": "10.1.1",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"author": {
|
|
8
8
|
"email": "hello@microlink.io",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"text"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@browserless/errors": "^10.
|
|
35
|
-
"@browserless/goto": "^10.
|
|
36
|
-
"@browserless/pdf": "^10.
|
|
37
|
-
"@browserless/screenshot": "^10.
|
|
34
|
+
"@browserless/errors": "^10.1.1",
|
|
35
|
+
"@browserless/goto": "^10.1.1",
|
|
36
|
+
"@browserless/pdf": "^10.1.1",
|
|
37
|
+
"@browserless/screenshot": "^10.1.1",
|
|
38
38
|
"debug-logfmt": "~1.0.4",
|
|
39
39
|
"kill-process-group": "~1.0.4",
|
|
40
40
|
"p-reflect": "~2.1.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"superlock": "~1.0.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@browserless/test": "^10.
|
|
47
|
+
"@browserless/test": "^10.1.1",
|
|
48
48
|
"ava": "latest",
|
|
49
49
|
"execa": "5",
|
|
50
50
|
"ps-list": "7"
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"timeout": "2m",
|
|
61
61
|
"workerThreads": false
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "fdab51b5598cc877afb3e4097007c77067526450",
|
|
64
64
|
"scripts": {
|
|
65
65
|
"test": "ava"
|
|
66
66
|
}
|
package/src/index.js
CHANGED
|
@@ -74,6 +74,7 @@ module.exports = ({ timeout: globalTimeout = 30000, ...launchOpts } = {}) => {
|
|
|
74
74
|
|
|
75
75
|
const createContext = async ({ retry = 2, timeout: contextTimeout, ...contextOpts } = {}) => {
|
|
76
76
|
let _contextPromise = createBrowserContext(contextOpts)
|
|
77
|
+
let isDestroyedForced = false
|
|
77
78
|
|
|
78
79
|
const getBrowserContext = () => _contextPromise
|
|
79
80
|
|
|
@@ -124,7 +125,7 @@ module.exports = ({ timeout: globalTimeout = 30000, ...launchOpts } = {}) => {
|
|
|
124
125
|
onFailedAttempt: async error => {
|
|
125
126
|
debug('onFailedAttempt', { name: error.name, code: error.code, isRejected })
|
|
126
127
|
if (error.name === 'AbortError') throw error
|
|
127
|
-
if (isRejected) throw new AbortError()
|
|
128
|
+
if (isRejected || isDestroyedForced) throw new AbortError()
|
|
128
129
|
if (error.code === 'EBRWSRCONTEXTCONNRESET') {
|
|
129
130
|
_contextPromise = createBrowserContext(contextOpts)
|
|
130
131
|
}
|
|
@@ -150,13 +151,15 @@ module.exports = ({ timeout: globalTimeout = 30000, ...launchOpts } = {}) => {
|
|
|
150
151
|
gotoOpts
|
|
151
152
|
)
|
|
152
153
|
|
|
153
|
-
const destroyContext = async () => {
|
|
154
|
+
const destroyContext = async ({ force = false } = {}) => {
|
|
155
|
+
if (force) isDestroyedForced = true
|
|
156
|
+
|
|
154
157
|
const [browserProcess, browserContext] = await Promise.all([
|
|
155
158
|
getBrowser(),
|
|
156
159
|
getBrowserContext()
|
|
157
160
|
])
|
|
158
161
|
await pReflect(browserContext.close())
|
|
159
|
-
debug('destroyContext', { pid: driver.pid(browserProcess), id: browserContext.id })
|
|
162
|
+
debug('destroyContext', { pid: driver.pid(browserProcess), force, id: browserContext.id })
|
|
160
163
|
}
|
|
161
164
|
|
|
162
165
|
return {
|