react-native/React/Base
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
..
RCTAssert.h Remove deprecated RCTAssert aliases 2017-07-07 12:21:59 -07:00
RCTAssert.m Display JS exceptions and stacks in a red box. 2016-06-30 19:43:28 -07:00
RCTBatchedBridge.mm Update native references to JSTimers 2017-06-22 09:52:33 -07:00
RCTBridge+Private.h Add block-based initializer for RCTModuleData 2017-04-07 11:16:59 -07:00
RCTBridge.h Add JSC utility header to RCTBridge 2017-04-07 11:16:59 -07:00
RCTBridge.m Make RCTSamplingProfilerPackagerMethod not depend on RCTBridge 2017-06-15 12:07:34 -07:00
RCTBridgeDelegate.h Make the choice of bridge based on an optional delegate method 2017-03-21 18:31:23 -07:00
RCTBridgeMethod.h Added support for synchronous methods in native modules on iOS 2017-04-27 12:03:30 -07:00
RCTBridgeModule.h Clean up after recent RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD changes 2017-04-28 05:35:41 -07:00
RCTBundleURLProvider.h allow fetching any resource under js folder via packager 2016-10-20 11:43:44 -07:00
RCTBundleURLProvider.m Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTConvert.h Add a type cast to RCT_ENUM_CONVERTER for C++ compatibility 2017-06-15 19:07:21 -07:00
RCTConvert.m Fix references to deprecated assets in separate bundles 2017-06-30 07:00:12 -07:00
RCTDefines.h Add RCT_PROFILE define 2016-06-13 04:28:38 -07:00
RCTDisplayLink.h Pull CADisplayLink into a separate file 2016-03-29 19:53:20 -07:00
RCTDisplayLink.m Remove last arg from RCTProfileEnd, make macro's function-like 2016-09-05 11:13:33 -07:00
RCTErrorCustomizer.h Add ability to customize error messages and stacks within the iOS redbox 2016-07-18 11:28:36 -07:00
RCTErrorInfo.h Add ability to customize error messages and stacks within the iOS redbox 2016-07-18 11:28:36 -07:00
RCTErrorInfo.m Add ability to customize error messages and stacks within the iOS redbox 2016-07-18 11:28:36 -07:00
RCTEventDispatcher.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTEventDispatcher.m Dispatch native handled events to JS 2016-11-23 05:43:35 -08:00
RCTFrameUpdate.h
RCTFrameUpdate.m
RCTImageSource.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTImageSource.m Revert D5197885 to unbreak Internal App 2017-06-23 13:05:49 -07:00
RCTInvalidating.h
RCTJSCErrorHandling.h Tease apart React and RCTBatchedBridge targets 2017-03-21 18:31:23 -07:00
RCTJSCErrorHandling.mm More verbose error messages for iOS 2017-04-18 14:19:13 -07:00
RCTJSEnvironment.h Make RCTSamplingProfilerPackagerMethod not depend on RCTBridge 2017-06-15 12:07:34 -07:00
RCTJSStackFrame.h Class for JS stack frames instead of dictionaries 2016-07-11 06:13:32 -07:00
RCTJSStackFrame.m Report JS errors in debug console 2017-04-05 19:51:03 -07:00
RCTJavaScriptExecutor.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTJavaScriptLoader.h JavaScriptLoader BCBundle version check 2017-01-11 22:28:43 -08:00
RCTJavaScriptLoader.mm Validate the content type of the bundle returned by the packager 2017-07-19 19:10:00 -07:00
RCTKeyCommands.h Add Shortcut "Double R" to Reload JS in iOS 2016-06-01 03:43:27 -07:00
RCTKeyCommands.m Cleanup warnings 2016-07-12 05:59:12 -07:00
RCTLog.h Replacing all instances of [UIApplication sharedApplication] wi… 2017-04-01 03:34:41 -07:00
RCTLog.mm Replacing all instances of [UIApplication sharedApplication] wi… 2017-04-01 03:34:41 -07:00
RCTModuleData.h Merge allowOffMainQueueRegistration and requiresMainQueueSetup 2017-07-17 03:45:30 -07:00
RCTModuleData.mm Merge allowOffMainQueueRegistration and requiresMainQueueSetup 2017-07-17 03:45:30 -07:00
RCTModuleMethod.h Added support for synchronous methods in native modules on iOS 2017-04-27 12:03:30 -07:00
RCTModuleMethod.m Clean up after recent RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD changes 2017-04-28 05:35:41 -07:00
RCTMultipartDataTask.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTMultipartDataTask.m fix RCTMultipartDataTask Memory leaks 2017-04-20 03:45:25 -07:00
RCTMultipartStreamReader.h Add multipart response stream reader 2016-10-03 18:13:36 -07:00
RCTMultipartStreamReader.m Add multipart response download task (2nd edition) 2016-10-11 12:28:42 -07:00
RCTNullability.h
RCTParserUtils.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTParserUtils.m
RCTPerformanceLogger.h Refactor measuring native requires 2016-09-09 15:28:44 -07:00
RCTPerformanceLogger.m Refactor measuring native requires 2016-09-09 15:28:44 -07:00
RCTPlatform.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTPlatform.m Merge RCTPlatform.isTesting and RCTRunningInTestEnvironment 2017-03-30 10:02:35 -07:00
RCTReloadCommand.h Refactor reload command in React Native 2016-12-07 20:13:22 -08:00
RCTReloadCommand.m Refactor reload command in React Native 2016-12-07 20:13:22 -08:00
RCTRootContentView.h Immediately trigger renderApplication from RCTRootView init 2017-04-21 07:04:57 -07:00
RCTRootContentView.m Immediately trigger renderApplication from RCTRootView init 2017-04-21 07:04:57 -07:00
RCTRootView.h Clean up -[RCTRootView cancelTouches] header docs 2017-07-11 11:06:21 -07:00
RCTRootView.m Use just `_bridge` instead of `batchedBridge` when actual bridge is already batched one 2017-05-03 11:16:31 -07:00
RCTRootViewDelegate.h RCTRootView's `intrinsicSize` property was deprecated in favour of `intrinsicContentSize` 2017-02-27 14:04:58 -08:00
RCTRootViewInternal.h RCTRootView's `intrinsicSize` property was deprecated in favour of `intrinsicContentSize` 2017-02-27 14:04:58 -08:00
RCTTVRemoteHandler.h Apple TV support 4: support for input (tvOS focus engine) 2016-12-19 06:28:40 -08:00
RCTTVRemoteHandler.m Fix warnings in React.xcodeproj 2017-03-23 11:36:17 -07:00
RCTTouchEvent.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTTouchEvent.m New way to handle simultaneously active gesture recognizers in RCTTouchHandler 2017-01-12 12:13:28 -08:00
RCTTouchHandler.h Nobody outside RCTTouchHandler should treat it as UIGestureRecognizer subclass 2017-01-09 00:13:33 -08:00
RCTTouchHandler.m Do not warn if `touch.force` is NaN 2017-04-26 15:16:16 -07:00
RCTURLRequestDelegate.h
RCTURLRequestHandler.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTUtils.h Fixed crash caused by NaN values in RCTTouchEvent 2017-04-21 11:30:57 -07:00
RCTUtils.m Fix references to deprecated assets in separate bundles 2017-06-30 07:00:12 -07:00
RCTWebSocketObserverProtocol.h Expose more of RCTWebSocketObserver 2016-12-08 07:44:38 -08:00