return packager URL instead of proxy URL when debugging

Summary:
JS relies on the URL returned by SourceCodeModule to load packager assets. Because we currently return localhost when debugging (because that's the URL Chrome uses), assets don't load when debugging. This makes it so SourceCodeModule still returns the package URL relative to the emulator / device even when debugging.

public

Reviewed By: astreet

Differential Revision: D2759710

fb-gh-sync-id: bab6a88ef044b8b4d971381e3b23c59fa9aa2ed0
This commit is contained in:
Felix Oghina
2015-12-15 12:16:19 -08:00
committed by facebook-github-bot-5
parent 7377fb8baf
commit 3d4889b5cf
2 changed files with 9 additions and 4 deletions

View File

@@ -507,7 +507,8 @@ import com.facebook.systrace.Systrace;
recreateReactContextInBackground(
new ProxyJavaScriptExecutor(jsExecutor),
JSBundleLoader.createRemoteDebuggerBundleLoader(
mDevSupportManager.getJSBundleURLForRemoteDebugging()));
mDevSupportManager.getJSBundleURLForRemoteDebugging(),
mDevSupportManager.getSourceUrl()));
}
private void onJSBundleLoadedFromServer() {

View File

@@ -68,18 +68,22 @@ public abstract class JSBundleLoader {
/**
* This loader is used when proxy debugging is enabled. In that case there is no point in fetching
* the bundle from device as remote executor will have to do it anyway.
*
* @param proxySourceURL the URL to load the JS bundle from in Chrome
* @param realSourceURL the URL to report as the source URL, e.g. for asset loading
*/
public static JSBundleLoader createRemoteDebuggerBundleLoader(
final String sourceURL) {
final String proxySourceURL,
final String realSourceURL) {
return new JSBundleLoader() {
@Override
public void loadScript(ReactBridge bridge) {
bridge.loadScriptFromFile(null, sourceURL);
bridge.loadScriptFromFile(null, proxySourceURL);
}
@Override
public String getSourceUrl() {
return sourceURL;
return realSourceURL;
}
};
}