SUPERSEEDED/REPLACED this approach by using the existing WebExtension APIs directly (previous explanation: WebExtension experiments API for privacy-related browser instrumentation that requires privileged code)
Перейти к файлу
Fredrik Wollsén 8e672ed4d5 Attempt to make tests pass for Nightly again in CI (Updated geckodriver form 0.20.0 to 0.21.0 and enabled geckodriver trace logs for further debugging) 2018-07-30 09:58:11 +03:00
.circleci Attempt to make tests pass for Nightly again in CI (Updated geckodriver form 0.20.0 to 0.21.0 and enabled geckodriver trace logs for further debugging) 2018-07-30 09:58:11 +03:00
bin Initial repository / webextension experiment boilerplate based on experiences from https://github.com/mozilla/shield-studies-addon-utils around what works and what does not work when it comes to bundled webextension experiments (WEEs) 2018-06-26 06:40:21 +03:00
dist Minor tweaks to the boilerplate 2018-07-29 09:58:39 +03:00
docs Initial repository / webextension experiment boilerplate based on experiences from https://github.com/mozilla/shield-studies-addon-utils around what works and what does not work when it comes to bundled webextension experiments (WEEs) 2018-06-26 06:40:21 +03:00
src Minor tweaks to the boilerplate 2018-07-29 09:58:39 +03:00
test Attempt to make tests pass for Nightly again in CI (Updated geckodriver form 0.20.0 to 0.21.0 and enabled geckodriver trace logs for further debugging) 2018-07-30 09:58:11 +03:00
test-addon Initial repository / webextension experiment boilerplate based on experiences from https://github.com/mozilla/shield-studies-addon-utils around what works and what does not work when it comes to bundled webextension experiments (WEEs) 2018-06-26 06:40:21 +03:00
testUtils Initial repository / webextension experiment boilerplate based on experiences from https://github.com/mozilla/shield-studies-addon-utils around what works and what does not work when it comes to bundled webextension experiments (WEEs) 2018-06-26 06:40:21 +03:00
.eslintignore Initial repository / webextension experiment boilerplate based on experiences from https://github.com/mozilla/shield-studies-addon-utils around what works and what does not work when it comes to bundled webextension experiments (WEEs) 2018-06-26 06:40:21 +03:00
.eslintrc.js Initial repository / webextension experiment boilerplate based on experiences from https://github.com/mozilla/shield-studies-addon-utils around what works and what does not work when it comes to bundled webextension experiments (WEEs) 2018-06-26 06:40:21 +03:00
.gitignore Initial repository / webextension experiment boilerplate based on experiences from https://github.com/mozilla/shield-studies-addon-utils around what works and what does not work when it comes to bundled webextension experiments (WEEs) 2018-06-26 06:40:21 +03:00
LICENSE Initial repository / webextension experiment boilerplate based on experiences from https://github.com/mozilla/shield-studies-addon-utils around what works and what does not work when it comes to bundled webextension experiments (WEEs) 2018-06-26 06:40:21 +03:00
README.md Updated docs / comments 2018-07-28 11:48:49 +03:00
package-lock.json Attempt to make tests pass for Nightly again in CI (Updated geckodriver form 0.20.0 to 0.21.0 and enabled geckodriver trace logs for further debugging) 2018-07-30 09:58:11 +03:00
package.json Attempt to make tests pass for Nightly again in CI (Updated geckodriver form 0.20.0 to 0.21.0 and enabled geckodriver trace logs for further debugging) 2018-07-30 09:58:11 +03:00

README.md

OpenWPM WebExtension Experiment / API

CircleCI badge

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

  1. Install the Package

    npm install --save mozilla/OpenWPM-WebExtension-Experiment#develop
    
  2. Copy the files to your 'privileged' src directory

    npx installOpenWPM src/privileged --example
    

    Suggestion: make this part of your package.json:scripts.postinstall script.

  3. 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"]]
          }
        }
      },
    
  4. Set logging level to All in about: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

  1. Read the documentation of the API

    Notice that there are

    • functions: async functions in the browser.openwpm.
    • events: webExtension events in the browser.openwpm
    • types: jsonschema draft-04 formats.
  2. Explore test-addon:

    • manifest.json

      Notice the experiment_apis section. This maps browser.openwpm to the privileged api code. (See details below)

    • openwpmSetup.js

      Construct a openwpmSetup usable by browser.openwpm.setup

    • background.js

      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 open
    • npm run test-only skips build steps.