mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-11 17:21:11 +08:00
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:
committed by
facebook-github-bot-5
parent
7377fb8baf
commit
3d4889b5cf
@@ -507,7 +507,8 @@ import com.facebook.systrace.Systrace;
|
||||
recreateReactContextInBackground(
|
||||
new ProxyJavaScriptExecutor(jsExecutor),
|
||||
JSBundleLoader.createRemoteDebuggerBundleLoader(
|
||||
mDevSupportManager.getJSBundleURLForRemoteDebugging()));
|
||||
mDevSupportManager.getJSBundleURLForRemoteDebugging(),
|
||||
mDevSupportManager.getSourceUrl()));
|
||||
}
|
||||
|
||||
private void onJSBundleLoadedFromServer() {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user