Commit Graph

544 Commits

Author SHA1 Message Date
Ari Lazier ac544205a1 test setting all primitive types to null/undefined throw 2015-10-21 23:06:39 -07:00
Ari Lazier ce682c3f70 Merge pull request #88 from realm/al-project
Make ReactTests runnable from RealmJS project
2015-10-21 23:05:04 -07:00
Ari Lazier a94e14cb70 update cordova to latest version/fixex 2015-10-21 20:52:18 -07:00
Ari Lazier 08a84bd8e9 cleanup scheme and target names 2015-10-21 19:20:45 -07:00
Ari Lazier 5d78670802 make ReactTests a subproject of RealmJS 2015-10-21 19:17:22 -07:00
Ari Lazier 290a595259 update to latest core 2015-10-21 19:12:36 -07:00
Scott Kyle 9cbc695fd7 Skip throwing an exception inside ResultsSetProperty 2015-10-21 15:59:11 -07:00
Scott Kyle bd2d1559d1 Error when assigning to Result index or length
Added some tests. Turns out our Chrome layer already did this too, so no changes were needed there.

Resolves #70
2015-10-21 15:25:53 -07:00
Scott Kyle d50e3ae68c Add Object.keys test for Results 2015-10-21 15:21:17 -07:00
Scott Kyle d55d42da8d Add ESLint config for JS test files
This helps the editor catch simple syntax issues before finding out about them when running a test.
2015-10-21 15:20:44 -07:00
Scott Kyle 8ba3a24eae Move RealmJSCoreTests.m to tests directory
Test failures were not pointing to the correct JS file path when it was in the src directory. This is where it belongs anyways.
2015-10-21 15:18:47 -07:00
Scott Kyle 36382ecb56 Add instanceof test for Results 2015-10-21 15:17:55 -07:00
Mark Rowe 347145b4f1 Merge pull request #8 from realm/mar-migrate-required-to-optional
Support migrating required columns to optional, preserving their contents
2015-10-21 14:40:44 -07:00
Scott Kyle 2e592bc101 Sprinkle some const inside ES6 JS code
React Native 0.13.0 fixes the bug we experienced by using const.
2015-10-21 13:57:34 -07:00
Scott Kyle 13617400d4 Remove libc++.tbd references from ReactExample 2015-10-21 13:57:34 -07:00
Scott Kyle 725e9855fe Update RPC JS to use originalXMLHttpRequest
React Native now leaves the original object accessible when it "polyfills" objects. So we check for that, but still have the previous logic in place in case they change their minds.
2015-10-21 13:57:34 -07:00
Scott Kyle 2f9c6a0727 Update ReactExample to React Native 0.13.0-rc 2015-10-21 13:57:34 -07:00
Scott Kyle 7acd4d89c1 Update ReactTests project to React Native 0.13.0-rc 2015-10-21 13:57:34 -07:00
Scott Kyle 0055d0510c Make List objects work with Object.keys in Chrome
Rather than using Object.preventExtensions to throw exceptions when setting any out-of-bounds index, we must instead compromise by only throwing for the common cases, which are -1 and list.length. Having Object.keys() support is essential for List to work with React Native ListViewDataSource.

Resolves #80
2015-10-21 13:11:41 -07:00
Mark Rowe 0b45772a0b Add a test showing our behavior when migrating from an optional column to a required column.
Optional values are not automatically migrated to required columns since it is a lossy process.

This test case revealed an issue where the number of objects can be lost if all properties of an
object were optional and are all being migrated to required. This happens because the migration
process removes the optional columns in a first pass, and recreates them as required in a second
pass. Since this results in all columns being removed, we lose track of how many objects were
stored. We avoid this by detecting the case where we are about to remove the last column and
inserting a placeholder column that we'll remove after inserting the new columns.
2015-10-20 17:52:25 -07:00
Mark Rowe 9f1702a10f Support migrating required columns to optional, preserving their contents.
Required columns are migrated to optional by creating a new nullable column,
copying the data from the required column to the optional column, then removing
the original required column.
2015-10-20 17:52:25 -07:00
Scott Kyle a8c1728502 Merge pull request #75 from realm/sk-session-id
Fix crash when reloading app during Chrome debugging
2015-10-20 16:53:29 -07:00
Ari Lazier f297a75057 Update README.md 2015-10-20 15:41:22 -07:00
Scott Kyle 34b84759c8 Fix crash when reloading app during Chrome debugging
Added a session ID, that actually tracks the Realm constructor in our RPC server's JS context. This conveniently let us remove the special casing for defaultPath as well as letting us call the Realm constructor with JSObjectCallAsConstructor.

Fixes #68
2015-10-20 15:10:52 -07:00
Thomas Goyne f5b790cf87 Merge pull request #6 from realm/tg-impl
Move things which are not part of the API to an impl directory/namespace
2015-10-20 09:59:10 -07:00
Scott Kyle b98e89db22 Merge pull request #63 from realm/sk-chrome-apis
Finish implementing APIs for Chrome
2015-10-20 01:23:40 -07:00
Scott Kyle 01dc3a85d9 Add comment about usage of preventExtensions 2015-10-20 00:52:38 -07:00
Scott Kyle f2c4e7882a Make RPC lists non-extensible
Assigning to non-existent index will throw an exception and all tests pass in Chrome!
2015-10-19 17:43:51 -07:00
Scott Kyle 85e2a26b42 Make RPC Results objects auto-resize 2015-10-19 17:28:20 -07:00
Scott Kyle 3439b4c455 Add getter/setter for defaultPath to RPC 2015-10-19 16:59:04 -07:00
Scott Kyle 03751c35b4 Handle passing dates through RPC 2015-10-19 16:46:56 -07:00
Scott Kyle b07aa72a55 Move all constants into a single JS file 2015-10-19 16:19:43 -07:00
Scott Kyle 57778ce878 Improve calling object methods through RPC 2015-10-19 16:15:38 -07:00
Scott Kyle d172b43535 Add path and schemaVersion getters to realm object 2015-10-19 15:46:28 -07:00
Scott Kyle 1b7653206a Generalize getting/setting properties through RPC 2015-10-19 15:46:00 -07:00
Ari Lazier 3b5c78d29f Merge pull request #66 from realm/al-per-realm
Store schema/defaults per Realm, Cleanup per Realm state and threads
2015-10-19 15:29:04 -07:00
Ari Lazier 5aa066e6fa newline 2015-10-19 14:56:59 -07:00
Ari Lazier 1fa7c018ea clean up per realm resources/threads 2015-10-19 14:25:35 -07:00
Ari Lazier 8fed61cb8a clean up per realm resources/threads 2015-10-19 14:25:35 -07:00
Ari Lazier dace77579b store schema and prototypes on the realm object 2015-10-19 13:39:21 -07:00
Ari Lazier 167c3e97b5 store schema and prototypes on the realm object 2015-10-19 13:39:21 -07:00
Scott Kyle 4c0cc578d5 Generalize calling methods through the RPC 2015-10-19 12:46:31 -07:00
Scott Kyle d482ea82e7 Error messages deserve good grammar 2015-10-19 12:18:16 -07:00
Scott Kyle 5f52d07154 Add support for Results methods in Chrome
Which only consists of sortByProperty
2015-10-19 12:18:09 -07:00
Scott Kyle 78ec67cd6c Hacky support for adding notifications in Chrome
Since notifications are called synchronously after a write, we fake it by calling them manually for now. The future plan will be more involved, so some of that is stubbed out.
2015-10-19 12:09:14 -07:00
Scott Kyle b985e1f0a6 Add realm.close() method to JS shim
That was easy!
2015-10-19 12:07:50 -07:00
Scott Kyle 44eea1e036 Minor syntax improvements to JS shim 2015-10-19 12:07:50 -07:00
Ari Lazier 8ee6e757ee Merge pull request #62 from realm/sk-test-suite
Run tests from ReactNative
2015-10-19 11:34:59 -07:00
Ari Lazier cfd618db32 flag to create jscontext 2015-10-19 11:28:50 -07:00
Ari Lazier f02fb05af4 add search paths for test path 2015-10-19 10:52:34 -07:00