mirror of https://github.com/gorhill/uBlock.git
Flush memory cache at key filtering profile changes
To reduce the need for hard reload after changes in filters, rules.
This commit is contained in:
parent
daee72b982
commit
6e8aeae283
|
@ -1298,6 +1298,9 @@ vAPI.Net = class {
|
|||
this.listenerMap.set(clientListener, actualListener);
|
||||
return actualListener;
|
||||
}
|
||||
handlerBehaviorChanged() {
|
||||
browser.webRequest.handlerBehaviorChanged();
|
||||
}
|
||||
onUnprocessedRequest(details) {
|
||||
const { tabId } = details;
|
||||
if ( tabId === -1 ) { return; }
|
||||
|
|
|
@ -459,6 +459,10 @@ if ( selfieIsValid !== true ) {
|
|||
}
|
||||
}
|
||||
|
||||
// Flush memory cache -- unsure whether the browser does this internally
|
||||
// when loading a new extension.
|
||||
vAPI.net.handlerBehaviorChanged();
|
||||
|
||||
// Final initialization steps after all needed assets are in memory.
|
||||
|
||||
// https://github.com/uBlockOrigin/uBlock-issues/issues/974
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
Home: https://github.com/gorhill/uBlock
|
||||
*/
|
||||
|
||||
/* globals browser, WebAssembly */
|
||||
/* globals WebAssembly */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -581,9 +581,7 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {
|
|||
|
||||
// https://www.reddit.com/r/uBlockOrigin/comments/cj7g7m/
|
||||
// https://www.reddit.com/r/uBlockOrigin/comments/cnq0bi/
|
||||
if ( options.killCache ) {
|
||||
browser.webRequest.handlerBehaviorChanged();
|
||||
}
|
||||
vAPI.net.handlerBehaviorChanged();
|
||||
|
||||
vAPI.messaging.broadcast({ what: 'userFiltersUpdated' });
|
||||
};
|
||||
|
@ -818,6 +816,7 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {
|
|||
staticExtFilteringEngine.freeze();
|
||||
redirectEngine.freeze();
|
||||
vAPI.net.unsuspend();
|
||||
vAPI.net.handlerBehaviorChanged();
|
||||
|
||||
vAPI.storage.set({ 'availableFilterLists': µb.availableFilterLists });
|
||||
|
||||
|
|
|
@ -187,6 +187,10 @@ const matchBucket = function(url, hostname, bucket, start) {
|
|||
}
|
||||
}
|
||||
this.saveWhitelist();
|
||||
|
||||
// Flush memory cache
|
||||
vAPI.net.handlerBehaviorChanged();
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -521,6 +525,11 @@ const matchBucket = function(url, hostname, bucket, start) {
|
|||
// https://github.com/chrisaljoudi/uBlock/issues/420
|
||||
cosmeticFilteringEngine.removeFromSelectorCache(srcHostname, 'net');
|
||||
|
||||
// Flush memory cache
|
||||
if ( action === 1 ) {
|
||||
vAPI.net.handlerBehaviorChanged();
|
||||
}
|
||||
|
||||
if ( details.tabId === undefined ) { return; }
|
||||
|
||||
if ( requestType.startsWith('3p') ) {
|
||||
|
@ -577,7 +586,7 @@ const matchBucket = function(url, hostname, bucket, start) {
|
|||
);
|
||||
if ( changed === false ) { return; }
|
||||
|
||||
// Take action if needed
|
||||
// Take per-switch action if needed
|
||||
switch ( details.name ) {
|
||||
case 'no-scripting':
|
||||
this.updateToolbarIcon(details.tabId, 0b100);
|
||||
|
@ -596,6 +605,20 @@ const matchBucket = function(url, hostname, bucket, start) {
|
|||
pageStore.temporarilyAllowLargeMediaElements(!newState);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Flush memory cache if needed
|
||||
if ( newState ) {
|
||||
switch ( details.name ) {
|
||||
case 'no-scripting':
|
||||
case 'no-remote-fonts':
|
||||
vAPI.net.handlerBehaviorChanged();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( details.persist !== true ) { return; }
|
||||
|
|
Loading…
Reference in New Issue