Skip to content

Commit 1b17a3b

Browse files
authored
chore(goto): teardown adbock gracefully (#622)
1 parent d3843b4 commit 1b17a3b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

packages/browserless/src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ module.exports = ({ timeout: globalTimeout = 30000, ...launchOpts } = {}) => {
9797
const closePage = async (page, name) => {
9898
if (page && !page.isClosed()) {
9999
const duration = debug.duration('closePage')
100+
if (page.disableAdblock) await page.disableAdblock()
100101
const [browserProcess, browserContext] = await Promise.all([
101102
getBrowser(),
102103
getBrowserContext(),

packages/goto/src/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@ module.exports = ({ defaultDevice = 'Macbook Pro 13', timeout: globalTimeout, ..
264264
}
265265

266266
if (adblock) {
267+
page.disableAdblock = async () => {
268+
await engine.disableBlockingInPage(page)
269+
debug.adblock('disabled')
270+
}
267271
prePromises.push(
268272
run({
269273
fn: engine.enableBlockingInPage(page),

0 commit comments

Comments
 (0)