mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-02 00:42:45 +01:00
also log root document for convenience
This commit is contained in:
parent
3e084455a7
commit
ae2eb25e25
@ -42,6 +42,9 @@ body {
|
|||||||
#content table tr.allowed {
|
#content table tr.allowed {
|
||||||
background-color: rgba(0, 160, 0, 0.1)
|
background-color: rgba(0, 160, 0, 0.1)
|
||||||
}
|
}
|
||||||
|
#content table tr.maindoc {
|
||||||
|
background-color: #eee;
|
||||||
|
}
|
||||||
#content table tr td {
|
#content table tr td {
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
|
@ -99,6 +99,9 @@ var renderLogEntry = function(entry) {
|
|||||||
} else if ( entry.result.charAt(1) === 'a' ) {
|
} else if ( entry.result.charAt(1) === 'a' ) {
|
||||||
tr.classList.add('allowed');
|
tr.classList.add('allowed');
|
||||||
}
|
}
|
||||||
|
if ( entry.type === 'main_frame' ) {
|
||||||
|
tr.classList.add('maindoc');
|
||||||
|
}
|
||||||
tr.cells[0].textContent = entry.result.slice(3);
|
tr.cells[0].textContent = entry.result.slice(3);
|
||||||
tr.cells[1].textContent = entry.type;
|
tr.cells[1].textContent = entry.type;
|
||||||
tr.cells[2].innerHTML = renderURL(entry.url, entry.result);
|
tr.cells[2].innerHTML = renderURL(entry.url, entry.result);
|
||||||
|
@ -39,16 +39,25 @@ var onBeforeRequest = function(details) {
|
|||||||
// Do not block behind the scene requests.
|
// Do not block behind the scene requests.
|
||||||
var tabId = details.tabId;
|
var tabId = details.tabId;
|
||||||
if ( tabId < 0 ) {
|
if ( tabId < 0 ) {
|
||||||
|
// TODO: logging behind-the-scene requests could be nice..
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var µb = µBlock;
|
var µb = µBlock;
|
||||||
var requestURL = details.url;
|
var requestURL = details.url;
|
||||||
var requestType = details.type;
|
var requestType = details.type;
|
||||||
|
var pageStore;
|
||||||
|
|
||||||
// Special handling for root document.
|
// Special handling for root document.
|
||||||
if ( requestType === 'main_frame' && details.parentFrameId === -1 ) {
|
if ( requestType === 'main_frame' && details.parentFrameId === -1 ) {
|
||||||
µb.bindTabToPageStats(tabId, requestURL, 'beforeRequest');
|
pageStore = µb.bindTabToPageStats(tabId, requestURL, 'beforeRequest');
|
||||||
|
// Log for convenience
|
||||||
|
if ( pageStore !== null ) {
|
||||||
|
pageStore.requestURL = requestURL;
|
||||||
|
pageStore.requestHostname = pageStore.pageHostname;
|
||||||
|
pageStore.requestType = 'main_frame';
|
||||||
|
pageStore.logBuffer.writeOne(pageStore, '');
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +82,7 @@ var onBeforeRequest = function(details) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Lookup the page store associated with this tab id.
|
// Lookup the page store associated with this tab id.
|
||||||
var pageStore = µb.pageStoreFromTabId(tabId);
|
pageStore = µb.pageStoreFromTabId(tabId);
|
||||||
if ( !pageStore ) {
|
if ( !pageStore ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user