diff --git a/React/Base/RCTJavaScriptLoader.h b/React/Base/RCTJavaScriptLoader.h index 1d32372cd56..c1d30ce2016 100755 --- a/React/Base/RCTJavaScriptLoader.h +++ b/React/Base/RCTJavaScriptLoader.h @@ -20,6 +20,7 @@ NS_ENUM(NSInteger) { RCTJavaScriptLoaderErrorFailedStatingFile = 3, RCTJavaScriptLoaderErrorURLLoadFailed = 3, RCTJavaScriptLoaderErrorBCVersion = 4, + RCTJavaScriptLoaderErrorBCNotSupported = 4, RCTJavaScriptLoaderErrorCannotBeLoadedSynchronously = 1000, }; diff --git a/React/Base/RCTJavaScriptLoader.mm b/React/Base/RCTJavaScriptLoader.mm index 1d0f3cdec88..eacdf024f22 100755 --- a/React/Base/RCTJavaScriptLoader.mm +++ b/React/Base/RCTJavaScriptLoader.mm @@ -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