mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 17:47:14 +02:00
fix #1539
This commit is contained in:
parent
462406ecf1
commit
dfe18111b9
@ -598,8 +598,10 @@ PageStore.prototype.filterRequest = function(context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( requestType.endsWith('font') ) {
|
||||||
if ( requestType === 'font' ) {
|
if ( requestType === 'font' ) {
|
||||||
this.remoteFontCount += 1;
|
this.remoteFontCount += 1;
|
||||||
|
}
|
||||||
if ( µb.hnSwitches.evaluateZ('no-remote-fonts', context.rootHostname) !== false ) {
|
if ( µb.hnSwitches.evaluateZ('no-remote-fonts', context.rootHostname) !== false ) {
|
||||||
if ( µb.logger.isEnabled() ) {
|
if ( µb.logger.isEnabled() ) {
|
||||||
this.logData = µb.hnSwitches.toLogData();
|
this.logData = µb.hnSwitches.toLogData();
|
||||||
|
@ -443,20 +443,17 @@ var injectCSP = function(pageStore, details) {
|
|||||||
if ( details.type !== 'main_frame' ) {
|
if ( details.type !== 'main_frame' ) {
|
||||||
context.pageHostname = context.pageDomain = context.requestHostname;
|
context.pageHostname = context.pageDomain = context.requestHostname;
|
||||||
}
|
}
|
||||||
|
context.requestURL = requestURL;
|
||||||
|
|
||||||
// Start collecting policies >>>>>>>>
|
// Start collecting policies >>>>>>>>
|
||||||
|
|
||||||
// ======== built-in policies
|
// ======== built-in policies
|
||||||
|
|
||||||
|
var builtinDirectives = [];
|
||||||
|
|
||||||
context.requestType = 'inline-script';
|
context.requestType = 'inline-script';
|
||||||
context.requestURL = requestURL;
|
|
||||||
if ( pageStore.filterRequest(context) === 1 ) {
|
if ( pageStore.filterRequest(context) === 1 ) {
|
||||||
cspSubsets[0] = "script-src 'unsafe-eval' * blob: data:";
|
builtinDirectives.push("script-src 'unsafe-eval' * blob: data:");
|
||||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=669086
|
|
||||||
// TODO: remove when most users are beyond Chromium v56
|
|
||||||
if ( vAPI.chromiumVersion < 57 ) {
|
|
||||||
cspSubsets[0] += '; frame-src *';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ( loggerEnabled === true ) {
|
if ( loggerEnabled === true ) {
|
||||||
logger.writeOne(
|
logger.writeOne(
|
||||||
@ -470,6 +467,28 @@ var injectCSP = function(pageStore, details) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/gorhill/uBlock/issues/1539
|
||||||
|
// - Use a CSP to also forbid inline fonts if remote fonts are blocked.
|
||||||
|
context.requestType = 'inline-font';
|
||||||
|
if ( pageStore.filterRequest(context) === 1 ) {
|
||||||
|
builtinDirectives.push('font-src *');
|
||||||
|
if ( loggerEnabled === true ) {
|
||||||
|
logger.writeOne(
|
||||||
|
tabId,
|
||||||
|
'net',
|
||||||
|
pageStore.logData,
|
||||||
|
'inline-font',
|
||||||
|
requestURL,
|
||||||
|
context.rootHostname,
|
||||||
|
context.pageHostname
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( builtinDirectives.length !== 0 ) {
|
||||||
|
cspSubsets[0] = builtinDirectives.join('; ');
|
||||||
|
}
|
||||||
|
|
||||||
// ======== filter-based policies
|
// ======== filter-based policies
|
||||||
|
|
||||||
// Static filtering.
|
// Static filtering.
|
||||||
|
Loading…
Reference in New Issue
Block a user