Bug 1496075 Comment 60 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

So due to the above test I have run into a fairly serious issue with the patch, glad we had a marionette test here and will be adding some dedicated marionette tests for this next

The issue is with how we interact with the AddonManager on startup, on first load everything is fairly easy since we install an addon then the addon gives us the details via `addEnginesFromExtension`, on restart we are usually loading from cache and everything is fine then, the issue is when we restart with an invalidated cache.

For example - First run: install google, yahoo, restart with new engines: keep google, uninstall yahoo, install ddg

I assumed (based on basic testing) that on restart with an invalidated cache, the AddonManager would boot and report all installed engines via `addEnginesFromExtension` before SearchService could possibly init, we would also be able to use `AddonManager.getAddonByID` inside SearchService init to find the engines that are not installed and install them

That assumption was wrong, I found a few bugs on using the AddonManager on startup (getAddonById returns null for installed addon, getLocalizedManifest crashes @ https://gist.github.com/daleharvey/9acf6e21ad8ac4c9a778f7c0843c52f5#file-gistfile1-txt-L265), and while asking about those bugs in IRC kmag told me I shouldnt be using AddonManager on startup at all as it invoked the add-on DB and is very expensive, similiarly the AddonManager doesnt report the installed extensions on its startup but when the add-on DB is invoked

This leaves me a little stuck, when SearchService inits I need to be able to get the details of the built in engines obviously, right now means getting them via `addEnginesFromExtension`, if I cant getAddonByID to check whether an addon is installed then we have 2 options as far as I can see

 1. Keep track of the install state of addons + the parsed manifest details across restarts in the SearchService cache
 2. Make builtIn extension install stateless, they don't get persisted across firefox restarts (store any data at all really) and we can installBuiltInAddon and get back the parsed manifest details at any time

I am trying to see how far I can get with the former, we already cache the engine details however I am worried about us keeping what is essentially an addons database in our cache, having the possibility of it going out of sync with the actual state of the addons and getting tricky bugs out the other end. The latter sounds much much cleaner to me, but would need new addons work.

Happy to hear any suggestions for any other options here or how feasible getting stateless installs would be

Back to Bug 1496075 Comment 60