mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
fix #2585
This commit is contained in:
parent
73def7eab3
commit
fe61cdddee
1 changed files with 14 additions and 26 deletions
|
|
@ -415,7 +415,7 @@
|
||||||
µb.staticNetFilteringEngine.freeze();
|
µb.staticNetFilteringEngine.freeze();
|
||||||
µb.redirectEngine.freeze();
|
µb.redirectEngine.freeze();
|
||||||
µb.cosmeticFilteringEngine.freeze();
|
µb.cosmeticFilteringEngine.freeze();
|
||||||
µb.selfieManager.create();
|
µb.selfieManager.destroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
var onLoaded = function(details) {
|
var onLoaded = function(details) {
|
||||||
|
|
@ -597,7 +597,7 @@
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
|
|
||||||
µb.selfieManager.create();
|
µb.selfieManager.destroy();
|
||||||
µb.loadingFilterLists = false;
|
µb.loadingFilterLists = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -895,47 +895,31 @@
|
||||||
// some set time.
|
// some set time.
|
||||||
|
|
||||||
µBlock.selfieManager = (function() {
|
µBlock.selfieManager = (function() {
|
||||||
var µb = µBlock;
|
|
||||||
var timer = null;
|
var timer = null;
|
||||||
|
|
||||||
var create = function() {
|
var create = function() {
|
||||||
timer = null;
|
timer = null;
|
||||||
|
|
||||||
var selfie = {
|
var selfie = {
|
||||||
magic: µb.systemSettings.selfieMagic,
|
magic: this.systemSettings.selfieMagic,
|
||||||
publicSuffixList: publicSuffixList.toSelfie(),
|
publicSuffixList: publicSuffixList.toSelfie(),
|
||||||
availableFilterLists: µb.availableFilterLists,
|
availableFilterLists: this.availableFilterLists,
|
||||||
staticNetFilteringEngine: µb.staticNetFilteringEngine.toSelfie(),
|
staticNetFilteringEngine: this.staticNetFilteringEngine.toSelfie(),
|
||||||
redirectEngine: µb.redirectEngine.toSelfie(),
|
redirectEngine: this.redirectEngine.toSelfie(),
|
||||||
cosmeticFilteringEngine: µb.cosmeticFilteringEngine.toSelfie()
|
cosmeticFilteringEngine: this.cosmeticFilteringEngine.toSelfie()
|
||||||
};
|
};
|
||||||
|
|
||||||
vAPI.cacheStorage.set({ selfie: selfie });
|
vAPI.cacheStorage.set({ selfie: selfie });
|
||||||
};
|
}.bind(µBlock);
|
||||||
|
|
||||||
var createAsync = function(after) {
|
|
||||||
if ( typeof after !== 'number' ) {
|
|
||||||
after = µb.selfieAfter;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( timer !== null ) {
|
|
||||||
clearTimeout(timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
timer = vAPI.setTimeout(create, after);
|
|
||||||
};
|
|
||||||
|
|
||||||
var destroy = function() {
|
var destroy = function() {
|
||||||
if ( timer !== null ) {
|
if ( timer !== null ) {
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
timer = null;
|
timer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
vAPI.cacheStorage.remove('selfie');
|
vAPI.cacheStorage.remove('selfie');
|
||||||
};
|
timer = vAPI.setTimeout(create, this.selfieAfter);
|
||||||
|
}.bind(µBlock);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
create: createAsync,
|
|
||||||
destroy: destroy
|
destroy: destroy
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
@ -1117,6 +1101,10 @@
|
||||||
cached: cached
|
cached: cached
|
||||||
|
|
||||||
});
|
});
|
||||||
|
// https://github.com/gorhill/uBlock/issues/2585
|
||||||
|
// Whenever an asset is overwritten, the current selfie is quite
|
||||||
|
// likely no longer valid.
|
||||||
|
this.selfieManager.destroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue