Permalink
Browse files

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
  • Loading branch information...
Chris Zheng authored and facebook-github-bot committed Sep 12, 2017
1 parent 718f4e6 commit 17126641b10d35c480190c807756186a8213ba3e
Showing with 5 additions and 25 deletions.
  1. +2 −8 React/Base/RCTBatchedBridge.mm
  2. +0 −9 React/Base/RCTBridgeDelegate.h
  3. +3 −8 React/CxxBridge/RCTCxxBridge.mm
@@ -209,14 +209,8 @@ - (void)loadSource:(RCTSourceLoadBlock)_onSourceLoad onProgress:(RCTSourceLoadPr
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);
}];
@@ -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
@@ -431,14 +431,9 @@ - (void)loadSource:(RCTSourceLoadBlock)_onSourceLoad onProgress:(RCTSourceLoadPr
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);
}];

0 comments on commit 1712664

Please sign in to comment.