Raymond Hill 6 years ago
parent b724a6356a
commit bb29ad2c34
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

@ -166,10 +166,10 @@ RowSnapshot.counts = (function() {
/******************************************************************************/ /******************************************************************************/
var matrixSnapshot = function(pageStore, details) { var matrixSnapshot = function(pageStore, details) {
var µmuser = µm.userSettings; let µmuser = µm.userSettings;
var headerIndices = µm.Matrix.columnHeaderIndices; let headerIndices = µm.Matrix.columnHeaderIndices;
var r = { let r = {
appVersion: vAPI.app.version, appVersion: vAPI.app.version,
blockedCount: pageStore.requestStats.blocked.all, blockedCount: pageStore.requestStats.blocked.all,
collapseAllDomains: µmuser.popupCollapseAllDomains, collapseAllDomains: µmuser.popupCollapseAllDomains,
@ -205,7 +205,10 @@ var matrixSnapshot = function(pageStore, details) {
} }
}; };
if ( typeof details.scope === 'string' ) { if (
typeof details.scope === 'string' &&
r.hostname.endsWith(details.scope)
) {
r.scope = details.scope; r.scope = details.scope;
} else if ( µmuser.popupScopeLevel === 'site' ) { } else if ( µmuser.popupScopeLevel === 'site' ) {
r.scope = r.hostname; r.scope = r.hostname;
@ -213,7 +216,7 @@ var matrixSnapshot = function(pageStore, details) {
r.scope = r.domain; r.scope = r.domain;
} }
for ( var switchName of µm.Matrix.switchNames ) { for ( let switchName of µm.Matrix.switchNames ) {
r.tSwitches[switchName] = µm.tMatrix.evaluateSwitchZ(switchName, r.scope); r.tSwitches[switchName] = µm.tMatrix.evaluateSwitchZ(switchName, r.scope);
r.pSwitches[switchName] = µm.pMatrix.evaluateSwitchZ(switchName, r.scope); r.pSwitches[switchName] = µm.pMatrix.evaluateSwitchZ(switchName, r.scope);
} }
@ -223,26 +226,22 @@ var matrixSnapshot = function(pageStore, details) {
r.rows['1st-party'] = new RowSnapshot(r.scope, '1st-party', '1st-party'); r.rows['1st-party'] = new RowSnapshot(r.scope, '1st-party', '1st-party');
r.rowCount += 1; r.rowCount += 1;
var µmuri = µm.URI; let µmuri = µm.URI;
var reqType, reqHostname, reqDomain; let anyIndex = headerIndices.get('*');
var desHostname;
var row, typeIndex; for ( let entry of pageStore.hostnameTypeCells ) {
var anyIndex = headerIndices.get('*'); let pos = entry[0].indexOf(' ');
var pos, count; let reqHostname = entry[0].slice(0, pos);
let reqType = entry[0].slice(pos + 1);
for ( var entry of pageStore.hostnameTypeCells ) {
pos = entry[0].indexOf(' ');
reqHostname = entry[0].slice(0, pos);
reqType = entry[0].slice(pos + 1);
// rhill 2013-10-23: hostname can be empty if the request is a data url // rhill 2013-10-23: hostname can be empty if the request is a data url
// https://github.com/gorhill/httpswitchboard/issues/26 // https://github.com/gorhill/httpswitchboard/issues/26
if ( reqHostname === '' ) { if ( reqHostname === '' ) {
reqHostname = pageStore.pageHostname; reqHostname = pageStore.pageHostname;
} }
reqDomain = µmuri.domainFromHostname(reqHostname) || reqHostname; let reqDomain = µmuri.domainFromHostname(reqHostname) || reqHostname;
// We want rows of self and ancestors // We want rows of self and ancestors
desHostname = reqHostname; let desHostname = reqHostname;
for (;;) { for (;;) {
// If row exists, ancestors exist // If row exists, ancestors exist
if ( r.rows.hasOwnProperty(desHostname) !== false ) { break; } if ( r.rows.hasOwnProperty(desHostname) !== false ) { break; }
@ -254,9 +253,9 @@ var matrixSnapshot = function(pageStore, details) {
desHostname = desHostname.slice(pos + 1); desHostname = desHostname.slice(pos + 1);
} }
count = entry[1].size; let count = entry[1].size;
typeIndex = headerIndices.get(reqType); let typeIndex = headerIndices.get(reqType);
row = r.rows[reqHostname]; let row = r.rows[reqHostname];
row.counts[typeIndex] += count; row.counts[typeIndex] += count;
row.counts[anyIndex] += count; row.counts[anyIndex] += count;
row = r.rows[reqDomain]; row = r.rows[reqDomain];

Loading…
Cancel
Save