mirror of https://github.com/gorhill/uBlock.git
[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,
|
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 ) {
|
||||||
|
localRemove('goodStart');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return localWrite('goodStart', false).then(( ) => true);
|
||||||
|
});
|
||||||
|
}).then(restart => {
|
||||||
|
if ( restart !== true ) { return; }
|
||||||
runtime.reload();
|
runtime.reload();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
Loading…
Reference in New Issue