mirror of https://github.com/gorhill/uBlock.git
code review
This commit is contained in:
parent
bb1e131ae7
commit
88b517e6fa
|
@ -354,15 +354,22 @@ var renderPrivacyExposure = function() {
|
|||
desHostnameDone[des] = true;
|
||||
}
|
||||
|
||||
// Domain of the page must always be included
|
||||
if ( allDomains.hasOwnProperty(popupData.pageDomain) === false ) {
|
||||
console.log(popupData.pageDomain);
|
||||
allHostnameRows.push(popupData.pageDomain);
|
||||
allDomains[popupData.pageDomain] = false;
|
||||
allDomainCount += 1;
|
||||
}
|
||||
|
||||
// The root page domain must always be counted as connected: that's from
|
||||
// where the root document was fetched.
|
||||
// https://github.com/gorhill/uBlock/issues/759
|
||||
// The root page domain must be counted if and only if it was actually
|
||||
// obtained through a network request.
|
||||
if ( allDomainCount !== 0 && allDomains[popupData.pageDomain] !== true ) {
|
||||
allDomains[popupData.pageDomain] = true;
|
||||
touchedDomainCount += 1;
|
||||
}
|
||||
//if ( allDomainCount !== 0 && allDomains[popupData.pageDomain] === false ) {
|
||||
// touchedDomainCount += 1;
|
||||
//}
|
||||
|
||||
var summary = domainsHitStr.replace('{{count}}', touchedDomainCount.toLocaleString())
|
||||
.replace('{{total}}', allDomainCount.toLocaleString());
|
||||
|
|
|
@ -78,21 +78,24 @@ var onBeforeRequest = function(details) {
|
|||
// Lookup the page store associated with this tab id.
|
||||
pageStore = µb.pageStoreFromTabId(tabId);
|
||||
if ( !pageStore ) {
|
||||
if ( mostRecentRootDocURL === '' ) {
|
||||
return;
|
||||
}
|
||||
// https://github.com/gorhill/uBlock/issues/1025
|
||||
// Google Hangout popup opens without a root frame. So for now we will
|
||||
// just discard that best-guess root frame if it is too far in the
|
||||
// future, at which point it ceases to be a "best guess".
|
||||
if ( (Date.now() - mostRecentRootDocURLTimestamp) >= 500 ) {
|
||||
mostRecentRootDocURL = '';
|
||||
return;
|
||||
}
|
||||
// https://github.com/gorhill/uBlock/issues/1001
|
||||
// Not a behind-the-scene request, yet no page store found for the
|
||||
// tab id: we will thus bind the last-seen root document to the
|
||||
// unbound tab. It's a guess, but better than ending up filtering
|
||||
// nothing at all.
|
||||
if ( mostRecentRootDocURL !== '' ) {
|
||||
pageStore = µb.bindTabToPageStats(tabId, mostRecentRootDocURL, 'beforeRequest');
|
||||
}
|
||||
vAPI.tabs.onNavigation({ tabId: tabId, frameId: 0, url: mostRecentRootDocURL });
|
||||
pageStore = µb.pageStoreFromTabId(tabId);
|
||||
if ( !pageStore ) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue