Skip to content

Commit 7984c75

Browse files
committed
1 parent 42938c9 commit 7984c75

4 files changed

Lines changed: 16 additions & 41 deletions

File tree

src/css/popup.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,6 @@ body.portrait #firewallContainer > div > span:nth-of-type(4) {
473473
#actionSelector.colorBlind > span:nth-of-type(3) {
474474
background-color: rgb(0, 19, 110);
475475
}
476-
#firewallContainer span.aRule #actionSelector > span:nth-of-type(1),
477-
#firewallContainer span.nRule #actionSelector > span:nth-of-type(2),
478-
#firewallContainer span.bRule #actionSelector > span:nth-of-type(3) {
479-
visibility: hidden;
480-
}
481476

482477
#rulesetTools {
483478
background-color: transparent;

src/js/dynamic-net-filtering.js

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*******************************************************************************
22
3-
uBlock - a browser extension to block requests.
4-
Copyright (C) 2014 Raymond Hill
3+
uBlock Origin - a browser extension to block requests.
4+
Copyright (C) 2014-2016 Raymond Hill
55
66
This program is free software: you can redistribute it and/or modify
77
it under the terms of the GNU General Public License as published by
@@ -19,15 +19,15 @@
1919
Home: https://github.com/gorhill/uBlock
2020
*/
2121

22-
/* global punycode, µBlock */
22+
/* global punycode */
2323
/* jshint bitwise: false */
2424

25+
'use strict';
26+
2527
/******************************************************************************/
2628

2729
µBlock.Firewall = (function() {
2830

29-
'use strict';
30-
3131
/******************************************************************************/
3232

3333
var magicId = 'chmdgxwtetgu';
@@ -94,6 +94,10 @@ var isIPAddress = function(hostname) {
9494

9595
/******************************************************************************/
9696

97+
// TODO: Rearrange the code so as to avoid calling isIPAddress() from within
98+
// toBroaderHostname(). A hostname will never magically become an IP address
99+
// when broadened -- so no need to test for this condition each call.
100+
97101
var toBroaderHostname = function(hostname) {
98102
if ( isIPAddress(hostname) ) {
99103
return '*';
@@ -261,38 +265,10 @@ Matrix.prototype.unsetCell = function(srcHostname, desHostname, type) {
261265
return true;
262266
};
263267

264-
/******************************************************************************/
265-
266-
Matrix.prototype.setCellZ = function(srcHostname, desHostname, type, action) {
267-
this.evaluateCellZY(srcHostname, desHostname, type);
268-
if ( this.r === action ) {
269-
return false;
270-
}
271-
this.setCell(srcHostname, desHostname, type, 0);
272-
this.evaluateCellZY(srcHostname, desHostname, type);
273-
if ( this.r === action ) {
274-
return true;
275-
}
276-
this.setCell(srcHostname, desHostname, type, action);
277-
return true;
278-
};
279-
280-
/******************************************************************************/
281-
282-
Matrix.prototype.blockCell = function(srcHostname, desHostname, type) {
283-
return this.setCellZ(srcHostname, desHostname, type, 1);
284-
};
285-
286268
// https://www.youtube.com/watch?v=Csewb_eIStY
287269

288270
/******************************************************************************/
289271

290-
Matrix.prototype.allowCell = function(srcHostname, desHostname, type) {
291-
return this.setCellZ(srcHostname, desHostname, type, 2);
292-
};
293-
294-
/******************************************************************************/
295-
296272
Matrix.prototype.evaluateCell = function(srcHostname, desHostname, type) {
297273
var key = srcHostname + ' ' + desHostname;
298274
var bitmap = this.rules[key];

src/js/popup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ var updateFirewallCell = function(scope, des, type, rule) {
239239
cell.toggleClass(action + 'Rule', true);
240240
}
241241

242-
// Use dark shade visual cue if the filter is specific to the cell.
242+
// Use dark shade visual cue if the rule is specific to the cell.
243243
var ownRule = false;
244244
var matches = reSrcHostnameFromRule.exec(rule);
245245
if ( matches !== null ) {

src/js/ublock.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,19 +330,23 @@ var matchWhitelistDirective = function(url, hostname, directive) {
330330

331331
/******************************************************************************/
332332

333+
// https://github.com/gorhill/uBlock/issues/2033
334+
// Always set own rules, trying to be fancy to avoid setting seemingly
335+
// (but not really) redundant rules led to this issue.
336+
333337
µBlock.toggleFirewallRule = function(details) {
334338
var requestType = details.requestType;
335339

336340
if ( details.action !== 0 ) {
337-
this.sessionFirewall.setCellZ(details.srcHostname, details.desHostname, requestType, details.action);
341+
this.sessionFirewall.setCell(details.srcHostname, details.desHostname, requestType, details.action);
338342
} else {
339343
this.sessionFirewall.unsetCell(details.srcHostname, details.desHostname, requestType);
340344
}
341345

342346
// https://github.com/chrisaljoudi/uBlock/issues/731#issuecomment-73937469
343347
if ( details.persist ) {
344348
if ( details.action !== 0 ) {
345-
this.permanentFirewall.setCellZ(details.srcHostname, details.desHostname, requestType, details.action);
349+
this.permanentFirewall.setCell(details.srcHostname, details.desHostname, requestType, details.action);
346350
} else {
347351
this.permanentFirewall.unsetCell(details.srcHostname, details.desHostname, requestType, details.action);
348352
}

0 commit comments

Comments
 (0)