Skip to content

Commit 7176ecb

Browse files
committed
code review of fix to #2360
1 parent 48b3ba1 commit 7176ecb

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/js/traffic.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -430,28 +430,29 @@ var processCSP = function(pageStore, details) {
430430
loggerEnabled = µb.logger.isEnabled();
431431

432432
var context = pageStore.createContextFromPage();
433-
context.requestURL = requestURL;
434433
context.requestHostname = µb.URI.hostnameFromURI(requestURL);
435434
if ( details.type !== 'main_frame' ) {
436435
context.pageHostname = context.pageDomain = context.requestHostname;
437436
}
438437

439-
var inlineScriptResult, blockInlineScript;
438+
var inlineScriptResult, blockInlineScript,
439+
workerResult, blockWorker;
440440
if ( details.type !== 'script' ) {
441441
context.requestType = 'inline-script';
442+
context.requestURL = requestURL;
442443
inlineScriptResult = pageStore.filterRequestNoCache(context);
443444
blockInlineScript = µb.isBlockResult(inlineScriptResult);
445+
// https://github.com/gorhill/uBlock/issues/2360
446+
context.requestType = 'script';
447+
context.requestURL = 'blob:';
448+
workerResult = pageStore.filterRequestNoCache(context);
449+
blockWorker = µb.isBlockResult(workerResult);
444450
}
445451

446452
µb.staticNetFilteringEngine.matchStringExactType(context, requestURL, 'websocket');
447453
var websocketResult = µb.staticNetFilteringEngine.toResultString(loggerEnabled),
448454
blockWebsocket = µb.isBlockResult(websocketResult);
449455

450-
// https://github.com/gorhill/uBlock/issues/2360
451-
µb.staticNetFilteringEngine.matchStringExactType(context, 'blob:', 'script');
452-
var workerResult = µb.staticNetFilteringEngine.toResultString(loggerEnabled),
453-
blockWorker = µb.isBlockResult(workerResult);
454-
455456
var headersChanged;
456457
if ( blockInlineScript || blockWebsocket || blockWorker ) {
457458
headersChanged = foilWithCSP(

0 commit comments

Comments
 (0)