1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-14 23:12:28 +02:00

more code review re. #3140

This commit is contained in:
gorhill 2017-10-19 08:07:00 -04:00
parent 7e21eec7ce
commit 143e9c7414
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -435,17 +435,14 @@ var onBeforeMaybeSpuriousCSPReport = function(details) {
if ( data instanceof Object ) {
var report = data['csp-report'];
if ( report instanceof Object ) {
var blockedURI = report['blocked-uri'] ||
report['blockedURI'],
sourceFile = report['source-file'] ||
report['sourceFile'];
var blocked = report['blocked-uri'] || report['blockedURI'],
validBlocked = typeof blocked === 'string',
source = report['source-file'] || report['sourceFile'],
validSource = typeof source === 'string';
if (
(typeof blockedURI === 'string' ||
typeof sourceFile === 'string') &&
(typeof blockedURI !== 'string' ||
blockedURI.startsWith('data') === false) &&
(typeof sourceFile !== 'string' ||
sourceFile.startsWith('data') === false)
(validBlocked || validSource) &&
(!validBlocked || !blocked.startsWith('data')) &&
(!validSource || !source.startsWith('data'))
) {
return;
}