Skip to content

Commit

Permalink
more code review re. #3140
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Oct 19, 2017
1 parent 7e21eec commit 143e9c7
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/js/traffic.js
Expand Up @@ -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;
}
Expand Down

0 comments on commit 143e9c7

Please sign in to comment.