Skip to content

Revert to built-in devToolsFrontendUrl in target list #39242

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions packages/dev-middleware/src/inspector-proxy/InspectorProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import type {IncomingMessage, ServerResponse} from 'http';

import url from 'url';
import WS from 'ws';
import getDevToolsFrontendUrl from '../utils/getDevToolsFrontendUrl';
import Device from './Device';

const debug = require('debug')('Metro:InspectorProxy');
Expand Down Expand Up @@ -116,12 +115,19 @@ export default class InspectorProxy {
const debuggerUrl = `${this._serverBaseUrl}${WS_DEBUGGER_URL}?device=${deviceId}&page=${page.id}`;
const webSocketDebuggerUrl = 'ws://' + debuggerUrl;

// For now, `/json/list` returns the legacy built-in `devtools://` URL, to
// preserve existing handling by Flipper. This may return a placeholder in
// future -- please use the `/open-debugger` endpoint.
const devtoolsFrontendUrl =
'devtools://devtools/bundled/js_app.html?experiments=true&v8only=true&ws=' +
encodeURIComponent(webSocketDebuggerUrl);

return {
id: `${deviceId}-${page.id}`,
description: page.app,
title: page.title,
faviconUrl: 'https://reactjs.org/favicon.ico',
devtoolsFrontendUrl: getDevToolsFrontendUrl(webSocketDebuggerUrl),
devtoolsFrontendUrl,
type: 'node',
webSocketDebuggerUrl,
vm: page.vm,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {Logger} from '../types/Logger';

import url from 'url';
import getDevServerUrl from '../utils/getDevServerUrl';
import getDevToolsFrontendUrl from '../utils/getDevToolsFrontendUrl';
import queryInspectorTargets from '../utils/queryInspectorTargets';

const debuggerInstances = new Map<string, ?LaunchedBrowser>();
Expand Down Expand Up @@ -83,7 +84,7 @@ export default function openDebuggerMiddleware({
debuggerInstances.set(
appId,
await browserLauncher.launchDebuggerAppWindow(
target.devtoolsFrontendUrl,
getDevToolsFrontendUrl(target.webSocketDebuggerUrl),
),
);
res.end();
Expand Down