@browserless/goto 10.9.0 → 10.9.2
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 +2 -2
- package/src/index.js +17 -2
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@browserless/goto",
|
|
3
3
|
"description": "Go to a page aborting unnecessary requests",
|
|
4
4
|
"homepage": "https://browserless.js.org/#/?id=gotopage-options",
|
|
5
|
-
"version": "10.9.
|
|
5
|
+
"version": "10.9.2",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"author": {
|
|
8
8
|
"email": "hello@microlink.io",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"timeout": "2m",
|
|
65
65
|
"workerThreads": false
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "c693f31fb428b362ad32e3db53356e7d9c9ebbb6"
|
|
68
68
|
}
|
package/src/index.js
CHANGED
|
@@ -235,12 +235,21 @@ module.exports = ({ defaultDevice = 'Macbook Pro 13', timeout: globalTimeout, ..
|
|
|
235
235
|
)
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
+
// TODO: drop this when https://github.com/ghostery/adblocker/pull/5161 is merged
|
|
239
|
+
let isRequestInterceptionEnabled = false
|
|
240
|
+
page.isRequestInterceptionEnabled = () => isRequestInterceptionEnabled
|
|
241
|
+
|
|
238
242
|
const enableInterception =
|
|
239
243
|
(onPageRequest || abortTypes.length > 0) &&
|
|
240
|
-
run({
|
|
244
|
+
run({
|
|
245
|
+
fn: page.setRequestInterception(true).then(() => (isRequestInterceptionEnabled = true)),
|
|
246
|
+
debug: 'enableInterception'
|
|
247
|
+
})
|
|
241
248
|
|
|
242
249
|
if (onPageRequest) {
|
|
243
|
-
Promise.resolve(enableInterception).then(() =>
|
|
250
|
+
Promise.resolve(enableInterception).then(() =>
|
|
251
|
+
page.on('request', req => onPageRequest(req, page))
|
|
252
|
+
)
|
|
244
253
|
}
|
|
245
254
|
|
|
246
255
|
if (abortTypes.length > 0) {
|
|
@@ -264,6 +273,12 @@ module.exports = ({ defaultDevice = 'Macbook Pro 13', timeout: globalTimeout, ..
|
|
|
264
273
|
}
|
|
265
274
|
|
|
266
275
|
if (adblock) {
|
|
276
|
+
page.disableAdblock = async () => {
|
|
277
|
+
await engine.disableBlockingInPage(page)
|
|
278
|
+
isRequestInterceptionEnabled = false
|
|
279
|
+
debug.adblock('disabled')
|
|
280
|
+
}
|
|
281
|
+
|
|
267
282
|
prePromises.push(
|
|
268
283
|
run({
|
|
269
284
|
fn: engine.enableBlockingInPage(page),
|