Commit Graph

15 Commits

Author SHA1 Message Date
Justin Reynolds 3ae45d5cb8 Fix Content-Type header checking of React/RCTJavascriptLoader.mm #15791
Summary:
To fix this issue: https://github.com/facebook/react-native/issues/15791
Closes https://github.com/facebook/react-native/pull/15792

Differential Revision: D5813101

Pulled By: shergin

fbshipit-source-id: fd3eb6f1d9ccdeb5373d1ba2b2df173ff7a8e986
2017-09-19 19:50:07 -07:00
Paco Estevez Garcia 6b733a4fe7 Force local builds to use regular JS bundles
Reviewed By: dcaspi

Differential Revision: D5824552

fbshipit-source-id: a435fc0ad5b43a8bd3c6a873a4147c4d92190f4e
2017-09-18 08:00:33 -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
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
Janic Duplessis ef23d2bdcf Show bundle download progress on iOS
Summary:
This shows progress for the download of the JS bundle (different from the packager transform progress that we show already). This is useful especially when loading the JS bundle from a remote source or when developing on device (on simulator + localhost it pretty much just downloads instantly). This will be nice for the expo client since all bundles are loaded over the network and can take several seconds to load.

This depends on https://github.com/facebook/metro-bundler/pull/28 to work but won't crash or anything without it, it just won't show the progress percentage.

![img_05070155d2cc-1](https://user-images.githubusercontent.com/2677334/28293828-2c08d974-6b24-11e7-9334-e106ef3326d9.jpeg)

**Test plan**
Tested that bundle download progress is shown properly in RNTester on both localhost + simulator and on real device with network conditionner to simulate a slow loading bundle.

Tested that it doesn't cause issues if the packager doesn't send the Content-Length header.
Closes https://github.com/facebook/react-native/pull/15066

Differential Revision: D5449073

Pulled By: shergin

fbshipit-source-id: 43a8fb559393bbdc04f77916500e21898695bac5
2017-08-14 11:05:35 -07:00
Kevin Gozali 3149348358 ios: allow application/javascript and text/javascript for packager bundle mime type
Summary: When loading bundle from packager, "application/javascript" and "text/javascript" both refer to JS, so let's allow both for now.

Reviewed By: javache

Differential Revision: D5499446

fbshipit-source-id: f0b42e2fe5dc043a68d2c8df6a9f81e6dd995b57
2017-07-26 11:48:47 -07:00
Janic Duplessis 3ce36698de Validate the content type of the bundle returned by the packager
Summary:
When using the packager behind something like an http tunnel it is possible something else than JS is returned, in that case throw an error instead of trying to parse it.

This is useful for Expo since the packager runs behind ngrok. This allows to intercept that error and show a more meaningful error message based on the ngrok response.

**Test plan**
Tested by changing the packager to return text/html content type and validate that the error shows up properly.
Also tested that it works when multipart response is disabled.

<img width="354" alt="screen shot 2017-07-19 at 8 01 58 pm" src="https://user-images.githubusercontent.com/2677334/28394905-39e86d52-6cbe-11e7-9059-13a85816a57e.png">
Closes https://github.com/facebook/react-native/pull/15112

Differential Revision: D5459395

Pulled By: shergin

fbshipit-source-id: aaea7ab2e1311ee8dc10feb579adf9b9701d8d4c
2017-07-19 19:10:00 -07:00
Pieter De Baets c25f356675 Avoid crash when accessing jsContextRef without an executor
Reviewed By: adamjernst

Differential Revision: D5237039

fbshipit-source-id: 6a86da90605b896093e0ef99b0fcf079bf9854bf
2017-06-14 05:32:27 -07:00
Stephen Bird f1284b8231 Add message to remind user to enable wifi
Summary:
Our iOS devs frequently turn off wifi and forget to turn it back on. This message should remind them that they need wifi to connect. Often they waste several minutes due to this problem.

I'm not sure if there's a test plan to apply here. Any suggestions?
Closes https://github.com/facebook/react-native/pull/13551

Differential Revision: D5149231

Pulled By: hramos

fbshipit-source-id: 0afc71024f10f802ac1a50435fb57fc10a02c819
2017-05-30 20:49:48 -07:00
Ashok Menon 1635c02e92 Simplifying Struct definition.
Summary:
Since we are reading from a file, we should make sure this struct is packed, just in case we change it down the line and the compiler decides it might want to introduce padding, we're now protected against that.

There was also a discussion about the fact that people might use `ptr += sizeof(BundleHeader)` as an idiom in their code, which would currently be incorrect, if padding was introduced at the end of the file. Actually, it remains incorrect to do that now, because a RAM bundle header is a different size to a BC Bundle header. If people are properly testing their code, they should spot this pretty quickly, because it will always be an incorrect thing to do with a RAM bundle, so this isn't as bad as previously thought: where the code only succeeds when the compiler deigns to not pad the struct at the end.

This diff also cleans up how headers are initialised. `BundleHeader` has a constructor that explicitly zero-initialises it so we can rely on the default initializer to do the right thing now.

Reviewed By: mhorowitz

Differential Revision: D4572032

fbshipit-source-id: 7dc50cfa9438dfdfb9f842dc39d8f15334813c63
2017-02-20 04:30:19 -08:00
Pieter De Baets a2000d1200 Replace valueForKey with subscript access in RCTJavascriptLoader
Reviewed By: shergin

Differential Revision: D4559391

fbshipit-source-id: 44cb4900f93f2ac60dae3a461ed5344e1af08f3b
2017-02-15 03:45:55 -08:00
rh389 4844225eed JavaScriptLoader BCBundle version check
Summary:
Currently a build warning is thrown by `if (header.BCVersion != runtimeBCVersion) ...` because `runtimeBCVersion` is signed, apparently because `-1` is used to mean that the runtime has no support for bytecode bundles.

This PR splits out the error case of the runtime not supporting BC bundles from the case of a version mismatch.

Tested as much as I could by building and running `UIExplorer` - I haven't attempted to use real bytecode bundles.
Closes https://github.com/facebook/react-native/pull/11806

Differential Revision: D4408608

fbshipit-source-id: a1d868bb2064588e6a20827692629a46b6ba1e74
2017-01-11 22:28:43 -08:00
Dave Lee 7123618aa8 Fix comparison between NSNumber* and int
Summary:
Strangely comparing a pointer with zero will only be a clang warning when compiling with `-Wpedantic`, so this incorrect comparison is silently allowed.

**Test plan**

Compiles with `-Wpedantic`.
Closes https://github.com/facebook/react-native/pull/11709

Differential Revision: D4377512

Pulled By: ericvicenti

fbshipit-source-id: 483cf1f41d3f539c452d542ad2155c4c4b41616d
2017-01-03 10:28:29 -08:00
Pieter De Baets f2a46b17d4 Replace RCTJSCWrapper with JSCWrapper from ReactCommon
Reviewed By: mhorowitz

Differential Revision: D4204516

fbshipit-source-id: 6bcb122daf2848035dfae404ee7a2e9aca0f8087
2016-11-23 11:43:48 -08:00
David Aurelio 5db7484e8d Move `ScriptTag` and `RCTJSModulesUnbundle` to `cxxreact`
Reviewed By: javache

Differential Revision: D4213662

fbshipit-source-id: fc2ec9717c24fe77bb022a48777049f88173ebeb
2016-11-23 06:43:50 -08:00