@browserless/goto 10.9.1 → 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 +13 -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) {
|
|
@@ -266,8 +275,10 @@ module.exports = ({ defaultDevice = 'Macbook Pro 13', timeout: globalTimeout, ..
|
|
|
266
275
|
if (adblock) {
|
|
267
276
|
page.disableAdblock = async () => {
|
|
268
277
|
await engine.disableBlockingInPage(page)
|
|
278
|
+
isRequestInterceptionEnabled = false
|
|
269
279
|
debug.adblock('disabled')
|
|
270
280
|
}
|
|
281
|
+
|
|
271
282
|
prePromises.push(
|
|
272
283
|
run({
|
|
273
284
|
fn: engine.enableBlockingInPage(page),
|