Skip to content

Instantly share code, notes, and snippets.

@leplatrem
Last active January 25, 2016 11:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leplatrem/91251807b9fd6cea78ec to your computer and use it in GitHub Desktop.
Save leplatrem/91251807b9fd6cea78ec to your computer and use it in GitHub Desktop.

Update Kinto.js in Firefox

Compile Firefox

First, follow the instructions to build Firefox.

Run Kinto tests

$ ./mach xpcshell-test services/common/tests/unit/test_kinto.js
$ ./mach xpcshell-test services/common/tests/unit/test_storage_adapter.js

Update kinto.js

From kinto.js repo, generate the moz-kinto-client.js file:

$ npm run dist-fx

And overwrite it in the Firefox code base:

$ cp dist/moz-kinto-client.js ../mozilla-central/services/common

Re-run tests :)

TDD mode

Using inotify, we will detect a file change in the dist/ folder and run a series of commands to execute the tests automatically.

First, install inotify-tools:

sudo apt-get install inotify-tools

Then start an infinite loop with inotify-wait:

while true; do
    # Wait for a change
    inotifywait -q -e create,modify,delete -r ~/Code/Mozilla/kinto.js/dist
    # Execute these commands
    cp ~/Code/Mozilla/kinto.js/dist/moz-kinto-client.js services/common/
    ./mach xpcshell-test services/common/tests/unit/test_storage_adapter.js
    ./mach xpcshell-test services/common/tests/unit/test_kinto.js          
done

Source: Antoine Cezar

Contribute

Patch are contributed to kinto.js which is then released on NPM and updated manually in Mozilla central.

Become a contributor

Configure SSH key for hg:

Host hg.mozilla.org
  User user@server.com
  IdentityFile ~/.ssh/contrib_moz

Run integration tests: «Try»

See https://wiki.mozilla.org/ReleaseEngineering/TryServer

Or use a gecko-dev fork from Github, and with install moz git tools

git push-to-try -t --rev master..HEAD ~/hg/mozilla-central/ -b do -p linux,linux64,macosx64,win32,win64 -u xpcshell -t none

Debug script with console

let console = (Cu.import("resource://gre/modules/devtools/Console.jsm", {})).console;
console.log("Hello from Firefox code");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment