Skip to content

Commit 043ae11

Browse files
committed
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.
1 parent 219f460 commit 043ae11

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/js/start.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,17 +293,23 @@ try {
293293
// https://github.com/uBlockOrigin/uBlock-issues/issues/817#issuecomment-565730122
294294
// Still try to load filter lists regardless of whether a serious error
295295
// occurred in the previous initialization steps.
296+
let selfieIsValid = false;
296297
try {
297-
const selfieIsValid = await µb.selfieManager.load();
298+
selfieIsValid = await µb.selfieManager.load();
298299
if ( selfieIsValid === true ) {
299300
log.info(`Selfie ready ${Date.now()-vAPI.T0} ms after launch`);
300-
} else {
301-
await µb.loadFilterLists();
302-
log.info(`Filter lists ready ${Date.now()-vAPI.T0} ms after launch`);
303301
}
304302
} catch (ex) {
305303
console.trace(ex);
306304
}
305+
if ( selfieIsValid !== true ) {
306+
try {
307+
await µb.loadFilterLists();
308+
log.info(`Filter lists ready ${Date.now()-vAPI.T0} ms after launch`);
309+
} catch (ex) {
310+
console.trace(ex);
311+
}
312+
}
307313

308314
// Final initialization steps after all needed assets are in memory.
309315

0 commit comments

Comments
 (0)