1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-19 19:52:51 +02:00
This commit is contained in:
gorhill 2017-05-06 13:19:05 -04:00
parent 73def7eab3
commit fe61cdddee
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -415,7 +415,7 @@
µb.staticNetFilteringEngine.freeze();
µb.redirectEngine.freeze();
µb.cosmeticFilteringEngine.freeze();
µb.selfieManager.create();
µb.selfieManager.destroy();
};
var onLoaded = function(details) {
@ -597,7 +597,7 @@
callback();
µb.selfieManager.create();
µb.selfieManager.destroy();
µb.loadingFilterLists = false;
};
@ -895,47 +895,31 @@
// some set time.
µBlock.selfieManager = (function() {
var µb = µBlock;
var timer = null;
var create = function() {
timer = null;
var selfie = {
magic: µb.systemSettings.selfieMagic,
magic: this.systemSettings.selfieMagic,
publicSuffixList: publicSuffixList.toSelfie(),
availableFilterLists: µb.availableFilterLists,
staticNetFilteringEngine: µb.staticNetFilteringEngine.toSelfie(),
redirectEngine: µb.redirectEngine.toSelfie(),
cosmeticFilteringEngine: µb.cosmeticFilteringEngine.toSelfie()
availableFilterLists: this.availableFilterLists,
staticNetFilteringEngine: this.staticNetFilteringEngine.toSelfie(),
redirectEngine: this.redirectEngine.toSelfie(),
cosmeticFilteringEngine: this.cosmeticFilteringEngine.toSelfie()
};
vAPI.cacheStorage.set({ selfie: selfie });
};
var createAsync = function(after) {
if ( typeof after !== 'number' ) {
after = µb.selfieAfter;
}
if ( timer !== null ) {
clearTimeout(timer);
}
timer = vAPI.setTimeout(create, after);
};
}.bind(µBlock);
var destroy = function() {
if ( timer !== null ) {
clearTimeout(timer);
timer = null;
}
vAPI.cacheStorage.remove('selfie');
};
timer = vAPI.setTimeout(create, this.selfieAfter);
}.bind(µBlock);
return {
create: createAsync,
destroy: destroy
};
})();
@ -1117,6 +1101,10 @@
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;
}