mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-08 11:52:53 +01:00
Fix CSP/PP header injection in non-document resources
Related feedback: https://github.com/uBlockOrigin/uBlock-issues/issues/229#issuecomment-2220354261 https://old.reddit.com/r/uBlockOrigin/comments/1dz6du7/ Regression from: https://github.com/gorhill/uBlock/commit/7c3e060c01
This commit is contained in:
parent
9c1252ef9c
commit
c90f4933df
@ -553,12 +553,17 @@ const onHeadersReceived = function(details) {
|
|||||||
if ( httpheaderFilteringEngine.apply(fctxt, responseHeaders) === true ) {
|
if ( httpheaderFilteringEngine.apply(fctxt, responseHeaders) === true ) {
|
||||||
modifiedHeaders = true;
|
modifiedHeaders = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/uBlockOrigin/uBlock-issues/issues/229#issuecomment-2220354261
|
||||||
|
// Inject CSP/PP in document resource only
|
||||||
|
if ( fctxt.isDocument() ) {
|
||||||
if ( injectCSP(fctxt, pageStore, responseHeaders) === true ) {
|
if ( injectCSP(fctxt, pageStore, responseHeaders) === true ) {
|
||||||
modifiedHeaders = true;
|
modifiedHeaders = true;
|
||||||
}
|
}
|
||||||
if ( injectPP(fctxt, pageStore, responseHeaders) === true ) {
|
if ( injectPP(fctxt, pageStore, responseHeaders) === true ) {
|
||||||
modifiedHeaders = true;
|
modifiedHeaders = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1376932
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1376932
|
||||||
// Prevent document from being cached by the browser if we modified it,
|
// Prevent document from being cached by the browser if we modified it,
|
||||||
@ -945,10 +950,6 @@ const bodyFilterer = (( ) => {
|
|||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
const injectCSP = function(fctxt, pageStore, responseHeaders) {
|
const injectCSP = function(fctxt, pageStore, responseHeaders) {
|
||||||
// https://github.com/uBlockOrigin/uBlock-issues/issues/229#issuecomment-2220354261
|
|
||||||
// Inject CSP in document resource only
|
|
||||||
if ( fctxt.isDocument() === false ) { return; }
|
|
||||||
|
|
||||||
const cspSubsets = [];
|
const cspSubsets = [];
|
||||||
const requestType = fctxt.type;
|
const requestType = fctxt.type;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user