Skip to content

Commit bc641fc

Browse files
committed
Prevent access to picker when "My filters" is not enabled
Related issue: uBlockOrigin/uBlock-issues#3076
1 parent a15c356 commit bc641fc

File tree

6 files changed

+19
-8
lines changed

6 files changed

+19
-8
lines changed

src/css/popup-fenix.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ body.needSave #revertRules {
211211
font-size: 1.6em;
212212
}
213213

214-
#basicTools:not(.canPick) .needPick {
214+
#basicTools .needPick:not(.canPick) {
215215
visibility: hidden;
216216
}
217217

src/js/commands.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ vAPI.commands.onCommand.addListener(async command => {
139139

140140
switch ( command ) {
141141
case 'launch-element-picker':
142+
if ( µb.userFiltersAreEnabled() === false ) { break; }
143+
/* fall through */
142144
case 'launch-element-zapper': {
143145
µb.epickerArgs.mouse = false;
144146
µb.elementPickerExec(

src/js/contextmenu.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,11 @@ let currentBits = 0;
200200

201201
const update = function(tabId = undefined) {
202202
let newBits = 0;
203-
if ( µb.userSettings.contextMenuEnabled && tabId !== undefined ) {
203+
if (
204+
µb.userSettings.contextMenuEnabled &&
205+
µb.userFiltersAreEnabled() &&
206+
tabId !== undefined
207+
) {
204208
const pageStore = µb.pageStoreFromTabId(tabId);
205209
if ( pageStore && pageStore.getNetFilteringSwitch() ) {
206210
if ( pageStore.shouldApplySpecificCosmeticFilters(0) ) {

src/js/messaging.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ const popupDataFromTabId = function(tabId, tabTitle) {
369369
fontSize: µbhs.popupFontSize,
370370
godMode: µbhs.filterAuthorMode,
371371
netFilteringSwitch: false,
372+
userFiltersAreEnabled: µb.userFiltersAreEnabled(),
372373
rawURL: tabContext.rawURL,
373374
pageURL: tabContext.normalURL,
374375
pageHostname: rootHostname,

src/js/popup-fenix.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -614,11 +614,11 @@ const renderPopup = function() {
614614
}
615615
}
616616

617-
dom.cl.toggle(
618-
'#basicTools',
619-
'canPick',
620-
popupData.canElementPicker === true && isFiltering
621-
);
617+
const canPick = popupData.canElementPicker && isFiltering;
618+
619+
dom.cl.toggle('#gotoZap', 'canPick', canPick);
620+
dom.cl.toggle('#gotoPick', 'canPick', canPick && popupData.userFiltersAreEnabled);
621+
dom.cl.toggle('#gotoReport', 'canPick', canPick);
622622

623623
let blocked, total;
624624
if ( popupData.pageCounts !== undefined ) {
@@ -675,7 +675,7 @@ const renderPopup = function() {
675675
total ? Math.min(total, 99).toLocaleString() : ''
676676
);
677677

678-
// Unprocesseed request(s) warning
678+
// Unprocessed request(s) warning
679679
dom.cl.toggle(dom.root, 'warn', popupData.hasUnprocessedRequest === true);
680680

681681
dom.cl.toggle(dom.html, 'colorBlind', popupData.colorBlindFriendly === true);

src/js/storage.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,10 @@ onBroadcast(msg => {
628628
);
629629
};
630630

631+
µb.userFiltersAreEnabled = function() {
632+
return this.selectedFilterLists.includes(this.userFiltersPath);
633+
};
634+
631635
/******************************************************************************/
632636

633637
µb.autoSelectRegionalFilterLists = function(lists) {

0 commit comments

Comments
 (0)