Skip to content

Commit 162e537

Browse files
committed
Make the creation of _allow_ rules in panel an opt-in feature
There have been too many examples out there of users opting-in to "I am an advanced user" and yet still misusing dynamic filtering by creating _allow_ rules where _noop_ rules should be used. Creating _allow_ rules has serious consequences as these override blocking static filters and can potentially disable other advanced filtering ability such as HTML filtering and scriptlet injection -- often used to deal with anti-blocker mechanisms. The ability to point-and-click to create _allow_ rules from the popup panel is no longer allowed by default. An new advanced setting has been added to enable the ability to create _allow_ rules from the popup panel, `popupPanelGodMode`, which default to `false`. Set to `true` to restore ability to set _allow_ rules from popup panel. Since the creation of _allow_ rules is especially useful to filter list authors, to diagnose and narrow down site breakage as a result of problematic blocking filter, the creation of _allow_ rules will still be available when the advanced setting `filterAuthorMode` is `true`. This change is probably going to be problematic to all those users who were misusing dynamic filtering by creating _allow_ rules instead of _noop_ rules -- but the breakage is going to bring their misusing to their attention, a positive outcome.
1 parent 7b140a1 commit 162e537

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

src/css/popup-fenix.css

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,9 @@ body.advancedUser #firewall > div > span.noopRule.ownRule,
478478

479479
#actionSelector {
480480
box-sizing: border-box;
481+
display: flex;
481482
height: 100%;
483+
justify-items: stretch;
482484
left: 0;
483485
overflow: hidden;
484486
position: absolute;
@@ -488,16 +490,17 @@ body.advancedUser #firewall > div > span.noopRule.ownRule,
488490
}
489491
#actionSelector > span {
490492
display: inline-block;
491-
height: 100%;
493+
flex-grow: 1;
492494
}
493495
#actionSelector > #dynaAllow {
494-
width: 33%;
496+
display: none;
497+
}
498+
body.godMode #actionSelector > #dynaAllow {
499+
display: inline-block;
495500
}
496501
#actionSelector > #dynaNoop {
497-
width: 33.5%;
498502
}
499503
#actionSelector > #dynaBlock {
500-
width: 33.5%;
501504
}
502505
#actionSelector > #dynaCounts {
503506
background-color: transparent;

src/js/background.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ const µBlock = (( ) => { // jshint ignore:line
6868
popupFontSize: 'unset',
6969
popupPanelDisabledSections: 0,
7070
popupPanelLockedSections: 0,
71+
popupPanelGodMode: false,
7172
popupPanelHeightMode: 0,
7273
requestJournalProcessPeriod: 1000,
7374
selfieAfter: 3,

src/js/messaging.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ const popupDataFromTabId = function(tabId, tabTitle) {
269269
const tabContext = µb.tabContextManager.mustLookup(tabId);
270270
const rootHostname = tabContext.rootHostname;
271271
const µbus = µb.userSettings;
272+
const µbhs = µb.hiddenSettings;
272273
const r = {
273274
advancedUserEnabled: µbus.advancedUserEnabled,
274275
appName: vAPI.app.name,
@@ -278,7 +279,8 @@ const popupDataFromTabId = function(tabId, tabTitle) {
278279
firewallPaneMinimized: µbus.firewallPaneMinimized,
279280
globalAllowedRequestCount: µb.localSettings.allowedRequestCount,
280281
globalBlockedRequestCount: µb.localSettings.blockedRequestCount,
281-
fontSize: µb.hiddenSettings.popupFontSize,
282+
fontSize: µbhs.popupFontSize,
283+
godMode: µbhs.filterAuthorMode || µbhs.popupPanelGodMode,
282284
netFilteringSwitch: false,
283285
rawURL: tabContext.rawURL,
284286
pageURL: tabContext.normalURL,
@@ -288,16 +290,16 @@ const popupDataFromTabId = function(tabId, tabTitle) {
288290
pageBlockedRequestCount: 0,
289291
popupBlockedCount: 0,
290292
popupPanelSections: µbus.popupPanelSections,
291-
popupPanelDisabledSections: µb.hiddenSettings.popupPanelDisabledSections,
292-
popupPanelLockedSections: µb.hiddenSettings.popupPanelLockedSections,
293-
popupPanelHeightMode: µb.hiddenSettings.popupPanelHeightMode,
293+
popupPanelDisabledSections: µbhs.popupPanelDisabledSections,
294+
popupPanelLockedSections: µbhs.popupPanelLockedSections,
295+
popupPanelHeightMode: µbhs.popupPanelHeightMode,
294296
tabId: tabId,
295297
tabTitle: tabTitle,
296298
tooltipsDisabled: µbus.tooltipsDisabled
297299
};
298300

299-
if ( µb.hiddenSettings.uiPopupConfig !== 'undocumented' ) {
300-
r.uiPopupConfig = µb.hiddenSettings.uiPopupConfig;
301+
if ( µbhs.uiPopupConfig !== 'undocumented' ) {
302+
r.uiPopupConfig = µbhs.uiPopupConfig;
301303
}
302304

303305
const pageStore = µb.pageStoreFromTabId(tabId);

src/js/popup-fenix.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,13 @@ let renderOnce = function() {
644644
if ( popupData.popupPanelHeightMode === 1 ) {
645645
body.classList.add('vMin');
646646
}
647+
648+
// Prevent non-advanced user opting into advanced user mode from harming
649+
// themselves by disabling by default features generally suitable to
650+
// filter list maintainers and actual advanced users.
651+
if ( popupData.godMode ) {
652+
body.classList.add('godMode');
653+
}
647654
};
648655

649656
/******************************************************************************/

0 commit comments

Comments
 (0)