Synchronously fail when calling JS too early

Differential Revision: D3453476

fbshipit-source-id: 3fbfda46b4cb7d31f554df6760c5146c412ff468
This commit is contained in:
Chris Hopman 2016-06-20 12:43:41 -07:00 коммит произвёл Facebook Github Bot 3
Родитель cc8cf8f0f2
Коммит 6128b7236f
2 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -137,7 +137,12 @@ public class ReactTestHelper {
return null;
}
}).get();
InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
@Override
public void run() {
instance.initialize();
}
});
} catch (Exception e) {
throw new RuntimeException(e);
}

Просмотреть файл

@ -191,6 +191,9 @@ public class CatalystInstanceImpl implements CatalystInstance {
FLog.w(ReactConstants.TAG, "Calling JS function after bridge has been destroyed.");
return;
}
if (!mInitialized) {
throw new RuntimeException("Attempt to call JS function before instance initialization.");
}
callJSFunction(executorToken, module, method, arguments, tracingName);
}