mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-09 17:31:39 +08:00
Added support for JavaScript third-party debuggers
Summary:* Add ability to configure the app that should open when starting debugging axemclion discussed this feature with tadeuzagallo and martinbigio on: https://github.com/facebook/react-native/issues/5051 Closes https://github.com/facebook/react-native/pull/5683 Reviewed By: martinbigio Differential Revision: D2971497 Pulled By: mkonicek fb-gh-sync-id: 91c3ce68feed989658124bb96cb61d03dd032599 fbshipit-source-id: 91c3ce68feed989658124bb96cb61d03dd032599
This commit is contained in:
committed by
Facebook Github Bot 1
parent
b9396cd744
commit
4c8a9f0d00
@@ -69,7 +69,7 @@ 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 proxySourceURL the URL to load the JS bundle from in the JavaScript proxy
|
||||
* @param realSourceURL the URL to report as the source URL, e.g. for asset loading
|
||||
*/
|
||||
public static JSBundleLoader createRemoteDebuggerBundleLoader(
|
||||
|
||||
@@ -54,8 +54,8 @@ public class DevServerHelper {
|
||||
"http://%s/%s.bundle?platform=android&dev=%s&hot=%s&minify=%s";
|
||||
private static final String SOURCE_MAP_URL_FORMAT =
|
||||
BUNDLE_URL_FORMAT.replaceFirst("\\.bundle", ".map");
|
||||
private static final String LAUNCH_CHROME_DEVTOOLS_COMMAND_URL_FORMAT =
|
||||
"http://%s/launch-chrome-devtools";
|
||||
private static final String LAUNCH_JS_DEVTOOLS_COMMAND_URL_FORMAT =
|
||||
"http://%s/launch-js-devtools";
|
||||
private static final String ONCHANGE_ENDPOINT_URL_FORMAT =
|
||||
"http://%s/onchange";
|
||||
private static final String WEBSOCKET_PROXY_URL_FORMAT = "ws://%s/debugger-proxy?role=client";
|
||||
@@ -366,13 +366,13 @@ public class DevServerHelper {
|
||||
return String.format(Locale.US, ONCHANGE_ENDPOINT_URL_FORMAT, getDebugServerHost());
|
||||
}
|
||||
|
||||
private String createLaunchChromeDevtoolsCommandUrl() {
|
||||
return String.format(LAUNCH_CHROME_DEVTOOLS_COMMAND_URL_FORMAT, getDebugServerHost());
|
||||
private String createLaunchJSDevtoolsCommandUrl() {
|
||||
return String.format(LAUNCH_JS_DEVTOOLS_COMMAND_URL_FORMAT, getDebugServerHost());
|
||||
}
|
||||
|
||||
public void launchChromeDevtools() {
|
||||
public void launchJSDevtools() {
|
||||
Request request = new Request.Builder()
|
||||
.url(createLaunchChromeDevtoolsCommandUrl())
|
||||
.url(createLaunchJSDevtoolsCommandUrl())
|
||||
.build();
|
||||
mClient.newCall(request).enqueue(new Callback() {
|
||||
@Override
|
||||
@@ -398,7 +398,7 @@ public class DevServerHelper {
|
||||
|
||||
public String getJSBundleURLForRemoteDebugging(String mainModuleName) {
|
||||
// The host IP we use when connecting to the JS bundle server from the emulator is not the
|
||||
// same as the one needed to connect to the same server from the Chrome proxy running on the
|
||||
// same as the one needed to connect to the same server from the JavaScript proxy running on the
|
||||
// host itself.
|
||||
return createBundleURL(getHostForJSProxy(), mainModuleName, getDevMode(), getHMR(), getJSMinifyMode());
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class DevSupportManagerImpl implements DevSupportManager {
|
||||
if (DevServerHelper.getReloadAppAction(context).equals(action)) {
|
||||
if (intent.getBooleanExtra(DevServerHelper.RELOAD_APP_EXTRA_JS_PROXY, false)) {
|
||||
mIsUsingJSProxy = true;
|
||||
mDevServerHelper.launchChromeDevtools();
|
||||
mDevServerHelper.launchJSDevtools();
|
||||
} else {
|
||||
mIsUsingJSProxy = false;
|
||||
}
|
||||
@@ -584,7 +584,7 @@ public class DevSupportManagerImpl implements DevSupportManager {
|
||||
private void reloadJSInProxyMode(final ProgressDialog progressDialog) {
|
||||
// When using js proxy, there is no need to fetch JS bundle as proxy executor will do that
|
||||
// anyway
|
||||
mDevServerHelper.launchChromeDevtools();
|
||||
mDevServerHelper.launchJSDevtools();
|
||||
|
||||
JavaJSExecutor.Factory factory = new JavaJSExecutor.Factory() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user