Commit Graph

5946 Commits

Author SHA1 Message Date
Lina Cambridge
8caa2f7986 Bug 1634191 - Wire up Golden Gate to the new Rust extension storage interface. r=markh
This commit adds syncing support to the `StorageSyncArea` class, via
the Golden Gate library.

It also changes the `BridgedEngine` trait: `initialize` and `finalize`
haven't been useful in practice, since that's managed by the storage
service, and the `LazyStore` takes care of setting up the storage
connection on first use. But, what we do need is a way to signal a
sync is starting, so that the engine can set up temp tables. That's
handled by the new `sync_started`.

Finally, this commit changes `BridgedEngine::set_uploaded` to take a
`sync15_traits::Guid` instead of a `String`.

Differential Revision: https://phabricator.services.mozilla.com/D73415
2020-05-05 06:59:32 +00:00
Ryan Kelly
ccc520aafb Bug 1632734 - refactor FxAccounts.device public methods to use withCurrentAccountState. r=eoger,markh
Differential Revision: https://phabricator.services.mozilla.com/D73011
2020-05-04 02:48:20 +00:00
Lina Cambridge
4eafc7c1a6 Bug 1634191 - Pass BSO fields along with Sync record payloads to bridged Rust engines. r=markh
This commit splits `CryptoWrapper` into a base `RawCryptoWrapper`
class, which only handles encryption and decryption without
parsing the cleartext's contents, and the existing `CryptoWrapper`
class, which works like before.

Our bridged engine subclasses `RawCryptoWrapper`, and
implements some methods to convert records to and from envelopes.
Envelopes are a concept we introduced in `sync15_traits` to pass
along metadata from the BSO wrapper (like the modified time from the
server, and ID, to ensure they match) in addition to the cleartext.
This lets us reuse `sync15_traits::Payload` to parse record payloads
in Rust, and avoids parsing the cleartext in JS, only to stringify it
again when we pass it to the bridged Rust engine.

Differential Revision: https://phabricator.services.mozilla.com/D73581
2020-05-04 22:25:00 +00:00
Lina Cambridge
7783b7bc0b Bug 1634626 - Add interrupt support for StorageSyncArea. r=markh,tcsc
This commit adds a `mozIInterruptible` implementation to
`StorageSyncArea`, and changes `LazyStore` to get an a-s interrupt
handle and interrupt pending operations.

Differential Revision: https://phabricator.services.mozilla.com/D73414
2020-05-04 21:32:52 +00:00
Lina Cambridge
a9b590300f Bug 1634626 - Refactor interruption in Golden Gate. r=markh,tcsc
This commit removes the `nsICancelable` return values from all
`mozIBridgedSyncEngine` methods, and replaces them with a
`mozIInterruptible` interface that can be implemented by store
classes that support interrupting.

The `nsICancelable` pattern was intended to make each operation
interruptible, without affecting the others. But we can't guarantee
that with SQLite, because it only has a way to interrupt all
running statements on a connection, not specific ones. Further,
this pattern doesn't match what we currently do in a-s, where we
create an internal "interrupt scope" for each operation, and hand
out an "interrupt handle" for interrupting all in-progress
operations.

Storage classes like `StorageSyncArea` can opt in to interruption
by implementing `mozIInterruptible`. It's a separate interface to
protect against accidental misuse: because it interrupts all
statements on the connection, it might lose writes if the current
operation is a `set`, for example. But it's useful for testing and
debugging, so we still expose it.

This commit also changes Golden Gate ferries to hold weak references to
the `BridgedEngine`, so that they don't block teardown.

Differential Revision: https://phabricator.services.mozilla.com/D73413
2020-05-04 21:32:29 +00:00
Mihai Alexandru Michis
6c70d124b5 Merge mozilla-central to autoland. a=merge 2020-05-04 18:52:51 +03:00
Mozilla Releng Treescript
b6bf8b5422 Update configs. IGNORE BROKEN CHANGESETS CLOSED TREE NO BUG a=release ba=release 2020-05-04 14:53:37 +00:00
ffxbld
960049edf3 No Bug, mozilla-central repo-update HSTS HPKP remote-settings - a=repo-update r=RyanVM
Differential Revision: https://phabricator.services.mozilla.com/D73699
2020-05-04 14:03:46 +00:00
Rob Wu
f7f88112a2 Bug 1634671 - Add RS dump of addons-bloomfilters blocklist to Android r=agi
These support the new implementation of the addon blocklist (bug 1620621),
which is a more space-efficient way to represent the blocklist.

A comparison of file size was given in D73159. In short, 913KB for the
old JSON-based blocklist (addons.json), 64KB for the new one.

In practice, addons.json is 273KB compressed.

The new blocklist (addons-mlbf.bin) does not compress that well since it
is already an efficiently packed binary format.

Differential Revision: https://phabricator.services.mozilla.com/D73438
2020-05-01 19:36:43 +00:00
Rob Wu
ed0c57f641 Bug 1634203 - Replace Kinto client with RemoteSettings client in test_remote_settings_poll r=glasserc
Differential Revision: https://phabricator.services.mozilla.com/D73321
2020-04-30 19:52:14 +00:00
ffxbld
39ea1433df No Bug, mozilla-central repo-update HSTS HPKP remote-settings - a=repo-update r=RyanVM
Differential Revision: https://phabricator.services.mozilla.com/D73270
2020-04-30 14:02:58 +00:00
Mathieu Leplatre
8e59cea76e Bug 1634058 - Honor load_dump pref with .get() r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D73229
2020-04-30 13:40:24 +00:00
Rob Wu
1d005914a3 Bug 1620621 - Temporarily disable test_remote_settings_poll.js r=glasserc
This test uses the Kinto client to access the RemoteSettings database.
However, due to the database version bump from D72416, the kinto client
is no longer compatible with the RemoteSettings database.

This will be fixed in bug 1634203.

Differential Revision: https://phabricator.services.mozilla.com/D73160
2020-04-30 10:02:44 +00:00
Rob Wu
6c21ed0e5d Bug 1620621 - Add initial dump of addons blocklist r=Gijs
The MLBF (addons-mlbf.bin) itself is 64 KB.
Together with the metadata, this is 65 KB.
In contrast, the current JSON-based dump (addons.json) is 913 KB.

Differential Revision: https://phabricator.services.mozilla.com/D73159
2020-04-30 10:02:41 +00:00
Rob Wu
981457a895 Bug 1620621 - Add support for fallback to dumps for attachments r=Gijs,leplatrem
With this piece, it is now possible for RemoteSettings clients to always
have a valid attachment.

This adds the client APIs that could support bug 1542177.

Differential Revision: https://phabricator.services.mozilla.com/D72417
2020-04-30 10:02:30 +00:00
Rob Wu
f08ef10b92 Bug 1620621 - Add caching and recovery mechanisms to RemoteSettings's download() method r=Gijs,leplatrem
The current RemoteSettings API has two methods for downloading:

- `download(record)` to download an attachment to disk, with a filename
  given by the record. The file is read and returned before downloading.
  A new download attempt overwrites the file, with no recovery mechanism
  if the download fails.
- `downloadAsBytes(record)` to download an attachment in memory.

The `download` method does have a cache, but it is only useful for
reducing bandwidth usage, not for availability of data. Moreover, if its
associated record is removed from the collection, then callers do not
have a way to delete the file since its identifier (filename) originates
from the record.

The `downloadAsBytes` method does not have this file tracking issue
since it does not persist the data, but it forces callers to implement
their own attachment storing mechanism.

This commit adds the `useCache` option to the `download()` method to
enable callers to use an IndexedDB-based cache instead of the
filesystem. The following options unlock significant features:

- `fallbackToCache` - If the requested attachment is not available, the
  last known attachment is returned.
- `fallbackToDump` - If the requested attachment is not available, nor
  cached, then the attachment (dump) that is packaged with the client is
  returned instead. This is implemented in the next commit (D72417).

The original record is cached along with the attachment, to allow
callers to use the file (identified by the given `attachmentId`) and
its metadata, even when the original record has been removed from the
collection.

This is particularly useful for scenarios where one wants to keep a file
(and metadata) up to date via RemoteSettings, without having to develop
a separate storage and synchronization mechanism.

The deprecation of the old behavior will be handled in bug 1634127.

Differential Revision: https://phabricator.services.mozilla.com/D72416
2020-04-30 10:02:27 +00:00
Razvan Maries
c92da124b3 Backed out 8 changesets (bug 1620621) for build bustages. CLOSED TREE
Backed out changeset 14a57e32c414 (bug 1620621)
Backed out changeset 56b2b19a9bc1 (bug 1620621)
Backed out changeset 6df42b7528ec (bug 1620621)
Backed out changeset c23703684254 (bug 1620621)
Backed out changeset 206ad824e1bc (bug 1620621)
Backed out changeset e0f3e057b311 (bug 1620621)
Backed out changeset 12817823a3c9 (bug 1620621)
Backed out changeset 80dcb089ce8e (bug 1620621)
2020-04-30 12:29:30 +03:00
Rob Wu
6b89689536 Bug 1620621 - Temporarily disable test_remote_settings_poll.js r=glasserc
This test uses the Kinto client to access the RemoteSettings database.
However, due to the database version bump from D72416, the kinto client
is no longer compatible with the RemoteSettings database.

This will be fixed in bug 1634203.

Differential Revision: https://phabricator.services.mozilla.com/D73160
2020-04-30 09:08:14 +00:00
Rob Wu
6986e261ef Bug 1620621 - Add initial dump of addons blocklist r=Gijs
The MLBF (addons-mlbf.bin) itself is 64 KB.
Together with the metadata, this is 65 KB.
In contrast, the current JSON-based dump (addons.json) is 913 KB.

Differential Revision: https://phabricator.services.mozilla.com/D73159
2020-04-30 02:48:46 +00:00
Rob Wu
4c8480260e Bug 1620621 - Add support for fallback to dumps for attachments r=Gijs,leplatrem
With this piece, it is now possible for RemoteSettings clients to always
have a valid attachment.

This adds the client APIs that could support bug 1542177.

Differential Revision: https://phabricator.services.mozilla.com/D72417
2020-04-30 02:48:37 +00:00
Rob Wu
e515fb95e2 Bug 1620621 - Add caching and recovery mechanisms to RemoteSettings's download() method r=Gijs,leplatrem
The current RemoteSettings API has two methods for downloading:

- `download(record)` to download an attachment to disk, with a filename
  given by the record. The file is read and returned before downloading.
  A new download attempt overwrites the file, with no recovery mechanism
  if the download fails.
- `downloadAsBytes(record)` to download an attachment in memory.

The `download` method does have a cache, but it is only useful for
reducing bandwidth usage, not for availability of data. Moreover, if its
associated record is removed from the collection, then callers do not
have a way to delete the file since its identifier (filename) originates
from the record.

The `downloadAsBytes` method does not have this file tracking issue
since it does not persist the data, but it forces callers to implement
their own attachment storing mechanism.

This commit adds the `useCache` option to the `download()` method to
enable callers to use an IndexedDB-based cache instead of the
filesystem. The following options unlock significant features:

- `fallbackToCache` - If the requested attachment is not available, the
  last known attachment is returned.
- `fallbackToDump` - If the requested attachment is not available, nor
  cached, then the attachment (dump) that is packaged with the client is
  returned instead. This is implemented in the next commit (D72417).

The original record is cached along with the attachment, to allow
callers to use the file (identified by the given `attachmentId`) and
its metadata, even when the original record has been removed from the
collection.

This is particularly useful for scenarios where one wants to keep a file
(and metadata) up to date via RemoteSettings, without having to develop
a separate storage and synchronization mechanism.

The deprecation of the old behavior will be handled in bug 1634127.

Differential Revision: https://phabricator.services.mozilla.com/D72416
2020-04-30 09:02:14 +00:00
Gijs Kruitbosch
f6364a8a1b Bug 1630766 - use Remote Settings instead of kinto-offline-client for remote_settings_worker sanity checks, r=leplatrem
Depends on D72063

Differential Revision: https://phabricator.services.mozilla.com/D72064
2020-04-30 08:23:36 +00:00
Gijs Kruitbosch
6a1f88f746 Bug 1630766 - optimize clear() in remote settings' Database.jsm to delete based on a keyrange instead of cursor'ing through everything, r=asuth
Depends on D71326

Differential Revision: https://phabricator.services.mozilla.com/D72063
2020-04-29 22:57:18 +00:00
Gijs Kruitbosch
ca9538bd16 Bug 1630766 - handle abort events in Remote Settings' executeIDB and test that this works, r=asuth,leplatrem
This adds abort handlers to Database.jsm and RemoteSettingsWorker.js's
indexedDB transactions, so we handle transaction aborts appropriately
and do not leave consumers waiting forever.

It also adds explicit error passing to places where we continue operating on a
store via a live transaction after control flow passes back to executeIDB,
because we use the `onsuccess` handler of earlier IDBRequests to run more
requests in the transaction.

In this case, in theory exceptions get handled by IndexedDB by invoking the
abort handler on the transaction (which we do not have right now...), but as a
belt-and-braces approach, it's probably better to do this explicitly.

Differential Revision: https://phabricator.services.mozilla.com/D71326
2020-04-30 08:17:54 +00:00
Mathieu Leplatre
77fd51daf1 Bug 1633502 - Fix usage of timestamp in changeset querystring r=mythmon
Differential Revision: https://phabricator.services.mozilla.com/D73133
2020-04-29 20:49:27 +00:00
Mark Hammond
c777f6f9ed Bug 1634257 - expose wipe_all to mozIExtensionStorageArea. r=lina
Differential Revision: https://phabricator.services.mozilla.com/D73191
2020-04-30 08:16:26 +00:00
Stefan Hindli
49c6346195 Backed out changeset 13bb4d7dde88 (bug 1634257) for spidermoney bustages CLOSED TREE 2020-04-30 10:56:43 +03:00
Mark Hammond
baecd41165 Bug 1634257 - expose wipe_all to mozIExtensionStorageArea. r=lina
Differential Revision: https://phabricator.services.mozilla.com/D73191
2020-04-30 07:08:38 +00:00
Dorel Luca
58186c88dc Backed out 8 changesets (bug 1620621) for XPCshell failures in xpcshell/rs-blocklist/test_blocklist_mlbf_fetch.js
Backed out changeset 06fccc75c09e (bug 1620621)
Backed out changeset 8b4e286967c0 (bug 1620621)
Backed out changeset cfde27a748fd (bug 1620621)
Backed out changeset 7abf836343be (bug 1620621)
Backed out changeset 1a28d1de8f76 (bug 1620621)
Backed out changeset 90c08438be0a (bug 1620621)
Backed out changeset 723a3b4e7bbf (bug 1620621)
Backed out changeset bbc991f09d5d (bug 1620621)
2020-04-30 05:44:28 +03:00
Rob Wu
cca5bab1f4 Bug 1620621 - Temporarily disable 2 RemoteSettings tests r=glasserc
These two tests use the Kinto client to access the RemoteSettings
database. However, due to the database version bump from D72416,
the kinto client is no longer compatible with the RemoteSettings
database.

This will be fixed in bug 1634203.

Differential Revision: https://phabricator.services.mozilla.com/D73160
2020-04-30 00:34:54 +00:00
Rob Wu
8962b5b5c1 Bug 1620621 - Add initial dump of addons blocklist r=Gijs
The MLBF (addons-mlbf.bin) itself is 64 KB.
Together with the metadata, this is 65 KB.
In contrast, the current JSON-based dump (addons.json) is 913 KB.

Differential Revision: https://phabricator.services.mozilla.com/D73159
2020-04-30 00:34:54 +00:00
Rob Wu
2f5a6bf9d0 Bug 1620621 - Add support for fallback to dumps for attachments r=Gijs,leplatrem
With this piece, it is now possible for RemoteSettings clients to always
have a valid attachment.

This adds the client APIs that could support bug 1542177.

Differential Revision: https://phabricator.services.mozilla.com/D72417
2020-04-29 23:08:08 +00:00
Rob Wu
3c1bafb9ac Bug 1620621 - Add caching and recovery mechanisms to RemoteSettings's download() method r=Gijs,leplatrem
The current RemoteSettings API has two methods for downloading:

- `download(record)` to download an attachment to disk, with a filename
  given by the record. The file is read and returned before downloading.
  A new download attempt overwrites the file, with no recovery mechanism
  if the download fails.
- `downloadAsBytes(record)` to download an attachment in memory.

The `download` method does have a cache, but it is only useful for
reducing bandwidth usage, not for availability of data. Moreover, if its
associated record is removed from the collection, then callers do not
have a way to delete the file since its identifier (filename) originates
from the record.

The `downloadAsBytes` method does not have this file tracking issue
since it does not persist the data, but it forces callers to implement
their own attachment storing mechanism.

This commit adds the `useCache` option to the `download()` method to
enable callers to use an IndexedDB-based cache instead of the
filesystem. The following options unlock significant features:

- `fallbackToCache` - If the requested attachment is not available, the
  last known attachment is returned.
- `fallbackToDump` - If the requested attachment is not available, nor
  cached, then the attachment (dump) that is packaged with the client is
  returned instead. This is implemented in the next commit (D72417).

The original record is cached along with the attachment, to allow
callers to use the file (identified by the given `attachmentId`) and
its metadata, even when the original record has been removed from the
collection.

This is particularly useful for scenarios where one wants to keep a file
(and metadata) up to date via RemoteSettings, without having to develop
a separate storage and synchronization mechanism.

The deprecation of the old behavior will be handled in bug 1634127.

Differential Revision: https://phabricator.services.mozilla.com/D72416
2020-04-29 23:39:07 +00:00
Ryan Kelly
7bae4ae386 Bug 1604844 - add identifiers from the sync ping to the deletion-request ping. r=markh,chutten
Differential Revision: https://phabricator.services.mozilla.com/D72286
2020-04-29 07:47:38 +00:00
Lina Cambridge
add5457732 Bug 1633943 - Support tearing down a Rust StorageSyncArea. r=markh
This commit wires up `StorageSyncArea::teardown()` to call the new
`webext_storage::Store::close()` method.

It also changes `teardown` to drop the `LazyStore`, and thus close its
database connection, on the main thread if dispatching to the task
queue fails. Dispatch should only fail at shutdown, and putting the
owned reference back only adds indirection, since the `StorageSyncArea`
will still drop its `LazyStore` later in shutdown.

Finally, it includes an xpcshell test fix for
https://github.com/mozilla/application-services/pull/3050.

Differential Revision: https://phabricator.services.mozilla.com/D72992
2020-04-29 04:35:45 +00:00
Vlad Filippov
cf50ebbe18 Bug 1631830 - Fetch Sync tokens with OAuth behind a pref r=rfkelly
Differential Revision: https://phabricator.services.mozilla.com/D72092
2020-04-28 04:20:55 +00:00
Lina Cambridge
c13f9f9d49 Bug 1626128 - Change Golden Gate to depend on sync15_traits. r=markh
Now that `BridgedEngine` has been moved to `sync15_traits`, we can
remove `golden_gate_traits` from the tree, and change Golden Gate to
depend on `sync15_traits` directly.

This commit also adds a Cargo feature, `services_sync`, which reflects
the `MOZ_SERVICES_SYNC` config option. In the future, we'll use this
feature to gate implementations of `mozIBridgedSyncEngine`.

Differential Revision: https://phabricator.services.mozilla.com/D72784
2020-04-28 04:13:04 +00:00
ffxbld
b534feae40 No Bug, mozilla-central repo-update HSTS HPKP remote-settings tld-suffixes - a=repo-update r=RyanVM
Differential Revision: https://phabricator.services.mozilla.com/D72661
2020-04-27 14:21:26 +00:00
Mathieu Leplatre
e95ee4d2f4 Bug 1620186 - Fetch from changeset endpoint r=glasserc
Differential Revision: https://phabricator.services.mozilla.com/D71570
2020-04-24 09:15:43 +00:00
Mathieu Leplatre
3c64c7a3b2 Bug 1620186 - Upgrade kinto-client to 5.1.1 r=glasserc
Differential Revision: https://phabricator.services.mozilla.com/D71569
2020-04-24 09:15:25 +00:00
Dale Harvey
4ccaa0f9aa Bug 1615060 - Add distribution engines to m-c r=Standard8,mkaply
Differential Revision: https://phabricator.services.mozilla.com/D67231
2020-04-23 21:01:10 +00:00
Gijs Kruitbosch
d0edbfc642 Bug 1624301 - optimize remote settings Database list calls without filters, r=leplatrem
Differential Revision: https://phabricator.services.mozilla.com/D72137
2020-04-23 16:19:27 +00:00
Gijs Kruitbosch
9655c6cc65 Bug 1631484 - make bulk imports / deletes in remote settings faster, r=asuth,leplatrem
Differential Revision: https://phabricator.services.mozilla.com/D71588
2020-04-22 00:04:19 +00:00
ffxbld
3e98c37370 No Bug, mozilla-central repo-update HSTS HPKP remote-settings - a=repo-update r=RyanVM
Differential Revision: https://phabricator.services.mozilla.com/D71596
2020-04-20 16:44:01 +00:00
ffxbld
618ba07d34 No Bug, mozilla-central repo-update HSTS HPKP remote-settings - a=repo-update r=RyanVM
Differential Revision: https://phabricator.services.mozilla.com/D71198
2020-04-16 16:16:14 +00:00
vladikoff
de2af0a87e Bug 1627856 - Dont log URIs when sync fails to fetch favicons for synced tabs r=rfkelly
Differential Revision: https://phabricator.services.mozilla.com/D70414

--HG--
extra : moz-landing-system : lando
2020-04-13 23:40:16 +00:00
jayati
4da359df42 Bug 1628729 - Remove nsIFxAccountsUIGlue. r=eoger
Differential Revision: https://phabricator.services.mozilla.com/D70427

--HG--
extra : moz-landing-system : lando
2020-04-09 19:50:54 +00:00
Lina Cambridge
f9abd62b34 Bug 1596322 - Add XPCOM bindings for Rust Sync engines. r=markh,tcsc,LougeniaBailey
This commit adds a new crate for bridging Rust Sync engines to Desktop,
and a `mozIBridgedSyncEngine` for accessing the bridge via JS.
Naturally, the bridge is called Golden Gate. 😊 For more information
on how to use it, please see `golden_gate/src/lib.rs`.

Other changes include:

* Ensuring the test Sync server uses UTF-8 for requests and responses.
* Renaming `mozISyncedBookmarksMirrorLogger` to `mozIServicesLogger`,
  and moving it into the shared Sync interfaces.

The `BridgedEngine` trait lives in its own crate, called
`golden_gate_traits`, to make it easier to eventually move into a-s.
`Interruptee` and `Interrupted` already exist in a-s, and are
duplicated in this crate for now.

Differential Revision: https://phabricator.services.mozilla.com/D65268

--HG--
extra : moz-landing-system : lando
2020-04-09 15:45:37 +00:00
ffxbld
c53603da3d No Bug, mozilla-central repo-update HSTS HPKP remote-settings tld-suffixes - a=repo-update r=RyanVM
Differential Revision: https://phabricator.services.mozilla.com/D70364

--HG--
extra : moz-landing-system : lando
2020-04-09 13:55:34 +00:00
Bogdan Tara
5dcf5dcc85 Backed out changeset d8ef791a2165 (bug 1596322) for browser_all_files_referenced.js failures CLOSED TREE 2020-04-09 13:17:04 +03:00