Skip to content

Commit

Permalink
Revert to built-in devToolsFrontendUrl in target list
Browse files Browse the repository at this point in the history
Summary:
Reverts external behaviour of facebook#39122.

- `/json/list` once again returns the built-in `devtools://devtools/bundled/js_app.html` URL — effectively freezing the current experience in Flipper.
- `/open-debugger` continues to use the *new* frontend via `getDevToolsFrontendUrl`.
    - *Eventually*, we'll want to align this as the returned `devtoolsFrontendUrl` value once Flipper is out of the picture.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D48868767

fbshipit-source-id: 26405f57e396c00957b5345dc21c4d8bd920edcf
  • Loading branch information
huntie authored and facebook-github-bot committed Aug 31, 2023
1 parent c66d570 commit 35b02a7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
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

0 comments on commit 35b02a7

Please sign in to comment.