Closed Bug 974035 Opened 10 years ago Closed 10 years ago

Only sync home provider data when dataset is used in an installed panel

Categories

(Firefox for Android Graveyard :: Data Providers, defect, P2)

ARM
Android
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 978991

People

(Reporter: Margaret, Assigned: Margaret)

References

Details

Instead of encouraging add-ons to only sync their data when the user has actually installed their panel (we would need to build some API for them to know this), we should find a way to do that for them through the HomeProvider.requestSync and addPeriodicSync methods.

Right now HomeProvider.jsm doesn't know anything about panels or UI, and it would be nice to keep it that way, so we should come up with a way to abstract this away. For example, maybe HomeProvider could just ask HomeConfig for the set of datasets being used in the UI.

Thoughts?
Quick (rough) idea: change HomePager to send a message to gecko (HomePanels:ActiveDatasets?) with the list of active datasets whenever it (re-)loads HomeConfig. HomeStorage would listen to this message and only sync these active datasets. The caveat of this approach is that HomePager might not be loaded if you start Fennec from an external link.
Priority: -- → P1
I forgot about this bug when recently commenting in bug 978991. In that bug, I proposed that we notify Home.panels consumers of when their panels are installed to let them sync their data.

The approach proposed in this bug is nice because add-ons can just call HomeProvider.addPeriodicSync and forget about it. However, if we go with the approach here, we should probably force a sync when a panel is installed, in order to make sure there's data available.

I also think that if we go with the "let us handle it for you" approach here, we should also just clear the data ourselves when the panel is uninstalled.

On the one hand, the add-on hook idea in bug 978991 is nice because it gives add-ons more control, but on the other hand, it might be nice to control things ourselves, and avoid exposing more APIs to add-ons.
Assignee: nobody → margaret.leibovic
(In reply to :Margaret Leibovic from comment #2)

> I also think that if we go with the "let us handle it for you" approach
> here, we should also just clear the data ourselves when the panel is
> uninstalled.

One potential problem here is that the same dataset could be used in multiple views, so we would need to be careful to only delete the data if it isn't used in any installed panel.
Priority: P1 → P2
I'm going to dupe this to bug 978991, since I think the best way to solve this issue is to just let the add-on be in charge of knowing when its panel is installed or uninstalled, and sync its data appropriately. I think this is a better approach than making HomeProvider worry about whether or not datasets are showing in panels, since it's nice that right now it doesn't know anything about how the data its storing is being used.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
Setting P2 hub bugs to block hub v2 EPIC bug (targeting fx31 release).

Filter on epic-hub-bugs.
Blocks: 1014030
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.