This commit is contained in:
gorhill 2016-01-07 17:30:56 -05:00
parent c15f693129
commit 91c2763259
4 changed files with 18 additions and 2 deletions

View file

@ -154,7 +154,7 @@ body.colorBlind #netInspector tr.nooped {
body.colorBlind #netInspector tr.allowed {
background-color: rgba(255, 194, 57, 0.1)
}
#netInspector tr.cb {
#netInspector tr.cb, #netInspector tr.rr {
background-color: rgba(255, 255, 0, 0.1);
}
#netInspector tr.maindoc {
@ -219,6 +219,9 @@ body:not(.popupOn) #netInspector tr.canMtx td:nth-of-type(2):hover {
#netInspector tr.canLookup td:nth-of-type(3) {
cursor: zoom-in;
}
#netInspector tr.cat_redirect td:nth-of-type(3):before {
content: '\21d2 ';
}
#netInspector tr.cat_net td:nth-of-type(4),
#netInspector tr.cat_cosmetic td:nth-of-type(4) {
font: 12px monospace;

View file

@ -517,6 +517,7 @@ var renderLogEntry = function(entry) {
case 'cosmetic':
case 'net':
case 'redirect':
tr = createRow('1111');
renderNetLogEntry(tr, entry);
break;

View file

@ -96,6 +96,7 @@ RedirectEntry.fromSelfie = function(selfie) {
var RedirectEngine = function() {
this.resources = Object.create(null);
this.reset();
this.resourceNameRegister = '';
};
/******************************************************************************/
@ -131,7 +132,7 @@ RedirectEngine.prototype.lookup = function(context) {
while ( i-- ) {
entry = entries[i];
if ( entry.c.test(reqURL) ) {
return entry.r;
return (this.resourceNameRegister = entry.r);
}
}
}

View file

@ -135,6 +135,17 @@ var onBeforeRequest = function(details) {
// Redirect blocked request?
var url = µb.redirectEngine.toURL(requestContext);
if ( url !== undefined ) {
if ( µb.logger.isEnabled() ) {
µb.logger.writeOne(
tabId,
'redirect',
'rr:' + µb.redirectEngine.resourceNameRegister,
'redirect',
requestURL,
requestContext.rootHostname,
requestContext.pageHostname
);
}
return { redirectUrl: url };
}