Firefox/Kinto: Difference between revisions

Jump to navigation Jump to search
Add details about implementation
(fixed formatting)
(Add details about implementation)
Line 1: Line 1:
= Kinto Integration in Firefox =
= Kinto Integration in Firefox =


== Key features ==
= Key features =


* Data synchronization
* Diff-based data synchronization
* Data integrity/signing
* Data integrity/signing
* Offline persistence
* Offline persistence
* Admin panel UI
* Admin panel UI


== Use Cases ==
= Use Cases =


* Certificates blocklist (OneCRL)
* Certificates blocklist (OneCRL) ''(contact: mgoodwin)''
* Addons/Plugins/Gfx [[Blocklisting]]
* Addons/Plugins/Gfx [[Blocklisting]] ''(contact: leplatrem)''
* <code>storage.sync</code> API ([[WebExtensions]])
* <code>storage.sync</code> API ([[WebExtensions]]) ''(contact: tarek)''
* Fennec assets catalog ''(contact: Sebastian Kaspari)''
* Password manager recipes ''(contact: MattN)''
 
Feel free to come and discuss on <code>#storage</code> :)
 
= Usage =
 
Leveraging the [https://github.com/Kinto/kinto-client Kinto HTTP client] in Gecko looks like this:
 
<pre>
const { KintoHttpClient } = Cu.import("resource://services-common/kinto-http-client.js");
 
const client = new KintoHttpClient("https://kinto.dev.mozaws.net/v1");
client.bucket("a-bucket").collection("a-collection")
  .listRecords()
  .then(result => ...);
</pre>
 
As for the [https://github.com/Kinto/kinto.js Kinto offline-first client], it is like:
 
<pre>
const { loadKinto } = Cu.import("resource://services-common/kinto-offline-client.js");
 
const KintoOfflineClient = loadKinto();
 
const client = new KintoOfflineClient({
  adapter: Kinto.adapters.FirefoxAdapter,
  remote: "https://kinto.dev.mozaws.net/v1",
  bucket: "a-bucket"
});
 
const collection = db.collection("a-collection");
 
try {
  yield collection.db.open();
  // Fetch changes from server.
  yield collection.sync();
  // Read local collection of records.
  const records = yield collection.list();
} finally {
  yield collection.db.close();
}
</pre>
 
 
= Specifications =
 
Currently, the instance of Kinto used by Firefox clients is hosted at https://firefox.settings.services.mozilla.com/v1/
 
== Blocklists ==
 
The goal is to replace the current system based on a single XML file downloaded everyday by several Kinto collections.
 
* The bucket is '''blocklists'''
* The collection for OneCRL entries is '''certificates''' https://firefox.settings.services.mozilla.com/v1/buckets/blocklists/collections/certificates/records
* The collection for Add-ons entries is '''addons''' https://firefox.settings.services.mozilla.com/v1/buckets/blocklists/collections/certificates/records
* The collection for Plugins entries is '''plugins''' https://firefox.settings.services.mozilla.com/v1/buckets/blocklists/collections/certificates/records
* The collection for Gfx entries is '''gfx''' https://firefox.settings.services.mozilla.com/v1/buckets/blocklists/collections/certificates/records
 
See https://bugzilla.mozilla.org/show_bug.cgi?id=1197707
 
== Fennec assets catalog ==
 
The goal is to remove the static assets (fonts, hyphenation dicts, etc.) from the distribution package and download them asynchronously using an online Kinto catalog.
 
* The bucket is '''fennec'''
* The collection is '''catalog'''
 
See https://bugzilla.mozilla.org/show_bug.cgi?id=1201059
 
 
= Contribute =


== Upgrade client libraries ==
== Upgrade client libraries ==
Line 74: Line 146:
<pre>
<pre>
$ ./mach xpcshell-test services/common/tests/unit/*into*
$ ./mach xpcshell-test services/common/tests/unit/*into*
</pre>
==== Gfx blocklist tests ====
The Gfx test suite requires the debug mode to be enabled. Add this to <code>mozconfig</code> file, rebuild and run the tests:
<pre>
ac_add_options --enable-debug
</pre>
==== Debug content signature ====
You can get tests (or Firefox) to give you more information on what the content signature verifier is doing by setting the NSPR_LOG_MODULES environment variable. For example:
<pre>
EXPORT NSPR_LOG_MODULES=ContentSignatureVerifier:5,CSTrustDomain:5
</pre>
</pre>


Line 153: Line 241:


* https://reviewboard.mozilla.org/r/45445/
* https://reviewboard.mozilla.org/r/45445/
= Tips for Testing =
You can get tests (or Firefox) to give you more information on what the content signature verifier is doing by setting the NSPR_LOG_MODULES environment variable. For example:
<pre>
EXPORT NSPR_LOG_MODULES=ContentSignatureVerifier:5,CSTrustDomain:5
</pre>
24

edits

Navigation menu