Skip to content

Loading…

[Safari] Does not restore properly from a backup created in Firefox, works fine in Firefox/Chrome #988

Closed
MikhailTNY opened this Issue · 9 comments

3 participants

@MikhailTNY

Steps to Reproduce

  1. Make a few rule changes in uBlock via Firefox, something that's easy to see. My suggestion to make this test easier, set all to block globally in Firefox/Chrome and add a few custom rules
  2. Back up the settings in Firefox
  3. Restore in Safari, wait a minute and even restart Safari if you want.

Symptoms

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

uBlock version:
    0.9.0.0
Browser and version:
    Firefox Nightly 39a, Canary 43, and Safari 8.0.5
OS and version:
    OS X 10.10.3
@chrisaljoudi chrisaljoudi added a commit that closed this issue
@chrisaljoudi Sort-of fixes #988 654c826
@chrisaljoudi chrisaljoudi reopened this
@chrisaljoudi

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.

@chrisaljoudi

@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?

@gorhill

What's the problem specifically?

@chrisaljoudi

@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).

@gorhill

There is more to be reloaded than just these three items. Let me think a bit about what can be done.

@gorhill

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?

@chrisaljoudi

@gorhill not at all — that's what I was thinking.

@gorhill gorhill added a commit that referenced this issue
@gorhill gorhill this helps #988 32687c9
@gorhill

that's what I was thinking

Sorry, I see it now. Code is checked-in, hopefully this will work.

@chrisaljoudi chrisaljoudi added a commit that referenced this issue
@chrisaljoudi Completes fix of #988 717c7a0
@chrisaljoudi

@gorhill yep, it does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.