@browserless/goto 9.6.0 → 9.6.5

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 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.6.0",
5
+ "version": "9.6.5",
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.4.1",
32
+ "@browserless/devices": "^9.6.5",
33
33
  "@cliqz/adblocker-puppeteer": "~1.23.8",
34
34
  "debug-logfmt": "~1.0.4",
35
35
  "got": "~11.8.5",
@@ -40,15 +40,15 @@
40
40
  "shallow-equal": "~1.2.1",
41
41
  "time-span": "~4.0.0",
42
42
  "top-user-agents": "~1.0.45",
43
- "tough-cookie": "~4.0.0",
43
+ "tough-cookie": "~4.1.0",
44
44
  "unique-random-array": "~2.0.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@browserless/test": "latest",
48
48
  "ava": "3",
49
49
  "browserless": "latest",
50
- "exit-hook": "2",
51
- "fpscanner": "latest"
50
+ "fpscanner": "latest",
51
+ "p-wait-for": "3"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">= 12"
@@ -59,7 +59,7 @@
59
59
  ],
60
60
  "scripts": {
61
61
  "postinstall": "node scripts/postinstall",
62
- "test": "NODE_ENV=test ava"
62
+ "test": "NODE_ENV=test ava --concurrency 2"
63
63
  },
64
64
  "license": "MIT",
65
65
  "ava": {
@@ -69,5 +69,5 @@
69
69
  "timeout": "2m",
70
70
  "verbose": true
71
71
  },
72
- "gitHead": "ed21c66d61affc17cf23dfb54a1c2071dc08de11"
72
+ "gitHead": "e31274882aa88167c98826fed9368e5adcfe270b"
73
73
  }
package/src/engine.bin CHANGED
Binary file
package/src/index.js CHANGED
@@ -121,7 +121,7 @@ const inject = async (page, { timeout, mediaType, animations, modules, scripts,
121
121
  postPromises.push(
122
122
  run({
123
123
  fn: Promise.all(
124
- castArray(modules).map(value => injectScript(page, value, { type: 'modules' }))
124
+ castArray(modules).map(value => injectScript(page, value, { type: 'module' }))
125
125
  ),
126
126
  timeout,
127
127
  debug: 'modules'
@@ -198,12 +198,14 @@ module.exports = ({
198
198
  javascript = true,
199
199
  mediaType,
200
200
  modules,
201
+ password,
201
202
  scripts,
202
203
  scroll,
203
204
  styles,
204
205
  timeout = globalTimeout,
205
206
  timezone,
206
207
  url,
208
+ username,
207
209
  waitForFunction,
208
210
  waitForSelector,
209
211
  waitForTimeout,
@@ -222,6 +224,26 @@ module.exports = ({
222
224
 
223
225
  const prePromises = []
224
226
 
227
+ if (username || password) {
228
+ prePromises.push(
229
+ run({
230
+ fn: page.authenticate({ username, password }),
231
+ timeout: actionTimeout,
232
+ debug: 'authenticate'
233
+ })
234
+ )
235
+ }
236
+
237
+ if (modules || scripts || styles) {
238
+ prePromises.push(
239
+ run({
240
+ fn: page.setBypassCSP(true),
241
+ timeout: actionTimeout,
242
+ debug: 'bypassCSP'
243
+ })
244
+ )
245
+ }
246
+
225
247
  if (abortTypes.length > 0) {
226
248
  await page.setRequestInterception(true)
227
249
  page.on('request', req => {