browserless 10.7.9-beta.0 → 10.7.9
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 +3 -3
- package/src/index.js +5 -10
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.7.9
|
|
5
|
+
"version": "10.7.9",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"author": {
|
|
8
8
|
"email": "hello@microlink.io",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@browserless/errors": "^10.7.1",
|
|
35
35
|
"@browserless/goto": "^10.7.6",
|
|
36
36
|
"@browserless/pdf": "^10.7.6",
|
|
37
|
-
"@browserless/screenshot": "^10.7.
|
|
37
|
+
"@browserless/screenshot": "^10.7.9",
|
|
38
38
|
"debug-logfmt": "~1.2.3",
|
|
39
39
|
"kill-process-group": "~1.0.11",
|
|
40
40
|
"p-reflect": "~2.1.0",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"timeout": "2m",
|
|
65
65
|
"workerThreads": false
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "a82182ec098073ab2debbf60f5db8c09c177b1c5"
|
|
68
68
|
}
|
package/src/index.js
CHANGED
|
@@ -111,12 +111,7 @@ module.exports = ({ timeout: globalTimeout = 30000, ...launchOpts } = {}) => {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
* FIXME: Apparently there is a kind of race condition if you have more than one context and you close the page,
|
|
116
|
-
* the browser context is closed but the browser process is broken
|
|
117
|
-
* Related: https://github.com/search?q=repo%3Apuppeteer%2Fpuppeteer%20waitForScreenshotOperations&type=code
|
|
118
|
-
*/
|
|
119
|
-
const withPage = (fn, { closePage: withClosePage = true, timeout: evaluateTimeout } = {}) => {
|
|
114
|
+
const withPage = (fn, { timeout: evaluateTimeout } = {}) => {
|
|
120
115
|
const name = fn.name || 'anonymous'
|
|
121
116
|
|
|
122
117
|
return async (...args) => {
|
|
@@ -127,12 +122,12 @@ module.exports = ({ timeout: globalTimeout = 30000, ...launchOpts } = {}) => {
|
|
|
127
122
|
|
|
128
123
|
try {
|
|
129
124
|
page = await createPage(name)
|
|
130
|
-
setTimeout(() => closePage(page,
|
|
125
|
+
setTimeout(() => closePage(page, name), timeout).unref()
|
|
131
126
|
const value = await fn(page, goto)(...args)
|
|
132
|
-
|
|
127
|
+
await closePage(page, `${name}:success`)
|
|
133
128
|
return value
|
|
134
129
|
} catch (error) {
|
|
135
|
-
|
|
130
|
+
await closePage(page, `${name}:error`)
|
|
136
131
|
if (!isRejected) throw ensureError(error)
|
|
137
132
|
}
|
|
138
133
|
}
|
|
@@ -197,7 +192,7 @@ module.exports = ({ timeout: globalTimeout = 30000, ...launchOpts } = {}) => {
|
|
|
197
192
|
html: evaluate(page => page.content()),
|
|
198
193
|
page: createPage,
|
|
199
194
|
pdf: withPage(createPdf({ goto })),
|
|
200
|
-
screenshot: withPage(createScreenshot({ goto })
|
|
195
|
+
screenshot: withPage(createScreenshot({ goto })),
|
|
201
196
|
text: evaluate(page => page.evaluate(() => document.body.innerText)),
|
|
202
197
|
getDevice: goto.getDevice,
|
|
203
198
|
destroyContext,
|