-
Notifications
You must be signed in to change notification settings - Fork 32
Closed
Labels
Priority: P4Release: v2.0.1Resolution: FixedStatus: ClosedVersion: Scriptlets v2.0enhancementImprovement of existent featureImprovement of existent feature
Description
Steps to reproduce:
- Add this rule:
example.org#%#//scriptlet('prevent-fetch', 'googlesyndication', '', 'opaque')2, Go to - https://example.org/
3. In browser console run:
(async () => {
try {
const response = await fetch('https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js', {
mode: 'no-cors'
});
if (response.ok) {
alert('adblock');
}
} catch (error) {
alert('adblock');
}
})();Alert is displayed, because response.ok is true, but without ad blocker is false.
Adding ok: { value: false; } to:
Scriptlets/src/helpers/noop-utils.ts
Lines 126 to 132 in 85b3346
| Object.defineProperties(response, { | |
| body: { value: null }, | |
| status: { value: 0 }, | |
| statusText: { value: '' }, | |
| url: { value: '' }, | |
| type: { value: responseType }, | |
| }); |
should fixes it.
This issue - #394 (comment) could be also fixed.
I think that the problem is that website overrides Object.defineProperties which is used by prevent-fetch.
Metadata
Metadata
Assignees
Labels
Priority: P4Release: v2.0.1Resolution: FixedStatus: ClosedVersion: Scriptlets v2.0enhancementImprovement of existent featureImprovement of existent feature