styleViaXhr: allow cookies for sandbox CSP
This commit is contained in:
parent
1b8091afb7
commit
be41f13ef3
|
@ -78,6 +78,13 @@ CHROME && (async () => {
|
||||||
name: 'Set-Cookie',
|
name: 'Set-Cookie',
|
||||||
value: `${chrome.runtime.id}=${prefs.get('disableAll') ? 1 : 0}${blobId}`,
|
value: `${chrome.runtime.id}=${prefs.get('disableAll') ? 1 : 0}${blobId}`,
|
||||||
});
|
});
|
||||||
|
// allow cookies for sandbox CSP (known case: raw github urls)
|
||||||
|
for (const h of responseHeaders) {
|
||||||
|
if (h.name.toLowerCase() === 'content-security-policy' && h.value.includes('sandbox')) {
|
||||||
|
h.value = h.value.replace(/((^|;)\s*sandbox)(\s+[^;]+)?\s*(?=;|$)/, '$1 allow-same-origin');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
return {responseHeaders};
|
return {responseHeaders};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user