Improve reporting of reason option in strict-blocked pages

Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/issues/1195#issuecomment-3072981070
This commit is contained in:
Raymond Hill 2025-07-15 12:10:10 -04:00
parent 1e955bebbe
commit b7510eee61
No known key found for this signature in database
GPG key ID: 25E1490B761470C2
3 changed files with 16 additions and 10 deletions

View file

@ -73,7 +73,7 @@ a {
}
#theURL > p > span:first-of-type {
display: block;
max-height: 6lh;
max-height: 3lh;
overflow-y: auto;
}
:root.mobile #theURL > p > span:first-of-type {
@ -146,6 +146,7 @@ details > *:not(summary) {
#urlskip a {
display: block;
max-height: 3lh;
overflow-y: auto;
word-break: break-all;
}

View file

@ -976,14 +976,12 @@ const PageStore = class {
skipMainDocument(fctxt, blocked) {
const directives = staticNetFilteringEngine.urlSkip(fctxt, blocked);
if ( directives === undefined ) { return; }
if ( logger.enabled !== true ) { return; }
fctxt.pushFilters(directives.map(a => a.logData()));
if ( fctxt.redirectURL !== undefined ) {
fctxt.pushFilter({
source: 'redirect',
raw: fctxt.redirectURL
});
}
if ( fctxt.redirectURL === undefined ) { return; }
fctxt.pushFilter({
source: 'redirect',
raw: fctxt.redirectURL
});
}
filterCSPReport(fctxt) {

View file

@ -221,9 +221,16 @@ const onBeforeRootFrameRequest = function(fctxt) {
// Blocked
let reason = logData.reason;
// Find out the URL navigated to should the document not be strict-blocked
pageStore.skipMainDocument(fctxt, false);
if ( reason === undefined && Array.isArray(fctxt.filter) ) {
const filter = fctxt.filter.find(a => a.reason !== undefined);
reason = filter?.reason;
}
const query = {
url: requestURL,
dn: fctxt.getDomain() || requestHostname,
@ -231,8 +238,8 @@ const onBeforeRootFrameRequest = function(fctxt) {
hn: requestHostname,
to: fctxt.redirectURL || '',
};
if ( logData.reason ) {
query.reason = logData.reason;
if ( reason ) {
query.reason = reason;
}
vAPI.tabs.replace(