Skip to content

Commit b7510ee

Browse files
committed
Improve reporting of reason option in strict-blocked pages
Related feedback: uBlockOrigin/uBlock-issues#1195 (comment)
1 parent 1e955be commit b7510ee

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

src/css/document-blocked.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ a {
7373
}
7474
#theURL > p > span:first-of-type {
7575
display: block;
76-
max-height: 6lh;
76+
max-height: 3lh;
7777
overflow-y: auto;
7878
}
7979
:root.mobile #theURL > p > span:first-of-type {
@@ -146,6 +146,7 @@ details > *:not(summary) {
146146

147147
#urlskip a {
148148
display: block;
149+
max-height: 3lh;
149150
overflow-y: auto;
150151
word-break: break-all;
151152
}

src/js/pagestore.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -976,14 +976,12 @@ const PageStore = class {
976976
skipMainDocument(fctxt, blocked) {
977977
const directives = staticNetFilteringEngine.urlSkip(fctxt, blocked);
978978
if ( directives === undefined ) { return; }
979-
if ( logger.enabled !== true ) { return; }
980979
fctxt.pushFilters(directives.map(a => a.logData()));
981-
if ( fctxt.redirectURL !== undefined ) {
982-
fctxt.pushFilter({
983-
source: 'redirect',
984-
raw: fctxt.redirectURL
985-
});
986-
}
980+
if ( fctxt.redirectURL === undefined ) { return; }
981+
fctxt.pushFilter({
982+
source: 'redirect',
983+
raw: fctxt.redirectURL
984+
});
987985
}
988986

989987
filterCSPReport(fctxt) {

src/js/traffic.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,18 +221,25 @@ const onBeforeRootFrameRequest = function(fctxt) {
221221

222222
// Blocked
223223

224+
let reason = logData.reason;
225+
224226
// Find out the URL navigated to should the document not be strict-blocked
225227
pageStore.skipMainDocument(fctxt, false);
226228

229+
if ( reason === undefined && Array.isArray(fctxt.filter) ) {
230+
const filter = fctxt.filter.find(a => a.reason !== undefined);
231+
reason = filter?.reason;
232+
}
233+
227234
const query = {
228235
url: requestURL,
229236
dn: fctxt.getDomain() || requestHostname,
230237
fs: logData.raw,
231238
hn: requestHostname,
232239
to: fctxt.redirectURL || '',
233240
};
234-
if ( logData.reason ) {
235-
query.reason = logData.reason;
241+
if ( reason ) {
242+
query.reason = reason;
236243
}
237244

238245
vAPI.tabs.replace(

0 commit comments

Comments
 (0)