@browserless/goto 9.3.0-beta.11 → 9.3.0-beta.12
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 +3 -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": "9.3.0-beta.
|
|
5
|
+
"version": "9.3.0-beta.12",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"author": {
|
|
8
8
|
"email": "hello@microlink.io",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"puppeteer"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@browserless/devices": "^9.
|
|
32
|
+
"@browserless/devices": "^9.3.0-beta.12",
|
|
33
33
|
"@cliqz/adblocker-puppeteer": "~1.23.0",
|
|
34
34
|
"debug-logfmt": "~1.0.4",
|
|
35
35
|
"got": "~11.8.3",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"timeout": "2m",
|
|
69
69
|
"verbose": true
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "4c4e979c675f544b903ee5c0d6add9a8651deb0c"
|
|
72
72
|
}
|
package/src/index.js
CHANGED
|
@@ -24,7 +24,6 @@ const engine = PuppeteerBlocker.deserialize(
|
|
|
24
24
|
|
|
25
25
|
engine.on('request-blocked', ({ url }) => debugAdblock('block', url))
|
|
26
26
|
engine.on('request-redirected', ({ url }) => debugAdblock('redirect', url))
|
|
27
|
-
engine.setRequestInterceptionPriority(1)
|
|
28
27
|
|
|
29
28
|
const isEmpty = val => val == null || !(Object.keys(val) || val).length
|
|
30
29
|
|
|
@@ -167,13 +166,15 @@ module.exports = ({
|
|
|
167
166
|
if (abortTypes.length > 0) {
|
|
168
167
|
await page.setRequestInterception(true)
|
|
169
168
|
page.on('request', req => {
|
|
169
|
+
if (req.isInterceptResolutionHandled()) return
|
|
170
|
+
|
|
170
171
|
const resourceType = req.resourceType()
|
|
171
172
|
if (!abortTypes.includes(resourceType)) {
|
|
172
173
|
debug('continue', { url: req.url(), resourceType })
|
|
173
174
|
return req.continue(req.continueRequestOverrides(), 0)
|
|
174
175
|
}
|
|
175
176
|
debug('abort', { url: req.url(), resourceType })
|
|
176
|
-
return req.abort('blockedbyclient',
|
|
177
|
+
return req.abort('blockedbyclient', 0)
|
|
177
178
|
})
|
|
178
179
|
}
|
|
179
180
|
|