Firefox/Kinto: Difference between revisions

Jump to navigation Jump to search
Formatting, documented kinto github repositories
(formatting)
(Formatting, documented kinto github repositories)
Line 11: Line 11:


* Certificates blocklist (OneCRL)
* Certificates blocklist (OneCRL)
* Addons/Plugins/Gfx blocklist
* Addons/Plugins/Gfx [[Blocklisting]]
* storage.sync API (Web Extensions)
* <code>storage.sync</code> API ([[WebExtensions]])


== Upgrade client libraries ==
== Upgrade client libraries ==
Line 18: Line 18:
Two client libraries are embedded in Firefox:
Two client libraries are embedded in Firefox:


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


=== Generate bundles ===
=== Generate bundles ===


The libraries are developed independently on Github, using NPM packages.
The Kinto client libraries are developed independently on Github:
 
* [https://github.com/Kinto/kinto-client kinto-client] is the HTTP client for the Kinto REST API;
* [https://github.com/Kinto/kinto.js kinto.js] is the offline-first client for Kinto.
 
With the help of Babel and browsersify, a bundle is generated for Firefox with the minimum transpilation possible (eg. CommonJS require, ES7 decorators).
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 ====
==== kinto.js ====


From kinto.js repo, generate the `moz-kinto-offline-client.js` file:
From the kinto.js repo, generate the <code>moz-kinto-offline-client.js</code> file:


    $ npm run dist-fx
<pre>
$ npm run dist-fx
</pre>


And overwrite it in the Firefox code base:
And overwrite it in the Firefox code base:
      
      
    $ cp dist/moz-kinto-offline-client.js ../mozilla-central/services/common/kinto-offline-client.js
<pre>
$ cp dist/moz-kinto-offline-client.js ../mozilla-central/services/common/kinto-offline-client.js
</pre>


==== kinto-client.js ====
==== kinto-client.js ====


From kinto-client.js repo, generate the `moz-kinto-http-client.js` file:
From the kinto-client.js repo, generate the <code>moz-kinto-http-client.js</code> file:


    $ npm run dist-fx
<pre>
$ npm run dist-fx
</pre>


And overwrite it in the Firefox code base:
And overwrite it in the Firefox code base:


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


=== Run the tests ===
=== Run the tests ===
Line 52: Line 64:
For JavaScript updates only, have a look at [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Artifact_builds Artifacts Builds], trading bandwidth for compilation time.
For JavaScript updates only, have a look at [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Artifact_builds Artifacts Builds], trading bandwidth for compilation time.


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


Or all tests related to Kinto:
Or all tests related to Kinto:


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


==== 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 <code>dist/</code> 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
<pre>
sudo apt-get install inotify-tools
</pre>


Then start an infinite loop with `inotify-wait`:
Then start an infinite loop with <code>inotify-wait</code>:


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


[http://makina-corpus.com/blog/metier/2013/utiliser-inotify-pour-tester-en-continu-son-code Source: Antoine Cezar]
[http://makina-corpus.com/blog/metier/2013/utiliser-inotify-pour-tester-en-continu-son-code Source: Antoine Cezar]
Line 88: Line 107:
'''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 ====


* Generate a SSH key
* Generate a SSH key
Line 97: Line 116:
Configure SSH key for hg:
Configure SSH key for hg:


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


==== Run integration tests: «Try» ====
==== Run integration tests: «Try» ====
Line 107: Line 128:
Or use a ''gecko-dev'' fork from Github, and with install [https://github.com/mozilla/moz-git-tools 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
<pre>
git push-to-try -t --rev master..HEAD ~/hg/mozilla-central/ -b do -p linux,linux64,macosx64,win32,win64 -u xpcshell -t none
</pre>


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


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


Examples:  
Examples:  


* https://reviewboard.mozilla.org/r/45445/
* https://reviewboard.mozilla.org/r/45445/
3

edits

Navigation menu