What is the current best practices template.
As of 2017-11-16:
http://github.com/mozilla/shield-studies-addon-template
As of 2017-10-03:
http://github.com/gregglind/template-shield-study
Useful LEGACY ADDON building links.
LEGACY ADDON contrasts with "extension" or "addon" which are now webextensions. Legacy Addon is the term for the bootstrap.js with a startup method way of doing things.
Explain resource files and chrome.manifest
resource:// maps a FILE SYSTEM list of files, using the ALIASES in a chrome.manifest file.
Example line in chrome.manifest
resource some-addon-name .
and this folder structure
$ tree addon
addon
├── Config.jsm
├── StudyUtils.jsm
├── bootstrap.js
├── chrome.manifest
├── install.rdf
├── lib
│ ├── AddonPrefs.jsm
│ └── Feature.jsm
└── skin
└── heartbeat-icon.svg
THEN, that chrome.manifest maps these paths between the resource protocol and the jar protocol.
resource://some-addon-name/skin/heartbeat-icon.svg ==> jar:///abs/path/to/theAddon.xpi!/skin/heartbeat-icon.svg
WARNINGS:
- The characters @ # ; : ? / are not allowed in the
alias. This is annoying, because it means you can't use your addonId as the alias
- Resource files won't show up in dev tools
debugger until you attempt to import / use them.
- If two addons use the same
alias, I have no idea of what will happen, but it's PROBABLY BAD. Your alias should be unique to your addon.
chrome.manifest resource paths aren't loadable until LEGACY startup. In particular, they are NOT usable during install.
All about LEGACY (Bootstrap / Restartless) addons.
https://developer.mozilla.org/en-US/Add-ons/Bootstrapped_extensions
Is Firefox Wack?
Yes. In particular, LEGACY ADDONS (bootstrap) addons are an orphaned technology, that we still need to use. Debugging is hard. Cu.import is NOT require.
How do I debug?
about:debugging, does load temporary addon, reload (which won't work if you changed things!) and uninstall.
tools > web developer > Browser Toolbox (shift alt command i) shows ALL BROWSER LOGGING, which might be where your addon things go. In particular, if you have thrown errors in your bootstrap or other files.
about:telemetry records all 'current' and 'archive' Telemetry Pings.
when to use isEligible as part of install
From gregglind/57-perception-study#3
I noticed isEligible just returns true -- when would we use this method versus using filter expressions in Normandy?
Reasons
- JEXL expresssions inadequate. Normandy controls who is offered the study. The JEXL elements it can select on might be inadequate for expressing this criteria.
- Changes during install. It's a 'backstop' (belt and suspenders) in case the user changes during the download process.
- If the same study is distributed other ways, beside Normandy.
Writing Tests
Answer: https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/firefox/index.html
I am having a sadness.
Me too buddy. Me too.
SIGNING
As of 57 (2017-10-05), to get a LEGACY addon to work with BETA or RELEASE, it must be signed with the special legacy signing key, EVEN IF you about:debugging > load temporary addon.
Solutions (in brief)
- use Nightly
- use unbranded Firefox
- get a signed addon.
Initial signing flow
- NAME your addon like this:
<addonId>-<version>.xpi
- upload the addon somewhere (such as s3 / Google drive)
- use this bugzilla signing bug template
- get signed addon as an attachement.
See example:
Tracking and Debugging Telemetry Pings
There is an addon for that! It makes reports.
What is the current
best practicestemplate.As of 2017-11-16:
http://github.com/mozilla/shield-studies-addon-template
As of 2017-10-03:http://github.com/gregglind/template-shield-study
Useful LEGACY ADDON building links.
LEGACY ADDON contrasts with "extension" or "addon" which are now webextensions. Legacy Addon is the term for the
bootstrap.jswith astartupmethod way of doing things.bootstrap.js, including__SCRIPT_URI_SPEC__at https://dxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/internal/XPIProvider.jsm#4335-4353Explain
resourcefiles andchrome.manifestresource://maps a FILE SYSTEM list of files, using the ALIASES in achrome.manifestfile.Example line in
chrome.manifestresource some-addon-name .and this folder structure
THEN, that
chrome.manifestmaps these paths between theresourceprotocol and thejarprotocol.resource://some-addon-name/skin/heartbeat-icon.svg ==> jar:///abs/path/to/theAddon.xpi!/skin/heartbeat-icon.svgWARNINGS:
alias. This is annoying, because it means you can't use youraddonIdas thealiasdebuggeruntil you attempt to import / use them.alias, I have no idea of what will happen, but it's PROBABLY BAD. Your alias should be unique to your addon.chrome.manifestresource paths aren't loadable until LEGACYstartup. In particular, they are NOT usable duringinstall.All about LEGACY (Bootstrap / Restartless) addons.
https://developer.mozilla.org/en-US/Add-ons/Bootstrapped_extensions
Is Firefox Wack?
Yes. In particular, LEGACY ADDONS (
bootstrap) addons are an orphaned technology, that we still need to use. Debugging is hard.Cu.importis NOTrequire.How do I debug?
about:debugging, doesload temporary addon,reload(which won't work if you changed things!) and uninstall.tools > web developer > Browser Toolbox(shift alt command i) shows ALL BROWSER LOGGING, which might be where your addon things go. In particular, if you have thrown errors in your bootstrap or other files.about:telemetryrecords all 'current' and 'archive' Telemetry Pings.when to use
isEligibleas part ofinstallFrom gregglind/57-perception-study#3
I noticed isEligible just returns true -- when would we use this method versus using filter expressions in Normandy?Reasons
Writing Tests
Answer: https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/firefox/index.html
I am having a sadness.
Me too buddy. Me too.
SIGNING
As of 57 (2017-10-05), to get a LEGACY addon to work with BETA or RELEASE, it must be signed with the special legacy signing key, EVEN IF you
about:debugging > load temporary addon.Solutions (in brief)
Initial signing flow
<addonId>-<version>.xpiSee example:
Tracking and Debugging Telemetry Pings
There is an addon for that! It makes reports.