Skip to content

Commit 2db3f51

Browse files
committed
Merge remote-tracking branch 'origin/main' into hoxyq-7103-repo-sync
2 parents 5b74d92 + 41bf86b commit 2db3f51

File tree

72 files changed

+654
-549
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+654
-549
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55

66
jobs:
77
build:
8-
runs-on: ubuntu-latest
8+
runs-on: ubuntu-22.04
99
steps:
1010
- uses: actions/checkout@v3
1111
with:

build

Submodule build updated from 7a8285c to e13953c

buildtools

Submodule buildtools updated from 3ef44a2 to 6f35929

config/gni/devtools_grd_files.gni

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ grd_files_release_sources = [
732732
"front_end/third_party/codemirror.next/chunk/codemirror.js",
733733
"front_end/third_party/codemirror.next/chunk/cpp.js",
734734
"front_end/third_party/codemirror.next/chunk/java.js",
735-
"front_end/third_party/codemirror.next/chunk/.js",
735+
"front_end/third_party/codemirror.next/chunk/legacy.js",
736736
"front_end/third_party/codemirror.next/chunk/less.js",
737737
"front_end/third_party/codemirror.next/chunk/markdown.js",
738738
"front_end/third_party/codemirror.next/chunk/php.js",
@@ -806,7 +806,7 @@ grd_files_release_sources = [
806806
"front_end/ui/legacy/components/source_frame/source_frame-meta.js",
807807
"front_end/ui/legacy/components/source_frame/source_frame.js",
808808
"front_end/ui/legacy/components/utils/utils.js",
809-
"front_end/ui/legacy/.js",
809+
"front_end/ui/legacy/legacy.js",
810810
"front_end/ui/legacy/theme_support/theme_support.js",
811811
"front_end/ui/lit/lit.js",
812812
"front_end/ui/visual_logging/visual_logging.js",
@@ -937,7 +937,6 @@ grd_files_debug_sources = [
937937
"front_end/core/sdk/PaintProfiler.js",
938938
"front_end/core/sdk/PerformanceMetricsModel.js",
939939
"front_end/core/sdk/PreloadingModel.js",
940-
"front_end/core/sdk/ProfileTreeModel.js",
941940
"front_end/core/sdk/ReactNativeApplicationModel.js",
942941
"front_end/core/sdk/RehydratingConnection.js",
943942
"front_end/core/sdk/RehydratingObject.js",
@@ -2578,18 +2577,14 @@ grd_files_debug_sources = [
25782577
"front_end/ui/legacy/infobar.css.js",
25792578
"front_end/ui/legacy/inlineButton.css.js",
25802579
"front_end/ui/legacy/inspectorCommon.css.js",
2581-
"front_end/ui/legacy/inspectorCommon.css.js",
2582-
"front_end/ui/legacy/inspectorSyntaxHighlight.css.js",
25832580
"front_end/ui/legacy/inspectorViewTabbedPane.css.js",
25842581
"front_end/ui/legacy/listWidget.css.js",
25852582
"front_end/ui/legacy/popover.css.js",
25862583
"front_end/ui/legacy/progressIndicator.css.js",
2587-
"front_end/ui/legacy/radioButton.css.js",
25882584
"front_end/ui/legacy/remoteDebuggingTerminatedScreen.css.js",
25892585
"front_end/ui/legacy/reportView.css.js",
25902586
"front_end/ui/legacy/rootView.css.js",
25912587
"front_end/ui/legacy/searchableView.css.js",
2592-
"front_end/ui/legacy/slider.css.js",
25932588
"front_end/ui/legacy/smallBubble.css.js",
25942589
"front_end/ui/legacy/softContextMenu.css.js",
25952590
"front_end/ui/legacy/softDropDown.css.js",
@@ -2598,9 +2593,7 @@ grd_files_debug_sources = [
25982593
"front_end/ui/legacy/suggestBox.css.js",
25992594
"front_end/ui/legacy/tabbedPane.css.js",
26002595
"front_end/ui/legacy/targetCrashedScreen.css.js",
2601-
"front_end/ui/legacy/textButton.css.js",
26022596
"front_end/ui/legacy/textPrompt.css.js",
2603-
"front_end/ui/legacy/themeColors.css.js",
26042597
"front_end/ui/legacy/theme_support/ThemeSupport.js",
26052598
"front_end/ui/legacy/toolbar.css.js",
26062599
"front_end/ui/legacy/treeoutline.css.js",

front_end/BUILD.gn

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,9 @@ node_action("html_entrypoints") {
7777
"js_app",
7878
"ndb_app",
7979
"node_app",
80-
<<<<<<< HEAD
8180
"rn_fusebox",
8281
"rn_inspector",
83-
=======
8482
"rehydrated_devtools_app",
85-
>>>>>>> chromedevtools/chromium/7103
8683
"worker_app",
8784
"device_mode_emulation_frame",
8885
]

front_end/core/common/ResourceType.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,13 @@ export const resourceCategories = {
392392
};
393393

394394
export const resourceCategoriesReactNative = {
395-
XHR: new ResourceCategory(i18nLazyString(UIStrings.fetchAndXHR), i18n.i18n.lockedLazyString('Fetch/XHR')),
396-
Script: new ResourceCategory(i18nLazyString(UIStrings.javascript), i18nLazyString(UIStrings.js)),
397-
Image: new ResourceCategory(i18nLazyString(UIStrings.image), i18nLazyString(UIStrings.img)),
398-
Media: new ResourceCategory(i18nLazyString(UIStrings.media), i18nLazyString(UIStrings.media)),
399-
Other: new ResourceCategory(i18nLazyString(UIStrings.other), i18nLazyString(UIStrings.other)),
395+
XHR: new ResourceCategory(
396+
'Fetch and XHR', i18nLazyString(UIStrings.fetchAndXHR), i18n.i18n.lockedLazyString('Fetch/XHR')),
397+
Script:
398+
new ResourceCategory(UIStrings.javascript, i18nLazyString(UIStrings.javascript), i18nLazyString(UIStrings.js)),
399+
Image: new ResourceCategory(UIStrings.image, i18nLazyString(UIStrings.image), i18nLazyString(UIStrings.img)),
400+
Media: new ResourceCategory(UIStrings.media, i18nLazyString(UIStrings.media), i18nLazyString(UIStrings.media)),
401+
Other: new ResourceCategory(UIStrings.other, i18nLazyString(UIStrings.other), i18nLazyString(UIStrings.other)),
400402
};
401403

402404
/**

front_end/core/host/InspectorFrontendHost.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,12 @@ function initializeInspectorFrontendHost(): void {
626626

627627
// Attach the events object.
628628
InspectorFrontendHostInstance.events = new Common.ObjectWrapper.ObjectWrapper();
629+
630+
// @ts-expect-error Global injected by the React Native DevTools shell.
631+
const {reactNativeDecorateInspectorFrontendHostInstance} = globalThis;
632+
if (typeof reactNativeDecorateInspectorFrontendHostInstance === 'function') {
633+
reactNativeDecorateInspectorFrontendHostInstance(InspectorFrontendHostInstance);
634+
}
629635
}
630636

631637
// FIXME: This file is included into both apps, since the devtools_app needs the InspectorFrontendHostAPI only,

front_end/core/host/RNPerfMetrics.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
// Use of this source code is governed by a BSD-style license that can be
44
// found in the LICENSE file.
55

6-
import {type ParsedURL} from '../common/ParsedURL.js';
6+
import type {ParsedURL} from '../common/ParsedURL.js';
77

8-
import {type DeveloperResourceLoaded} from './UserMetrics.js';
8+
import type {DeveloperResourceLoaded} from './UserMetrics.js';
99

1010
export type RNReliabilityEventListener = (event: DecoratedReactNativeChromeDevToolsEvent) => void;
1111

@@ -22,13 +22,13 @@ type PanelLocation = 'main'|'drawer';
2222
type UnsubscribeFn = () => void;
2323
class RNPerfMetrics {
2424
readonly #consoleErrorMethod = 'error';
25-
#listeners: Set<RNReliabilityEventListener> = new Set();
25+
#listeners = new Set<RNReliabilityEventListener>();
2626
#launchId: string|null = null;
2727
#appId: string|null = null;
2828
#entryPoint: EntryPoint = 'rn_inspector';
2929
#telemetryInfo: Object = {};
3030
// map of panel location to panel name
31-
#currentPanels: Map<PanelLocation, string> = new Map();
31+
#currentPanels = new Map<PanelLocation, string>();
3232

3333
addEventListener(listener: RNReliabilityEventListener): UnsubscribeFn {
3434
this.#listeners.add(listener);
@@ -295,7 +295,7 @@ function getPerfTimestamp(): DOMHighResTimeStamp {
295295

296296
function maybeTruncateDeveloperResourceUrl(parsedURL: ParsedURL): string {
297297
const {url} = parsedURL;
298-
return parsedURL.isHttpOrHttps() ? url : `${url.slice(0, 100)} …(omitted ${url.length - 100} characters)`;
298+
return parsedURL.scheme === 'http' || parsedURL.scheme === 'https' ? url : `${url.slice(0, 100)} …(omitted ${url.length - 100} characters)`;
299299
}
300300

301301
function maybeWrapError(baseMessage: string, error: unknown): [string, Error] {

front_end/core/rn_experiments/experimentsImpl.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ type RNExperimentPredicate = ({
5959
}: {
6060
isReactNativeEntryPoint: boolean,
6161
}) => boolean;
62-
type RNExperimentSpec = {
63-
name: RNExperimentName,
64-
title: string,
65-
unstable: boolean,
66-
docLink?: string,
67-
feedbackLink?: string,
68-
enabledByDefault?: boolean | RNExperimentPredicate,
69-
};
62+
interface RNExperimentSpec {
63+
name: RNExperimentName;
64+
title: string;
65+
unstable: boolean;
66+
docLink?: string;
67+
feedbackLink?: string;
68+
enabledByDefault?: boolean | RNExperimentPredicate;
69+
}
7070

7171
class RNExperiment {
7272
readonly name: RNExperimentName;
@@ -100,7 +100,7 @@ function normalizePredicate(
100100
}
101101

102102
class RNExperimentsSupport {
103-
#experiments: Map<Root.Runtime.RNExperimentName, RNExperiment> = new Map();
103+
#experiments = new Map<Root.Runtime.RNExperimentName, RNExperiment>();
104104
#defaultEnabledCoreExperiments = new Set<Root.Runtime.ExperimentName>();
105105

106106
register(spec: RNExperimentSpec): void {
@@ -142,7 +142,7 @@ class RNExperimentsSupport {
142142
}
143143
}
144144

145-
copyInto(other: Root.Runtime.ExperimentsSupport, titlePrefix: string = ''): void {
145+
copyInto(other: Root.Runtime.ExperimentsSupport, titlePrefix = ''): void {
146146
for (const [name, spec] of this.#experiments) {
147147
other.register(
148148
name,

front_end/core/root/Runtime.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,21 +302,18 @@ export class Experiment {
302302
export const experiments = new ExperimentsSupport();
303303

304304
// React Native-specific experiments, see rn_experiments.ts
305-
// eslint-disable-next-line rulesdir/const_enum
306305
export enum RNExperimentName {
307306
REACT_NATIVE_SPECIFIC_UI = 'react-native-specific-ui',
308307
JS_HEAP_PROFILER_ENABLE = 'js-heap-profiler-enable',
309308
ENABLE_PERFORMANCE_PANEL = 'enable-performance-panel',
310309
ENABLE_NETWORK_PANEL = 'enable-network-panel',
311310
}
312311

313-
// TODO(crbug.com/1167717): Make this a const enum again
314-
// eslint-disable-next-line rulesdir/const_enum
315312
export enum ConditionName {
316-
CAN_DOCK = 'can_dock',
317313
NOT_SOURCES_HIDE_ADD_FOLDER = '!sources.hide_add_folder',
318314
REACT_NATIVE_UNSTABLE_NETWORK_PANEL = 'unstable_enableNetworkPanel',
319315
}
316+
320317
export const enum ExperimentName {
321318
CAPTURE_NODE_CREATION_STACKS = 'capture-node-creation-stacks',
322319
CSS_OVERVIEW = 'css-overview',

front_end/core/sdk/Connections.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ export class WebSocketConnection implements ProtocolClient.InspectorBackend.Conn
8989
#socket: WebSocket|null;
9090
onMessage: ((arg0: (Object|string)) => void)|null;
9191
#onDisconnect: ((arg0: string) => void)|null;
92-
#onWebSocketDisconnect: ((connectionLostDetails?: {reason?: Platform.UIString.LocalizedString, code?: string, errorType?: string}) => void)|null;
92+
#onWebSocketDisconnect: ((connectionLostDetails?: {reason?: string, code?: string, errorType?: string}) => void)|null;
9393
#connected: boolean;
9494
#messages: string[];
9595
constructor(
9696
url: Platform.DevToolsPath.UrlString,
97-
onWebSocketDisconnect: (connectionLostDetails?: {reason?: Platform.UIString.LocalizedString, code?: string, errorType?: string}) => void) {
98-
97+
onWebSocketDisconnect: (connectionLostDetails?: {reason?: string, code?: string, errorType?: string}) => void) {
98+
9999
this.#socket = new WebSocket(url);
100100
this.#socket.onerror = this.onError.bind(this);
101101
this.#socket.onopen = this.onOpen.bind(this);
@@ -121,9 +121,9 @@ export class WebSocketConnection implements ProtocolClient.InspectorBackend.Conn
121121
this.#onDisconnect = onDisconnect;
122122
}
123123

124-
private onError(ev: Event): void {
124+
private onError(event: Event): void {
125125
if (this.#onWebSocketDisconnect) {
126-
this.#onWebSocketDisconnect.call(null, {reason: i18nString(UIStrings.websocketDisconnected)});
126+
this.#onWebSocketDisconnect.call(null, {reason: i18nString(UIStrings.websocketDisconnected), errorType: event.type});
127127
}
128128
if (this.#onDisconnect) {
129129
// This is called if error occurred while connecting.
@@ -143,9 +143,9 @@ export class WebSocketConnection implements ProtocolClient.InspectorBackend.Conn
143143
this.#messages = [];
144144
}
145145

146-
private onClose(ev: CloseEvent): void {
146+
private onClose(event: CloseEvent): void {
147147
if (this.#onWebSocketDisconnect) {
148-
this.#onWebSocketDisconnect.call(null, {reason: i18nString(UIStrings.websocketDisconnected)});
148+
this.#onWebSocketDisconnect.call(null, {reason: event.reason, code: String(event.code || 0)});
149149
}
150150
if (this.#onDisconnect) {
151151
this.#onDisconnect.call(null, 'websocket closed');
@@ -279,21 +279,29 @@ export class ParallelConnection implements ParallelConnectionInterface {
279279

280280
export async function initMainConnection(
281281
createRootTarget: () => Promise<void>,
282-
onConnectionLost: (connectionLostDetails?: {reason?: Platform.UIString.LocalizedString, code?: string, errorType?: string}) => void): Promise<void> {
282+
onConnectionLost: (connectionLostDetails?: {reason?: string, code?: string, errorType?: string}) => void): Promise<void> {
283283
ProtocolClient.InspectorBackend.Connection.setFactory(createMainConnection.bind(null, onConnectionLost));
284284
await createRootTarget();
285285
Host.InspectorFrontendHost.InspectorFrontendHostInstance.connectionReady();
286286
}
287287

288-
function createMainConnection(onConnectionLost: (connectionLostDetails?: {reason?: Platform.UIString.LocalizedString, code?: string, errorType?: string}) => void):
288+
function createMainConnection(onConnectionLost: (connectionLostDetails?: {reason?: string, code?: string, errorType?: string}) => void):
289289
ProtocolClient.InspectorBackend.Connection {
290290
if (Root.Runtime.getPathName().includes('rehydrated_devtools_app')) {
291291
return new RehydratingConnection(onConnectionLost);
292292
}
293293
const wsParam = Root.Runtime.Runtime.queryParam('ws');
294294
const wssParam = Root.Runtime.Runtime.queryParam('wss');
295295
if (wsParam || wssParam) {
296-
const ws = (wsParam ? `ws://${wsParam}` : `wss://${wssParam}`) as Platform.DevToolsPath.UrlString;
296+
const scheme = wsParam ? 'ws' : 'wss';
297+
// ws[s]Param is either:
298+
// 1. The hierarchical part of a URL (with the scheme and :// removed).
299+
// 2. A path-absolute URL (beginning with `/`) relative to the current host. This is only meaningful in hosted mode.
300+
let schemelessUrl = (wsParam ? wsParam : wssParam) as string;
301+
if (Host.InspectorFrontendHost.InspectorFrontendHostInstance.isHostedMode() && schemelessUrl.startsWith('/')) {
302+
schemelessUrl = `${window.location.host}${schemelessUrl}`;
303+
}
304+
const ws = `${scheme}://${schemelessUrl}` as Platform.DevToolsPath.UrlString;
297305
return new WebSocketConnection(ws, onConnectionLost);
298306
}
299307
if (Host.InspectorFrontendHost.InspectorFrontendHostInstance.isHostedMode()) {

front_end/core/sdk/ReactNativeApplicationModel.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
// Use of this source code is governed by a BSD-style license that can be
44
// found in the LICENSE file.
55

6+
import * as Host from '../../core/host/host.js';
67
import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
78
import type * as Protocol from '../../generated/protocol.js';
89

9-
import * as Host from '../../core/host/host.js';
10-
import {Capability, type Target} from './Target.js';
1110
import {SDKModel} from './SDKModel.js';
11+
import type {Target} from './Target.js';
1212

1313
export class ReactNativeApplicationModel extends SDKModel<EventTypes> implements ProtocolProxyApi.ReactNativeApplicationDispatcher {
1414
#enabled: boolean;
@@ -49,14 +49,14 @@ export class ReactNativeApplicationModel extends SDKModel<EventTypes> implements
4949

5050
metadataUpdated(metadata: Protocol.ReactNativeApplication.MetadataUpdatedEvent): void {
5151
this.metadataCached = metadata;
52-
this.dispatchEventToListeners(Events.MetadataUpdated, metadata);
52+
this.dispatchEventToListeners(Events.METADATA_UPDATED, metadata);
5353
}
5454
}
5555

5656
export const enum Events {
57-
MetadataUpdated = 'MetadataUpdated',
57+
METADATA_UPDATED = 'MetadataUpdated',
5858
}
5959

60-
export type EventTypes = {
61-
[Events.MetadataUpdated]: Protocol.ReactNativeApplication.MetadataUpdatedEvent,
62-
};
60+
export interface EventTypes {
61+
[Events.METADATA_UPDATED]: Protocol.ReactNativeApplication.MetadataUpdatedEvent;
62+
}

0 commit comments

Comments
 (0)