mirror of https://github.com/gorhill/uBlock.git
this should help with #402
This commit is contained in:
parent
d509890260
commit
172f98d462
|
@ -142,10 +142,21 @@ var cachedAssetsManager = (function() {
|
|||
details.error = 'Error: ' + lastError.message;
|
||||
console.error('µBlock> cachedAssetsManager.load():', details.error);
|
||||
cbError(details);
|
||||
} else {
|
||||
details.content = bin[cachedContentPath];
|
||||
cbSuccess(details);
|
||||
return;
|
||||
}
|
||||
// Not sure how this can happen, but I've seen it happen. It could
|
||||
// be because the save occurred while I was stepping in the code
|
||||
// though, which means it would not occur during normal operation.
|
||||
// Still, just to be safe.
|
||||
if ( bin[cachedContentPath] === undefined ) {
|
||||
details.error = 'Error: not found';
|
||||
delete entries[path];
|
||||
vAPI.storage.set({ 'cached_asset_entries': entries });
|
||||
cbError(details);
|
||||
return;
|
||||
}
|
||||
details.content = bin[cachedContentPath];
|
||||
cbSuccess(details);
|
||||
};
|
||||
var onEntries = function(entries) {
|
||||
if ( entries[path] === undefined ) {
|
||||
|
|
|
@ -636,22 +636,32 @@
|
|||
µb.updater.restart(nextUpdate);
|
||||
};
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/226
|
||||
// Whitelist in memory.
|
||||
// Whitelist parser needs PSL to be ready.
|
||||
var onWhitelistReady = function() {
|
||||
onAllDone();
|
||||
};
|
||||
var filtersReady = false;
|
||||
var whitelistReady = false;
|
||||
|
||||
// Filters are in memory.
|
||||
// Filter engines need PSL to be ready.
|
||||
var onFiltersReady = function() {
|
||||
µb.loadWhitelist(onWhitelistReady);
|
||||
filtersReady = true;
|
||||
if ( whitelistReady ) {
|
||||
onAllDone();
|
||||
}
|
||||
};
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/226
|
||||
// Whitelist in memory.
|
||||
// Whitelist parser needs PSL to be ready.
|
||||
var onWhitelistReady = function() {
|
||||
whitelistReady = true;
|
||||
if ( filtersReady ) {
|
||||
onAllDone();
|
||||
}
|
||||
};
|
||||
|
||||
// Load order because dependencies:
|
||||
// User settings -> PSL -> [filter lists, user whitelist]
|
||||
var onPSLReady = function() {
|
||||
µb.loadWhitelist(onWhitelistReady);
|
||||
µb.loadFilterLists(onFiltersReady);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue