Decouple JSBundleLoader from CatalystInstanceImpl

Summary: Right now JSBundleLoader is tightly coupled to CatalystInstanceImpl; this diffs adds an interface, JSBundleLoaderDelegate, that CatalystInstanceImpl implements so that we can use the bundle loader with other classes.

Reviewed By: mdvacca

Differential Revision: D13216752

fbshipit-source-id: fc406ef30f12ed9d3ed13a062dedd7b33f3b7985
This commit is contained in:
Emily Janzer
2018-11-30 16:51:26 -08:00
committed by Facebook Github Bot
parent 668341a294
commit a2ead1c7b5
5 changed files with 82 additions and 31 deletions
@@ -50,10 +50,10 @@ public final class FallbackJSBundleLoader extends JSBundleLoader {
* it is replaced by the next most preferred loader.
*/
@Override
public String loadScript(CatalystInstanceImpl instance) {
public String loadScript(JSBundleLoaderDelegate delegate) {
while (true) {
try {
return getDelegateLoader().loadScript(instance);
return getDelegateLoader().loadScript(delegate);
} catch (Exception e) {
if (e.getMessage() == null || !e.getMessage().startsWith(RECOVERABLE)) {
throw e;