Skip to content

Commit

Permalink
Make the creation of _allow_ rules in panel an opt-in feature
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gorhill committed May 22, 2020
1 parent 7b140a1 commit 162e537
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
11 changes: 7 additions & 4 deletions src/css/popup-fenix.css
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,9 @@ body.advancedUser #firewall > div > span.noopRule.ownRule,

#actionSelector {
box-sizing: border-box;
display: flex;
height: 100%;
justify-items: stretch;
left: 0;
overflow: hidden;
position: absolute;
Expand All @@ -488,16 +490,17 @@ body.advancedUser #firewall > div > span.noopRule.ownRule,
}
#actionSelector > span {
display: inline-block;
height: 100%;
flex-grow: 1;
}
#actionSelector > #dynaAllow {
width: 33%;
display: none;
}
body.godMode #actionSelector > #dynaAllow {
display: inline-block;
}
#actionSelector > #dynaNoop {
width: 33.5%;
}
#actionSelector > #dynaBlock {
width: 33.5%;
}
#actionSelector > #dynaCounts {
background-color: transparent;
Expand Down
1 change: 1 addition & 0 deletions src/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const µBlock = (( ) => { // jshint ignore:line
popupFontSize: 'unset',
popupPanelDisabledSections: 0,
popupPanelLockedSections: 0,
popupPanelGodMode: false,
popupPanelHeightMode: 0,
requestJournalProcessPeriod: 1000,
selfieAfter: 3,
Expand Down
14 changes: 8 additions & 6 deletions src/js/messaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ const popupDataFromTabId = function(tabId, tabTitle) {
const tabContext = µb.tabContextManager.mustLookup(tabId);
const rootHostname = tabContext.rootHostname;
const µbus = µb.userSettings;
const µbhs = µb.hiddenSettings;
const r = {
advancedUserEnabled: µbus.advancedUserEnabled,
appName: vAPI.app.name,
Expand All @@ -278,7 +279,8 @@ const popupDataFromTabId = function(tabId, tabTitle) {
firewallPaneMinimized: µbus.firewallPaneMinimized,
globalAllowedRequestCount: µb.localSettings.allowedRequestCount,
globalBlockedRequestCount: µb.localSettings.blockedRequestCount,
fontSize: µb.hiddenSettings.popupFontSize,
fontSize: µbhs.popupFontSize,
godMode: µbhs.filterAuthorMode || µbhs.popupPanelGodMode,
netFilteringSwitch: false,
rawURL: tabContext.rawURL,
pageURL: tabContext.normalURL,
Expand All @@ -288,16 +290,16 @@ const popupDataFromTabId = function(tabId, tabTitle) {
pageBlockedRequestCount: 0,
popupBlockedCount: 0,
popupPanelSections: µbus.popupPanelSections,
popupPanelDisabledSections: µb.hiddenSettings.popupPanelDisabledSections,
popupPanelLockedSections: µb.hiddenSettings.popupPanelLockedSections,
popupPanelHeightMode: µb.hiddenSettings.popupPanelHeightMode,
popupPanelDisabledSections: µbhs.popupPanelDisabledSections,
popupPanelLockedSections: µbhs.popupPanelLockedSections,
popupPanelHeightMode: µbhs.popupPanelHeightMode,
tabId: tabId,
tabTitle: tabTitle,
tooltipsDisabled: µbus.tooltipsDisabled
};

if ( µb.hiddenSettings.uiPopupConfig !== 'undocumented' ) {
r.uiPopupConfig = µb.hiddenSettings.uiPopupConfig;
if ( µbhs.uiPopupConfig !== 'undocumented' ) {
r.uiPopupConfig = µbhs.uiPopupConfig;
}

const pageStore = µb.pageStoreFromTabId(tabId);
Expand Down
7 changes: 7 additions & 0 deletions src/js/popup-fenix.js
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,13 @@ let renderOnce = function() {
if ( popupData.popupPanelHeightMode === 1 ) {
body.classList.add('vMin');
}

// Prevent non-advanced user opting into advanced user mode from harming
// themselves by disabling by default features generally suitable to
// filter list maintainers and actual advanced users.
if ( popupData.godMode ) {
body.classList.add('godMode');
}
};

/******************************************************************************/
Expand Down

1 comment on commit 162e537

@gwarser
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

popupPanelGodMode was removed in cd1fef2 and double tap on Ctrl in popup panel was added in 1967463

Please sign in to comment.