Commit Graph
2890 Commits
Author SHA1 Message Date
Gil 38d9643a00 Disallow empty document fields (#4229)
Port of firebase/firebase-android-sdk#643.

Also make error messages align with Android's.
2019-11-04 17:03:10 -06:00
Gil 0d64c5bf69 Prevent race conditions in DatastoreTest (#4227)
* Prevent race conditions in DatastoreTest

Previously it was possible for tasks on the async queue to outlive the
instance of the DatastoreTest which could crash or cause TSAN
violations.

This fixes a flake that appeared in the AuthOutlivesDatastore test case.

* Improve readability of the error classification tests
2019-11-04 15:51:51 -06:00
Maksym Malyhin af019d09fc check_whitespaces.sh: ignore notices. (#4231) 2019-11-04 16:21:46 -05:00
wu-hui 2f53582530 Various minor fixes to make SDK compile on Linux (#4185) 2019-11-04 14:39:44 -05:00
Maksym Malyhin 76b47085c9 FIS: Use IID auth token to authorize IID migration. (#4224)
* `FIRInstallationsIIDTokenStore` introduced. `FIRInstallationsIIDCheckinStore` removed.

* FIRInstallationsIIDTokenStoreTests

* Run ./scripts/style.sh

* FIRInstallationsIIDTokenStore implementation.

* ./scripts/style.sh

* Fix tvOS and macOS availability.

* Rename IIDAuthToken -> IIDDefaultToken

* FIRInstallationsIIDTokenStoreTests: fix flaky IID token removal

* ./scripts/style.sh
2019-11-04 11:45:17 -05:00
Gil 3ea7197090 Port FSTQueryCacheTests to C++ (#4160)
* Move FSTQueryCacheTests files to Firestore/core

* Rewrite QueryCache tests in C++

* Fix test flake in local store tests

This doesn't affect production because we always set the additional
references pointer there, but it's technically optional and some tests
don't do this.
2019-11-02 09:09:25 -05:00
Chuan Ren 11a3417d1c Revert "Add OIDC nonce support (#4183)" (#4220)
This reverts commit ffe4a3a5b4.
2019-11-01 13:14:07 -07:00
Morgan Chen b5b836670a Fix formatting breakage (#4214) 2019-10-31 20:47:57 -04:00
Morgan Chen f0bc70433a Add kokoro CI skeleton to firebase-ios-sdk (#4201)
* Add kokoro files

* Fix missing pod install in kokoro

* Add missing gem

* add export LC_CTYPE=en_US.UTF-8

* Add no-op for metrics collection

* Fix missing newline at end of file

* Add kokoro readme

* Add job structure section to README

* Add correct folder structure and better docs
2019-10-31 16:56:06 -07:00
Michael Haney 8c0ab30279 Address issues found by repeated tsan runs (#4202) 2019-10-31 11:25:37 -07:00
ChaoqunCHEN a507b40f17 Add bundle id http header to FIS requests (#4194)
* Add bundle id http header to FIS requests

* Add bundle id http header to FIS requests
2019-10-31 08:50:07 -07:00
Sebastian Schmidt 05b7a8ec6f Update Database CHANGELOG.md (#4197) 2019-10-30 12:37:22 -07:00
Konstantin Varlamov 04177614d0 Fix fuzz build (#4192) 2019-10-30 14:30:52 -04:00
Gil c93b71d57a Update CHANGELOG for Firestore v1.7.0 (#4195) 2019-10-30 08:44:08 -07:00
Chen Liang b310be4f32 update changelog for messaging and instanceID in M59 (#4181) 2019-10-29 18:49:20 -07:00
Chen Liang 8a4b210f6f fix warning (#4186) 2019-10-29 18:49:01 -07:00
Konstantin Varlamov 8ea6b0dbb4 Add a changelog entry on the C++ serializer migration (#4188) 2019-10-29 20:14:35 -04:00
Brian Chen 251a70f26a Make IN queries publicly available (#4174) 2019-10-29 14:13:02 -07:00
Chuan Ren ffe4a3a5b4 Add OIDC nonce support (#4183) 2019-10-29 13:03:37 -07:00
Ryan Wilson 2cac1f520e Only assign errors if parameter is non-NULL. (#4168)
* Only assign errors if parameter is non-NULL.

This fixes #4164.

* Remove unnecessary commenting.

* Remove other unnecessary comment.
2019-10-29 09:17:15 -04:00
Brian Chen 441d7eda8b Change id to NSArray<id> for IN queries (#4182) 2019-10-28 22:22:37 -07:00
Gil fb441a0376 Build all sources with CMake (#4159)
* Fix field initialization order

* Reduce dependencies in objc_compatibility_apple_test

This makes it possible to build and test util without having to build
everything

* Add a lint check for CMake files

* Find XCTest, if available

* Fix CMakeLists.txt to include all sources

* Fix test flake in local store tests

This doesn't affect production because we always set the additional
references pointer there, but it's technically optional and some tests
don't do this.
2019-10-28 13:03:21 -07:00
Chen Liang 67de928005 move database operation off main thread (#4053) 2019-10-28 12:45:47 -07:00
Ryan Wilson 1930f0e222 Change import of XCTestCase to XCTest (#4171) 2019-10-28 14:19:51 -04:00
Ryan Wilson e4ac5b9e89 Fix documentation comments for the Container. (#4178) 2019-10-28 09:56:36 -04:00
Chen Liang 4d10f32641 update keychain access level (#4172) 2019-10-25 15:37:37 -07:00
Maksym Malyhin 48a2a9e0fe Keychain: use kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly instead of deprecated since iOS 13 kSecAttrAccessibleAlwaysThisDeviceOnly. (#4169) 2019-10-25 17:14:02 -04:00
Ryan Wilson 563854e81e Copy component container to GoogleUtilitiesComponents (#4113)
* Move component container to GoogleUtilities.

This will allow non-Firebase SDKs to take advantage of the component
system. Note: Firebase Core will eventually move over to use this, but
more investigation is needed about how this can be done with the least
amount of churn for other SDKs.

* Fix dependency on Logger.

* Add CHANGELOG entry.

* Fix selector name.

* Move ComponentContainer subspec to new pod.

* Rename to GoogleUtilitiesComponents.

* Style, make public headers.

* Update travis with new name.

* Add project to if_changed.sh

* Review comments.

* Enabled static framework, changed homepage.

* Fix missing quote.
2019-10-25 14:05:29 -04:00
Paul Beusterien 42118c9b13 Stop using statics in header (#4149) 2019-10-24 06:36:55 -07:00
Konstantin Varlamov 8b23a3266d Remove Objective-C serializers and make local/ and remote/ (almost) fully C++ (#4151)
There are more sources that can be `.cc` now (e.g., in API); these are left for a follow-up PR.

The dependency on Objective-C proto library cannot be removed just yet due to current lack of pretty-printing support for Nanopb.
2019-10-23 20:56:44 -04:00
Maksym Malyhin a34540f9cb FIS: race condition (#4148)
* FIRInstallationsSingleOperationPromiseCache: a failing test for race condition added.

* ./scripts/style.sh

* FIRInstallationsSingleOperationPromiseCache: synchronize entire code blocks not relying on `atomic` property. The atomic property synchronization was insufficient to synchronize `newOperationHandler()`.

* ./scripts/style.sh
2019-10-23 20:32:23 -04:00
Gil 6fd815a5ed Port FSTRemoteDocumentCacheTests to C++ (#4136) 2019-10-23 12:28:16 -07:00
Maksym Malyhin af6f4e512b FIS: Make sure refreshed auth token is stored to the storage. (#4146)
* FIRInstallationsIDControllerTests: test refreshed token is stored.

* FIRInstallationsIDControllerTests: all required tests updated to expect refreshed token to be stored.

* Tests: assert all FBLWaitForPromisesWithTimeout

* FIRInstallationsIDController: saving refreshed token implemented.

* FIRInstallationsIDController: duplicated code removed.
2019-10-23 14:22:28 -04:00
Gil 341312b15d style.sh generated changes (#4140)
* style.sh generated changes

* Fix style.sh detection of swift formatting issues
2019-10-23 10:58:50 -07:00
Morgan Chen 532162d55d Update changelogs for M58 (#4135)
* Update changelogs for M58

* Remove link from Firestore changelog
2019-10-23 09:49:18 -07:00
Konstantin Varlamov 2c53bb9139 C++ migration: use C++ serializer for communicating with the local store (#4116)
After this PR is merged, the Objective-C serializers can be completely removed from the project. Also, this PR changes the `Message` class quite a bit; it's probably in its final form now.

I did some performance testing locally and came to the conclusion that replacing Objective-C serializers with their C++ versions brings no performance downgrade; actually, there seems to be a very slight improvement. I tested writing large batches and reading large collections:
* both are network-dominated; wall time is about twice longer than CPU time;
* serialization represents a pretty small percentage of the total CPU time;
* for writing, C++ serialization is a little more efficient, taking ~6% of total CPU time, compared to ~8% in the Objective-C version. I've seen similar results for reading.

All integration tests pass, under Address Sanitizer as well.
2019-10-22 21:52:55 -04:00
Paul Beusterien 47afee7e8d Update README for Firebase pod for mac/tv (#4139) 2019-10-22 14:49:51 -07:00
Paul Beusterien a621e59217 Merge 6.11.0 (#4134) 2019-10-22 11:35:29 -07:00
Gil 3f1fbe7e9a Migrate FSTPersistenceTestHelpers to C++ (#4122)
* Move FSTPersistenceHelpers to core/test/.../local

* Rewrite persistence_testing in C++

* Migrate from FSTPersistenceTestHelpers to C++ persistence_testing

* Rename .mm to .cc where possible in IndexManager tests

* Remove Objective-C gunk from index_manager_test.h
2019-10-21 20:12:46 -07:00
wu-hui 2bcfcc2cfb remove NSException from firestore client (#4131) 2019-10-21 22:30:25 -04:00
Konstantin Varlamov e241a9a9b8 Optimize DocumentKey comparisons (#4123)
This came up while I was investigating the effect of new C++ serializers on performance. When writing large batches, one of the hottest functions turned out to be `firebase::firestore::util::operator==(const DocumentKey& lhs, const DocumentKey& rhs)`, accounting for 15-20% of total CPU time. There are two reasons why comparing keys is currently not very efficient:
* `BasePath::CompareTo`, to which this comparison eventually resolves, mistakenly uses the general-purpose `util::Compare` function rather than the more efficient `util::CompareContainer`;
* the default implementation of `Comparable::operator==` results in two comparisons per element ("less-than" followed by "greater-than"), even though one would be sufficient.

Fixing these issues results in 8-10% CPU time improvement when writing large batches.

To work around the latter, this PR defines a new mixin `InequalityComparable` that is exactly the same as `Comparable`, except it doesn't define `operator==`, forcing the inheriting class to implement it manually.

Some measurements (all done on the emulator in release mode with no logging) follow; the test case was to write 10 batches of 500 very small documents. Note that I found wall clock to fluctuate too much to be reliable and instead use the measurements from XCode's Time Profiler, which (presumably) shows CPU time. Each measurement shows total CPU time spent on `firebase::firestore::util::operator==` (all instantiations, not just for `DocumentKey`), followed by the percentage of time spent in this function compared to total runtime:
* no optimization:
    * 275ms/18.8%;
    * 245ms/16.9%;
    * 252ms/18.5%.
* `CompareContainer` optimization:
    * 124ms/9.7%;
    * 110ms/8.5%;
    * 128ms/10.0%.
* `CompareContainer` + `ComparableWithEqual` optimizations:
    * 95ms/7.3%;
    * 100ms/8.0%;
    * 112ms/9.2%.
2019-10-21 16:43:45 -04:00
Paul Beusterien 2a45cf6598 Update Travis to Xcode 11.2 (#4129) 2019-10-21 10:41:52 -07:00
Paul Beusterien c5271e36a9 Switch to Xcode 10.2 since travis 10.1 config is broken (#4128) 2019-10-21 09:00:43 -07:00
Maksym Malyhin 63f7784962 Travis: install particular version of clang-format and swiftformat. (#4127) 2019-10-21 10:46:54 -04:00
Maksym Malyhin 65ec051abd FIS: Complex unrecoverable error handling reverted and replaced by a simple log message. (#4120)
* Revert "FIS: stored registration error timeout (#4032)"

This reverts commit 37747dbb3d.

* Revert "FirebaseInstallations: CreateInstallation API request error handling (#4024)"

This reverts commit 27384c0a2c.

* Complex unrecoverable error handling reverted and replaced by a simple log message.
2019-10-21 09:37:57 -04:00
Konstantin Varlamov 0f2a0bfeef Use C++ serializer for communicating with the backend (#4013)
Replace all uses of `FSTSerializerBeta` in `remote_objc_bridge.{h,mm}` with the C++ `Serializer`. Also, make most of `remote/` sources pure C++ and remove no-longer-used methods in `FSTSerializerBeta`. All integration tests pass, under Address Sanitizer as well.

Unfortunately, pretty-printing is still delegated to Objective-C, so that `remote_objc_bridge.mm` still has to be an Objective-C++ source (and which prevents inlining `remote_objc_bridge` into the streams).

#no-changelog Will add a changelog entry when local serializer is ported, too.
2019-10-18 17:58:14 -04:00
Paul Beusterien 5a7e177666 Add travis_retry to mitigate impact of GDTCCT flakes (#4119) 2019-10-18 14:32:31 -07:00
Maksym Malyhin 8c1168d188 FirebaseInstallation: send IID checkin data on IID migration. (#4114)
* FIRInstallationsIIDCheckinStore with tests introduced.

* FIRInstallationsIIDCheckinStore implementation and tests.

* Store IID checkin data.

* FIRInstallationsIDControllerTests: IID checkin migration tests.

* FIRInstallationsIDController: IID checkin migration logic.

* style.sh

* FIRInstallationsAPIServiceTests: IID migration header test.

* FIRInstallationsAPIService: send IID checkin data in CreateInstallation API request.

* FIRInstallationsIIDCheckinStoreTests: fix FIRInstanceIDCheckinStore subDirectoryName.

* FIRInstallationsIIDCheckinStoreTests: fix missing sub directory.

* Disable FIRInstallationsIntegrationTests for macOS.

* FIRInstallationsIntegrationTests: properly disable all tests on macOS.

* Fix.
2019-10-18 16:21:38 -04:00
Gil cd460eca2d Rationalize input validation exceptions and assertion failures (#4107)
* Rationalize input validation exceptions and assertions

... under a single ThrowHandler concept. This makes it possible to set
an alternative ThrowHandler in our C# bindings that properly translates
input validation exceptions to the correct .NET exception types.

* Rename api/input_validation.h to util/exception.h

* Reimplement util/hard_assert.h in terms of util/exception.h
2019-10-18 12:58:45 -07:00
Gil 7e78166064 Use base_configuration_reference.real_path rather than path (#4118)
real_path has the correct value after a pod deintegrate, while path has
some nearly correct value. No idea why these are different.
2019-10-18 12:56:46 -07:00