Firefox/Kinto: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(import release instructions)
(formatting)
Line 63: Line 63:
==== TDD mode ====
==== 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.
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`:
First, install ''inotify-tools'':


     sudo apt-get install inotify-tools
     sudo apt-get install inotify-tools
Line 86: Line 86:
> Patch are contributed to kinto.js and kinto-client.js, which are first released on NPM.
> Patch are contributed to kinto.js and kinto-client.js, which are first released on NPM.


**DO NOT** land files that are not tagged officially on upstream repositories.
'''DO NOT''' land files that are not tagged officially on upstream repositories.


==== Become a contributor =====
==== Become a contributor =====
Line 105: Line 105:
See https://wiki.mozilla.org/ReleaseEngineering/TryServer
See https://wiki.mozilla.org/ReleaseEngineering/TryServer


Or use a *gecko-dev* fork from Github, and with install [moz git tools](https://github.com/mozilla/moz-git-tools)
Or use a ''gecko-dev'' fork from Github, and with install [https://github.com/mozilla/moz-git-tools 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
     git push-to-try -t --rev master..HEAD ~/hg/mozilla-central/ -b do -p linux,linux64,macosx64,win32,win64 -u xpcshell -t none


==== Submit for review ====  
==== Submit for review ====  
See http://mozilla-version-control-tools.readthedocs.org


     # Commit with link to Bugzilla
     # Commit with link to Bugzilla
Line 122: Line 124:
     # Go back to «master»
     # Go back to «master»
     hg update central
     hg update central
Examples:
* https://reviewboard.mozilla.org/r/45445/

Revision as of 09:16, 13 April 2016

Kinto Integration in Firefox

Key features

  • Data synchronization
  • Data integrity/signing
  • Offline persistence
  • Admin panel UI

Use Cases

  • Certificates blocklist (OneCRL)
  • Addons/Plugins/Gfx blocklist
  • storage.sync API (Web Extensions)

Upgrade client libraries

Two client libraries are embedded in Firefox:

  • `Kinto/kinto-client.js`: for direct interactions with the Kinto HTTP API
  • `Kinto/kinto.js`: for offline persistence in internal SQLite

Generate bundles

The libraries are developed independently on Github, using NPM packages. With the help of Babel and browsersify, a bundle is generated for Firefox with the minimum transpilation possible (eg. CommonJS require, ES7 decorators).

kinto.js

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

   $ npm run dist-fx

And overwrite it in the Firefox code base:

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

kinto-client.js

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

   $ npm run dist-fx

And overwrite it in the Firefox code base:

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

Run the tests

First, follow the instructions to build Firefox.

For JavaScript updates only, have a look at Artifacts Builds, trading bandwidth for compilation time.

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

Or all tests related to Kinto:

   $ ./mach xpcshell-test services/common/tests/unit/*into*


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-offline-client.js services/common/kinto-offline-client.js
       ./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

Submit patch

> Patch are contributed to kinto.js and kinto-client.js, which are first released on NPM.

DO NOT land files that are not tagged officially on upstream repositories.

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

Submit for review

See http://mozilla-version-control-tools.readthedocs.org

   # Commit with link to Bugzilla
   hg commit -m "Bug XXXXX - Upgrade <lib> to X.Y.Z"
   
   # Submit to MozReview
   hg push review
   
   # Keep a bookmark of your branch to address review.
   hg bookmark bug-XXXXX
   
   # Go back to «master»
   hg update central

Examples: