chrome-devtools-frontend 1.0.930109 → 1.0.930993
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/config/gni/devtools_grd_files.gni +2 -1
- package/front_end/core/host/InspectorFrontendHost.ts +8 -1
- package/front_end/core/host/InspectorFrontendHostAPI.ts +12 -0
- package/front_end/core/i18n/locales/en-US.json +3 -0
- package/front_end/core/i18n/locales/en-XL.json +3 -0
- package/front_end/core/protocol_client/InspectorBackend.ts +71 -71
- package/front_end/core/sdk/NetworkManager.ts +6 -2
- package/front_end/devtools_compatibility.js +8 -0
- package/front_end/legacy_test_runner/sources_test_runner/DebuggerTestRunner.js +2 -2
- package/front_end/legacy_test_runner/test_runner/TestRunner.js +2 -3
- package/front_end/models/bindings/BreakpointManager.ts +158 -154
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +64 -56
- package/front_end/models/bindings/CompilerScriptMapping.ts +70 -70
- package/front_end/models/bindings/ContentProviderBasedProject.ts +20 -20
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +132 -132
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +73 -72
- package/front_end/models/bindings/DefaultScriptMapping.ts +22 -22
- package/front_end/models/bindings/FileUtils.ts +81 -81
- package/front_end/models/bindings/IgnoreListManager.ts +17 -17
- package/front_end/models/bindings/LiveLocation.ts +21 -21
- package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +28 -28
- package/front_end/models/bindings/ResourceMapping.ts +50 -50
- package/front_end/models/bindings/ResourceScriptMapping.ts +71 -71
- package/front_end/models/bindings/SASSSourceMapping.ts +32 -32
- package/front_end/models/bindings/StylesSourceMapping.ts +57 -57
- package/front_end/models/bindings/TempFile.ts +34 -34
- package/front_end/models/emulation/DeviceModeModel.ts +208 -203
- package/front_end/models/emulation/EmulatedDevices.ts +34 -34
- package/front_end/panels/console/ConsoleView.ts +2 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +3 -3
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +133 -133
- package/front_end/panels/css_overview/CSSOverviewModel.ts +16 -16
- package/front_end/panels/css_overview/CSSOverviewPanel.ts +77 -77
- package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +5 -5
- package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +4 -4
- package/front_end/panels/elements/ElementsTreeElement.ts +6 -10
- package/front_end/panels/elements/ElementsTreeOutline.ts +3 -1
- package/front_end/panels/elements/components/LayoutPane.ts +6 -0
- package/front_end/panels/elements/elementsPanel.css +0 -1
- package/front_end/panels/elements/elementsTreeOutline.css +0 -4
- package/front_end/panels/lighthouse/LighthouseProtocolService.ts +7 -2
- package/front_end/panels/network/BlockedURLsPane.ts +8 -5
- package/front_end/panels/network/blockedURLsPane.css +0 -1
- package/front_end/panels/search/SearchView.ts +0 -2
- package/front_end/panels/sources/BreakpointEditDialog.ts +98 -81
- package/front_end/panels/sources/DebuggerPlugin.ts +15 -14
- package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +18 -2
- package/front_end/ui/components/text_editor/config.ts +6 -0
- package/front_end/ui/components/text_editor/cursor_tooltip.ts +70 -0
- package/front_end/ui/components/text_editor/javascript.ts +590 -0
- package/front_end/ui/components/text_editor/text_editor.ts +1 -0
- package/front_end/ui/components/text_editor/theme.ts +11 -0
- package/front_end/ui/components/tree_outline/TreeOutline.ts +3 -1
- package/front_end/ui/legacy/ARIAUtils.ts +24 -8
- package/front_end/ui/legacy/components/text_editor/cmdevtools.css +1 -0
- package/front_end/ui/legacy/components/text_editor/text_editor-legacy.ts +0 -3
- package/front_end/ui/legacy/components/text_editor/text_editor.ts +0 -2
- package/package.json +1 -1
- package/scripts/migration/class-fields/migrate.js +15 -2
- package/scripts/migration/class-fields/migrate.sh +10 -0
- package/front_end/ui/legacy/components/text_editor/SyntaxHighlighter.ts +0 -62
|
@@ -1423,6 +1423,8 @@ grd_files_debug_sources = [
|
|
|
1423
1423
|
"front_end/ui/components/survey_link/surveyLink.css.js",
|
|
1424
1424
|
"front_end/ui/components/text_editor/TextEditor.js",
|
|
1425
1425
|
"front_end/ui/components/text_editor/config.js",
|
|
1426
|
+
"front_end/ui/components/text_editor/cursor_tooltip.js",
|
|
1427
|
+
"front_end/ui/components/text_editor/javascript.js",
|
|
1426
1428
|
"front_end/ui/components/text_editor/theme.js",
|
|
1427
1429
|
"front_end/ui/components/text_prompt/TextPrompt.js",
|
|
1428
1430
|
"front_end/ui/components/text_prompt/textPrompt.css.js",
|
|
@@ -1554,7 +1556,6 @@ grd_files_debug_sources = [
|
|
|
1554
1556
|
"front_end/ui/legacy/components/source_frame/SourcesTextEditor.js",
|
|
1555
1557
|
"front_end/ui/legacy/components/source_frame/XMLView.js",
|
|
1556
1558
|
"front_end/ui/legacy/components/text_editor/CodeMirrorTextEditor.js",
|
|
1557
|
-
"front_end/ui/legacy/components/text_editor/SyntaxHighlighter.js",
|
|
1558
1559
|
"front_end/ui/legacy/components/text_editor/TextEditorAutocompleteController.js",
|
|
1559
1560
|
"front_end/ui/legacy/components/text_editor/cm_modes.js",
|
|
1560
1561
|
"front_end/ui/legacy/components/utils/ImagePreview.js",
|
|
@@ -36,7 +36,7 @@ import * as i18n from '../i18n/i18n.js';
|
|
|
36
36
|
import * as Platform from '../platform/platform.js';
|
|
37
37
|
import * as Root from '../root/root.js';
|
|
38
38
|
|
|
39
|
-
import type {CanShowSurveyResult, ContextMenuDescriptor, EnumeratedHistogram, EventTypes, ExtensionDescriptor, InspectorFrontendHostAPI, LoadNetworkResourceResult, ShowSurveyResult} from './InspectorFrontendHostAPI.js';
|
|
39
|
+
import type {CanShowSurveyResult, ContextMenuDescriptor, EnumeratedHistogram, EventTypes, ExtensionDescriptor, InspectorFrontendHostAPI, LoadNetworkResourceResult, ShowSurveyResult, SyncInformation} from './InspectorFrontendHostAPI.js';
|
|
40
40
|
import {EventDescriptors, Events} from './InspectorFrontendHostAPI.js';
|
|
41
41
|
import {streamWrite as resourceLoaderStreamWrite} from './ResourceLoader.js';
|
|
42
42
|
|
|
@@ -274,6 +274,13 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
|
|
|
274
274
|
window.localStorage.clear();
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
+
getSyncInformation(callback: (arg0: SyncInformation) => void): void {
|
|
278
|
+
callback({
|
|
279
|
+
isSyncActive: false,
|
|
280
|
+
arePreferencesSynced: false,
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
|
|
277
284
|
upgradeDraggedFileSystemPermissions(fileSystem: FileSystem): void {
|
|
278
285
|
}
|
|
279
286
|
|
|
@@ -238,6 +238,8 @@ export interface InspectorFrontendHostAPI {
|
|
|
238
238
|
|
|
239
239
|
clearPreferences(): void;
|
|
240
240
|
|
|
241
|
+
getSyncInformation(callback: (arg0: SyncInformation) => void): void;
|
|
242
|
+
|
|
241
243
|
upgradeDraggedFileSystemPermissions(fileSystem: FileSystem): void;
|
|
242
244
|
|
|
243
245
|
platform(): string;
|
|
@@ -322,6 +324,16 @@ export interface ShowSurveyResult {
|
|
|
322
324
|
export interface CanShowSurveyResult {
|
|
323
325
|
canShowSurvey: boolean;
|
|
324
326
|
}
|
|
327
|
+
export interface SyncInformation {
|
|
328
|
+
/** Whether Chrome Sync is enabled and active */
|
|
329
|
+
isSyncActive: boolean;
|
|
330
|
+
/** Whether syncing of Chrome Settings is enabled via Chrome Sync is enabled */
|
|
331
|
+
arePreferencesSynced: boolean;
|
|
332
|
+
/** The email of the account used for syncing */
|
|
333
|
+
accountEmail?: string;
|
|
334
|
+
/** The image of the account used for syncing. Its a base64 encoded PNG */
|
|
335
|
+
accountImage?: string;
|
|
336
|
+
}
|
|
325
337
|
|
|
326
338
|
/**
|
|
327
339
|
* Enum for recordPerformanceHistogram
|
|
@@ -4025,6 +4025,9 @@
|
|
|
4025
4025
|
"panels/elements/components/LayoutPane.ts | chooseElementOverlayColor": {
|
|
4026
4026
|
"message": "Choose the overlay color for this element"
|
|
4027
4027
|
},
|
|
4028
|
+
"panels/elements/components/LayoutPane.ts | colorPickerOpened": {
|
|
4029
|
+
"message": "Color picker opened."
|
|
4030
|
+
},
|
|
4028
4031
|
"panels/elements/components/LayoutPane.ts | flexbox": {
|
|
4029
4032
|
"message": "Flexbox"
|
|
4030
4033
|
},
|
|
@@ -4025,6 +4025,9 @@
|
|
|
4025
4025
|
"panels/elements/components/LayoutPane.ts | chooseElementOverlayColor": {
|
|
4026
4026
|
"message": "Ĉh́ôóŝé t̂h́ê óv̂ér̂ĺâý ĉól̂ór̂ f́ôŕ t̂h́îś êĺêḿêńt̂"
|
|
4027
4027
|
},
|
|
4028
|
+
"panels/elements/components/LayoutPane.ts | colorPickerOpened": {
|
|
4029
|
+
"message": "Ĉól̂ór̂ ṕîćk̂ér̂ óp̂én̂éd̂."
|
|
4030
|
+
},
|
|
4028
4031
|
"panels/elements/components/LayoutPane.ts | flexbox": {
|
|
4029
4032
|
"message": "F̂ĺêx́b̂óx̂"
|
|
4030
4033
|
},
|
|
@@ -98,14 +98,14 @@ interface CallbackWithDebugInfo {
|
|
|
98
98
|
|
|
99
99
|
export class InspectorBackend {
|
|
100
100
|
readonly agentPrototypes: Map<ProtocolDomainName, _AgentPrototype> = new Map();
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
#initialized: boolean = false;
|
|
102
|
+
#eventParameterNamesForDomain = new Map<ProtocolDomainName, EventParameterNames>();
|
|
103
103
|
|
|
104
104
|
private getOrCreateEventParameterNamesForDomain(domain: ProtocolDomainName): EventParameterNames {
|
|
105
|
-
let map = this
|
|
105
|
+
let map = this.#eventParameterNamesForDomain.get(domain);
|
|
106
106
|
if (!map) {
|
|
107
107
|
map = new Map();
|
|
108
|
-
this
|
|
108
|
+
this.#eventParameterNamesForDomain.set(domain, map);
|
|
109
109
|
}
|
|
110
110
|
return map;
|
|
111
111
|
}
|
|
@@ -115,7 +115,7 @@ export class InspectorBackend {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
getEventParamterNames(): ReadonlyMap<ProtocolDomainName, ReadonlyEventParameterNames> {
|
|
118
|
-
return this
|
|
118
|
+
return this.#eventParameterNamesForDomain;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
static reportProtocolError(error: string, messageObject: Object): void {
|
|
@@ -127,7 +127,7 @@ export class InspectorBackend {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
isInitialized(): boolean {
|
|
130
|
-
return this
|
|
130
|
+
return this.#initialized;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
private agentPrototype(domain: ProtocolDomainName): _AgentPrototype {
|
|
@@ -142,7 +142,7 @@ export class InspectorBackend {
|
|
|
142
142
|
registerCommand(method: QualifiedName, parameters: CommandParameter[], replyArgs: string[]): void {
|
|
143
143
|
const [domain, command] = splitQualifiedName(method);
|
|
144
144
|
this.agentPrototype(domain as ProtocolDomainName).registerCommand(command, parameters, replyArgs);
|
|
145
|
-
this
|
|
145
|
+
this.#initialized = true;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
registerEnum(type: QualifiedName, values: Object): void {
|
|
@@ -155,14 +155,14 @@ export class InspectorBackend {
|
|
|
155
155
|
|
|
156
156
|
// @ts-ignore Protocol global namespace pollution
|
|
157
157
|
Protocol[domain][name] = values;
|
|
158
|
-
this
|
|
158
|
+
this.#initialized = true;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
registerEvent(eventName: QualifiedName, params: string[]): void {
|
|
162
162
|
const domain = eventName.split('.')[0];
|
|
163
163
|
const eventParameterNames = this.getOrCreateEventParameterNamesForDomain(domain as ProtocolDomainName);
|
|
164
164
|
eventParameterNames.set(eventName, params);
|
|
165
|
-
this
|
|
165
|
+
this.#initialized = true;
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
|
|
@@ -238,34 +238,34 @@ export const test = {
|
|
|
238
238
|
const LongPollingMethods = new Set<string>(['CSS.takeComputedStyleUpdates']);
|
|
239
239
|
|
|
240
240
|
export class SessionRouter {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
241
|
+
readonly #connectionInternal: Connection;
|
|
242
|
+
#lastMessageId: number;
|
|
243
|
+
#pendingResponsesCount: number;
|
|
244
|
+
readonly #pendingLongPollingMessageIds: Set<number>;
|
|
245
|
+
readonly #sessions: Map<string, {
|
|
246
246
|
target: TargetBase,
|
|
247
247
|
callbacks: Map<number, CallbackWithDebugInfo>,
|
|
248
248
|
proxyConnection: ((Connection | undefined)|null),
|
|
249
249
|
}>;
|
|
250
|
-
|
|
250
|
+
#pendingScripts: (() => void)[];
|
|
251
251
|
|
|
252
252
|
constructor(connection: Connection) {
|
|
253
|
-
this
|
|
254
|
-
this
|
|
255
|
-
this
|
|
256
|
-
this
|
|
253
|
+
this.#connectionInternal = connection;
|
|
254
|
+
this.#lastMessageId = 1;
|
|
255
|
+
this.#pendingResponsesCount = 0;
|
|
256
|
+
this.#pendingLongPollingMessageIds = new Set();
|
|
257
257
|
|
|
258
|
-
this
|
|
258
|
+
this.#sessions = new Map();
|
|
259
259
|
|
|
260
|
-
this
|
|
260
|
+
this.#pendingScripts = [];
|
|
261
261
|
|
|
262
262
|
test.deprecatedRunAfterPendingDispatches = this.deprecatedRunAfterPendingDispatches.bind(this);
|
|
263
263
|
test.sendRawMessage = this.sendRawMessageForTesting.bind(this);
|
|
264
264
|
|
|
265
|
-
this
|
|
265
|
+
this.#connectionInternal.setOnMessage(this.onMessage.bind(this));
|
|
266
266
|
|
|
267
|
-
this
|
|
268
|
-
const session = this
|
|
267
|
+
this.#connectionInternal.setOnDisconnect(reason => {
|
|
268
|
+
const session = this.#sessions.get('');
|
|
269
269
|
if (session) {
|
|
270
270
|
session.target.dispose(reason);
|
|
271
271
|
}
|
|
@@ -276,7 +276,7 @@ export class SessionRouter {
|
|
|
276
276
|
// Only the Audits panel uses proxy connections. If it is ever possible to have multiple active at the
|
|
277
277
|
// same time, it should be tested thoroughly.
|
|
278
278
|
if (proxyConnection) {
|
|
279
|
-
for (const session of this
|
|
279
|
+
for (const session of this.#sessions.values()) {
|
|
280
280
|
if (session.proxyConnection) {
|
|
281
281
|
console.error('Multiple simultaneous proxy connections are currently unsupported');
|
|
282
282
|
break;
|
|
@@ -284,22 +284,22 @@ export class SessionRouter {
|
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
this
|
|
287
|
+
this.#sessions.set(sessionId, {target, callbacks: new Map(), proxyConnection});
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
unregisterSession(sessionId: string): void {
|
|
291
|
-
const session = this
|
|
291
|
+
const session = this.#sessions.get(sessionId);
|
|
292
292
|
if (!session) {
|
|
293
293
|
return;
|
|
294
294
|
}
|
|
295
295
|
for (const callback of session.callbacks.values()) {
|
|
296
296
|
SessionRouter.dispatchUnregisterSessionError(callback);
|
|
297
297
|
}
|
|
298
|
-
this
|
|
298
|
+
this.#sessions.delete(sessionId);
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
private getTargetBySessionId(sessionId: string): TargetBase|null {
|
|
302
|
-
const session = this
|
|
302
|
+
const session = this.#sessions.get(sessionId ? sessionId : '');
|
|
303
303
|
if (!session) {
|
|
304
304
|
return null;
|
|
305
305
|
}
|
|
@@ -307,11 +307,11 @@ export class SessionRouter {
|
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
private nextMessageId(): number {
|
|
310
|
-
return this
|
|
310
|
+
return this.#lastMessageId++;
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
connection(): Connection {
|
|
314
|
-
return this
|
|
314
|
+
return this.#connectionInternal;
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
sendMessage(sessionId: string, domain: string, method: QualifiedName, params: Object|null, callback: Callback): void {
|
|
@@ -339,17 +339,17 @@ export class SessionRouter {
|
|
|
339
339
|
this.getTargetBySessionId(sessionId));
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
++this
|
|
342
|
+
++this.#pendingResponsesCount;
|
|
343
343
|
if (LongPollingMethods.has(method)) {
|
|
344
|
-
this
|
|
344
|
+
this.#pendingLongPollingMessageIds.add(messageId);
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
-
const session = this
|
|
347
|
+
const session = this.#sessions.get(sessionId);
|
|
348
348
|
if (!session) {
|
|
349
349
|
return;
|
|
350
350
|
}
|
|
351
351
|
session.callbacks.set(messageId, {callback, method});
|
|
352
|
-
this
|
|
352
|
+
this.#connectionInternal.sendRawMessage(JSON.stringify(messageObject));
|
|
353
353
|
}
|
|
354
354
|
|
|
355
355
|
private sendRawMessageForTesting(method: QualifiedName, params: Object|null, callback: Callback|null): void {
|
|
@@ -371,7 +371,7 @@ export class SessionRouter {
|
|
|
371
371
|
|
|
372
372
|
// Send all messages to proxy connections.
|
|
373
373
|
let suppressUnknownMessageErrors = false;
|
|
374
|
-
for (const session of this
|
|
374
|
+
for (const session of this.#sessions.values()) {
|
|
375
375
|
if (!session.proxyConnection) {
|
|
376
376
|
continue;
|
|
377
377
|
}
|
|
@@ -387,7 +387,7 @@ export class SessionRouter {
|
|
|
387
387
|
}
|
|
388
388
|
|
|
389
389
|
const sessionId = messageObject.sessionId || '';
|
|
390
|
-
const session = this
|
|
390
|
+
const session = this.#sessions.get(sessionId);
|
|
391
391
|
if (!session) {
|
|
392
392
|
if (!suppressUnknownMessageErrors) {
|
|
393
393
|
InspectorBackend.reportProtocolError('Protocol Error: the message with wrong session id', messageObject);
|
|
@@ -415,10 +415,10 @@ export class SessionRouter {
|
|
|
415
415
|
}
|
|
416
416
|
|
|
417
417
|
callback.callback(messageObject.error || null, messageObject.result || null);
|
|
418
|
-
--this
|
|
419
|
-
this
|
|
418
|
+
--this.#pendingResponsesCount;
|
|
419
|
+
this.#pendingLongPollingMessageIds.delete(messageObject.id);
|
|
420
420
|
|
|
421
|
-
if (this
|
|
421
|
+
if (this.#pendingScripts.length && !this.hasOutstandingNonLongPollingRequests()) {
|
|
422
422
|
this.deprecatedRunAfterPendingDispatches();
|
|
423
423
|
}
|
|
424
424
|
} else {
|
|
@@ -433,12 +433,12 @@ export class SessionRouter {
|
|
|
433
433
|
}
|
|
434
434
|
|
|
435
435
|
private hasOutstandingNonLongPollingRequests(): boolean {
|
|
436
|
-
return this
|
|
436
|
+
return this.#pendingResponsesCount - this.#pendingLongPollingMessageIds.size > 0;
|
|
437
437
|
}
|
|
438
438
|
|
|
439
439
|
private deprecatedRunAfterPendingDispatches(script?: (() => void)): void {
|
|
440
440
|
if (script) {
|
|
441
|
-
this
|
|
441
|
+
this.#pendingScripts.push(script);
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
// Execute all promises.
|
|
@@ -453,8 +453,8 @@ export class SessionRouter {
|
|
|
453
453
|
|
|
454
454
|
private executeAfterPendingDispatches(): void {
|
|
455
455
|
if (!this.hasOutstandingNonLongPollingRequests()) {
|
|
456
|
-
const scripts = this
|
|
457
|
-
this
|
|
456
|
+
const scripts = this.#pendingScripts;
|
|
457
|
+
this.#pendingScripts = [];
|
|
458
458
|
for (let id = 0; id < scripts.length; ++id) {
|
|
459
459
|
scripts[id]();
|
|
460
460
|
}
|
|
@@ -502,8 +502,8 @@ export class TargetBase {
|
|
|
502
502
|
needsNodeJSPatching: boolean;
|
|
503
503
|
readonly sessionId: string;
|
|
504
504
|
routerInternal: SessionRouter|null;
|
|
505
|
-
|
|
506
|
-
|
|
505
|
+
#agents: AgentsMap = new Map();
|
|
506
|
+
#dispatchers: DispatcherMap = new Map();
|
|
507
507
|
|
|
508
508
|
constructor(
|
|
509
509
|
needsNodeJSPatching: boolean, parentTarget: TargetBase|null, sessionId: string, connection: Connection|null) {
|
|
@@ -530,17 +530,17 @@ export class TargetBase {
|
|
|
530
530
|
for (const [domain, agentPrototype] of inspectorBackend.agentPrototypes) {
|
|
531
531
|
const agent = Object.create((agentPrototype as _AgentPrototype));
|
|
532
532
|
agent.target = this;
|
|
533
|
-
this
|
|
533
|
+
this.#agents.set(domain, agent);
|
|
534
534
|
}
|
|
535
535
|
|
|
536
536
|
for (const [domain, eventParameterNames] of inspectorBackend.getEventParamterNames().entries()) {
|
|
537
|
-
this
|
|
537
|
+
this.#dispatchers.set(domain, new DispatcherManager(eventParameterNames));
|
|
538
538
|
}
|
|
539
539
|
}
|
|
540
540
|
|
|
541
541
|
dispatch(eventMessage: EventMessage): void {
|
|
542
542
|
const [domainName, method] = splitQualifiedName(eventMessage.method);
|
|
543
|
-
const dispatcher = this
|
|
543
|
+
const dispatcher = this.#dispatchers.get(domainName as ProtocolDomainName);
|
|
544
544
|
if (!dispatcher) {
|
|
545
545
|
InspectorBackend.reportProtocolError(
|
|
546
546
|
`Protocol Error: the message ${eventMessage.method} is for non-existing domain '${domainName}'`,
|
|
@@ -577,7 +577,7 @@ export class TargetBase {
|
|
|
577
577
|
* name, because if `Domain` allows multiple domains, the type is unsound.
|
|
578
578
|
*/
|
|
579
579
|
private getAgent<Domain extends ProtocolDomainName>(domain: Domain): ProtocolProxyApi.ProtocolApi[Domain] {
|
|
580
|
-
const agent = this
|
|
580
|
+
const agent = this.#agents.get<Domain>(domain);
|
|
581
581
|
if (!agent) {
|
|
582
582
|
throw new Error('Accessing undefined agent');
|
|
583
583
|
}
|
|
@@ -744,7 +744,7 @@ export class TargetBase {
|
|
|
744
744
|
*/
|
|
745
745
|
private registerDispatcher<Domain extends ProtocolDomainName>(
|
|
746
746
|
domain: Domain, dispatcher: ProtocolProxyApi.ProtocolDispatchers[Domain]): void {
|
|
747
|
-
const manager = this
|
|
747
|
+
const manager = this.#dispatchers.get(domain);
|
|
748
748
|
if (!manager) {
|
|
749
749
|
return;
|
|
750
750
|
}
|
|
@@ -757,7 +757,7 @@ export class TargetBase {
|
|
|
757
757
|
*/
|
|
758
758
|
private unregisterDispatcher<Domain extends ProtocolDomainName>(
|
|
759
759
|
domain: Domain, dispatcher: ProtocolProxyApi.ProtocolDispatchers[Domain]): void {
|
|
760
|
-
const manager = this
|
|
760
|
+
const manager = this.#dispatchers.get(domain);
|
|
761
761
|
if (!manager) {
|
|
762
762
|
return;
|
|
763
763
|
}
|
|
@@ -874,9 +874,9 @@ export class TargetBase {
|
|
|
874
874
|
}
|
|
875
875
|
|
|
876
876
|
/**
|
|
877
|
-
* This is a class that serves as the prototype for a domains agents (every target
|
|
878
|
-
* has it's own set of agents). The InspectorBackend keeps an instance of this class
|
|
879
|
-
* per domain, and each TargetBase creates its agents (via Object.create) and installs
|
|
877
|
+
* This is a class that serves as the prototype for a domains #agents (every target
|
|
878
|
+
* has it's own set of #agents). The InspectorBackend keeps an instance of this class
|
|
879
|
+
* per domain, and each TargetBase creates its #agents (via Object.create) and installs
|
|
880
880
|
* this instance as prototype.
|
|
881
881
|
*
|
|
882
882
|
* The reasons this is done is so that on the prototypes we can install the implementations
|
|
@@ -885,11 +885,11 @@ export class TargetBase {
|
|
|
885
885
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
886
886
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
887
887
|
class _AgentPrototype {
|
|
888
|
-
|
|
888
|
+
replyArgs: {
|
|
889
889
|
[x: string]: string[],
|
|
890
890
|
};
|
|
891
|
-
|
|
892
|
-
|
|
891
|
+
readonly domain: string;
|
|
892
|
+
target!: TargetBase;
|
|
893
893
|
constructor(domain: string) {
|
|
894
894
|
this.replyArgs = {};
|
|
895
895
|
this.domain = domain;
|
|
@@ -1020,46 +1020,46 @@ class _AgentPrototype {
|
|
|
1020
1020
|
}
|
|
1021
1021
|
|
|
1022
1022
|
/**
|
|
1023
|
-
* A `DispatcherManager` has a collection of dispatchers that implement one of the
|
|
1023
|
+
* A `DispatcherManager` has a collection of #dispatchers that implement one of the
|
|
1024
1024
|
* `ProtocolProxyApi.{Foo}Dispatcher` interfaces. Each target uses one of these per
|
|
1025
|
-
* domain to manage the registered dispatchers. The class knows the parameter names
|
|
1026
|
-
* of the events via
|
|
1025
|
+
* domain to manage the registered #dispatchers. The class knows the parameter names
|
|
1026
|
+
* of the events via `#eventArgs`, which is a map managed by the inspector back-end
|
|
1027
1027
|
* so that there is only one map per domain that is shared among all DispatcherManagers.
|
|
1028
1028
|
*/
|
|
1029
1029
|
class DispatcherManager<Domain extends ProtocolDomainName> {
|
|
1030
|
-
|
|
1031
|
-
|
|
1030
|
+
#eventArgs: ReadonlyEventParameterNames;
|
|
1031
|
+
#dispatchers: ProtocolProxyApi.ProtocolDispatchers[Domain][] = [];
|
|
1032
1032
|
|
|
1033
1033
|
constructor(eventArgs: ReadonlyEventParameterNames) {
|
|
1034
|
-
this
|
|
1034
|
+
this.#eventArgs = eventArgs;
|
|
1035
1035
|
}
|
|
1036
1036
|
|
|
1037
1037
|
addDomainDispatcher(dispatcher: ProtocolProxyApi.ProtocolDispatchers[Domain]): void {
|
|
1038
|
-
this
|
|
1038
|
+
this.#dispatchers.push(dispatcher);
|
|
1039
1039
|
}
|
|
1040
1040
|
|
|
1041
1041
|
removeDomainDispatcher(dispatcher: ProtocolProxyApi.ProtocolDispatchers[Domain]): void {
|
|
1042
|
-
const index = this
|
|
1042
|
+
const index = this.#dispatchers.indexOf(dispatcher);
|
|
1043
1043
|
if (index === -1) {
|
|
1044
1044
|
return;
|
|
1045
1045
|
}
|
|
1046
|
-
this
|
|
1046
|
+
this.#dispatchers.splice(index, 1);
|
|
1047
1047
|
}
|
|
1048
1048
|
|
|
1049
1049
|
dispatch(event: UnqualifiedName, messageObject: EventMessage): void {
|
|
1050
|
-
if (!this
|
|
1050
|
+
if (!this.#dispatchers.length) {
|
|
1051
1051
|
return;
|
|
1052
1052
|
}
|
|
1053
1053
|
|
|
1054
|
-
if (!this
|
|
1054
|
+
if (!this.#eventArgs.has(messageObject.method)) {
|
|
1055
1055
|
InspectorBackend.reportProtocolWarning(
|
|
1056
1056
|
`Protocol Warning: Attempted to dispatch an unspecified event '${messageObject.method}'`, messageObject);
|
|
1057
1057
|
return;
|
|
1058
1058
|
}
|
|
1059
1059
|
|
|
1060
1060
|
const messageParams = {...messageObject.params};
|
|
1061
|
-
for (let index = 0; index < this
|
|
1062
|
-
const dispatcher = this
|
|
1061
|
+
for (let index = 0; index < this.#dispatchers.length; ++index) {
|
|
1062
|
+
const dispatcher = this.#dispatchers[index];
|
|
1063
1063
|
|
|
1064
1064
|
if (event in dispatcher) {
|
|
1065
1065
|
const f = dispatcher[event as string as keyof ProtocolProxyApi.ProtocolDispatchers[Domain]];
|
|
@@ -418,8 +418,12 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
|
|
|
418
418
|
networkRequest.setUrl(response.url);
|
|
419
419
|
}
|
|
420
420
|
networkRequest.mimeType = (response.mimeType as MIME_TYPE);
|
|
421
|
-
networkRequest.statusCode
|
|
422
|
-
|
|
421
|
+
if (!networkRequest.statusCode) {
|
|
422
|
+
networkRequest.statusCode = response.status;
|
|
423
|
+
}
|
|
424
|
+
if (!networkRequest.statusText) {
|
|
425
|
+
networkRequest.statusText = response.statusText;
|
|
426
|
+
}
|
|
423
427
|
if (!networkRequest.hasExtraResponseInfo()) {
|
|
424
428
|
networkRequest.responseHeaders = this.headersMapToHeadersArray(response.headers);
|
|
425
429
|
}
|
|
@@ -562,6 +562,14 @@
|
|
|
562
562
|
DevToolsAPI.sendMessageToEmbedder('clearPreferences', [], null);
|
|
563
563
|
}
|
|
564
564
|
|
|
565
|
+
/**
|
|
566
|
+
* @override
|
|
567
|
+
* @param {!function(!InspectorFrontendHostAPI.SyncInformation):void} callback
|
|
568
|
+
*/
|
|
569
|
+
getSyncInformation(callback) {
|
|
570
|
+
DevToolsAPI.sendMessageToEmbedder('getSyncInformation', [], callback);
|
|
571
|
+
}
|
|
572
|
+
|
|
565
573
|
/**
|
|
566
574
|
* @override
|
|
567
575
|
* @param {string} origin
|
|
@@ -500,7 +500,7 @@ SourcesTestRunner.waitBreakpointSidebarPane = function(waitUntilResolved) {
|
|
|
500
500
|
}
|
|
501
501
|
|
|
502
502
|
for (const {breakpoint} of self.Bindings.breakpointManager.allBreakpointLocations()) {
|
|
503
|
-
if (breakpoint.
|
|
503
|
+
if (!breakpoint.bound() && breakpoint.enabled()) {
|
|
504
504
|
return SourcesTestRunner.waitBreakpointSidebarPane();
|
|
505
505
|
}
|
|
506
506
|
}
|
|
@@ -714,7 +714,7 @@ SourcesTestRunner.waitDebuggerPluginBreakpoints = function(sourceFrame) {
|
|
|
714
714
|
|
|
715
715
|
function checkIfReady() {
|
|
716
716
|
for (const {breakpoint} of self.Bindings.breakpointManager.allBreakpointLocations()) {
|
|
717
|
-
if (breakpoint.
|
|
717
|
+
if (!breakpoint.bound() && breakpoint.enabled()) {
|
|
718
718
|
return SourcesTestRunner.waitDebuggerPluginDecorations().then(checkIfReady);
|
|
719
719
|
}
|
|
720
720
|
}
|
|
@@ -10,7 +10,7 @@ import * as ProtocolClientModule from '../../core/protocol_client/protocol_clien
|
|
|
10
10
|
import * as Root from '../../core/root/root.js';
|
|
11
11
|
import * as Bindings from '../../models/bindings/bindings.js';
|
|
12
12
|
import * as Workspace from '../../models/workspace/workspace.js';
|
|
13
|
-
import * as
|
|
13
|
+
import * as CodeHighlighter from '../../ui/components/code_highlighter/code_highlighter.js';
|
|
14
14
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -1369,8 +1369,7 @@ export function url(url = '') {
|
|
|
1369
1369
|
export function dumpSyntaxHighlight(str, mimeType) {
|
|
1370
1370
|
const node = document.createElement('span');
|
|
1371
1371
|
node.textContent = str;
|
|
1372
|
-
|
|
1373
|
-
return javascriptSyntaxHighlighter.syntaxHighlightNode(node).then(dumpSyntax);
|
|
1372
|
+
return CodeHighlighter.CodeHighlighter.highlightNode(node, mimeType).then(dumpSyntax);
|
|
1374
1373
|
|
|
1375
1374
|
function dumpSyntax() {
|
|
1376
1375
|
const node_parts = [];
|