1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-04 18:19:38 +02:00

this should help with #402

This commit is contained in:
Raymond Hill 2014-12-08 14:16:13 -02:00
parent d509890260
commit 172f98d462
2 changed files with 31 additions and 10 deletions

View File

@ -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 ) {

View File

@ -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);
};