Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disableBlockingInPage is not complete #1893

Closed
kmosunoff opened this issue Apr 28, 2021 · 2 comments
Closed

disableBlockingInPage is not complete #1893

kmosunoff opened this issue Apr 28, 2021 · 2 comments

Comments

@kmosunoff
Copy link
Contributor

kmosunoff commented Apr 28, 2021

Hello guys, thank you for such a pretty and efficient tool!

Nevertheless, I found out that the disableBlockingInPage method in PuppeteerBlocker does not disable blocking completely. To be precise, it does not remove the "domcontentloaded" listener set in the enable method of the BlockingContext class.

This leads to styles injection even after blocking disabling. Here is a couple of simple steps to reproduce the issue:

await puppeteerBlocker.enableBlockingInPage(page);
await page.goto(...);
const contentWithoutAds = await page.content();
await puppeteerBlocker.disableBlockingInPage(page);
await page.goto(...);
const content = await page.content();

You might notice that the content and the contentWithoutAds both have cosmetic styles injected. However, I expect the content to be not affected by the blocker at all. Is it a bug or a feature? :)
Thanks in advance!

@remusao
Copy link
Collaborator

remusao commented May 3, 2021

Hey @kmosunoff,

Good catch! This definitely looks like a bug. Would you be willing to contribute a patch for this issue? I'd gladly review and publish an update of the package.

Best,
Rémi

@kmosunoff kmosunoff reopened this May 3, 2021
@kmosunoff
Copy link
Contributor Author

Sure!
I've coded a bit, could you take a look please?
#1903

@remusao remusao closed this as completed May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants