Decouple error handling of lists loading from selfie loading

This commit make it so that if an *unexpected* error is
thrown when trying to load the selfie at launch, the filter
lists will still be loaded as a result.
This commit is contained in:
Raymond Hill 2020-01-21 10:52:13 -05:00
parent 219f4607a2
commit 043ae117c8
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -293,17 +293,23 @@ try {
// https://github.com/uBlockOrigin/uBlock-issues/issues/817#issuecomment-565730122 // https://github.com/uBlockOrigin/uBlock-issues/issues/817#issuecomment-565730122
// Still try to load filter lists regardless of whether a serious error // Still try to load filter lists regardless of whether a serious error
// occurred in the previous initialization steps. // occurred in the previous initialization steps.
let selfieIsValid = false;
try { try {
const selfieIsValid = await µb.selfieManager.load(); selfieIsValid = await µb.selfieManager.load();
if ( selfieIsValid === true ) { if ( selfieIsValid === true ) {
log.info(`Selfie ready ${Date.now()-vAPI.T0} ms after launch`); log.info(`Selfie ready ${Date.now()-vAPI.T0} ms after launch`);
} else {
await µb.loadFilterLists();
log.info(`Filter lists ready ${Date.now()-vAPI.T0} ms after launch`);
} }
} catch (ex) { } catch (ex) {
console.trace(ex); console.trace(ex);
} }
if ( selfieIsValid !== true ) {
try {
await µb.loadFilterLists();
log.info(`Filter lists ready ${Date.now()-vAPI.T0} ms after launch`);
} catch (ex) {
console.trace(ex);
}
}
// Final initialization steps after all needed assets are in memory. // Final initialization steps after all needed assets are in memory.