Add-on upgrade: distinguish betw. user-initiated vs. auto-update

https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Listening_for_load_and_unload#options.loadReason provides a (indirect) way to listen for an add-on upgrade event (loadReason == “upgrade”).

Is there a programmatic way to detect whether the upgrade was user-initiated, or was an auto-update?

a) User-initiated (user goes to my web site and installs the latest version of the add-on): once the new version is loaded, I’d like to pop a new tab/URL that says “Thank you for upgrading…”

b) Auto-update (em:updateURL…/update.rdf): No user messaging.

However, in both the a) and b) scenarios, my exports.main() is seeing loadReason == “upgrade”, so I don’t know how to distinguish between the two.

Any workaround suggestions?

TIA

Show the popup on your site after they click to download?

Well, after they click the download button on my page they will get the FF-controlled Install/Cancel prompt - the one in the upper-left with the jigsaw puzzle piece icon on it. How do I know whether they completed the install or canceled it?

I only want to pop my post-install “Thank you” page after they’ve completed the extension install/upgrade. At this point, the new version of my extension is running, and I want to pop the post-install page, but only if the install/upgrade was user-initiated, not an auto-update (update.rdf).

You could have your site redirect to a special page after the install is triggered. Once the extension is updated, it can send a message to that special page and make it show the “Thank you” message.

Just a note - users are ok with popup pages on first installation of the addon. Later however, the addon auto-updates, and then a new tab pops up randomly - users may think “uh oh virus” - but their first reaction is definitely “what the heck?”

Jorge,

Again, the issue is distinguishing between an auto-update (update.rdf) vs. the user going to my site and manually installing the newest version of my extension.
a) Auto-update -> no user messaging
b) Manual (user-initiated) update -> pop a ‘Thank you’ page

In both scenarios, my extension is seeing loadReason == “upgrade”, so how can I distinguish betw. a) and b) ?

The suggestion is based on the fact that the user is on your page when they install the add-on, so the add-on can detect right after being installed if that page is open and show the “Thank you” message. This assumes the add-on doesn’t require a restart to be installed, though.

Alternatively, you can have the add-on store a preference with its version number. When the add-on loads, it can check if the version number in the preference matches the current version, and do something different depending on that.