Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove DevServerHelper.symbolicateStackTrace and DevServerHelper.openStackFrameCall. #36652

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.facebook.react.common.ReactConstants;
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
import com.facebook.react.devsupport.interfaces.PackagerStatusCallback;
import com.facebook.react.devsupport.interfaces.StackFrame;
import com.facebook.react.modules.systeminfo.AndroidInfoHelpers;
import com.facebook.react.packagerconnection.FileIoHandler;
import com.facebook.react.packagerconnection.JSPackagerClient;
Expand All @@ -28,7 +27,6 @@
import com.facebook.react.util.RNLog;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
Expand All @@ -42,7 +40,6 @@
import okhttp3.Response;
import okio.Okio;
import okio.Sink;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

Expand Down Expand Up @@ -87,10 +84,6 @@ public interface PackagerCommandListener {

public interface PackagerCustomCommandProvider {}

public interface SymbolicationListener {
void onSymbolicationComplete(@Nullable Iterable<StackFrame> stackFrames);
}

private enum BundleType {
BUNDLE("bundle"),
MAP("map");
Expand Down Expand Up @@ -280,80 +273,6 @@ protected void onPostExecute(Boolean result) {
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}

public void symbolicateStackTrace(
Iterable<StackFrame> stackFrames, final SymbolicationListener listener) {
try {
final String symbolicateURL =
createSymbolicateURL(mSettings.getPackagerConnectionSettings().getDebugServerHost());
final JSONArray jsonStackFrames = new JSONArray();
for (final StackFrame stackFrame : stackFrames) {
jsonStackFrames.put(stackFrame.toJSON());
}
final Request request =
new Request.Builder()
.url(symbolicateURL)
.post(
RequestBody.create(
MediaType.parse("application/json"),
new JSONObject().put("stack", jsonStackFrames).toString()))
.build();
Call symbolicateCall = Assertions.assertNotNull(mClient.newCall(request));
symbolicateCall.enqueue(
new Callback() {
@Override
public void onFailure(Call call, IOException e) {
FLog.w(
ReactConstants.TAG,
"Got IOException when attempting symbolicate stack trace: " + e.getMessage());
listener.onSymbolicationComplete(null);
}

@Override
public void onResponse(Call call, final Response response) throws IOException {
try {
listener.onSymbolicationComplete(
Arrays.asList(
StackTraceHelper.convertJsStackTrace(
new JSONObject(response.body().string()).getJSONArray("stack"))));
} catch (JSONException exception) {
listener.onSymbolicationComplete(null);
}
}
});
} catch (JSONException e) {
FLog.w(
ReactConstants.TAG,
"Got JSONException when attempting symbolicate stack trace: " + e.getMessage());
}
}

public void openStackFrameCall(StackFrame stackFrame) {
final String openStackFrameURL =
createOpenStackFrameURL(mSettings.getPackagerConnectionSettings().getDebugServerHost());
final Request request =
new Request.Builder()
.url(openStackFrameURL)
.post(
RequestBody.create(
MediaType.parse("application/json"), stackFrame.toJSON().toString()))
.build();
Call symbolicateCall = Assertions.assertNotNull(mClient.newCall(request));
symbolicateCall.enqueue(
new Callback() {
@Override
public void onFailure(Call call, IOException e) {
FLog.w(
ReactConstants.TAG,
"Got IOException when attempting to open stack frame: " + e.getMessage());
}

@Override
public void onResponse(Call call, final Response response) throws IOException {
// We don't have a listener for this.
}
});
}

public String getWebsocketProxyURL() {
return String.format(
Locale.US,
Expand Down Expand Up @@ -448,14 +367,6 @@ private static String createResourceURL(String host, String resourcePath) {
return String.format(Locale.US, "http://%s/%s", host, resourcePath);
}

private static String createSymbolicateURL(String host) {
return String.format(Locale.US, "http://%s/symbolicate", host);
}

private static String createOpenStackFrameURL(String host) {
return String.format(Locale.US, "http://%s/open-stack-frame", host);
}

public String getDevServerBundleURL(final String jsModulePath) {
return createBundleURL(
jsModulePath,
Expand Down