8e672ed4d5 | ||
---|---|---|
.circleci | ||
bin | ||
dist | ||
docs | ||
src | ||
test | ||
test-addon | ||
testUtils | ||
.eslintignore | ||
.eslintrc.js | ||
.gitignore | ||
LICENSE | ||
README.md | ||
package-lock.json | ||
package.json |
README.md
OpenWPM WebExtension Experiment / API
This is the home of the openwpm-webext-experiment
npm package (TODO), which provides:
-
WebExtension Experiment API's
-
Scripts:
installOpenWPM
shell command copying these files in your study add-on.
-
testUtils/
- Test utilities (helper classes to write functional/unit tests for your add-on)
Goals:
Allows writing add-ons that use one or many of OpenWPM's instrumentation modules.
Installing OpenWPM WebExtension Experiment / API in your add-on
-
Install the Package
npm install --save mozilla/OpenWPM-WebExtension-Experiment#develop
-
Copy the files to your 'privileged' src directory
npx installOpenWPM src/privileged --example
Suggestion: make this part of your
package.json:scripts.postinstall
script. -
Add the following to your add-on's manifest.json:
"experiment_apis": { "openwpm": { "schema": "./privileged/openwpm/schema.json", "parent": { "scopes": ["addon_parent"], "script": "./privileged/openwpm/api.js", "paths": [["openwpm"]] } } },
-
Set logging level to
All
inabout:config
prefName: openwpm.logLevel values: All|Trace|Debug|Info|Warn|Error
This allows openwpm-related log output in the browser console.
How to use in your add-on
-
Read the documentation of the API
Notice that there are
functions
: async functions in thebrowser.openwpm
.events
: webExtension events in thebrowser.openwpm
types
: jsonschema draft-04 formats.
-
Explore
test-addon
:-
Notice the
experiment_apis
section. This mapsbrowser.openwpm
to the privileged api code. (See details below) -
Construct a
openwpmSetup
usable bybrowser.openwpm.setup
-
Uses the
browser.openwpm
api within a small instrumented feature.
-
Contribute
- Open an issue
- Hack and file a PR
npm run test
must pass.- Read ./docs/DEV.md for more in-depth development documentation.
- Useful testing helpers:
KEEPOPEN=1 npm run test
keeps Firefox opennpm run test-only
skips build steps.