JavaScriptLoader BCBundle version check
Summary: Currently a build warning is thrown by `if (header.BCVersion != runtimeBCVersion) ...` because `runtimeBCVersion` is signed, apparently because `-1` is used to mean that the runtime has no support for bytecode bundles. This PR splits out the error case of the runtime not supporting BC bundles from the case of a version mismatch. Tested as much as I could by building and running `UIExplorer` - I haven't attempted to use real bytecode bundles. Closes https://github.com/facebook/react-native/pull/11806 Differential Revision: D4408608 fbshipit-source-id: a1d868bb2064588e6a20827692629a46b6ba1e74
This commit is contained in:
parent
55f0294b7d
commit
4844225eed
|
@ -20,6 +20,7 @@ NS_ENUM(NSInteger) {
|
|||
RCTJavaScriptLoaderErrorFailedStatingFile = 3,
|
||||
RCTJavaScriptLoaderErrorURLLoadFailed = 3,
|
||||
RCTJavaScriptLoaderErrorBCVersion = 4,
|
||||
RCTJavaScriptLoaderErrorBCNotSupported = 4,
|
||||
|
||||
RCTJavaScriptLoaderErrorCannotBeLoadedSynchronously = 1000,
|
||||
};
|
||||
|
|
|
@ -142,10 +142,19 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
|||
return nil;
|
||||
|
||||
case facebook::react::ScriptTag::BCBundle:
|
||||
if (header.BCVersion != runtimeBCVersion) {
|
||||
if (runtimeBCVersion == JSNoBytecodeFileFormatVersion || runtimeBCVersion < 0) {
|
||||
if (error) {
|
||||
*error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain
|
||||
code:RCTJavaScriptLoaderErrorBCNotSupported
|
||||
userInfo:@{NSLocalizedDescriptionKey:
|
||||
@"Bytecode bundles are not supported by this runtime."}];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
else if ((uint32_t)runtimeBCVersion != header.BCVersion) {
|
||||
if (error) {
|
||||
NSString *errDesc =
|
||||
[NSString stringWithFormat:@"BC Version Mismatch. Expect: %d, Actual: %d",
|
||||
[NSString stringWithFormat:@"BC Version Mismatch. Expect: %d, Actual: %u",
|
||||
runtimeBCVersion, header.BCVersion];
|
||||
|
||||
*error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain
|
||||
|
|
Loading…
Reference in New Issue