Граф коммитов

129 Коммитов

Автор SHA1 Сообщение Дата
Ben Dean-Kawamura 7625a2cecc Switch to UniFFI library mode
This removes the need for a lot configuration in our `uniffi.toml`
files.
2024-09-18 20:31:35 +00:00
Lina Butler 5d0ad19431 all: Add `#[allow(dead_code)]` exemptions to prepare for Rust 1.79.0. 2024-07-11 00:03:23 +00:00
Alexander Cyon d73a4c7a45 Typos 2024-05-24 20:17:12 +00:00
Ben Dean-Kawamura 6c6951cdfe Updating the fxa-client example
Added flags to:
  - Request the session scope.
  - Control how log messages get printed to the console.

Updated the code to re-authenticated using the existing data rather than
throwing it away and starting from scratch.

These changes make it possible to repro
https://bugzilla.mozilla.org/show_bug.cgi?id=1887071

- run `cargo run -- --log -d devices` with fresh credentials.
  - Any command should do, but I used `devices`
  - The client should ask you to login and paste your credentials
  - You should see the device list printed out
- In a browser session, change your FxA password
- run `cargo run -- --log -d devices` again
  - The client should tell you there was an auth-problem and ask you to
    reauthenticate.
  - After you paste the reauthentication URL you should see an error
    printed out
2024-04-04 15:32:33 +00:00
lougeniac64 c1bd7dbede Prevented outgoing syncs of scrubbed credit card records 2024-02-28 22:55:01 +00:00
Issam Mani f86fd74ee9 fix: missed failing test 2024-02-26 15:14:43 +00:00
Mark Hammond f538529f15 Update a number of crate package versions.
This was largely done manually to try and bring app-services and
mozilla-central closer together. With this patch we can vendor
into mozilla-central, including when most of our mobile crates are
built into libxul in the Android monorepo, oak.

This patch also re-forks find-places-db to avoid using a now orhpaned
crate which no mozilla staff had access to update.
2024-02-06 15:43:45 +00:00
Mark Hammond 4fde1d35c0 Allow `inactive` field in tabs records and payloads.
This adds an `inactive` field to a `RemoteTabRecord` with the default
value being `false`. The intent is for the mobile platforms to start
populating this, then all platforms can choose how to handle such
tabs (eg, they may not show them by default and instead add a button
which shows them).
2024-01-03 21:38:33 +00:00
Ben Dean-Kawamura 8d1cf0f5e9 Updating the criterion version
The old version conflicted with some other changes I'm working on, so
let's upgrade it.
2023-12-20 21:01:46 +00:00
Mark Hammond 0c2109c89d Move rusqlite/libslite3-sys to workspace dependencies 2023-12-13 15:53:26 +00:00
Sammy Khamis 8a23472daa Refactor VisitTransition to be VisitType 2023-10-16 21:13:39 +00:00
Mike Hommey 8c0c0a60c5 Upgrade base64 to 0.21 2023-09-07 23:47:23 +00:00
lougeniac64 cc29c6925f Removed obsolete iOS sync logic 2023-07-17 22:39:21 +00:00
Mark Hammond 2051fa9e37 Kill the integration test feature 2023-06-20 18:46:28 +00:00
Ben Dean-Kawamura 2d1d6cc793 Renamed content_url -> url 2023-06-20 18:46:28 +00:00
Ben Dean-Kawamura 6f67d93b7b Updating the Kotlin/Swift code to avoid breaking changes (for now)
Made the wrapper code work with the new FxaConfig and FxaServer classes.
As noted, we should probably just expose those classes directly to the
consumer application, since they're almost identical to the
server/config classes that we do expose.  However, let's wait just a bit
and fix a couple smaller breaking changes at once.
2023-06-20 18:46:28 +00:00
Mark Hammond 6c4c65e8ce Move sync-test to the fxa cli helper. 2023-06-14 20:27:20 +00:00
Tarik Eshaq ffb06acd44 Updates rusqlite to 0.29.0 and libsqlite to 0.26.0 2023-06-13 01:11:26 +00:00
Mark Hammond 180d66f8d8 fix sync-test 2023-05-26 17:58:37 +00:00
Mark Hammond 70bebedbec
Minor cleanups of sync engine code: (#5365)
* Consolidate the various types used for a "collection name" - now we
  use `Cow` rather than the various `&'static str`, `&str` and `String`
  used previously.
* This made it easier to clean up the `LocalCollState` state machine
  to have the `Ready` state directly provide the `CollState` due to
  a mismatch between `'static str` and `String` reprs of collections.
* No longer store the outgoing timestamp in an OutgoingChangeset - it was
  never actually used and just creates unnecessary complexity.
* OutgoingChangsets now always supply the BSOs as they are created,
  meaning less `mut` objects.
* Bonus fix to unbreak the `places-utils` example.
2023-02-08 13:50:38 +11:00
Ben Dean-Kawamura b3a573164e Clippy and check-dependency fixes 2023-01-27 15:32:17 -05:00
Tarik Eshaq b8ba517115
remove iOS bookmarks migration code (#5276)
* Removes old iOS bookmarks migration code

* Adds changelog

* Fixes cargo clippy
2023-01-04 17:53:31 -05:00
Tarik Eshaq 43b5269403
Adds a 10,000 visit limit to the history migration (#5310)
* Implements limiting visits migrated to 10000

* adds changelog

* Improves test performance
2023-01-04 13:58:00 -05:00
lougeniaC64 05793e9376
Exposed credit card API for iOS (#5293) 2023-01-03 15:09:55 -05:00
Mark Hammond 24098bcafd
Update rust version to 1.65.0, MSR to 1.61 (#5299) 2022-12-16 14:02:22 +11:00
Mark Hammond ba67a665dd
Update rusqlite to 0.28.0 (#5282) 2022-12-08 15:01:25 +11:00
Mark Hammond 61952065d1
Remove the not-quite-functional test-utils feature from sync15 (#5275)
When doing #5139 I tried to have a test-utils feature for sync15,
which didn't really work out for various reasons but it was left in.

Currently `cargo test -p sync15 --features=sync-client` fails, although
CI doesn't every run that (it runs with default and all features)

This PR kills that feature entirely.
2022-12-06 10:42:52 +11:00
Mark Hammond 4d858e4266
Add support for lastModified in ClientRemoteTabs (#5230) (#5273) 2022-12-04 19:08:06 +11:00
Mark Hammond eb804faf80
Update sync15 BSO concept to use envelopes and kill sync15::Payload. (#5139)
Reworks how BSOs work in all syncable components.

This adopts some of the BridgedEngine model - specifically, there's now
an IncomingBso and OutgoingBso, each with a corresponding IncomingEnvelope
and OutgoingEnvelope. There's also a new formalized "content" mechanism
for serializing and deserializing payloads to and from some T, with a
sane and consistent procedure for handling tomebstones and malformed
records.

BridgedEngine and SyncEngine now work using these new types, getting us
closer to fully integrating these engines into a single trait.

This kills sync15::Payload entirely in favor of the new system.
2022-12-02 11:31:06 +11:00
Tarik Eshaq e15122cec7
Removes fennec migration code (#5268) 2022-12-01 17:06:17 -05:00
Ben Dean-Kawamura 8f9d0d365c Make places metrics more fine-grained (#5246)
Added `execute_one()` method to `ConnExt`.  I've wanted this a few times
before, but it's really nice for this new code.
2022-11-17 18:28:53 -05:00
Ben Dean-Kawamura 2d87160924 Reworked autofill to use the new error system (#5092)
Added a `AutofillApiError` enum with conversions from `Error` and
started using it in the UDL.
2022-10-27 18:37:45 -04:00
Ben Dean-Kawamura 01aeb370c3 Further reworked the places errors
- Renamed `PlacesInternalError` to `Error` because it seems more
  idiomatic
- Renamed `PlacesError` to `PlacesApiError` to make it consistent with
  the logins errors.  I considered just calling this `ApiError` but I
  thought that would be confusing for consumers since they won't always
  have the `places::` prefix before the class name.
- Removed `JsonError`, which seems like it was unusped
- Merged `InternalError` into `UnexpectedPlacesException`
- Merged `UrlTooLong` into `UrlParseFailed` for `PlacesApiError`
- Merged `InvalidBookmarkUpdate`, `CannotUpdateRoot`, `InvalidParent`
  into `InvalidBookmarkOperation` for `PlacesApiError`

Use the fielded style for `PlacesApiError` in places.udl.  Updated
`PlacesApiError` to use named fields to be compatible with this.

On swift renamed `PlacesApiError`, which was defined on top of the
normal errors to `PlacesConnectionError`.
2022-10-27 18:37:45 -04:00
Ben Dean-Kawamura 1c4093bb3d Refactored places to use the new error handling system
Replaced the error_support method with the new system that consists of:
  - `PlacesInternalError`: used internally in the crate.  This replaces
    the old `ErrorKind` enum and is the error for `Result<>`.
  - `PlacesError`: used for external errors that we return to UniFFI
    consumers.  This replaces the old `Error` enum and is the error for
    `ApiResult<>`
  - A `GetErrorHandling` impl to convert internal errors to external
    errors and report to sentry.  For now, I tried to make the sentry
    error reporting more-or-less match the old error reporting, which
    means reporting lots of internal errors.  The plan is going to be to
    check sentry and most likely turn some of those into logs rather
    than errors.

Reworked all top-level API methods to return `PlacesApiResults` and use
the `handle_error!` macro to do the error conversion/reporting.

Use `thiserror` to handle converting errors from other crates into
`PlacesInternalError`.
2022-10-20 09:05:59 -04:00
Tarik Eshaq 0d420f1895
Fixes missing titles in iOS history migration (#5182)
* Fixes missing titles

* Adds test for title recovery

* Uses a different transaction for running the frecency update

* Fix clippy

* Uses proper transactions
2022-10-17 20:55:56 -07:00
Tarik Eshaq 1094f87f24
Adds ios history migration and example (#5077)
* Adds ios history migration and example

* Exposes history migration function to iOS

* Adds changelog

* Adds basic test case for migration

* Moves timestamp computation to places

* Adds sync last timestamp
2022-09-15 15:15:06 -07:00
Mark Hammond d8503475f4
Merge sync15-traits back into sync15 via features. (#5125) 2022-09-15 11:09:04 +10:00
Mark Hammond e5d8a6d76c
Get sync-test working again. (#5107)
sync-test was removed from the workspace some time ago, which meant it
was never built or checked, so it went quite stale, particularly with
respect to logins changes.

We not keep it in the workspace but as an "excluded" item, which means
you can run it from its directory. To prevent it going stale again, CI
runs clippy on it.

Also needed a few misc tweaks to some other crates.
2022-09-08 20:02:18 +10:00
Mark Hammond 71cb0f6fa4
Add a 'full-sync' feature to tabs. (#5102)
If the new feature is enabled, tabs can sync - otherwise it can not.
The intention is that later there will be a "bridged-sync" feature,
and that in-practice, one or the other will be enabled - however, the
way features work, it must be possible that no features are enabled.

The new feature is not a default feature because I expect we will
want the default features to be what desktop consumes - ie, that
the default feature will be bridged-sync once that exists.

This isn't strictly required yet, but is being done now to make
future reviews of the bridged engine easier to reason about.
2022-09-01 10:52:50 +10:00
Ben Dean-Kawamura 46c31af855 Adding history pruning (#5011)
Added parameter to `run_maintanance()` to allow applications to request a maximum DB size and
prune the database if it's bigger than that.

Added code to find the best visits to prune and delete them.
2022-07-28 17:49:25 -04:00
Mark Hammond faba1ab63e
Update to base64 0.13 (#4985) 2022-06-06 10:57:17 +10:00
Mark Hammond 627426f567
Depend on parking_lot 0.11 or 0.12 so app-services and mozilla-central can use different versions (#4962) 2022-05-20 11:03:16 +10:00
Emilio Cobos Álvarez 5ad5931c2d
Follow-up to #4933: Remove tempdir, use tempfile instead. (#4935)
tempdir is unmaintained and uses an outdated version of rand. We already
depend on tempfile.
2022-05-02 20:15:12 -07:00
Tarik Eshaq f7c5588b1e
Update rand and parking lot (#4937)
* Update rand and parking_lot.

I need this to update other Gecko dependencies.

* Update dependency_summary to account for various windows-rs crates.

I'm not sure why it wasn't failing to find the relevant licenses before,
it was likely a pre-existing issue.

* Update dependency summaries.

* Runs dependency summaries on a mac

Co-authored-by: Emilio Cobos Álvarez <emilio@crisal.io>
2022-05-02 17:18:12 -07:00
Thom Chiovoloni f8f3589be3
Update everything to non-depreceated rusqlite functions 2022-03-06 20:27:49 -08:00
Thom Chiovoloni 4d3f7db7fc
Bump versions of `rusqlite`/`libsqlite3-sys` in `Cargo.toml`s 2022-03-06 20:27:06 -08:00
Ben Dean-Kawamura f504aa09ae Refactoring the interrupt code
- Refactored the `SqlInterruptHandle` and `SqlInterruptScope` types to
  work better with the new code.

  - Types now store an `SqlInterruptHandle` and use that to create
    `SqlInterruptScope` instances. This seems more natural than storing
    an `Arc<AtomicUsize>` and using that to create both the scope and
    handle.
  - Creating an `SqlInterruptScope` can fail if we are in shutdown mode.
    Updated the calling code to handle this error.
  - We now use `Ordering::Relaxed`.  This has less overhead compared to
    `Ordering::SeqCst` and I'm pretty sure we don't need the extra
    synchronization guarantees

- Moved the `Interrupted` and `Interuptee` types to their own modules.
  Updated the shutdown module documentation.

- Changed the `PlacesApi` sync methods to to just send `NeverInterrupts`
  to the `sync_multiple()`.  I think this is fine given that we only use
  these methods on iOS and we don't have actual interruption support
  there yet.

- Removed the `PlacesApi::new_sync_conn_interrupt_handle()` method.  If we want
  to interrupt syncing, then we should just enter shutdown mode.
2022-02-16 10:57:10 -05:00
Tarik Eshaq 68c10e0673
upgrades to rust 2021 [ci full] (#4822)
* upgrades to rust 2021

* Push rust minimum version to 1.57
2022-02-07 09:38:05 -08:00
Sammy Khamis 73427f79a6
Places uniffication (#4770)
* initial conversion of errors for places uniffication

* Converted history metadata functions for places uniffication

* Converted kotlin history metadata functions

* Converted iOS history metadata functions

* [Places uniffication] Fix places error issues (#4687)

* remove uniffi-specific wrapper and updated error test

* Uniffi VisitObservation and apply_observation (#4689)

* uniffied VisitObservation, HistoryVisitInfo and methods using those structs

* Uniffi top frecent site info (#4711)

* Uniffi top frecent site info

* Uniffis FrecencyThresholdOption

* Uniffi Places Sync (#4714)

* uniffi places sync and sync15 functions

* Uniffi Search result and match url (#4720)

* Uniffi query autocomplete

* uniffi places_accept_result

* uniffi places_match_url

* cargo fmt

* cargo clippy

* remove accept_result from ffi crate

* Adds comment on the uniffi bug with varaint shadowing type

* Uniffi Places Interrupt methods (#4726)

* uniffi places interrupt functions

* Consolidate types (#4736)

* Updates the visit observation to use URL

* Uses VisitTransition for HistoryVisitInfo

* updates uniffi to 0.16

* Uniffied bookmarks

* switch to use uint in the apis for adding bookmarks (#4747)

* Remove the manual places FFI entirely.

* folders and separators now have non-nullable parents

* Always insert via Insertable items, and clarify separation between node types.

* Add json_tree module with all json-based types and implementation.

* Fix swift warnings re non-null parentGuid

* bookmarks: Remove public_node and introduce a fetch module

* Update swift code to make breaking changes fixes cleaner (#4766)

* rebased and added changelog entry

Co-authored-by: lougeniac64 <lougeniaC64@users.noreply.github.com>
Co-authored-by: Tarik Eshaq <teshaq@mozilla.com>
Co-authored-by: Mark Hammond <mhammond@skippinet.com.au>
2022-01-20 15:00:00 -05:00
Mark Hammond 2661c5d74c
Move to parking_lot::Mutex in logins, places and sync_manager (#4663) 2021-11-22 11:00:53 +11:00