+52
-54
lines changedFilter options
+52
-54
lines changed Original file line number Diff line number Diff line change
@@ -186,9 +186,11 @@ vAPI.Tabs = class extends vAPI.Tabs {
186
186
return { cancel: true };
187
187
}
188
188
189
-
unsuspendAllRequests() {
190
-
for ( const tabId of this.suspendedTabIds ) {
191
-
vAPI.tabs.reload(tabId);
189
+
unsuspendAllRequests(discard = false) {
190
+
if ( discard !== true ) {
191
+
for ( const tabId of this.suspendedTabIds ) {
192
+
vAPI.tabs.reload(tabId);
193
+
}
192
194
}
193
195
this.suspendedTabIds.clear();
194
196
}
Original file line number Diff line number Diff line change
@@ -1220,20 +1220,18 @@ vAPI.Net = class {
1220
1220
}
1221
1221
unsuspendAllRequests() {
1222
1222
}
1223
-
suspend(force = false) {
1224
-
if ( this.canSuspend() || force ) {
1225
-
this.suspendDepth += 1;
1226
-
}
1223
+
suspend() {
1224
+
this.suspendDepth += 1;
1227
1225
}
1228
-
unsuspend(all = false) {
1226
+
unsuspend({ all = false, discard = false } = {}) {
1229
1227
if ( this.suspendDepth === 0 ) { return; }
1230
1228
if ( all ) {
1231
1229
this.suspendDepth = 0;
1232
1230
} else {
1233
1231
this.suspendDepth -= 1;
1234
1232
}
1235
1233
if ( this.suspendDepth !== 0 ) { return; }
1236
-
this.unsuspendAllRequests();
1234
+
this.unsuspendAllRequests(discard);
1237
1235
}
1238
1236
canSuspend() {
1239
1237
return false;
Original file line number Diff line number Diff line change
@@ -292,11 +292,15 @@ import {
292
292
this.pendingRequests.push(pending);
293
293
return pending.promise;
294
294
}
295
-
unsuspendAllRequests() {
295
+
unsuspendAllRequests(discard = false) {
296
296
const pendingRequests = this.pendingRequests;
297
297
this.pendingRequests = [];
298
298
for ( const entry of pendingRequests ) {
299
-
entry.resolve(this.onBeforeSuspendableRequest(entry.details));
299
+
entry.resolve(
300
+
discard !== true
301
+
? this.onBeforeSuspendableRequest(entry.details)
302
+
: undefined
303
+
);
300
304
}
301
305
}
302
306
canSuspend() {
Original file line number Diff line number Diff line change
@@ -24,10 +24,17 @@
24
24
</div>
25
25
26
26
<div>
27
-
<div class="li"><label><span class="input checkbox"><input type="checkbox" id="autoUpdate"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span><span data-i18n="3pAutoUpdatePrompt1"></span></label></div>
28
-
<div class="li"><label><span class="input checkbox"><input type="checkbox" id="parseCosmeticFilters"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span><span><span data-i18n="3pParseAllABPHideFiltersPrompt1"></span> <span class="fa-icon info" data-i18n-title="3pParseAllABPHideFiltersInfo">question-circle</span></span></label>
27
+
<div class="li">
28
+
<label><span class="input checkbox"><input type="checkbox" id="autoUpdate"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span><span data-i18n="3pAutoUpdatePrompt1"></span></label>
29
29
</div>
30
-
<div class="li"><label><span class="input checkbox"><input type="checkbox" id="ignoreGenericCosmeticFilters"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span><span><span data-i18n="3pIgnoreGenericCosmeticFilters"></span> <span class="fa-icon info" data-i18n-title="3pIgnoreGenericCosmeticFiltersInfo">question-circle</span></span></label>
30
+
<div class="li">
31
+
<label><span class="input checkbox"><input type="checkbox" id="parseCosmeticFilters"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span><span><span data-i18n="3pParseAllABPHideFiltersPrompt1"></span> <span class="fa-icon info" data-i18n-title="3pParseAllABPHideFiltersInfo">question-circle</span></span></label>
32
+
</div>
33
+
<div class="li">
34
+
<label><span class="input checkbox"><input type="checkbox" id="ignoreGenericCosmeticFilters"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span><span><span data-i18n="3pIgnoreGenericCosmeticFilters"></span> <span class="fa-icon info" data-i18n-title="3pIgnoreGenericCosmeticFiltersInfo">question-circle</span></span></label>
35
+
</div>
36
+
<div class="li">
37
+
<label><span class="input checkbox"><input type="checkbox" id="suspendUntilListsAreLoaded"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span><span data-i18n="3pSuspendUntilListsAreLoaded"></span></label>
31
38
</div>
32
39
</div>
33
40
Original file line number Diff line number Diff line change
@@ -286,7 +286,8 @@ const renderFilterLists = function(soft) {
286
286
// Re-insert import widget.
287
287
uDom('[data-groupkey="custom"] .listEntries').append(importWidget);
288
288
289
-
uDom.nodeFromId('autoUpdate').checked = listDetails.autoUpdate === true;
289
+
uDom.nodeFromId('autoUpdate').checked =
290
+
listDetails.autoUpdate === true;
290
291
uDom.nodeFromId('listsOfBlockedHostsPrompt').textContent =
291
292
vAPI.i18n('3pListsOfBlockedHostsPrompt')
292
293
.replace(
@@ -301,6 +302,8 @@ const renderFilterLists = function(soft) {
301
302
listDetails.parseCosmeticFilters === true;
302
303
uDom.nodeFromId('ignoreGenericCosmeticFilters').checked =
303
304
listDetails.ignoreGenericCosmeticFilters === true;
305
+
uDom.nodeFromId('suspendUntilListsAreLoaded').checked =
306
+
listDetails.suspendUntilListsAreLoaded === true;
304
307
305
308
// Compute a hash of the settings so that we can keep track of changes
306
309
// affecting the loading of filter lists.
@@ -529,11 +532,12 @@ const buttonPurgeAllHandler = async function(hard) {
529
532
530
533
/******************************************************************************/
531
534
532
-
const autoUpdateCheckboxChanged = function() {
535
+
const userSettingCheckboxChanged = function() {
536
+
const target = event.target;
533
537
messaging.send('dashboard', {
534
538
what: 'userSettings',
535
-
name: 'autoUpdate',
536
-
value: this.checked,
539
+
name: target.id,
540
+
value: target.checked,
537
541
});
538
542
};
539
543
@@ -683,9 +687,10 @@ self.hasUnsavedData = function() {
683
687
684
688
/******************************************************************************/
685
689
686
-
uDom('#autoUpdate').on('change', autoUpdateCheckboxChanged);
690
+
uDom('#autoUpdate').on('change', userSettingCheckboxChanged);
687
691
uDom('#parseCosmeticFilters').on('change', onFilteringSettingsChanged);
688
692
uDom('#ignoreGenericCosmeticFilters').on('change', onFilteringSettingsChanged);
693
+
uDom('#suspendUntilListsAreLoaded').on('change', userSettingCheckboxChanged);
689
694
uDom('#buttonApply').on('click', ( ) => { buttonApplyHandler(); });
690
695
uDom('#buttonUpdate').on('click', ( ) => { buttonUpdateHandler(); });
691
696
uDom('#buttonPurgeAll').on('click', ev => {
Original file line number Diff line number Diff line change
@@ -80,7 +80,6 @@ const hiddenSettingsDefault = {
80
80
requestJournalProcessPeriod: 1000,
81
81
selfieAfter: 2,
82
82
strictBlockingBypassDuration: 120,
83
-
suspendTabsUntilReady: 'unset',
84
83
uiPopupConfig: 'unset',
85
84
uiFlavor: 'unset',
86
85
uiStyles: 'unset',
@@ -109,6 +108,7 @@ const userSettingsDefault = {
109
108
prefetchingDisabled: true,
110
109
requestLogMaxEntries: 1000,
111
110
showIconBadge: true,
111
+
suspendUntilListsAreLoaded: true,
112
112
tooltipsDisabled: false,
113
113
webrtcIPAddressHidden: false,
114
114
};
@@ -214,7 +214,7 @@ const µBlock = { // jshint ignore:line
214
214
readyToFilter: false,
215
215
216
216
supportStats: {
217
-
launchToReadiness: '',
217
+
allReadyAfter: '',
218
218
},
219
219
220
220
pageStores: new Map(),
Original file line number Diff line number Diff line change
@@ -1091,6 +1091,7 @@ const getLists = async function(callback) {
1091
1091
isUpdating: io.isUpdating(),
1092
1092
netFilterCount: staticNetFilteringEngine.getFilterCount(),
1093
1093
parseCosmeticFilters: µb.userSettings.parseAllABPHideFilters,
1094
+
suspendUntilListsAreLoaded: µb.userSettings.suspendUntilListsAreLoaded,
1094
1095
userFiltersPath: µb.userFiltersPath
1095
1096
};
1096
1097
const [ lists, metadata ] = await Promise.all([
Original file line number Diff line number Diff line change
@@ -192,6 +192,13 @@ const onNetWhitelistReady = function(netWhitelistRaw, adminExtra) {
192
192
// User settings are in memory
193
193
194
194
const onUserSettingsReady = function(fetched) {
195
+
// Terminate suspended state?
196
+
if ( fetched.suspendUntilListsAreLoaded === false ) {
197
+
vAPI.net.unsuspend({ all: true, discard: true });
198
+
ubolog(`Unsuspend network activity listener`);
199
+
µb.supportStats.unsuspendAfter = `${Date.now() - vAPI.T0} ms`;
200
+
}
201
+
195
202
// `externalLists` will be deprecated in some future, it is kept around
196
203
// for forward compatibility purpose, and should reflect the content of
197
204
// `importedLists`.
@@ -282,13 +289,6 @@ const onHiddenSettingsReady = async function() {
282
289
ubolog(`Override default webext flavor with ${tokens}`);
283
290
}
284
291
285
-
// Maybe override current network listener suspend state
286
-
if ( µb.hiddenSettings.suspendTabsUntilReady === 'no' ) {
287
-
vAPI.net.unsuspend(true);
288
-
} else if ( µb.hiddenSettings.suspendTabsUntilReady === 'yes' ) {
289
-
vAPI.net.suspend(true);
290
-
}
291
-
292
292
// Maybe disable WebAssembly
293
293
if ( vAPI.canWASM && µb.hiddenSettings.disableWebAssembly !== true ) {
294
294
const wasmModuleFetcher = function(path) {
@@ -506,11 +506,11 @@ browser.runtime.onUpdateAvailable.addListener(details => {
506
506
}
507
507
});
508
508
509
-
µb.supportStats.launchToReadiness = `${Date.now() - vAPI.T0} ms`;
509
+
µb.supportStats.allReadyAfter = `${Date.now() - vAPI.T0} ms`;
510
510
if ( selfieIsValid ) {
511
-
µb.supportStats.launchToReadiness += ' (selfie)';
511
+
µb.supportStats.allReadyAfter += ' (selfie)';
512
512
}
513
-
ubolog(`All ready ${µb.supportStats.launchToReadiness} ms after launch`);
513
+
ubolog(`All ready ${µb.supportStats.allReadyAfter} ms after launch`);
514
514
515
515
// <<<<< end of private scope
516
516
})();
Original file line number Diff line number Diff line change
@@ -239,12 +239,6 @@ import {
239
239
if ( typeof hs[key] !== typeof hsDefault[key] ) { continue; }
240
240
this.hiddenSettings[key] = hs[key];
241
241
}
242
-
if ( typeof this.hiddenSettings.suspendTabsUntilReady === 'boolean' ) {
243
-
this.hiddenSettings.suspendTabsUntilReady =
244
-
this.hiddenSettings.suspendTabsUntilReady
245
-
? 'yes'
246
-
: 'unset';
247
-
}
248
242
this.fireDOMEvent('hiddenSettingsChanged');
249
243
};
250
244
@@ -810,7 +804,9 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {
810
804
const onFilterListsReady = function(lists) {
811
805
this.availableFilterLists = lists;
812
806
813
-
vAPI.net.suspend();
807
+
if ( vAPI.net.canSuspend() ) {
808
+
vAPI.net.suspend();
809
+
}
814
810
redirectEngine.reset();
815
811
staticExtFilteringEngine.reset();
816
812
staticNetFilteringEngine.reset();
Original file line number Diff line number Diff line change
@@ -1146,22 +1146,7 @@ const webRequest = {
1146
1146
{ urls: [ 'http://*/*', 'https://*/*' ] },
1147
1147
[ 'blocking', 'responseHeaders' ]
1148
1148
);
1149
-
vAPI.net.unsuspend(true);
1150
-
// Mitigation: force-reload active tabs for environments not
1151
-
// supporting suspended network request listeners.
1152
-
if (
1153
-
vAPI.net.canSuspend() !== true ||
1154
-
µb.hiddenSettings.suspendTabsUntilReady === 'no'
1155
-
) {
1156
-
const tabs = await vAPI.tabs.query({
1157
-
active: true,
1158
-
url: [ 'https://*/*', 'http://*/*' ],
1159
-
windowType: 'normal',
1160
-
});
1161
-
for ( const tab of tabs ) {
1162
-
vAPI.tabs.reload(tab.id);
1163
-
}
1164
-
}
1149
+
vAPI.net.unsuspend({ all: true });
1165
1150
};
1166
1151
})(),
1167
1152
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4