[ReactNative] Add test to check RootContentView and BatchedBridge are deallocated

This commit is contained in:
Tadeu Zagallo 2015-05-12 07:44:46 -07:00 committed by Christopher Chedeau
parent 92d7324f15
commit d230629e61
2 changed files with 19 additions and 6 deletions

View File

@ -819,9 +819,9 @@ static id<RCTJavaScriptExecutor> _latestJSExecutor;
- (void)reload
{
/**
* AnyThread
*/
/**
* AnyThread
*/
dispatch_async(dispatch_get_main_queue(), ^{
[self invalidate];
[self setUp];
@ -1088,7 +1088,16 @@ RCT_INNER_BRIDGE_ONLY(_invokeAndProcessModule:(NSString *)module method:(NSStrin
*/
_loading = NO;
} else if (bundleURL) { // Allow testing without a script
} else if (!bundleURL) {
// Allow testing without a script
dispatch_async(dispatch_get_main_queue(), ^{
_loading = NO;
[[NSNotificationCenter defaultCenter] postNotificationName:RCTJavaScriptDidLoadNotification
object:_parentBridge
userInfo:@{ @"bridge": self }];
});
} else {
RCTJavaScriptLoader *loader = [[RCTJavaScriptLoader alloc] initWithBridge:self];
[loader loadBundleAtURL:bundleURL onComplete:^(NSError *error, NSString *script) {

View File

@ -86,7 +86,7 @@ RCT_EXPORT_MODULE()
object:nil];
[notificationCenter addObserver:self
selector:@selector(jsLoaded)
selector:@selector(jsLoaded:)
name:RCTJavaScriptDidLoadNotification
object:nil];
@ -141,8 +141,12 @@ RCT_EXPORT_MODULE()
self.executorClass = NSClassFromString(_settings[@"executorClass"]);
}
- (void)jsLoaded
- (void)jsLoaded:(NSNotification *)notification
{
if (notification.userInfo[@"bridge"] != _bridge) {
return;
}
_jsLoaded = YES;
// Check if live reloading is available