mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-06 19:02:30 +01:00
Invalidate browser's memory cache after using element picker
Related reports: - https://www.reddit.com/r/uBlockOrigin/comments/cj7g7m/ - https://www.reddit.com/r/uBlockOrigin/comments/cnq0bi/ The browser cache will be invalidated only when creating static network filter through the element picker. As per @gwarser's arguments in favor of implementing usage of webRequest.handlerBehaviorChanged(): https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest/handlerBehaviorChanged
This commit is contained in:
parent
aa701484e7
commit
5e1f4d7906
@ -1040,7 +1040,7 @@ const userFilterFromCandidate = function(callback) {
|
||||
|
||||
// Cosmetic filter?
|
||||
if ( v.startsWith('##') ) {
|
||||
callback(hostname + v);
|
||||
callback(hostname + v, true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1188,8 +1188,8 @@ const onDialogClicked = function(ev) {
|
||||
// We have to exit from preview mode: this guarantees matching elements
|
||||
// will be found for the candidate filter.
|
||||
filterToDOMInterface.preview(false);
|
||||
userFilterFromCandidate(filter => {
|
||||
if ( !filter ) { return; }
|
||||
userFilterFromCandidate((filter = undefined, isCosmetic = false) => {
|
||||
if ( filter === undefined ) { return; }
|
||||
vAPI.messaging.send(
|
||||
'elementPicker',
|
||||
{
|
||||
@ -1197,7 +1197,8 @@ const onDialogClicked = function(ev) {
|
||||
autoComment: true,
|
||||
filters: filter,
|
||||
origin: window.location.origin,
|
||||
pageDomain: window.location.hostname
|
||||
pageDomain: window.location.hostname,
|
||||
killCache: isCosmetic === false,
|
||||
}
|
||||
);
|
||||
filterToDOMInterface.preview(rawFilterFromTextarea(), true);
|
||||
|
@ -468,6 +468,12 @@
|
||||
this.redirectEngine.freeze();
|
||||
this.staticExtFilteringEngine.freeze();
|
||||
this.selfieManager.destroy();
|
||||
|
||||
// https://www.reddit.com/r/uBlockOrigin/comments/cj7g7m/
|
||||
// https://www.reddit.com/r/uBlockOrigin/comments/cnq0bi/
|
||||
if ( options.killCache ) {
|
||||
browser.webRequest.handlerBehaviorChanged();
|
||||
}
|
||||
};
|
||||
|
||||
const onLoaded = details => {
|
||||
|
Loading…
Reference in New Issue
Block a user