
Loading…
[Safari] Does not restore properly from a backup created in Firefox, works fine in Firefox/Chrome #988
So 654c826 sort-of fixes this (the more crucial part of it, anyway). Now, you should be able to restore, and then a simple restart of Safari or uBlock will make the changes effective.
Safari doesn't make it as easy to programmatically restart an extension, so I'll have to figure out how to do this reasonably.
@gorhill is it okay to wrap this part of start.js:
toFetch(µb.localSettings, fetchableProps);
toFetch(µb.userSettings, fetchableProps);
toFetch(µb.restoreBackupSettings, fetchableProps);
vAPI.storage.get(fetchableProps, onFirstFetchReady);
in a function and export it, so vAPI.app.restart for Safari can call that to force a settings refresh?
What's the problem specifically?
@gorhill there's no way to restart an extension in Safari programmatically, so when settings are restored from a backup, there has to be a way to tell uBlock to go and re-initialize the settings from storage (this is done in Chrome/Firefox by restarting uBlock, which executes the code above in start.js).
There is more to be reloaded than just these three items. Let me think a bit about what can be done.
Ok, I did a quick experiment, to create a µBlock.restart() out of all code in start.js, and "re-launch" uBlock from the console, and it does appear it worked.
So, normally that code is executed once and probably garbage collected once executed, so that it's kept in memory ideally should be platform-dependant I suppose -- but this could be looked after later. The change I made is trivial so that there should be no impact really.
Is it a problem for you to call µBlock.restart() from the vAPI code?
@gorhill not at all — that's what I was thinking.
that's what I was thinking
Sorry, I see it now. Code is checked-in, hopefully this will work.
@gorhill yep, it does.
Steps to Reproduce
allto block globally in Firefox/Chrome and add a few custom rulesSymptoms
Open uBlock in Safari, note the all block didn't get restored properly and look at your custom rules you've added, it wasn't added.
Restoring in a different Firefox profile or Chrome works just fine.
Info