react-native/Examples/UIExplorer/UIExplorerUnitTests
Leo Natan 3ac3749ac3 Fix for Unicode decoding issue when using incremental networking.
Summary:
This is **a critical issue**.

The issue arises when incremental networking is enabled from JS by setting `onprogress` or `onload` on an `XMLHttpRequest` object.

The results:

![example1](https://cloud.githubusercontent.com/assets/2270433/18829964/5a54ff30-83e7-11e6-9806-97857dce0430.png)

![example2](https://cloud.githubusercontent.com/assets/2270433/18829966/5bf40a66-83e7-11e6-84e6-9e4d76ba4f8b.png)

Unicode characters get corrupted seemingly in random. The issue is from the way Unicode character parsing is handled in `RCTNetworking.mm`. When incremental networking is enabled, each chunk of data is decoded and passed to JS:

```objective-c
incrementalDataBlock = ^(NSData *data, int64_t progress, int64_t total) {
NSString *responseString = [RCTNetworking decodeTextData:data fromResponse:task.response];
if (!responseString) {
  RCTLogWarn(@"Received data was not a string, or was not a recognised encoding.");
  return;
}
NSArray<id> *responseJSON = @[task.requestID, responseString, @(prog
Closes https://github.com/facebook/react-native/pull/10110

Reviewed By: yungsters

Differential Revision: D4101533

Pulled By: fkgozali

fbshipit-source-id: 2674eaf0dd4568889070c6cde5cdf12edc5be521
2016-10-31 13:13:38 -07:00
..
OCMock CHORE - Remove Trailing Spaces 2016-04-06 09:21:53 -07:00
Info.plist Increased warning levels to -Wall -Wextra, and fixed Xcode 7 beta issues 2015-06-15 07:52:50 -08:00
RCTAllocationTests.m Improve stability of RCTAllocationTests 2016-09-15 04:28:47 -07:00
RCTBridgeTests.m Support sync method calls in the objc bridge 2016-09-05 07:44:00 -07:00
RCTBundleURLProviderTests.m Removed calls to RCTBundleURLProvider setDefaults 2016-07-11 02:58:32 -07:00
RCTComponentPropsTests.m Remove code for testing without JS bundle 2016-07-11 13:33:55 -07:00
RCTConvert_NSURLTests.m Use mainBundle in RCTConvert to resolve asset paths 2015-11-05 09:30:36 -08:00
RCTEventDispatcherTests.m Use new enqueueJSCall method everywhere 2016-08-02 11:14:06 -07:00
RCTFontTests.m Travis CI reliability fixes: preload package manager and increase tim… 2016-10-16 15:43:44 -07:00
RCTGzipTests.m Re-enable testUnderlyingBridgeIsDeallocated 2016-01-06 09:03:33 -08:00
RCTImageLoaderHelpers.h Generalized image decoding and resizing logic 2016-01-20 11:11:13 -08:00
RCTImageLoaderHelpers.m Fix some linter warnings 2016-09-27 06:13:31 -07:00
RCTImageLoaderTests.m Add partial image loading to RCTImageView 2016-09-21 12:14:09 -07:00
RCTImageUtilTests.m Removed placeholder image logic 2016-04-25 03:31:19 -07:00
RCTJSCExecutorTests.m Move RCTJSCExecutorTests to ReactKitBenchmarks 2016-04-19 11:37:28 -07:00
RCTJSONTests.m Allow serializing underlying NSError objects, closes #10506 2016-10-26 01:43:39 -07:00
RCTMethodArgumentTests.m Replaced RegExp method parser with recursive descent 2015-12-10 10:12:29 -08:00
RCTModuleInitNotificationRaceTests.m Remove customDirectEventTypes 2016-10-27 06:58:52 -07:00
RCTModuleInitTests.m Add MessageQueue method for executing function and returning its result 2016-07-18 07:13:32 -07:00
RCTModuleMethodTests.m Replaced RegExp method parser with recursive descent 2015-12-10 10:12:29 -08:00
RCTMultipartStreamReaderTests.m Add multipart response stream reader 2016-10-03 18:13:36 -07:00
RCTShadowViewTests.m Use single function for margin, position, padding, and border 2016-08-15 09:28:41 -07:00
RCTUIManagerTests.m Fixed unit tests 2016-06-07 12:43:49 -07:00
RCTURLUtilsTests.m Remove `hot` query string attribut when HL is disabled 2016-01-06 11:55:33 -08:00
RCTUnicodeDecodeTests.m Fix for Unicode decoding issue when using incremental networking. 2016-10-31 13:13:38 -07:00
TestBundle.js Fix snapshottests under iOS10 2016-08-17 10:44:01 -07:00
libOCMock.a [ReactNative] Move unit tests to UIExplorer 2015-06-06 13:38:34 -08:00