mozilla / addon-recommendation-shield-study

Stand-alone verison of Add-on Recommendation for Shield Study
Mozilla Public License 2.0
3 stars 7 forks source link

Delete simple-storage on cleanup #93

Closed casebenton closed 7 years ago

casebenton commented 7 years ago

I'm able to remove simple storage data, as requested in #90.

However, I haven't been able to find a way to delete addon preferences. The simple-prefs docs doesn't mention any way to do this. @mythmon @gregglind do you know of a way to delete preferences?

@mythmon r?

mythmon commented 7 years ago

I don't think this will work to delete the storage of the addon. The docs do say that you can delete individual elements out of storage with delete simpleStorage.storage.foo, but I don't see anywhere in the docs or code that imply that deleting simpleStorage.storage will clear the storage.

In fact, I think that the simpleStorage helper automatically deletes addon data on uninstall

As far as removing prefs, I'm not sure how to do that. Maybe iterating known keys and removing them using a lower level preferences interface? I didn't see any helpers in simple prefs for that.

casebenton commented 7 years ago

I used a low level library for resetting the prefs on cleanup, like you suggested. It worked properly for me in testing, but it looks like there are some preferences from the shield studies utilities (not under my control) that aren't reset. I'm planning on migrating to the newer version of the shield studies platform, and that may resolve the issue. I also removed the code attempting to clear out simple storage, since you pointed out that that will be cleaned up automatically by the library.

@mythmon r?