Commit Graph

68 Commits

Author SHA1 Message Date
Dan Zimmerman 55f75dfd65 Remove the experimental concept of whitelisted modules
Reviewed By: dcaspi

Differential Revision: D6124036

fbshipit-source-id: af3771ce2204b3695f79265d5aade7e321e12a3e
2017-10-25 08:20:48 -07:00
Dan Zimmerman fe792f5878 Remove experimental shouldBridgeLoadJavaScriptSynchronously:
Differential Revision: D6124037

fbshipit-source-id: a116def1032e1f4656fafbc7f2e36e812b13c9c0
2017-10-25 08:20:48 -07:00
Dan Zimmerman ca85a536c6 Remove experimental shouldBridgeInitializeNativeModulesSynchronously:
Differential Revision: D6124035

fbshipit-source-id: 540b8bfc955bf48e9ca33ed97807177ac740059e
2017-10-25 08:20:48 -07:00
Tsolis Dimitris Sotiris 1d674f0309 Fix crash when loading local bundle and hot reload is enabled
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

When initializing react native module using a url pointing to local jsbundle and hot reload is enabled, bridge, is trying to initialize the feature but crashes because there is no host in a local file url.

1. Create a new project.

```sh
$ react-native init testPlanApp && cd testPlanApp
```

2. Create jsbundle.

```sh
$ react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ios/main.jsbundle
```

3. Run the app and enable hot reload.
4. Enable airplane mode.
5. Close application and re-run.
6. See app crashes.

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAl  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->

[IOS] [BUGFIX] [Hot reloading] - Fix crash when loading local bundle and hot reload is enabled.
Closes https://github.com/facebook/react-native/pull/16504

Differential Revision: D6133767

Pulled By: shergin

fbshipit-source-id: 3f7668e3e8fa7e772f58420e5a8a0985a5f8e48b
2017-10-24 00:06:31 -07:00
Alex Dvornikov dd400f842b add "jsBundlesDirectory" method to RCTBridgeDelegate
Differential Revision: D6030185

fbshipit-source-id: 58d6f9d0d412c7ad0f83af9ae4df01c4dc1178bc
2017-10-12 12:33:21 -07:00
Alex Dvornikov 9e01d72103 Unify supplimentary bundle path creation logic between Android and iOS
Differential Revision: D5941546

fbshipit-source-id: c9b8fab887f480faa373c26a1d5ba310e8acde78
2017-10-04 15:16:27 -07:00
Paco Estevez Garcia ef2e29f54c Move URL escaping to Inspector layer
Reviewed By: Hypuk

Differential Revision: D5967544

fbshipit-source-id: d741e6324aff7583778cb13c862505b61ca02a3d
2017-10-04 03:51:33 -07:00
Paco Estevez Garcia da14fad829 Add AppIdentity and DeviceIdentity to Inspector
Reviewed By: Hypuk

Differential Revision: D5924011

fbshipit-source-id: a81d420dbe1a5ede203d2fa313548e19664b9587
2017-10-03 06:03:23 -07:00
Alex Dvornikov 7d2021ec49 Added iOS support for loading multiple RAM bundles
Differential Revision: D5890466

fbshipit-source-id: e7805f90a7c446f5f75427c3fadcd133a3f7ad18
2017-09-22 09:58:47 -07:00
Alex Dvornikov 7d115730dc Configure JSExector with BundleRegistry instead of JSModulesUnbundle
Differential Revision: D5890458

fbshipit-source-id: 968be95786ffbf53aa98928d4d3e3bd52a84b3dc
2017-09-22 09:58:46 -07:00
Jia Li 0aa12939fd Revert D5850968: Configure JSExector with BundleRegistry instead of JSModulesUnbundle.
Differential Revision: D5850968

fbshipit-source-id: f4c9dc8d5f14cdd32195463e8786242e708770e9
2017-09-21 21:22:39 -07:00
Jia Li 526fd6b931 Revert D5850970: Added iOS support for loading multiple RAM bundles
Differential Revision: D5850970

fbshipit-source-id: 8b0f9bc296ac2944b8b7657a4119b6787d810a2c
2017-09-21 21:22:39 -07:00
Alex Dvornikov 1aeb767a37 Added iOS support for loading multiple RAM bundles
Differential Revision: D5850970

fbshipit-source-id: 88ab6fe3822f1bc4195007f8ec83177a84c27569
2017-09-21 08:51:00 -07:00
Alex Dvornikov 79821917fa Configure JSExector with BundleRegistry instead of JSModulesUnbundle.
Differential Revision: D5850968

fbshipit-source-id: e5e7ad92c2347c2641551fcf820f061ffde5fed6
2017-09-21 08:51:00 -07:00
Alex Dvornikov 6e281798e8 Refactored executeApplicationScript in RCTCxxBridge
Reviewed By: dcaspi

Differential Revision: D5850957

fbshipit-source-id: d2cacfd99fd7ffca70b0dcf0bf252ea160268c05
2017-09-18 06:45:38 -07:00
Chris Zheng 17126641b1 Removing fallback source URL from JS bridge
Summary:
Remove fallback logic.
It is hard to test whether a bundle is good or bad on device, since it does the fallback, remove the fallback logic now.

Reviewed By: javache

Differential Revision: D5773542

fbshipit-source-id: 8bb4fdad4c5761ccce915f9f1c2577464e8d37d8
2017-09-12 15:54:59 -07:00
Pieter De Baets 7b770556ac Improve RCTCxxBridge invalidation
Reviewed By: fromcelticpark

Differential Revision: D5536063

fbshipit-source-id: b0f19bebea839c7da84890c338ad4d38293bc99c
2017-09-11 04:30:31 -07:00
Marc Horowitz d48f08cad6 Thread the JSI runtime descriptor up into the RCTDevMenu title
Reviewed By: javache

Differential Revision: D5643014

fbshipit-source-id: 977be5729c57c0d01ff67b268031ad6fdbf88a07
2017-09-05 15:02:19 -07:00
Ben Nham 259161f872 add files changed count to reload metrics
Reviewed By: alexeylang

Differential Revision: D5694813

fbshipit-source-id: 2e2517e60a7547e261a7c15a3a9138dbb3cb9783
2017-08-31 05:34:48 -07:00
Mehdi Mulani 1f9fc0ee3a Stop CxxBridge run loop when bridge is invalidated
Summary:
This fixes the `testModulesAreDeallocated` test. It was sometimes failing because the bridge's module was still alive. I debugged with the Xcode memory graph and found that the bridge was actually kept alive by a pointer from the NSThread.
By killing the runloop on the thread, the thread will eventually die and thus free the bridge.

One thing I didn't investigate was whether the thread was alive because of it receiving actual messages or just because the run loop was spinning.

Reviewed By: javache

Differential Revision: D5729925

fbshipit-source-id: 304f526129d2c5e137bfd791a6f957f6169b783e
2017-08-30 09:46:31 -07:00
Ben Nham abe7a2a9f1 encapsulate JS source in RCTSource object
Reviewed By: alexeylang

Differential Revision: D5669734

fbshipit-source-id: 60c798afa2115510a17acf9e970e8ba52507724f
2017-08-30 06:29:42 -07:00
Ben Nham 1ce7e4c1e5 add notifications for dev reload
Reviewed By: alexeylang

Differential Revision: D5630472

fbshipit-source-id: 1c44a52fddead361b43551384bbfc73e2d89438f
2017-08-17 17:16:19 -07:00
Rafael Oleza 6ad7e8281b Do not send 'hot' parameter when requesting a bundle from iOS
Reviewed By: fromcelticpark

Differential Revision: D5631050

fbshipit-source-id: 1f587f3af68da4d94b5d24afabf7659abb697747
2017-08-16 11:10:32 -07:00
Dmitry Zakharov cf38b083dd Implement lazy discovery scaffolding for loading NativeModules on demand.
Reviewed By: javache

Differential Revision: D5364734

fbshipit-source-id: 5162f7d41434a3ba38c82fa610e84f865bfacf50
2017-08-11 06:41:33 -07:00
Pieter De Baets 1cd276ab5c Specialize JSCValueEncoder for id instead of NSArray
Reviewed By: kathryngray

Differential Revision: D5355723

fbshipit-source-id: a992514c92143fcac52f8e35824c665a1cb44ea4
2017-08-07 06:45:34 -07:00
Adlai Holler 7c528cd569 RCTCxxBridge: Use C++ atomic
Summary:
The next in my series of :atom: migrations.
Closes https://github.com/facebook/react-native/pull/15277

Differential Revision: D5526460

Pulled By: javache

fbshipit-source-id: e4ba54a5911c4a76280edf8aa164ac5aa935a945
2017-07-31 03:35:18 -07:00
Marc Horowitz 2334899dfe in RCT_DEBUG mode, make the js stack bigger
Reviewed By: javache

Differential Revision: D5459755

fbshipit-source-id: 169cb542c92ea6d5e438c4bbe35879e7a097a3aa
2017-07-20 12:16:21 -07:00
Marc Horowitz 05c4de0b51 Add a delegate hook for providing a different JS implementation
Reviewed By: javache

Differential Revision: D5404876

fbshipit-source-id: d86ca9943b4b45616fc90bf14e8b0607d3cdb93c
2017-07-19 13:49:32 -07:00
Pieter De Baets 980d5140d6 Merge allowOffMainQueueRegistration and requiresMainQueueSetup
Reviewed By: fromcelticpark

Differential Revision: D5398021

fbshipit-source-id: 7e721cce579678f4c82582f5068cf46574afe961
2017-07-17 03:45:30 -07:00
Paco Estevez Garcia a1e053cc50 Add Framework name to Attach selection
Reviewed By: Hypuk, javache

Differential Revision: D5389047

fbshipit-source-id: 90e2a5f805561e47e7705e7935ced7556a374616
2017-07-14 07:50:40 -07:00
Pieter De Baets f1cbb11620 Replace -[RCTConvert folly_dynamic:] with direct calls to convertIdToFollyDynamic
Reviewed By: kathryngray

Differential Revision: D5355734

fbshipit-source-id: 4ba1533b75c8e271a86a2d5cc3a3354e52f83db2
2017-07-10 05:31:04 -07:00
Pieter De Baets d795fa1b2c Update native references to JSTimers
Reviewed By: AaaChiuuu

Differential Revision: D5294997

fbshipit-source-id: 3003d56f744af0c35b1ffef7bdd71617d4f948c3
2017-06-22 09:52:33 -07:00
Pieter De Baets c5004d5dd0 Make startup errors in the websocket executor invalidate the bridge
Reviewed By: mhorowitz

Differential Revision: D5226936

fbshipit-source-id: b6d605974674d0e6f86559f2583553e3636d389b
2017-06-22 08:37:13 -07:00
Viacheslav Radchenko 879edf0d05 Added RCTInspectorDevServerHelper call in FBReactJSExecutor. Added UTF8StringForSourceURL
Reviewed By: javache

Differential Revision: D5246399

fbshipit-source-id: 179ff0b69886c4ff71911fc7b1d3491ff4d5967d
2017-06-14 14:10:10 -07:00
Pieter De Baets 9250250364 Call Systrace.setEnabled from CxxBridge
Reviewed By: alexeylang

Differential Revision: D5247016

fbshipit-source-id: 7e31e38d7adae8d432a11199a1de572d082169e3
2017-06-14 11:16:05 -07:00
Ben Nham 2984628357 add marker surrounding entire native module creation
Reviewed By: javache

Differential Revision: D5200856

fbshipit-source-id: 35b0e627224d518126a1cfdd36d6af264dd186cf
2017-06-09 06:22:39 -07:00
Pieter De Baets 33e22486e9 Fix some issues with the React podspec for the Cxx bridge
Summary:
Trying to fix the RN Travis CI tests

Splitting off from https://github.com/facebook/react-native/pull/14100
Closes https://github.com/facebook/react-native/pull/14132

Reviewed By: ericvicenti

Differential Revision: D5112077

Pulled By: javache

fbshipit-source-id: cf030b927b0f28f2b494471498f1ddb2c0a5c1df
2017-05-30 11:15:19 -07:00
Kathy Gray f46eaa30cf Provide sync vs async interface for bundle loading via parameter
Reviewed By: javache

Differential Revision: D5104317

fbshipit-source-id: ffacb57d85c24795a3acc2faba2ff5824cc739b2
2017-05-24 07:31:36 -07:00
Pieter De Baets 0357303f5b Schedule initializeBridge on the JS thread
Reviewed By: shergin

Differential Revision: D5044230

fbshipit-source-id: 87030e210af662bc12cfb57bc83e73a128303fb0
2017-05-17 09:02:43 -07:00
Pieter De Baets 8525aac769 Ensure enqueueJSCall's completion block is always dispatched after the actual JS call
Reviewed By: mhorowitz

Differential Revision: D4985694

fbshipit-source-id: 50ab14e7088a53e03d5ee70c8ea1e245f531dac1
2017-05-16 09:46:54 -07:00
Pieter De Baets 6221053179 Improve systrace markers
Reviewed By: mhorowitz

Differential Revision: D4860135

fbshipit-source-id: ce963010883e6b9cc8e34f7ff01b4018cd195eba
2017-05-12 18:07:49 -07:00
Ben Nham 65f22a5190 log script name with bundle loading perf event
Reviewed By: javache

Differential Revision: D5010638

fbshipit-source-id: 2e139201a8374245fa1dedc4f11a716dcf700fd7
2017-05-10 04:09:19 -07:00
Pieter De Baets 34bc6bd2ae Drop support for webworkers
Reviewed By: AaaChiuuu

Differential Revision: D4916449

fbshipit-source-id: a447233d3b7cfee98db2ce00f1c0505d513e2429
2017-04-25 05:37:54 -07:00
Alexey Lang 1bc9d448f5 Port perf metrics used in RCTBatchedBridge
Reviewed By: javache

Differential Revision: D4938279

fbshipit-source-id: c927261ff96c2eb07b7303ae96aae7600f2947f1
2017-04-25 02:32:25 -07:00
Kevin Cooper e443b7379e More verbose error messages for iOS
Summary:
Output the reason for the error when failing to load source code. This was a big help when trying to diagnose https://github.com/facebook/react-native/issues/13299.

~~Unfortunately there still seems to be no way to get the offending line number (because `loadError.userInfo[RCTJSStackTraceKey]` is empty), but this is good enough.~~

Before:

```
[warn][tid:com.facebook.react.JavaScript][RCTBatchedBridge.m:510] Failed to execute source code. Unhandled JS Exception: SyntaxError
```

After:

```
[warn][tid:com.facebook.react.JavaScript][RCTJSCErrorHandling.mm:30] Couldn't get stack trace for http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:81886
[warn][tid:com.facebook.react.JavaScript][RCTBatchedBridge.m:510] Failed to execute source code. Unhandled JS Exception: SyntaxError Unexpected keyword 'var'
```
Closes https://github.com/facebook/react-native/pull/13561

Differential Revision: D4908501

Pulled By: javache

fbshipit-source-id: a316dc70739b917b3cc690309d0ff37a8bb5d412
2017-04-18 14:19:13 -07:00
Pieter De Baets 5767b98f4d Add JSC utility header to RCTBridge
Reviewed By: shergin

Differential Revision: D4823509

fbshipit-source-id: 79c96d3bc183d89a5dec7da06b0a0a710d8c7dea
2017-04-07 11:16:59 -07:00
Pieter De Baets 76b93e1253 Add block-based initializer for RCTModuleData
Reviewed By: shergin

Differential Revision: D4821772

fbshipit-source-id: 2cd35ec6726b6fe1494a92966ade5aa0b86e769b
2017-04-07 11:16:59 -07:00
Pieter De Baets b2647ea335 Allow ModuleRegistry initialization to complete lazily
Reviewed By: mhorowitz

Differential Revision: D4794794

fbshipit-source-id: f3b7a5d02587b4cd4e214aa6b0368a0d214fb63f
2017-04-07 09:30:33 -07:00
Pieter De Baets e12e57eb77 Move bindKeys to RCTBridge setUp
Reviewed By: shergin

Differential Revision: D4794788

fbshipit-source-id: 0839829f4ed010bf2fb2574092a8f68f4c95341a
2017-03-31 05:31:26 -07:00
Pieter De Baets 5af30382d5 Improve fbsystrace support
Reviewed By: mhorowitz

Differential Revision: D4756318

fbshipit-source-id: 7811f680a7ad044b5ae028ee9b2fed5f46ce2a63
2017-03-30 06:53:16 -07:00