1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-21 18:02:34 +01:00

[mv3] Fix force-reloading repeatedly when erroring at load time

Related issue:
https://github.com/uBlockOrigin/uBOL-home/issues/234
This commit is contained in:
Raymond Hill 2024-11-19 13:16:56 -05:00
parent 2f2f383c1b
commit f3486275e9
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -35,7 +35,7 @@ import {
adminRead, adminRead,
browser, browser,
dnr, dnr,
localRead, localWrite, localRead, localRemove, localWrite,
runtime, runtime,
windows, windows,
} from './ext.js'; } from './ext.js';
@ -407,13 +407,19 @@ async function start() {
// https://github.com/uBlockOrigin/uBOL-home/issues/199 // https://github.com/uBlockOrigin/uBOL-home/issues/199
// Force a restart of the extension once when an "internal error" occurs // Force a restart of the extension once when an "internal error" occurs
start().then(( ) => { start().then(( ) => {
localWrite({ goodStart: true }); localRemove('goodStart');
return false;
}).catch(reason => { }).catch(reason => {
console.trace(reason); console.trace(reason);
localRead('goodStart').then((bin = {}) => { if ( process.wakeupRun ) { return; }
if ( bin.goodStart === false ) { return; } return localRead('goodStart').then(goodStart => {
localWrite({ goodStart: false }).then(( ) => { if ( goodStart === false ) {
runtime.reload(); localRemove('goodStart');
}); return false;
}
return localWrite('goodStart', false).then(( ) => true);
}); });
}).then(restart => {
if ( restart !== true ) { return; }
runtime.reload();
}); });