Skip to content

Commit

Permalink
Fix #8
Browse files Browse the repository at this point in the history
Assume `hostnameDict = Object.create(null)`

Ideally this should always be the case.
  • Loading branch information
el1t committed Dec 9, 2016
1 parent 623fa90 commit 764e1db
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
3 changes: 0 additions & 3 deletions src/js/dynamic-net-filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,6 @@ Matrix.prototype.copyRules = function(other, srcHostname, desHostnames) {

// Specific destinations
for ( var desHostname in desHostnames ) {
if ( desHostnames.hasOwnProperty(desHostname) === false ) {
continue;
}
ruleKey = '* ' + desHostname;
ruleValue = otherRules[ruleKey] || 0;
if ( ruleValue !== 0 ) {
Expand Down
2 changes: 1 addition & 1 deletion src/js/messaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ var popupDataFromTabId = function(tabId, tabTitle) {
r.noRemoteFonts = µb.hnSwitches.evaluateZ('no-remote-fonts', rootHostname);
r.remoteFontCount = pageStore.remoteFontCount;
} else {
r.hostnameDict = {};
r.hostnameDict = Object.create(null);
r.firewallRules = getFirewallRules();
}
r.matrixIsDirty = !µb.sessionFirewall.hasSameRules(
Expand Down
5 changes: 1 addition & 4 deletions src/js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ var cachePopupData = function(data) {
}
var domain, prefix;
for ( var hostname in hostnameDict ) {
if ( Object.prototype.hasOwnProperty.call(hostnameDict, hostname) === false ) {
continue;
}
domain = hostnameDict[hostname].domain;
prefix = hostname.slice(0, 0 - domain.length);
// Prefix with space char for 1st-party hostnames: this ensure these
Expand Down Expand Up @@ -254,7 +251,7 @@ var updateFirewallCell = function(scope, des, type, rule) {

// Remember this may be a cell from a reused row, we need to clear text
// content if we can't compute request counts.
if ( Object.prototype.hasOwnProperty.call(popupData.hostnameDict, des) === false ) {
if ( popupData.hostnameDict[des] === undefined ) {
cells.removeAttr('data-acount');
cells.removeAttr('data-acount');
return;
Expand Down

0 comments on commit 764e1db

Please sign in to comment.