Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

DOCS, WIP, FAQ #93

@gregglind

Description

@gregglind

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:

  1. The characters @ # ; : ? / are not allowed in the alias. This is annoying, because it means you can't use your addonId as the alias
  2. Resource files won't show up in dev tools debugger until you attempt to import / use them.
  3. 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.
  4. 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

  1. JEXL expresssions inadequate. Normandy controls who is offered the study. The JEXL elements it can select on might be inadequate for expressing this criteria.
  2. Changes during install. It's a 'backstop' (belt and suspenders) in case the user changes during the download process.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions