Removing fallback source URL from JS bridge

Summary:
Remove fallback logic.
It is hard to test whether a bundle is good or bad on device, since it does the fallback, remove the fallback logic now.

Reviewed By: javache

Differential Revision: D5773542

fbshipit-source-id: 8bb4fdad4c5761ccce915f9f1c2577464e8d37d8
This commit is contained in:
Chris Zheng 2017-09-12 15:40:48 -07:00 committed by Facebook Github Bot
parent 718f4e60c2
commit 17126641b1
3 changed files with 5 additions and 25 deletions

View File

@ -209,14 +209,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
onSourceLoad(error, nil);
} else {
[RCTJavaScriptLoader loadBundleAtURL:self.bundleURL onProgress:onProgress onComplete:^(NSError *error, RCTSource *source) {
if (error && [self.delegate respondsToSelector:@selector(fallbackSourceURLForBridge:)]) {
NSURL *fallbackURL = [self.delegate fallbackSourceURLForBridge:self->_parentBridge];
if (fallbackURL && ![fallbackURL isEqual:self.bundleURL]) {
RCTLogError(@"Failed to load bundle(%@) with error:(%@ %@)", self.bundleURL, error.localizedDescription, error.localizedFailureReason);
self.bundleURL = fallbackURL;
[RCTJavaScriptLoader loadBundleAtURL:self.bundleURL onProgress:onProgress onComplete:onSourceLoad];
return;
}
if (error) {
RCTLogError(@"Failed to load bundle(%@) with error:(%@ %@)", self.bundleURL, error.localizedDescription, error.localizedFailureReason);
}
onSourceLoad(error, source);
}];

View File

@ -24,15 +24,6 @@
@optional
/**
* The bridge will attempt to load the JS source code from the location specified
* by the `sourceURLForBridge:` method, if loading fails, you can implement this
* method to specify fallbackSourceURL.
* NOTE: We don't plan to support this API permanently (this method will be
* removed after we track down why a valid sourceURL fails to load sometimes).
*/
- (NSURL *)fallbackSourceURLForBridge:(RCTBridge *)bridge;
/**
* The bridge initializes any registered RCTBridgeModules automatically, however
* if you wish to instantiate your own module instances, you can return them

View File

@ -431,14 +431,9 @@ struct RCTInstanceCallback : public InstanceCallback {
onSourceLoad(error, nil);
} else {
[RCTJavaScriptLoader loadBundleAtURL:self.bundleURL onProgress:onProgress onComplete:^(NSError *error, RCTSource *source) {
if (error && [self.delegate respondsToSelector:@selector(fallbackSourceURLForBridge:)]) {
NSURL *fallbackURL = [self.delegate fallbackSourceURLForBridge:self->_parentBridge];
if (fallbackURL && ![fallbackURL isEqual:self.bundleURL]) {
RCTLogError(@"Failed to load bundle(%@) with error:(%@ %@)", self.bundleURL, error.localizedDescription, error.localizedFailureReason);
self.bundleURL = fallbackURL;
[RCTJavaScriptLoader loadBundleAtURL:self.bundleURL onProgress:onProgress onComplete:onSourceLoad];
return;
}
if (error) {
RCTLogError(@"Failed to load bundle(%@) with error:(%@ %@)", self.bundleURL, error.localizedDescription, error.localizedFailureReason);
return;
}
onSourceLoad(error, source);
}];