-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix(proxy): fix requests with proxies #1408
Conversation
Fixes #1394 |
if (prop === 'setRequestInterception') { | ||
return noop; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose the important part here is that you're returning an empty function rather than a value, correct?
Why is this important?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The adblock plugin will sometimes, for various reasons, call setRequestInterception(false)
because it thinks it is the authority on request listeners (which, due to us injecting proxies with that, too, it is not).
All this does is give the adblock plugin a function to call that will not error and simply does nothing at all, so it can be happy thinking it disabled request listeners, and the proxy plugin can be happy still using them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, I see! Interesting. Do you think it would be worth mentioning making a ticket about on their repos?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jef Not really. The way puppeteer works, only one on-request listener is possible. The Proxy
thing we do is a hack, and for sure not an expected use case of anything. Now if puppeteer ever supports multiple on-request listeners, then that might be considered an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, I'm sorry. I'm misunderstanding the situation. You did make a fork of package and you fixed that issue. As for ghostery/adblocker#1495, that isn't an issue for that library, yet an issue with the original puppeteer-page-proxy
.
I'm I understanding this correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jef The issue with adblock purely arises because we need multiple things that employ request listeners, which puppeteer does not support in any way. So we hack around and "fake" the Page object the adblocker sees to be able to do it. Of course adblock has no way of expecting to get a proxied page object, so this is not a bug on their end at all, we just do something puppeteer cannot do.
Description
As you might notice, I had to fork puppeteer-page-proxy. The fix I applied has already been PR'd upstream for several months and the library seems unmaintained currently (but there is no viable alternative either).
Other than that, I also added the
*.proxies
files to gitignore and fixed a problem where adblock would "randomly" disable request interception.Testing
New dependencies