mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-22 02:12:44 +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:
parent
2f2f383c1b
commit
f3486275e9
@ -35,7 +35,7 @@ import {
|
||||
adminRead,
|
||||
browser,
|
||||
dnr,
|
||||
localRead, localWrite,
|
||||
localRead, localRemove, localWrite,
|
||||
runtime,
|
||||
windows,
|
||||
} from './ext.js';
|
||||
@ -407,13 +407,19 @@ async function start() {
|
||||
// https://github.com/uBlockOrigin/uBOL-home/issues/199
|
||||
// Force a restart of the extension once when an "internal error" occurs
|
||||
start().then(( ) => {
|
||||
localWrite({ goodStart: true });
|
||||
localRemove('goodStart');
|
||||
return false;
|
||||
}).catch(reason => {
|
||||
console.trace(reason);
|
||||
localRead('goodStart').then((bin = {}) => {
|
||||
if ( bin.goodStart === false ) { return; }
|
||||
localWrite({ goodStart: false }).then(( ) => {
|
||||
runtime.reload();
|
||||
});
|
||||
if ( process.wakeupRun ) { return; }
|
||||
return localRead('goodStart').then(goodStart => {
|
||||
if ( goodStart === false ) {
|
||||
localRemove('goodStart');
|
||||
return false;
|
||||
}
|
||||
return localWrite('goodStart', false).then(( ) => true);
|
||||
});
|
||||
}).then(restart => {
|
||||
if ( restart !== true ) { return; }
|
||||
runtime.reload();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user