biancadanforth / shield-study-webextension-experiment-template

A prototype for the new development of Shield studies as WebExtension Experiments
Mozilla Public License 2.0
0 stars 2 forks source link

Compile a list of up-to-date WEE documentation #2

Open biancadanforth opened 6 years ago

biancadanforth commented 6 years ago

After meeting with aswan, we now have two up-to-date sources for information on how to write a WebExtension Experiment (WEE):

  1. https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/index.html
    • This covers mostly WEE concepts
  2. https://github.com/aswan/webext-experiment-hello/tree/embedded
    • This is a sample WEE that bundles an experimental API with a WebExtension.
motin commented 6 years ago

Important regarding lifecycle events with bundled web experiments - the ordinary onUpdate, onUninstall, onManifestEntry are a no go, but we can use extension.callOnClose() and browser.runtime.onInstalled:

aswan uninstall and update for bundled experiments are tricky like, the extension isn't installed when we would fire those events motin so for now we will have to resort to use ordinary lifecycle events and hope there is no need to use privileged code or use a hybrid extension to handle those events aswan yeah, what's the larger thing you're trying to do? motin get shield studies running without legacy addons it is important to send telemetry and clear preferences on disable/uninstall aswan motin: your api implementation can use extension.callOnClose() to get a callback whenever the extension is shut down that could be when the extension is disabled or uninstalled, but also just during browser shutdown, so you'd want to check the extension's shutdownReason property the one caveat with callOnClose() is that if you're calling that from somewhere in your experimental api, the callback won't get set up if the webextension never does anything to cause your api to be loaded... motin good to know, will make sure it gets loaded :) aswan this should be documented more clearly, the only lifecycle event that works in bundled apis is startup the extension can use browser.runtime.onInstalled() will that work? callOnClose() ought to cover shutdown, disable, uninstall