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
This commit is contained in:
Adam Miskiewicz 2016-02-10 10:40:42 -08:00 committed by facebook-github-bot-7
parent d96a4ba94d
commit f2a60a202f
2 changed files with 3 additions and 3 deletions

View File

@ -31,7 +31,7 @@ public abstract class JSBundleLoader {
if (fileName.startsWith("assets://")) { if (fileName.startsWith("assets://")) {
bridge.loadScriptFromAssets(context.getAssets(), fileName.replaceFirst("assets://", "")); bridge.loadScriptFromAssets(context.getAssets(), fileName.replaceFirst("assets://", ""));
} else { } else {
bridge.loadScriptFromFile(fileName, fileName); bridge.loadScriptFromFile(fileName, "file://" + fileName);
} }
} }

View File

@ -700,9 +700,9 @@ static void loadScriptFromAssets(JNIEnv* env, jobject obj, jobject assetManager,
env->CallStaticVoidMethod(markerClass, gLogMarkerMethod, env->NewStringUTF("loadScriptFromAssets_read")); env->CallStaticVoidMethod(markerClass, gLogMarkerMethod, env->NewStringUTF("loadScriptFromAssets_read"));
if (JniJSModulesUnbundle::isUnbundle(manager, assetNameStr)) { if (JniJSModulesUnbundle::isUnbundle(manager, assetNameStr)) {
loadApplicationUnbundle(bridge, manager, script, assetNameStr); loadApplicationUnbundle(bridge, manager, script, "file://" + assetNameStr);
} else { } else {
executeApplicationScript(bridge, script, assetNameStr); executeApplicationScript(bridge, script, "file://" + assetNameStr);
} }
if (env->ExceptionCheck()) { if (env->ExceptionCheck()) {
return; return;