chrome-devtools-frontend 1.0.1531367 → 1.0.1532884
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTHORS +3 -0
- package/front_end/core/platform/ArrayUtilities.ts +1 -1
- package/front_end/core/protocol_client/ConnectionTransport.ts +26 -0
- package/front_end/core/protocol_client/InspectorBackend.ts +24 -42
- package/front_end/core/protocol_client/protocol_client.ts +2 -10
- package/front_end/core/root/Runtime.ts +0 -2
- package/front_end/core/sdk/ChildTargetManager.ts +3 -3
- package/front_end/core/sdk/Connections.ts +8 -8
- package/front_end/core/sdk/NetworkManager.ts +20 -0
- package/front_end/core/sdk/RehydratingConnection.ts +6 -4
- package/front_end/core/sdk/Target.ts +2 -1
- package/front_end/core/sdk/TargetManager.ts +2 -1
- package/front_end/entrypoints/node_app/NodeMain.ts +1 -1
- package/front_end/generated/ARIAProperties.js +1301 -174
- package/front_end/generated/Deprecation.ts +7 -0
- package/front_end/generated/InspectorBackendCommands.js +1 -0
- package/front_end/generated/protocol-mapping.d.ts +4 -0
- package/front_end/generated/protocol-proxy-api.d.ts +5 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +1 -1
- package/front_end/models/issues_manager/AttributionReportingIssue.ts +4 -3
- package/front_end/models/issues_manager/BounceTrackingIssue.ts +4 -3
- package/front_end/models/issues_manager/ClientHintIssue.ts +4 -3
- package/front_end/models/issues_manager/ContentSecurityPolicyIssue.ts +4 -3
- package/front_end/models/issues_manager/CookieDeprecationMetadataIssue.ts +5 -3
- package/front_end/models/issues_manager/CookieIssue.ts +4 -4
- package/front_end/models/issues_manager/CorsIssue.ts +3 -3
- package/front_end/models/issues_manager/CrossOriginEmbedderPolicyIssue.ts +2 -1
- package/front_end/models/issues_manager/DeprecationIssue.ts +4 -3
- package/front_end/models/issues_manager/ElementAccessibilityIssue.ts +4 -3
- package/front_end/models/issues_manager/FederatedAuthRequestIssue.ts +4 -3
- package/front_end/models/issues_manager/GenericIssue.ts +3 -3
- package/front_end/models/issues_manager/HeavyAdIssue.ts +3 -3
- package/front_end/models/issues_manager/IssuesManager.ts +3 -3
- package/front_end/models/issues_manager/LowTextContrastIssue.ts +5 -3
- package/front_end/models/issues_manager/MixedContentIssue.ts +4 -3
- package/front_end/models/issues_manager/PartitioningBlobURLIssue.ts +5 -3
- package/front_end/models/issues_manager/PropertyRuleIssue.ts +4 -3
- package/front_end/models/issues_manager/QuirksModeIssue.ts +4 -3
- package/front_end/models/issues_manager/SRIMessageSignatureIssue.ts +5 -3
- package/front_end/models/issues_manager/SharedArrayBufferIssue.ts +5 -3
- package/front_end/models/issues_manager/SharedDictionaryIssue.ts +5 -3
- package/front_end/models/issues_manager/StylesheetLoadingIssue.ts +5 -3
- package/front_end/models/issues_manager/UnencodedDigestIssue.ts +5 -3
- package/front_end/models/issues_manager/UserReidentificationIssue.ts +4 -3
- package/front_end/models/javascript_metadata/NativeFunctions.js +1 -1
- package/front_end/models/trace/extras/TraceTree.ts +13 -3
- package/front_end/models/trace/insights/ForcedReflow.ts +1 -1
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +16 -3
- package/front_end/panels/console/ConsoleInsightTeaser.ts +40 -48
- package/front_end/panels/console/consoleInsightTeaser.css +13 -0
- package/front_end/panels/lighthouse/LighthousePanel.ts +1 -1
- package/front_end/panels/lighthouse/LighthouseProtocolService.ts +1 -1
- package/front_end/panels/network/{BlockedURLsPane.ts → RequestConditionsDrawer.ts} +78 -28
- package/front_end/panels/network/network-meta.ts +33 -9
- package/front_end/panels/network/network.ts +3 -3
- package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +18 -6
- package/front_end/panels/recorder/components/stepView.css +2 -2
- package/front_end/panels/sources/SourcesPanel.ts +10 -9
- package/front_end/panels/sources/SourcesSearchScope.ts +5 -0
- package/front_end/panels/timeline/TimelinePanel.ts +1 -2
- package/front_end/panels/timeline/TimingsTrackAppender.ts +10 -8
- package/front_end/panels/timeline/components/ExportTraceOptions.ts +2 -8
- package/front_end/panels/timeline/components/insights/ForcedReflow.ts +2 -2
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/HTTPRequest.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.js +20 -14
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Connection.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Connection.js +16 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Connection.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPRequest.js +2 -4
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Realm.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Request.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Request.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Request.js +30 -4
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Request.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js +18 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ExecutionContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ExecutionContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.js +2 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPResponse.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/JSHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/utils.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/utils.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +22 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/HTTPRequest.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.js +20 -14
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Connection.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Connection.js +16 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Connection.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPRequest.js +2 -4
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Request.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Request.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Request.js +31 -5
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Request.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js +18 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ExecutionContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ExecutionContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.js +2 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPResponse.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/JSHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/utils.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/utils.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/package.json +5 -4
- package/front_end/third_party/puppeteer/package/src/api/HTTPRequest.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/api/Page.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/bidi/Browser.ts +24 -14
- package/front_end/third_party/puppeteer/package/src/bidi/Connection.ts +16 -0
- package/front_end/third_party/puppeteer/package/src/bidi/HTTPRequest.ts +2 -4
- package/front_end/third_party/puppeteer/package/src/bidi/core/Request.ts +35 -5
- package/front_end/third_party/puppeteer/package/src/cdp/Accessibility.ts +20 -0
- package/front_end/third_party/puppeteer/package/src/cdp/ExecutionContext.ts +6 -2
- package/front_end/third_party/puppeteer/package/src/cdp/HTTPRequest.ts +2 -1
- package/front_end/third_party/puppeteer/package/src/cdp/HTTPResponse.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/cdp/JSHandle.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/cdp/utils.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/ui/components/tooltips/Tooltip.ts +5 -0
- package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +31 -5
- package/front_end/ui/legacy/components/utils/TargetDetachedDialog.ts +3 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
- package/package.json +1 -1
- /package/front_end/panels/network/{blockedURLsPane.css → requestConditionsDrawer.css} +0 -0
package/AUTHORS
CHANGED
|
@@ -65,6 +65,7 @@ Marijn Haverbeke <marijnh@gmail.com>
|
|
|
65
65
|
Max 😎 Coplan <mchcopl@gmail.com>
|
|
66
66
|
Michael Brüning <michael.bruning@qt.io>
|
|
67
67
|
Michael Rienstra <mrienstra@gmail.com>
|
|
68
|
+
Mostafa Aboalkasim <mostafa.aboalkasim.offical@gmail.com>
|
|
68
69
|
Muhammad Mahad <mahadtxt@gmail.com>
|
|
69
70
|
Naoto Ono <onoto1998@gmail.com>
|
|
70
71
|
Paras Awasthi <awasthiparas6@gmail.com>
|
|
@@ -80,6 +81,7 @@ Ross Wollman <ross.wollman@gmail.com>
|
|
|
80
81
|
Royi Hagigi <rhagigi@gmail.com>
|
|
81
82
|
Ryan Puhalovich <reanpuhalovich@gmail.com>
|
|
82
83
|
Ryuhei Shima <shimaryuhei@gmail.com>
|
|
84
|
+
Samuel Maddock <samuelmaddock@electronjs.org>
|
|
83
85
|
Satvic Dhawan <satvicdhawan14@gmail.com>
|
|
84
86
|
Sebastian Markbåge <sebastian@calyptus.eu>
|
|
85
87
|
Serg Kryvonos <sergeikrivonos@gmail.com>
|
|
@@ -93,6 +95,7 @@ Tony Kostowny <tonykostowny@gmail.com>
|
|
|
93
95
|
Toshiaki Tanaka <zokutyou2@gmail.com>
|
|
94
96
|
Tushar Singh <tusharvickey1999@gmail.com>
|
|
95
97
|
Varun Varada <varuncvarada@gmail.com>
|
|
98
|
+
Vishwa Kalubowila <vishwa.kalubowila@codimite.com>
|
|
96
99
|
Vitali Zaidman <vzaidman@gmail.com>
|
|
97
100
|
Will Hernandez <w.hernandez.code@gmail.com>
|
|
98
101
|
Yeol Park <peary2@gmail.com>
|
|
@@ -22,7 +22,7 @@ export const removeElement = <T>(array: T[], element: T, firstOnly?: boolean): b
|
|
|
22
22
|
|
|
23
23
|
type NumberComparator = (a: number, b: number) => number;
|
|
24
24
|
|
|
25
|
-
function swap(array:
|
|
25
|
+
export function swap<T>(array: T[], i1: number, i2: number): void {
|
|
26
26
|
const temp = array[i1];
|
|
27
27
|
array[i1] = array[i2];
|
|
28
28
|
array[i2] = temp;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright 2025 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
let connectionFactory: () => ConnectionTransport;
|
|
6
|
+
|
|
7
|
+
export abstract class ConnectionTransport {
|
|
8
|
+
declare onMessage: ((arg0: Object) => void)|null;
|
|
9
|
+
|
|
10
|
+
// on message from browser
|
|
11
|
+
abstract setOnMessage(onMessage: (arg0: Object|string) => void): void;
|
|
12
|
+
abstract setOnDisconnect(onDisconnect: (arg0: string) => void): void;
|
|
13
|
+
|
|
14
|
+
// send raw CDP message to browser
|
|
15
|
+
abstract sendRawMessage(message: string): void;
|
|
16
|
+
|
|
17
|
+
abstract disconnect(): Promise<void>;
|
|
18
|
+
|
|
19
|
+
static setFactory(factory: () => ConnectionTransport): void {
|
|
20
|
+
connectionFactory = factory;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static getFactory(): () => ConnectionTransport {
|
|
24
|
+
return connectionFactory;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
|
+
import * as InspectorBackendCommands from '../../generated/InspectorBackendCommands.js';
|
|
5
6
|
import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
|
|
6
7
|
import type * as Protocol from '../../generated/protocol.js';
|
|
7
8
|
import type * as Platform from '../platform/platform.js';
|
|
8
9
|
|
|
10
|
+
import {ConnectionTransport} from './ConnectionTransport.js';
|
|
9
11
|
import {NodeURL} from './NodeURL.js';
|
|
10
12
|
|
|
11
13
|
export const DevToolsStubErrorCode = -32015;
|
|
@@ -78,6 +80,15 @@ export class InspectorBackend {
|
|
|
78
80
|
readonly typeMap = new Map<QualifiedName, CommandParameter[]>();
|
|
79
81
|
readonly enumMap = new Map<QualifiedName, Record<string, string>>();
|
|
80
82
|
|
|
83
|
+
constructor() {
|
|
84
|
+
// Create the global here because registering commands will involve putting
|
|
85
|
+
// items onto the global.
|
|
86
|
+
// @ts-expect-error Global namespace instantiation
|
|
87
|
+
globalThis.Protocol ||= {};
|
|
88
|
+
|
|
89
|
+
InspectorBackendCommands.registerCommands(this);
|
|
90
|
+
}
|
|
91
|
+
|
|
81
92
|
private getOrCreateEventParameterNamesForDomain(domain: ProtocolDomainName): EventParameterNames {
|
|
82
93
|
let map = this.#eventParameterNamesForDomain.get(domain);
|
|
83
94
|
if (!map) {
|
|
@@ -150,35 +161,6 @@ export class InspectorBackend {
|
|
|
150
161
|
}
|
|
151
162
|
}
|
|
152
163
|
|
|
153
|
-
let connectionFactory: () => Connection;
|
|
154
|
-
|
|
155
|
-
export class Connection {
|
|
156
|
-
declare onMessage: ((arg0: Object) => void)|null;
|
|
157
|
-
|
|
158
|
-
// on message from browser
|
|
159
|
-
setOnMessage(_onMessage: (arg0: Object|string) => void): void {
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
setOnDisconnect(_onDisconnect: (arg0: string) => void): void {
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// send raw CDP message to browser
|
|
166
|
-
sendRawMessage(_message: string): void {
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
disconnect(): Promise<void> {
|
|
170
|
-
throw new Error('not implemented');
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
static setFactory(factory: () => Connection): void {
|
|
174
|
-
connectionFactory = factory;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
static getFactory(): () => Connection {
|
|
178
|
-
return connectionFactory;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
164
|
type SendRawMessageCallback = (...args: unknown[]) => void;
|
|
183
165
|
|
|
184
166
|
export const test = {
|
|
@@ -222,18 +204,18 @@ export const test = {
|
|
|
222
204
|
const LongPollingMethods = new Set<string>(['CSS.takeComputedStyleUpdates']);
|
|
223
205
|
|
|
224
206
|
export class SessionRouter {
|
|
225
|
-
readonly #connection:
|
|
207
|
+
readonly #connection: ConnectionTransport;
|
|
226
208
|
#lastMessageId = 1;
|
|
227
209
|
#pendingResponsesCount = 0;
|
|
228
210
|
readonly #pendingLongPollingMessageIds = new Set<number>();
|
|
229
211
|
readonly #sessions = new Map<string, {
|
|
230
212
|
target: TargetBase,
|
|
231
213
|
callbacks: Map<number, CallbackWithDebugInfo>,
|
|
232
|
-
proxyConnection:
|
|
214
|
+
proxyConnection: ConnectionTransport|undefined|null,
|
|
233
215
|
}>();
|
|
234
216
|
#pendingScripts: Array<() => void> = [];
|
|
235
217
|
|
|
236
|
-
constructor(connection:
|
|
218
|
+
constructor(connection: ConnectionTransport) {
|
|
237
219
|
this.#connection = connection;
|
|
238
220
|
|
|
239
221
|
test.deprecatedRunAfterPendingDispatches = this.deprecatedRunAfterPendingDispatches.bind(this);
|
|
@@ -249,7 +231,7 @@ export class SessionRouter {
|
|
|
249
231
|
});
|
|
250
232
|
}
|
|
251
233
|
|
|
252
|
-
registerSession(target: TargetBase, sessionId: string, proxyConnection?:
|
|
234
|
+
registerSession(target: TargetBase, sessionId: string, proxyConnection?: ConnectionTransport|null): void {
|
|
253
235
|
// Only the Audits panel uses proxy connections. If it is ever possible to have multiple active at the
|
|
254
236
|
// same time, it should be tested thoroughly.
|
|
255
237
|
if (proxyConnection) {
|
|
@@ -287,7 +269,7 @@ export class SessionRouter {
|
|
|
287
269
|
return this.#lastMessageId++;
|
|
288
270
|
}
|
|
289
271
|
|
|
290
|
-
connection():
|
|
272
|
+
connection(): ConnectionTransport {
|
|
291
273
|
return this.#connection;
|
|
292
274
|
}
|
|
293
275
|
|
|
@@ -367,9 +349,8 @@ export class SessionRouter {
|
|
|
367
349
|
const sessionId = messageObject.sessionId || '';
|
|
368
350
|
const session = this.#sessions.get(sessionId);
|
|
369
351
|
if (!session) {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
}
|
|
352
|
+
// In the DevTools MCP case, we may share the transport with puppeteer so we silently
|
|
353
|
+
// ignore unknown sessions.
|
|
373
354
|
return;
|
|
374
355
|
}
|
|
375
356
|
|
|
@@ -488,21 +469,22 @@ export class TargetBase {
|
|
|
488
469
|
#dispatchers: DispatcherMap = new Map();
|
|
489
470
|
|
|
490
471
|
constructor(
|
|
491
|
-
needsNodeJSPatching: boolean, parentTarget: TargetBase|null, sessionId: string,
|
|
472
|
+
needsNodeJSPatching: boolean, parentTarget: TargetBase|null, sessionId: string,
|
|
473
|
+
connection: ConnectionTransport|null) {
|
|
492
474
|
this.needsNodeJSPatching = needsNodeJSPatching;
|
|
493
475
|
this.sessionId = sessionId;
|
|
494
476
|
|
|
495
|
-
if (
|
|
496
|
-
throw new Error('
|
|
477
|
+
if (parentTarget && !sessionId) {
|
|
478
|
+
throw new Error('Specifying a parent target requires a session ID');
|
|
497
479
|
}
|
|
498
480
|
|
|
499
481
|
let router: SessionRouter;
|
|
500
|
-
if (
|
|
482
|
+
if (parentTarget && parentTarget.#router) {
|
|
501
483
|
router = parentTarget.#router;
|
|
502
484
|
} else if (connection) {
|
|
503
485
|
router = new SessionRouter(connection);
|
|
504
486
|
} else {
|
|
505
|
-
router = new SessionRouter(
|
|
487
|
+
router = new SessionRouter(ConnectionTransport.getFactory()());
|
|
506
488
|
}
|
|
507
489
|
|
|
508
490
|
this.#router = router;
|
|
@@ -2,20 +2,12 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
|
-
import * as
|
|
6
|
-
|
|
5
|
+
import * as ConnectionTransport from './ConnectionTransport.js';
|
|
7
6
|
import * as InspectorBackend from './InspectorBackend.js';
|
|
8
7
|
import * as NodeURL from './NodeURL.js';
|
|
9
8
|
|
|
10
9
|
export {
|
|
10
|
+
ConnectionTransport,
|
|
11
11
|
InspectorBackend,
|
|
12
12
|
NodeURL,
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
// Create the global here because registering commands will involve putting
|
|
16
|
-
// items onto the global.
|
|
17
|
-
// @ts-expect-error Global namespace instantiation
|
|
18
|
-
globalThis.Protocol = globalThis.Protocol || {};
|
|
19
|
-
|
|
20
|
-
// FIXME: This instance of InspectorBackend should not be a side effect of importing this module.
|
|
21
|
-
InspectorBackendCommands.registerCommands(InspectorBackend.inspectorBackend);
|
|
@@ -343,8 +343,6 @@ export const enum ExperimentName {
|
|
|
343
343
|
USE_SOURCE_MAP_SCOPES = 'use-source-map-scopes',
|
|
344
344
|
TIMELINE_SHOW_POST_MESSAGE_EVENTS = 'timeline-show-postmessage-events',
|
|
345
345
|
TIMELINE_DEBUG_MODE = 'timeline-debug-mode',
|
|
346
|
-
TIMELINE_ENHANCED_TRACES = 'timeline-enhanced-traces',
|
|
347
|
-
TIMELINE_COMPILED_SOURCES = 'timeline-compiled-sources',
|
|
348
346
|
// Adding or removing an entry from this enum?
|
|
349
347
|
// You will need to update:
|
|
350
348
|
// 1. REGISTERED_EXPERIMENTS in EnvironmentHelpers.ts (to create this experiment in the test env)
|
|
@@ -36,7 +36,7 @@ export class ChildTargetManager extends SDKModel<EventTypes> implements Protocol
|
|
|
36
36
|
readonly #targetInfos = new Map<Protocol.Target.TargetID, Protocol.Target.TargetInfo>();
|
|
37
37
|
readonly #childTargetsBySessionId = new Map<Protocol.Target.SessionID, Target>();
|
|
38
38
|
readonly #childTargetsById = new Map<Protocol.Target.TargetID|'main', Target>();
|
|
39
|
-
readonly #parallelConnections = new Map<string, ProtocolClient.
|
|
39
|
+
readonly #parallelConnections = new Map<string, ProtocolClient.ConnectionTransport.ConnectionTransport>();
|
|
40
40
|
#parentTargetId: Protocol.Target.TargetID|null = null;
|
|
41
41
|
|
|
42
42
|
constructor(parentTarget: Target) {
|
|
@@ -261,7 +261,7 @@ export class ChildTargetManager extends SDKModel<EventTypes> implements Protocol
|
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
async createParallelConnection(onMessage: (arg0: Object|string) => void):
|
|
264
|
-
Promise<{connection: ProtocolClient.
|
|
264
|
+
Promise<{connection: ProtocolClient.ConnectionTransport.ConnectionTransport, sessionId: string}> {
|
|
265
265
|
// The main Target id is actually just `main`, instead of the real targetId.
|
|
266
266
|
// Get the real id (requires an async operation) so that it can be used synchronously later.
|
|
267
267
|
const targetId = await this.getParentTargetId();
|
|
@@ -274,7 +274,7 @@ export class ChildTargetManager extends SDKModel<EventTypes> implements Protocol
|
|
|
274
274
|
|
|
275
275
|
private async createParallelConnectionAndSessionForTarget(target: Target, targetId: Protocol.Target.TargetID):
|
|
276
276
|
Promise<{
|
|
277
|
-
connection: ProtocolClient.
|
|
277
|
+
connection: ProtocolClient.ConnectionTransport.ConnectionTransport,
|
|
278
278
|
sessionId: string,
|
|
279
279
|
}> {
|
|
280
280
|
const targetAgent = target.targetAgent();
|
|
@@ -19,7 +19,7 @@ const UIStrings = {
|
|
|
19
19
|
} as const;
|
|
20
20
|
const str_ = i18n.i18n.registerUIStrings('core/sdk/Connections.ts', UIStrings);
|
|
21
21
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
22
|
-
export class MainConnection implements ProtocolClient.
|
|
22
|
+
export class MainConnection implements ProtocolClient.ConnectionTransport.ConnectionTransport {
|
|
23
23
|
onMessage: ((arg0: Object|string) => void)|null = null;
|
|
24
24
|
#onDisconnect: ((arg0: string) => void)|null = null;
|
|
25
25
|
#messageBuffer = '';
|
|
@@ -81,7 +81,7 @@ export class MainConnection implements ProtocolClient.InspectorBackend.Connectio
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
export class WebSocketConnection implements ProtocolClient.
|
|
84
|
+
export class WebSocketConnection implements ProtocolClient.ConnectionTransport.ConnectionTransport {
|
|
85
85
|
#socket: WebSocket|null;
|
|
86
86
|
onMessage: ((arg0: Object|string) => void)|null = null;
|
|
87
87
|
#onDisconnect: ((arg0: string) => void)|null = null;
|
|
@@ -176,7 +176,7 @@ export class WebSocketConnection implements ProtocolClient.InspectorBackend.Conn
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
export class StubConnection implements ProtocolClient.
|
|
179
|
+
export class StubConnection implements ProtocolClient.ConnectionTransport.ConnectionTransport {
|
|
180
180
|
onMessage: ((arg0: Object|string) => void)|null = null;
|
|
181
181
|
#onDisconnect: ((arg0: string) => void)|null = null;
|
|
182
182
|
|
|
@@ -213,17 +213,17 @@ export class StubConnection implements ProtocolClient.InspectorBackend.Connectio
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
export interface ParallelConnectionInterface extends ProtocolClient.
|
|
216
|
+
export interface ParallelConnectionInterface extends ProtocolClient.ConnectionTransport.ConnectionTransport {
|
|
217
217
|
getSessionId: () => string;
|
|
218
218
|
getOnDisconnect: () => ((arg0: string) => void) | null;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
export class ParallelConnection implements ParallelConnectionInterface {
|
|
222
|
-
readonly #connection: ProtocolClient.
|
|
222
|
+
readonly #connection: ProtocolClient.ConnectionTransport.ConnectionTransport;
|
|
223
223
|
#sessionId: string;
|
|
224
224
|
onMessage: ((arg0: Object) => void)|null = null;
|
|
225
225
|
#onDisconnect: ((arg0: string) => void)|null = null;
|
|
226
|
-
constructor(connection: ProtocolClient.
|
|
226
|
+
constructor(connection: ProtocolClient.ConnectionTransport.ConnectionTransport, sessionId: string) {
|
|
227
227
|
this.#connection = connection;
|
|
228
228
|
this.#sessionId = sessionId;
|
|
229
229
|
}
|
|
@@ -265,13 +265,13 @@ export class ParallelConnection implements ParallelConnectionInterface {
|
|
|
265
265
|
export async function initMainConnection(
|
|
266
266
|
createRootTarget: () => Promise<void>,
|
|
267
267
|
onConnectionLost: (message: Platform.UIString.LocalizedString) => void): Promise<void> {
|
|
268
|
-
ProtocolClient.
|
|
268
|
+
ProtocolClient.ConnectionTransport.ConnectionTransport.setFactory(createMainConnection.bind(null, onConnectionLost));
|
|
269
269
|
await createRootTarget();
|
|
270
270
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.connectionReady();
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
function createMainConnection(onConnectionLost: (message: Platform.UIString.LocalizedString) => void):
|
|
274
|
-
ProtocolClient.
|
|
274
|
+
ProtocolClient.ConnectionTransport.ConnectionTransport {
|
|
275
275
|
if (Root.Runtime.Runtime.isTraceApp()) {
|
|
276
276
|
return new RehydratingConnection(onConnectionLost);
|
|
277
277
|
}
|
|
@@ -1817,6 +1817,26 @@ export class RequestConditions extends Common.ObjectWrapper.ObjectWrapper<Reques
|
|
|
1817
1817
|
this.#conditionsChanged();
|
|
1818
1818
|
}
|
|
1819
1819
|
|
|
1820
|
+
decreasePriority(condition: RequestCondition): void {
|
|
1821
|
+
const index = this.#conditions.indexOf(condition);
|
|
1822
|
+
if (index < 0 || index >= this.#conditions.length - 1) {
|
|
1823
|
+
return;
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
Platform.ArrayUtilities.swap(this.#conditions, index, index + 1);
|
|
1827
|
+
this.dispatchEventToListeners(RequestConditions.Events.REQUEST_CONDITIONS_CHANGED);
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
increasePriority(condition: RequestCondition): void {
|
|
1831
|
+
const index = this.#conditions.indexOf(condition);
|
|
1832
|
+
if (index <= 0) {
|
|
1833
|
+
return;
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
Platform.ArrayUtilities.swap(this.#conditions, index - 1, index);
|
|
1837
|
+
this.dispatchEventToListeners(RequestConditions.Events.REQUEST_CONDITIONS_CHANGED);
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1820
1840
|
delete(condition: RequestCondition): void {
|
|
1821
1841
|
const index = this.#conditions.indexOf(condition);
|
|
1822
1842
|
if (index < 0) {
|
|
@@ -63,7 +63,7 @@ export const enum RehydratingConnectionState {
|
|
|
63
63
|
REHYDRATED = 3,
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export class RehydratingConnection implements ProtocolClient.
|
|
66
|
+
export class RehydratingConnection implements ProtocolClient.ConnectionTransport.ConnectionTransport {
|
|
67
67
|
rehydratingConnectionState: RehydratingConnectionState = RehydratingConnectionState.UNINITIALIZED;
|
|
68
68
|
onDisconnect: ((arg0: string) => void)|null = null;
|
|
69
69
|
onMessage: ((arg0: Object) => void)|null = null;
|
|
@@ -106,11 +106,13 @@ export class RehydratingConnection implements ProtocolClient.InspectorBackend.Co
|
|
|
106
106
|
|
|
107
107
|
#setupMessagePassing(): void {
|
|
108
108
|
this.#rehydratingWindow.addEventListener('message', this.#onReceiveHostWindowPayloadBound);
|
|
109
|
-
if (
|
|
109
|
+
if (this.#rehydratingWindow.opener) {
|
|
110
|
+
this.#rehydratingWindow.opener.postMessage({type: 'REHYDRATING_WINDOW_READY'});
|
|
111
|
+
} else if (this.#rehydratingWindow !== window.top) {
|
|
112
|
+
this.#rehydratingWindow.parent.postMessage({type: 'REHYDRATING_IFRAME_READY'});
|
|
113
|
+
} else {
|
|
110
114
|
this.#onConnectionLost(i18nString(UIStrings.noHostWindow));
|
|
111
|
-
return;
|
|
112
115
|
}
|
|
113
|
-
this.#rehydratingWindow.opener.postMessage({type: 'REHYDRATING_WINDOW_READY'});
|
|
114
116
|
}
|
|
115
117
|
|
|
116
118
|
/**
|
|
@@ -39,7 +39,8 @@ export class Target extends ProtocolClient.InspectorBackend.TargetBase {
|
|
|
39
39
|
constructor(
|
|
40
40
|
targetManager: TargetManager, id: Protocol.Target.TargetID|'main', name: string, type: Type,
|
|
41
41
|
parentTarget: Target|null, sessionId: string, suspended: boolean,
|
|
42
|
-
connection: ProtocolClient.
|
|
42
|
+
connection: ProtocolClient.ConnectionTransport.ConnectionTransport|null,
|
|
43
|
+
targetInfo?: Protocol.Target.TargetInfo) {
|
|
43
44
|
const needsNodeJSPatching = type === Type.NODE;
|
|
44
45
|
super(needsNodeJSPatching, parentTarget, sessionId, connection);
|
|
45
46
|
this.#targetManager = targetManager;
|
|
@@ -209,7 +209,8 @@ export class TargetManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes
|
|
|
209
209
|
|
|
210
210
|
createTarget(
|
|
211
211
|
id: Protocol.Target.TargetID|'main', name: string, type: TargetType, parentTarget: Target|null,
|
|
212
|
-
sessionId?: string, waitForDebuggerInPage?: boolean,
|
|
212
|
+
sessionId?: string, waitForDebuggerInPage?: boolean,
|
|
213
|
+
connection?: ProtocolClient.ConnectionTransport.ConnectionTransport,
|
|
213
214
|
targetInfo?: Protocol.Target.TargetInfo): Target {
|
|
214
215
|
const target = new Target(
|
|
215
216
|
this, id, name, type, parentTarget, sessionId || '', this.#isSuspended, connection || null, targetInfo);
|
|
@@ -146,7 +146,7 @@ export class NodeChildTargetManager extends SDK.SDKModel.SDKModel<void> implemen
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
export class NodeConnection implements ProtocolClient.
|
|
149
|
+
export class NodeConnection implements ProtocolClient.ConnectionTransport.ConnectionTransport {
|
|
150
150
|
readonly #targetAgent: ProtocolProxyApi.TargetApi;
|
|
151
151
|
readonly #sessionId: Protocol.Target.SessionID;
|
|
152
152
|
onMessage: ((arg0: Object|string) => void)|null;
|