Skip to content

Commit f2a60a2

Browse files
skevyfacebook-github-bot-7
authored andcommitted
Add 'file://' prefix to sourceURL when loading a script from a file.
Reviewed By: svcscm Differential Revision: D2922108 Pulled By: androidtrunkagent fb-gh-sync-id: d9c98af31e844e3fed2f57a3a4250a6ef5e735a8 shipit-source-id: d9c98af31e844e3fed2f57a3a4250a6ef5e735a8
1 parent d96a4ba commit f2a60a2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ReactAndroid/src/main/java/com/facebook/react/bridge/JSBundleLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void loadScript(ReactBridge bridge) {
3131
if (fileName.startsWith("assets://")) {
3232
bridge.loadScriptFromAssets(context.getAssets(), fileName.replaceFirst("assets://", ""));
3333
} else {
34-
bridge.loadScriptFromFile(fileName, fileName);
34+
bridge.loadScriptFromFile(fileName, "file://" + fileName);
3535
}
3636
}
3737

ReactAndroid/src/main/jni/react/jni/OnLoad.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,9 +700,9 @@ static void loadScriptFromAssets(JNIEnv* env, jobject obj, jobject assetManager,
700700

701701
env->CallStaticVoidMethod(markerClass, gLogMarkerMethod, env->NewStringUTF("loadScriptFromAssets_read"));
702702
if (JniJSModulesUnbundle::isUnbundle(manager, assetNameStr)) {
703-
loadApplicationUnbundle(bridge, manager, script, assetNameStr);
703+
loadApplicationUnbundle(bridge, manager, script, "file://" + assetNameStr);
704704
} else {
705-
executeApplicationScript(bridge, script, assetNameStr);
705+
executeApplicationScript(bridge, script, "file://" + assetNameStr);
706706
}
707707
if (env->ExceptionCheck()) {
708708
return;

0 commit comments

Comments
 (0)