diff --git a/Libraries/Utilities/MessageQueue.js b/Libraries/Utilities/MessageQueue.js index dd5747a2b..0bf8a8840 100644 --- a/Libraries/Utilities/MessageQueue.js +++ b/Libraries/Utilities/MessageQueue.js @@ -71,7 +71,7 @@ class MessageQueue { [ 'invokeCallbackAndReturnFlushedQueue', 'callFunctionReturnFlushedQueue', - 'callFunction', + 'callFunctionReturnResultAndFlushedQueue', 'flushedQueue', ].forEach((fn) => (this[fn] = this[fn].bind(this))); @@ -109,14 +109,14 @@ class MessageQueue { return this.flushedQueue(); } - callFunction(module, method, args) { + callFunctionReturnResultAndFlushedQueue(module, method, args) { let result; guard(() => { result = this.__callFunction(module, method, args); this.__callImmediates(); }); - return result; + return [result, this.flushedQueue()]; } invokeCallbackAndReturnFlushedQueue(cbID, args) { diff --git a/React/Base/RCTBatchedBridge.m b/React/Base/RCTBatchedBridge.m index c2e02f0d2..d27576916 100644 --- a/React/Base/RCTBatchedBridge.m +++ b/React/Base/RCTBatchedBridge.m @@ -530,6 +530,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithDelegate:(id)dele } if (loadError) { + RCTLogError(@"Failed to execute source code: %@", [loadError localizedDescription]); dispatch_async(dispatch_get_main_queue(), ^{ [self stopLoadingWithError:loadError]; }); diff --git a/React/Executors/RCTJSCExecutor.mm b/React/Executors/RCTJSCExecutor.mm index 8aa623fa8..22e674dcd 100644 --- a/React/Executors/RCTJSCExecutor.mm +++ b/React/Executors/RCTJSCExecutor.mm @@ -613,23 +613,23 @@ static void installBasicSynchronousHooksOnContext(JSContext *context) - (void)_callFunctionOnModule:(NSString *)module method:(NSString *)method arguments:(NSArray *)args - flushQueue:(BOOL)flushQueue + returnValue:(BOOL)returnValue unwrapResult:(BOOL)unwrapResult callback:(RCTJavaScriptCallback)onComplete { // TODO: Make this function handle first class instead of dynamically dispatching it. #9317773 - NSString *bridgeMethod = flushQueue ? @"callFunctionReturnFlushedQueue" : @"callFunction"; + NSString *bridgeMethod = returnValue ? @"callFunctionReturnFlushedQueue" : @"callFunctionReturnResultAndFlushedQueue"; [self _executeJSCall:bridgeMethod arguments:@[module, method, args] unwrapResult:unwrapResult callback:onComplete]; } - (void)callFunctionOnModule:(NSString *)module method:(NSString *)method arguments:(NSArray *)args callback:(RCTJavaScriptCallback)onComplete { - [self _callFunctionOnModule:module method:method arguments:args flushQueue:YES unwrapResult:YES callback:onComplete]; + [self _callFunctionOnModule:module method:method arguments:args returnValue:YES unwrapResult:YES callback:onComplete]; } - (void)callFunctionOnModule:(NSString *)module method:(NSString *)method arguments:(NSArray *)args jsValueCallback:(RCTJavaScriptValueCallback)onComplete { - [self _callFunctionOnModule:module method:method arguments:args flushQueue:NO unwrapResult:NO callback:onComplete]; + [self _callFunctionOnModule:module method:method arguments:args returnValue:NO unwrapResult:NO callback:onComplete]; } - (void)invokeCallbackID:(NSNumber *)cbID