Re-enable testUnderlyingBridgeIsDeallocated
Reviewed By: jspahrsummers Differential Revision: D2803543 fb-gh-sync-id: d62b68b1e23fad2a0b3d4e490459b1f38ca2dca1
This commit is contained in:
parent
e730a9fdd0
commit
435efadbba
|
@ -22,13 +22,12 @@
|
|||
#import "RCTRootView.h"
|
||||
|
||||
#define RUN_RUNLOOP_WHILE(CONDITION) \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clang diagnostic ignored \"-Wshadow\"") \
|
||||
NSDate *timeout = [[NSDate date] dateByAddingTimeInterval:5]; \
|
||||
while ((CONDITION) && [timeout timeIntervalSinceNow] > 0) { \
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:timeout]; \
|
||||
} \
|
||||
_Pragma("clang diagnostic pop")
|
||||
{ \
|
||||
NSDate *timeout = [NSDate dateWithTimeIntervalSinceNow:5]; \
|
||||
while ((CONDITION) && [timeout timeIntervalSinceNow] > 0) { \
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; \
|
||||
} \
|
||||
}
|
||||
|
||||
@interface RCTJavaScriptContext : NSObject
|
||||
|
||||
|
@ -212,8 +211,6 @@ RCT_EXPORT_METHOD(test:(__unused NSString *)a
|
|||
XCTAssertFalse(rootContentView.userInteractionEnabled, @"RCTContentView should have been invalidated");
|
||||
}
|
||||
|
||||
// This test is flaky, and needs to be fixed before re-enabling. See t9456702.
|
||||
#if 0
|
||||
- (void)testUnderlyingBridgeIsDeallocated
|
||||
{
|
||||
RCTBridge *bridge;
|
||||
|
@ -229,7 +226,15 @@ RCT_EXPORT_METHOD(test:(__unused NSString *)a
|
|||
|
||||
XCTAssertNotNil(bridge, @"RCTBridge should not have been deallocated");
|
||||
XCTAssertNil(batchedBridge, @"RCTBatchedBridge should have been deallocated");
|
||||
|
||||
// Wait to complete the test until the new batchedbridge is also deallocated
|
||||
@autoreleasepool {
|
||||
batchedBridge = bridge.batchedBridge;
|
||||
bridge = nil;
|
||||
}
|
||||
|
||||
RUN_RUNLOOP_WHILE(batchedBridge != nil);
|
||||
XCTAssertNil(batchedBridge);
|
||||
}
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
|
|
@ -21,15 +21,13 @@
|
|||
#import "RCTJavaScriptExecutor.h"
|
||||
#import "RCTUtils.h"
|
||||
|
||||
|
||||
#define RUN_RUNLOOP_WHILE(CONDITION) \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clang diagnostic ignored \"-Wshadow\"") \
|
||||
NSDate *timeout = [[NSDate date] dateByAddingTimeInterval:0.1]; \
|
||||
while ((CONDITION) && [timeout timeIntervalSinceNow] > 0) { \
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:timeout]; \
|
||||
} \
|
||||
_Pragma("clang diagnostic pop")
|
||||
{ \
|
||||
NSDate *timeout = [NSDate dateWithTimeIntervalSinceNow:5]; \
|
||||
while ((CONDITION) && [timeout timeIntervalSinceNow] > 0) { \
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; \
|
||||
} \
|
||||
}
|
||||
|
||||
@interface TestExecutor : NSObject <RCTJavaScriptExecutor>
|
||||
|
||||
|
|
|
@ -17,13 +17,12 @@
|
|||
#import "RCTNetworking.h"
|
||||
|
||||
#define RUN_RUNLOOP_WHILE(CONDITION) \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clang diagnostic ignored \"-Wshadow\"") \
|
||||
NSDate *timeout = [[NSDate date] dateByAddingTimeInterval:5]; \
|
||||
while ((CONDITION) && [timeout timeIntervalSinceNow] > 0) { \
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:timeout]; \
|
||||
} \
|
||||
_Pragma("clang diagnostic pop")
|
||||
{ \
|
||||
NSDate *timeout = [NSDate dateWithTimeIntervalSinceNow:5]; \
|
||||
while ((CONDITION) && [timeout timeIntervalSinceNow] > 0) { \
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; \
|
||||
} \
|
||||
}
|
||||
|
||||
extern BOOL RCTIsGzippedData(NSData *data);
|
||||
|
||||
|
|
|
@ -175,9 +175,7 @@ RCT_EXTERN NSArray<Class> *RCTGetModuleClasses(void);
|
|||
dispatch_group_notify(initModulesAndLoadSource, dispatch_get_main_queue(), ^{
|
||||
RCTBatchedBridge *strongSelf = weakSelf;
|
||||
if (sourceCode && strongSelf.loading) {
|
||||
dispatch_async(bridgeQueue, ^{
|
||||
[weakSelf executeSourceCode:sourceCode];
|
||||
});
|
||||
[strongSelf executeSourceCode:sourceCode];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -570,6 +568,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
|||
}
|
||||
|
||||
RCTAssertMainThread();
|
||||
RCTAssert(_javaScriptExecutor != nil, @"Can't complete invalidation without a JS executor");
|
||||
|
||||
_loading = NO;
|
||||
_valid = NO;
|
||||
|
@ -605,11 +604,13 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
|||
if (RCTProfileIsProfiling()) {
|
||||
RCTProfileUnhookModules(self);
|
||||
}
|
||||
|
||||
_moduleDataByName = nil;
|
||||
_moduleDataByID = nil;
|
||||
_moduleClassesByID = nil;
|
||||
_modulesByName_DEPRECATED = nil;
|
||||
_frameUpdateObservers = nil;
|
||||
_pendingCalls = nil;
|
||||
|
||||
}];
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue