-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Labels
Description
Related to - #297 and partially related to - #334
Steps to reproduce:
- Add to user rules:
example.org#%#//scriptlet('prevent-fetch', 'adsbygoogle')
||pagead2.googlesyndication.com/pagead/js/adsbygoogle.js$xmlhttprequest,redirect=googlesyndication-adsbygoogle- Navigate to - https://example.org/
- Run in console:
const fetchData = await fetch('https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js');
const contentLengthHeader = fetchData.headers.get('content-length');
console.log('Content-Length:', contentLengthHeader); // Should not be null
console.log('URL:', fetchData.url); // Should be the requested URLWhen request is redirected by browser extension then Content-Length is null and URL from extension redirection is used.
I guess we could check here:
Scriptlets/src/scriptlets/prevent-fetch.js
Lines 213 to 215 in 3e8429f
| if (!origResponse.ok) { | |
| return noopPromiseResolve(strResponseBody, fetchData.url, finalResponseType); | |
| } |
if
origResponse.url is from extension redirection (like chrome-extension://, moz-extension://, I'm not sure what is used for Safari (safari-extension://?), but it perhaps should be also excluded when $redirect will be supported in Safari extension):
if (
!origResponse.ok
|| origResponse.url.startsWith('chrome-extension://')
|| origResponse.url.startsWith('moz-extension://')
|| origResponse.url.startsWith('safari-extension://')
) {
return noopPromiseResolve(strResponseBody, fetchData.url, finalResponseType);
}Or maybe it can be just simply checked if it does not start with http?
