chrome-devtools-frontend 1.0.927127 → 1.0.928589
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 +1 -0
- package/config/gni/all_devtools_files.gni +0 -1
- package/config/gni/devtools_grd_files.gni +30 -4
- package/config/gni/devtools_image_files.gni +1 -0
- package/front_end/Images/src/ic_preview_feature.svg +3 -0
- package/front_end/Tests.js +2 -3
- package/front_end/core/common/Settings.ts +26 -45
- package/front_end/core/host/UserMetrics.ts +2 -2
- package/front_end/core/i18n/locales/en-US.json +60 -15
- package/front_end/core/i18n/locales/en-XL.json +60 -15
- package/front_end/core/platform/keyboard-utilities.ts +1 -0
- package/front_end/core/root/Runtime.ts +62 -61
- package/front_end/core/sdk/AccessibilityModel.ts +73 -73
- package/front_end/core/sdk/CPUProfileDataModel.ts +14 -14
- package/front_end/core/sdk/CPUProfilerModel.ts +33 -33
- package/front_end/core/sdk/CPUThrottlingManager.ts +8 -8
- package/front_end/core/sdk/CSSFontFace.ts +10 -10
- package/front_end/core/sdk/CSSMatchedStyles.ts +114 -114
- package/front_end/core/sdk/CSSMedia.ts +22 -22
- package/front_end/core/sdk/CSSMetadata.ts +53 -49
- package/front_end/core/sdk/CSSModel.ts +139 -135
- package/front_end/core/sdk/CSSProperty.ts +18 -18
- package/front_end/core/sdk/CSSRule.ts +15 -15
- package/front_end/core/sdk/CSSStyleDeclaration.ts +49 -47
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +12 -12
- package/front_end/core/sdk/ChildTargetManager.ts +41 -40
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +10 -10
- package/front_end/core/sdk/Connections.ts +81 -81
- package/front_end/core/sdk/ConsoleModel.ts +68 -68
- package/front_end/core/sdk/Cookie.ts +48 -48
- package/front_end/core/sdk/CookieModel.ts +13 -13
- package/front_end/core/sdk/CookieParser.ts +45 -45
- package/front_end/core/sdk/DOMDebuggerModel.ts +131 -131
- package/front_end/core/sdk/DOMModel.ts +264 -252
- package/front_end/core/sdk/DebuggerModel.ts +209 -205
- package/front_end/core/sdk/EmulationModel.ts +76 -76
- package/front_end/core/sdk/FilmStripModel.ts +29 -29
- package/front_end/core/sdk/FrameManager.ts +43 -42
- package/front_end/core/sdk/HeapProfilerModel.ts +36 -36
- package/front_end/core/sdk/IsolateManager.ts +82 -82
- package/front_end/core/sdk/IssuesModel.ts +6 -6
- package/front_end/core/sdk/LayerTreeBase.ts +37 -37
- package/front_end/core/sdk/LogModel.ts +5 -5
- package/front_end/core/sdk/NetworkManager.ts +229 -225
- package/front_end/core/sdk/NetworkRequest.ts +368 -360
- package/front_end/core/sdk/OverlayColorGenerator.ts +9 -9
- package/front_end/core/sdk/OverlayModel.ts +155 -153
- package/front_end/core/sdk/OverlayPersistentHighlighter.ts +100 -101
- package/front_end/core/sdk/PageResourceLoader.ts +30 -30
- package/front_end/core/sdk/PaintProfiler.ts +16 -16
- package/front_end/core/sdk/PerformanceMetricsModel.ts +12 -12
- package/front_end/core/sdk/ProfileTreeModel.ts +3 -3
- package/front_end/core/sdk/RemoteObject.ts +108 -104
- package/front_end/core/sdk/Resource.ts +85 -84
- package/front_end/core/sdk/ResourceTreeModel.ts +150 -145
- package/front_end/core/sdk/RuntimeModel.ts +38 -34
- package/front_end/core/sdk/SDKModel.ts +3 -3
- package/front_end/core/sdk/ScreenCaptureModel.ts +19 -19
- package/front_end/core/sdk/Script.ts +29 -29
- package/front_end/core/sdk/SecurityOriginManager.ts +19 -19
- package/front_end/core/sdk/ServerTiming.ts +2 -2
- package/front_end/core/sdk/ServiceWorkerCacheModel.ts +43 -43
- package/front_end/core/sdk/ServiceWorkerManager.ts +72 -68
- package/front_end/core/sdk/SourceMap.ts +40 -36
- package/front_end/core/sdk/SourceMapManager.ts +57 -57
- package/front_end/core/sdk/Target.ts +64 -63
- package/front_end/core/sdk/TargetManager.ts +60 -56
- package/front_end/core/sdk/TracingManager.ts +39 -39
- package/front_end/core/sdk/TracingModel.ts +125 -125
- package/front_end/core/sdk/WebAuthnModel.ts +9 -9
- package/front_end/entrypoints/lighthouse_worker/{LighthouseService.js → LighthouseService.ts} +20 -45
- package/front_end/entrypoints/lighthouse_worker/{lighthouse_worker.js → lighthouse_worker.ts} +0 -0
- package/front_end/entrypoints/main/MainImpl.ts +7 -2
- package/front_end/legacy_test_runner/elements_test_runner/ElementsTestRunner.js +4 -4
- package/front_end/legacy_test_runner/sdk_test_runner/sdk_test_runner.js +1 -1
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -6
- package/front_end/models/issues_manager/GenericIssue.ts +86 -0
- package/front_end/models/issues_manager/Issue.ts +24 -0
- package/front_end/models/issues_manager/IssuesManager.ts +18 -6
- package/front_end/models/issues_manager/descriptions/genericCrossOriginPortalPostMessageError.md +3 -0
- package/front_end/models/issues_manager/issues_manager.ts +2 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +5422 -1
- package/front_end/panels/console/ConsoleSidebar.ts +0 -3
- package/front_end/panels/elements/ElementsTreeElement.ts +53 -61
- package/front_end/panels/elements/ElementsTreeOutline.ts +0 -1
- package/front_end/panels/elements/components/LayoutPane.ts +5 -1
- package/front_end/panels/issues/GenericIssueDetailsView.ts +68 -0
- package/front_end/panels/issues/IssueAggregator.ts +16 -0
- package/front_end/panels/issues/IssueKindView.ts +95 -0
- package/front_end/panels/issues/IssueView.ts +6 -0
- package/front_end/panels/issues/IssuesPane.ts +81 -18
- package/front_end/panels/issues/issuesTree.css +8 -3
- package/front_end/panels/lighthouse/LighthouseController.ts +3 -1
- package/front_end/panels/network/NetworkItemView.ts +1 -1
- package/front_end/panels/network/networkLogView.css +5 -0
- package/front_end/panels/sensors/LocationsSettingsTab.ts +1 -1
- package/front_end/panels/settings/SettingsScreen.ts +1 -0
- package/front_end/panels/settings/settingsScreen.css +24 -0
- package/front_end/panels/snippets/SnippetsQuickOpen.ts +8 -3
- package/front_end/panels/sources/TabbedEditorContainer.ts +1 -1
- package/front_end/panels/sources/sources-meta.ts +22 -7
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +4 -4
- package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +137 -0
- package/front_end/ui/components/code_highlighter/codeHighlighter.css +51 -0
- package/front_end/ui/components/code_highlighter/code_highlighter.ts +11 -0
- package/front_end/ui/components/docs/text_editor/basic.html +28 -0
- package/front_end/ui/components/docs/text_editor/basic.ts +14 -0
- package/front_end/ui/components/docs/text_prompt/basic.html +35 -0
- package/front_end/ui/components/docs/text_prompt/basic.ts +19 -0
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +1 -0
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +17 -0
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -0
- package/front_end/ui/components/text_editor/TextEditor.ts +161 -0
- package/front_end/ui/components/text_editor/config.ts +264 -0
- package/front_end/{panels/console/components/components.ts → ui/components/text_editor/text_editor.ts} +2 -5
- package/front_end/ui/components/text_editor/theme.ts +113 -0
- package/front_end/ui/components/text_prompt/TextPrompt.ts +144 -0
- package/front_end/ui/components/text_prompt/textPrompt.css +33 -0
- package/front_end/ui/components/text_prompt/text_prompt.ts +9 -0
- package/front_end/ui/legacy/ARIAUtils.ts +14 -11
- package/front_end/ui/legacy/TabbedPane.ts +32 -3
- package/front_end/ui/legacy/UIUtils.ts +3 -1
- package/front_end/ui/legacy/View.ts +6 -0
- package/front_end/ui/legacy/ViewManager.ts +5 -1
- package/front_end/ui/legacy/ViewRegistration.ts +5 -0
- package/front_end/ui/legacy/XLink.ts +1 -1
- package/front_end/ui/legacy/closeButton.css +6 -0
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +8 -3
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +38 -38
- package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +10 -4
- package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +23 -6
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +14 -16
- package/front_end/ui/legacy/filter.css +1 -0
- package/front_end/ui/legacy/tabbedPane.css +24 -0
- package/front_end/ui/legacy/toolbar.css +5 -0
- package/inspector_overlay/main.ts +2 -1
- package/inspector_overlay/tool_screenshot.ts +8 -1
- package/package.json +1 -1
- package/scripts/build/rollup.config.js +9 -0
- package/scripts/migration/class-fields/migrate.js +56 -0
- package/scripts/migration/class-fields/package.json +5 -0
- package/front_end/panels/console/components/SidebarDeprecation.ts +0 -58
- package/front_end/panels/console/components/sidebarDeprecation.css +0 -17
|
@@ -198,30 +198,30 @@ const str_ = i18n.i18n.registerUIStrings('core/sdk/DOMDebuggerModel.ts', UIStrin
|
|
|
198
198
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
199
199
|
export class DOMDebuggerModel extends SDKModel<EventTypes> {
|
|
200
200
|
readonly agent: ProtocolProxyApi.DOMDebuggerApi;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
201
|
+
readonly #runtimeModelInternal: RuntimeModel;
|
|
202
|
+
#domModel: DOMModel;
|
|
203
|
+
#domBreakpointsInternal: DOMBreakpoint[];
|
|
204
|
+
readonly #domBreakpointsSetting: Common.Settings
|
|
205
205
|
.Setting<{url: string, path: string, type: Protocol.DOMDebugger.DOMBreakpointType, enabled: boolean}[]>;
|
|
206
206
|
suspended = false;
|
|
207
207
|
|
|
208
208
|
constructor(target: Target) {
|
|
209
209
|
super(target);
|
|
210
210
|
this.agent = target.domdebuggerAgent();
|
|
211
|
-
this
|
|
212
|
-
this
|
|
213
|
-
this
|
|
214
|
-
this
|
|
215
|
-
|
|
216
|
-
this
|
|
217
|
-
this
|
|
218
|
-
if (this
|
|
211
|
+
this.#runtimeModelInternal = (target.model(RuntimeModel) as RuntimeModel);
|
|
212
|
+
this.#domModel = (target.model(DOMModel) as DOMModel);
|
|
213
|
+
this.#domModel.addEventListener(DOMModelEvents.DocumentUpdated, this.documentUpdated, this);
|
|
214
|
+
this.#domModel.addEventListener(DOMModelEvents.NodeRemoved, this.nodeRemoved, this);
|
|
215
|
+
|
|
216
|
+
this.#domBreakpointsInternal = [];
|
|
217
|
+
this.#domBreakpointsSetting = Common.Settings.Settings.instance().createLocalSetting('domBreakpoints', []);
|
|
218
|
+
if (this.#domModel.existingDocument()) {
|
|
219
219
|
this.documentUpdated();
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
runtimeModel(): RuntimeModel {
|
|
224
|
-
return this
|
|
224
|
+
return this.#runtimeModelInternal;
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
async suspendModel(): Promise<void> {
|
|
@@ -233,7 +233,7 @@ export class DOMDebuggerModel extends SDKModel<EventTypes> {
|
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
async eventListeners(remoteObject: RemoteObject): Promise<EventListener[]> {
|
|
236
|
-
console.assert(remoteObject.runtimeModel() === this
|
|
236
|
+
console.assert(remoteObject.runtimeModel() === this.#runtimeModelInternal);
|
|
237
237
|
if (!remoteObject.objectId) {
|
|
238
238
|
return [];
|
|
239
239
|
}
|
|
@@ -241,41 +241,41 @@ export class DOMDebuggerModel extends SDKModel<EventTypes> {
|
|
|
241
241
|
const listeners = await this.agent.invoke_getEventListeners({objectId: remoteObject.objectId});
|
|
242
242
|
const eventListeners = [];
|
|
243
243
|
for (const payload of listeners.listeners || []) {
|
|
244
|
-
const location = this
|
|
244
|
+
const location = this.#runtimeModelInternal.debuggerModel().createRawLocationByScriptId(
|
|
245
245
|
payload.scriptId, payload.lineNumber, payload.columnNumber);
|
|
246
246
|
if (!location) {
|
|
247
247
|
continue;
|
|
248
248
|
}
|
|
249
249
|
eventListeners.push(new EventListener(
|
|
250
250
|
this, remoteObject, payload.type, payload.useCapture, payload.passive, payload.once,
|
|
251
|
-
payload.handler ? this
|
|
252
|
-
payload.originalHandler ? this
|
|
251
|
+
payload.handler ? this.#runtimeModelInternal.createRemoteObject(payload.handler) : null,
|
|
252
|
+
payload.originalHandler ? this.#runtimeModelInternal.createRemoteObject(payload.originalHandler) : null,
|
|
253
253
|
location, null));
|
|
254
254
|
}
|
|
255
255
|
return eventListeners;
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
retrieveDOMBreakpoints(): void {
|
|
259
|
-
this
|
|
259
|
+
this.#domModel.requestDocument();
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
domBreakpoints(): DOMBreakpoint[] {
|
|
263
|
-
return this
|
|
263
|
+
return this.#domBreakpointsInternal.slice();
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
hasDOMBreakpoint(node: DOMNode, type: Protocol.DOMDebugger.DOMBreakpointType): boolean {
|
|
267
|
-
return this
|
|
267
|
+
return this.#domBreakpointsInternal.some(breakpoint => (breakpoint.node === node && breakpoint.type === type));
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
setDOMBreakpoint(node: DOMNode, type: Protocol.DOMDebugger.DOMBreakpointType): DOMBreakpoint {
|
|
271
|
-
for (const breakpoint of this
|
|
271
|
+
for (const breakpoint of this.#domBreakpointsInternal) {
|
|
272
272
|
if (breakpoint.node === node && breakpoint.type === type) {
|
|
273
273
|
this.toggleDOMBreakpoint(breakpoint, true);
|
|
274
274
|
return breakpoint;
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
const breakpoint = new DOMBreakpoint(this, node, type, true);
|
|
278
|
-
this
|
|
278
|
+
this.#domBreakpointsInternal.push(breakpoint);
|
|
279
279
|
this.saveDOMBreakpoints();
|
|
280
280
|
this.enableDOMBreakpoint(breakpoint);
|
|
281
281
|
this.dispatchEventToListeners(Events.DOMBreakpointAdded, breakpoint);
|
|
@@ -318,7 +318,7 @@ export class DOMDebuggerModel extends SDKModel<EventTypes> {
|
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
private nodeHasBreakpoints(node: DOMNode): boolean {
|
|
321
|
-
for (const breakpoint of this
|
|
321
|
+
for (const breakpoint of this.#domBreakpointsInternal) {
|
|
322
322
|
if (breakpoint.node === node && breakpoint.enabled) {
|
|
323
323
|
return true;
|
|
324
324
|
}
|
|
@@ -338,7 +338,7 @@ export class DOMDebuggerModel extends SDKModel<EventTypes> {
|
|
|
338
338
|
insertion: boolean,
|
|
339
339
|
}|null {
|
|
340
340
|
const type = auxData['type'];
|
|
341
|
-
const node = this
|
|
341
|
+
const node = this.#domModel.nodeForId(auxData['nodeId']);
|
|
342
342
|
if (!type || !node) {
|
|
343
343
|
return null;
|
|
344
344
|
}
|
|
@@ -346,13 +346,13 @@ export class DOMDebuggerModel extends SDKModel<EventTypes> {
|
|
|
346
346
|
let insertion = false;
|
|
347
347
|
if (type === Protocol.DOMDebugger.DOMBreakpointType.SubtreeModified) {
|
|
348
348
|
insertion = auxData['insertion'] || false;
|
|
349
|
-
targetNode = this
|
|
349
|
+
targetNode = this.#domModel.nodeForId(auxData['targetNodeId']);
|
|
350
350
|
}
|
|
351
351
|
return {type: type, node: node, targetNode: targetNode, insertion: insertion};
|
|
352
352
|
}
|
|
353
353
|
|
|
354
354
|
private currentURL(): string {
|
|
355
|
-
const domDocument = this
|
|
355
|
+
const domDocument = this.#domModel.existingDocument();
|
|
356
356
|
return domDocument ? domDocument.documentURL : '';
|
|
357
357
|
}
|
|
358
358
|
|
|
@@ -360,8 +360,8 @@ export class DOMDebuggerModel extends SDKModel<EventTypes> {
|
|
|
360
360
|
if (this.suspended) {
|
|
361
361
|
return;
|
|
362
362
|
}
|
|
363
|
-
const removed = this
|
|
364
|
-
this
|
|
363
|
+
const removed = this.#domBreakpointsInternal;
|
|
364
|
+
this.#domBreakpointsInternal = [];
|
|
365
365
|
this.dispatchEventToListeners(Events.DOMBreakpointsRemoved, removed);
|
|
366
366
|
|
|
367
367
|
// this.currentURL() is empty when the page is reloaded because the
|
|
@@ -369,11 +369,11 @@ export class DOMDebuggerModel extends SDKModel<EventTypes> {
|
|
|
369
369
|
// removed. Therefore, we need to request the document and wait for it.
|
|
370
370
|
// Note that requestDocument() caches the document so that it is requested
|
|
371
371
|
// only once.
|
|
372
|
-
const document = await this
|
|
372
|
+
const document = await this.#domModel.requestDocument();
|
|
373
373
|
const currentURL = document ? document.documentURL : '';
|
|
374
|
-
for (const breakpoint of this
|
|
374
|
+
for (const breakpoint of this.#domBreakpointsSetting.get()) {
|
|
375
375
|
if (breakpoint.url === currentURL) {
|
|
376
|
-
this
|
|
376
|
+
this.#domModel.pushNodeByPathToFrontend(breakpoint.path).then(appendBreakpoint.bind(this, breakpoint));
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
|
|
@@ -383,12 +383,12 @@ export class DOMDebuggerModel extends SDKModel<EventTypes> {
|
|
|
383
383
|
enabled: boolean,
|
|
384
384
|
},
|
|
385
385
|
nodeId: Protocol.DOM.NodeId|null): void {
|
|
386
|
-
const node = nodeId ? this
|
|
386
|
+
const node = nodeId ? this.#domModel.nodeForId(nodeId) : null;
|
|
387
387
|
if (!node) {
|
|
388
388
|
return;
|
|
389
389
|
}
|
|
390
390
|
const domBreakpoint = new DOMBreakpoint(this, node, breakpoint.type, breakpoint.enabled);
|
|
391
|
-
this
|
|
391
|
+
this.#domBreakpointsInternal.push(domBreakpoint);
|
|
392
392
|
if (breakpoint.enabled) {
|
|
393
393
|
this.enableDOMBreakpoint(domBreakpoint);
|
|
394
394
|
}
|
|
@@ -399,7 +399,7 @@ export class DOMDebuggerModel extends SDKModel<EventTypes> {
|
|
|
399
399
|
private removeDOMBreakpoints(filter: (arg0: DOMBreakpoint) => boolean): void {
|
|
400
400
|
const removed = [];
|
|
401
401
|
const left = [];
|
|
402
|
-
for (const breakpoint of this
|
|
402
|
+
for (const breakpoint of this.#domBreakpointsInternal) {
|
|
403
403
|
if (filter(breakpoint)) {
|
|
404
404
|
removed.push(breakpoint);
|
|
405
405
|
if (breakpoint.enabled) {
|
|
@@ -414,7 +414,7 @@ export class DOMDebuggerModel extends SDKModel<EventTypes> {
|
|
|
414
414
|
if (!removed.length) {
|
|
415
415
|
return;
|
|
416
416
|
}
|
|
417
|
-
this
|
|
417
|
+
this.#domBreakpointsInternal = left;
|
|
418
418
|
this.saveDOMBreakpoints();
|
|
419
419
|
this.dispatchEventToListeners(Events.DOMBreakpointsRemoved, removed);
|
|
420
420
|
}
|
|
@@ -430,14 +430,14 @@ export class DOMDebuggerModel extends SDKModel<EventTypes> {
|
|
|
430
430
|
|
|
431
431
|
private saveDOMBreakpoints(): void {
|
|
432
432
|
const currentURL = this.currentURL();
|
|
433
|
-
const breakpoints = this
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
for (const breakpoint of this
|
|
433
|
+
const breakpoints = this.#domBreakpointsSetting.get().filter((breakpoint: {
|
|
434
|
+
url: string,
|
|
435
|
+
}) => breakpoint.url !== currentURL);
|
|
436
|
+
for (const breakpoint of this.#domBreakpointsInternal) {
|
|
437
437
|
breakpoints.push(
|
|
438
438
|
{url: currentURL, path: breakpoint.node.path(), type: breakpoint.type, enabled: breakpoint.enabled});
|
|
439
439
|
}
|
|
440
|
-
this
|
|
440
|
+
this.#domBreakpointsSetting.set(breakpoints);
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
443
|
|
|
@@ -474,76 +474,76 @@ export class DOMBreakpoint {
|
|
|
474
474
|
}
|
|
475
475
|
|
|
476
476
|
export class EventListener {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
477
|
+
readonly #domDebuggerModelInternal: DOMDebuggerModel;
|
|
478
|
+
readonly #eventTarget: RemoteObject;
|
|
479
|
+
readonly #typeInternal: string;
|
|
480
|
+
readonly #useCaptureInternal: boolean;
|
|
481
|
+
readonly #passiveInternal: boolean;
|
|
482
|
+
readonly #onceInternal: boolean;
|
|
483
|
+
readonly #handlerInternal: RemoteObject|null;
|
|
484
|
+
readonly #originalHandlerInternal: RemoteObject|null;
|
|
485
|
+
readonly #locationInternal: Location;
|
|
486
|
+
readonly #sourceURLInternal: string;
|
|
487
|
+
readonly #customRemoveFunction: RemoteObject|null;
|
|
488
|
+
#originInternal: string;
|
|
489
489
|
|
|
490
490
|
constructor(
|
|
491
491
|
domDebuggerModel: DOMDebuggerModel, eventTarget: RemoteObject, type: string, useCapture: boolean,
|
|
492
492
|
passive: boolean, once: boolean, handler: RemoteObject|null, originalHandler: RemoteObject|null,
|
|
493
493
|
location: Location, customRemoveFunction: RemoteObject|null, origin?: string) {
|
|
494
|
-
this
|
|
495
|
-
this
|
|
496
|
-
this
|
|
497
|
-
this
|
|
498
|
-
this
|
|
499
|
-
this
|
|
500
|
-
this
|
|
501
|
-
this
|
|
502
|
-
this
|
|
494
|
+
this.#domDebuggerModelInternal = domDebuggerModel;
|
|
495
|
+
this.#eventTarget = eventTarget;
|
|
496
|
+
this.#typeInternal = type;
|
|
497
|
+
this.#useCaptureInternal = useCapture;
|
|
498
|
+
this.#passiveInternal = passive;
|
|
499
|
+
this.#onceInternal = once;
|
|
500
|
+
this.#handlerInternal = handler;
|
|
501
|
+
this.#originalHandlerInternal = originalHandler || handler;
|
|
502
|
+
this.#locationInternal = location;
|
|
503
503
|
const script = location.script();
|
|
504
|
-
this
|
|
505
|
-
this
|
|
506
|
-
this
|
|
504
|
+
this.#sourceURLInternal = script ? script.contentURL() : '';
|
|
505
|
+
this.#customRemoveFunction = customRemoveFunction;
|
|
506
|
+
this.#originInternal = origin || EventListener.Origin.Raw;
|
|
507
507
|
}
|
|
508
508
|
|
|
509
509
|
domDebuggerModel(): DOMDebuggerModel {
|
|
510
|
-
return this
|
|
510
|
+
return this.#domDebuggerModelInternal;
|
|
511
511
|
}
|
|
512
512
|
|
|
513
513
|
type(): string {
|
|
514
|
-
return this
|
|
514
|
+
return this.#typeInternal;
|
|
515
515
|
}
|
|
516
516
|
|
|
517
517
|
useCapture(): boolean {
|
|
518
|
-
return this
|
|
518
|
+
return this.#useCaptureInternal;
|
|
519
519
|
}
|
|
520
520
|
|
|
521
521
|
passive(): boolean {
|
|
522
|
-
return this
|
|
522
|
+
return this.#passiveInternal;
|
|
523
523
|
}
|
|
524
524
|
|
|
525
525
|
once(): boolean {
|
|
526
|
-
return this
|
|
526
|
+
return this.#onceInternal;
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
handler(): RemoteObject|null {
|
|
530
|
-
return this
|
|
530
|
+
return this.#handlerInternal;
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
location(): Location {
|
|
534
|
-
return this
|
|
534
|
+
return this.#locationInternal;
|
|
535
535
|
}
|
|
536
536
|
|
|
537
537
|
sourceURL(): string {
|
|
538
|
-
return this
|
|
538
|
+
return this.#sourceURLInternal;
|
|
539
539
|
}
|
|
540
540
|
|
|
541
541
|
originalHandler(): RemoteObject|null {
|
|
542
|
-
return this
|
|
542
|
+
return this.#originalHandlerInternal;
|
|
543
543
|
}
|
|
544
544
|
|
|
545
545
|
canRemove(): boolean {
|
|
546
|
-
return Boolean(this
|
|
546
|
+
return Boolean(this.#customRemoveFunction) || this.#originInternal !== EventListener.Origin.FrameworkUser;
|
|
547
547
|
}
|
|
548
548
|
|
|
549
549
|
remove(): Promise<void> {
|
|
@@ -551,7 +551,7 @@ export class EventListener {
|
|
|
551
551
|
return Promise.resolve(undefined);
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
-
if (this
|
|
554
|
+
if (this.#originInternal !== EventListener.Origin.FrameworkUser) {
|
|
555
555
|
function removeListener(
|
|
556
556
|
this: {
|
|
557
557
|
removeEventListener: (arg0: string, arg1: () => void, arg2: boolean) => void,
|
|
@@ -565,36 +565,36 @@ export class EventListener {
|
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
567
|
|
|
568
|
-
return this
|
|
568
|
+
return this.#eventTarget
|
|
569
569
|
.callFunction(
|
|
570
570
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
571
571
|
// @ts-expect-error
|
|
572
572
|
removeListener,
|
|
573
573
|
[
|
|
574
|
-
RemoteObject.toCallArgument(this
|
|
575
|
-
RemoteObject.toCallArgument(this
|
|
576
|
-
RemoteObject.toCallArgument(this
|
|
574
|
+
RemoteObject.toCallArgument(this.#typeInternal),
|
|
575
|
+
RemoteObject.toCallArgument(this.#originalHandlerInternal),
|
|
576
|
+
RemoteObject.toCallArgument(this.#useCaptureInternal),
|
|
577
577
|
])
|
|
578
578
|
.then(() => undefined) as Promise<undefined>;
|
|
579
579
|
}
|
|
580
580
|
|
|
581
|
-
if (this
|
|
581
|
+
if (this.#customRemoveFunction) {
|
|
582
582
|
function callCustomRemove(
|
|
583
583
|
this: (arg0: string, arg1: () => void, arg2: boolean, arg3: boolean) => void, type: string,
|
|
584
584
|
listener: () => void, useCapture: boolean, passive: boolean): void {
|
|
585
585
|
this.call(null, type, listener, useCapture, passive);
|
|
586
586
|
}
|
|
587
587
|
|
|
588
|
-
return this
|
|
588
|
+
return this.#customRemoveFunction
|
|
589
589
|
.callFunction(
|
|
590
590
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
591
591
|
// @ts-expect-error
|
|
592
592
|
callCustomRemove,
|
|
593
593
|
[
|
|
594
|
-
RemoteObject.toCallArgument(this
|
|
595
|
-
RemoteObject.toCallArgument(this
|
|
596
|
-
RemoteObject.toCallArgument(this
|
|
597
|
-
RemoteObject.toCallArgument(this
|
|
594
|
+
RemoteObject.toCallArgument(this.#typeInternal),
|
|
595
|
+
RemoteObject.toCallArgument(this.#originalHandlerInternal),
|
|
596
|
+
RemoteObject.toCallArgument(this.#useCaptureInternal),
|
|
597
|
+
RemoteObject.toCallArgument(this.#passiveInternal),
|
|
598
598
|
])
|
|
599
599
|
.then(() => undefined);
|
|
600
600
|
}
|
|
@@ -602,20 +602,20 @@ export class EventListener {
|
|
|
602
602
|
}
|
|
603
603
|
|
|
604
604
|
canTogglePassive(): boolean {
|
|
605
|
-
return this
|
|
605
|
+
return this.#originInternal !== EventListener.Origin.FrameworkUser;
|
|
606
606
|
}
|
|
607
607
|
|
|
608
608
|
togglePassive(): Promise<undefined> {
|
|
609
|
-
return this
|
|
609
|
+
return this.#eventTarget
|
|
610
610
|
.callFunction(
|
|
611
611
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
612
612
|
// @ts-expect-error
|
|
613
613
|
callTogglePassive,
|
|
614
614
|
[
|
|
615
|
-
RemoteObject.toCallArgument(this
|
|
616
|
-
RemoteObject.toCallArgument(this
|
|
617
|
-
RemoteObject.toCallArgument(this
|
|
618
|
-
RemoteObject.toCallArgument(this
|
|
615
|
+
RemoteObject.toCallArgument(this.#typeInternal),
|
|
616
|
+
RemoteObject.toCallArgument(this.#originalHandlerInternal),
|
|
617
|
+
RemoteObject.toCallArgument(this.#useCaptureInternal),
|
|
618
|
+
RemoteObject.toCallArgument(this.#passiveInternal),
|
|
619
619
|
])
|
|
620
620
|
.then(() => undefined);
|
|
621
621
|
|
|
@@ -636,16 +636,16 @@ export class EventListener {
|
|
|
636
636
|
}
|
|
637
637
|
|
|
638
638
|
origin(): string {
|
|
639
|
-
return this
|
|
639
|
+
return this.#originInternal;
|
|
640
640
|
}
|
|
641
641
|
|
|
642
642
|
markAsFramework(): void {
|
|
643
|
-
this
|
|
643
|
+
this.#originInternal = EventListener.Origin.Framework;
|
|
644
644
|
}
|
|
645
645
|
|
|
646
646
|
isScrollBlockingType(): boolean {
|
|
647
|
-
return this
|
|
648
|
-
this
|
|
647
|
+
return this.#typeInternal === 'touchstart' || this.#typeInternal === 'touchmove' ||
|
|
648
|
+
this.#typeInternal === 'mousewheel' || this.#typeInternal === 'wheel';
|
|
649
649
|
}
|
|
650
650
|
}
|
|
651
651
|
|
|
@@ -660,18 +660,18 @@ export namespace EventListener {
|
|
|
660
660
|
}
|
|
661
661
|
|
|
662
662
|
export class CategorizedBreakpoint {
|
|
663
|
-
|
|
663
|
+
readonly #categoryInternal: string;
|
|
664
664
|
titleInternal: string;
|
|
665
665
|
enabledInternal: boolean;
|
|
666
666
|
|
|
667
667
|
constructor(category: string, title: string) {
|
|
668
|
-
this
|
|
668
|
+
this.#categoryInternal = category;
|
|
669
669
|
this.titleInternal = title;
|
|
670
670
|
this.enabledInternal = false;
|
|
671
671
|
}
|
|
672
672
|
|
|
673
673
|
category(): string {
|
|
674
|
-
return this
|
|
674
|
+
return this.#categoryInternal;
|
|
675
675
|
}
|
|
676
676
|
|
|
677
677
|
enabled(): boolean {
|
|
@@ -692,14 +692,14 @@ export class CategorizedBreakpoint {
|
|
|
692
692
|
}
|
|
693
693
|
|
|
694
694
|
export class CSPViolationBreakpoint extends CategorizedBreakpoint {
|
|
695
|
-
|
|
695
|
+
readonly #typeInternal: Protocol.DOMDebugger.CSPViolationType;
|
|
696
696
|
constructor(category: string, title: string, type: Protocol.DOMDebugger.CSPViolationType) {
|
|
697
697
|
super(category, title);
|
|
698
|
-
this
|
|
698
|
+
this.#typeInternal = type;
|
|
699
699
|
}
|
|
700
700
|
|
|
701
701
|
type(): Protocol.DOMDebugger.CSPViolationType {
|
|
702
|
-
return this
|
|
702
|
+
return this.#typeInternal;
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
705
|
|
|
@@ -750,27 +750,27 @@ export class EventListenerBreakpoint extends CategorizedBreakpoint {
|
|
|
750
750
|
let domDebuggerManagerInstance: DOMDebuggerManager;
|
|
751
751
|
|
|
752
752
|
export class DOMDebuggerManager implements SDKModelObserver<DOMDebuggerModel> {
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
753
|
+
readonly #xhrBreakpointsSetting: Common.Settings.Setting<{url: string, enabled: boolean}[]>;
|
|
754
|
+
readonly #xhrBreakpointsInternal: Map<string, boolean>;
|
|
755
|
+
readonly #cspViolationsToBreakOn: CSPViolationBreakpoint[];
|
|
756
|
+
readonly #eventListenerBreakpointsInternal: EventListenerBreakpoint[];
|
|
757
757
|
|
|
758
758
|
constructor() {
|
|
759
|
-
this
|
|
760
|
-
this
|
|
761
|
-
for (const breakpoint of this
|
|
762
|
-
this
|
|
759
|
+
this.#xhrBreakpointsSetting = Common.Settings.Settings.instance().createLocalSetting('xhrBreakpoints', []);
|
|
760
|
+
this.#xhrBreakpointsInternal = new Map();
|
|
761
|
+
for (const breakpoint of this.#xhrBreakpointsSetting.get()) {
|
|
762
|
+
this.#xhrBreakpointsInternal.set(breakpoint.url, breakpoint.enabled);
|
|
763
763
|
}
|
|
764
764
|
|
|
765
|
-
this
|
|
766
|
-
this
|
|
765
|
+
this.#cspViolationsToBreakOn = [];
|
|
766
|
+
this.#cspViolationsToBreakOn.push(new CSPViolationBreakpoint(
|
|
767
767
|
i18nString(UIStrings.trustedTypeViolations), i18nString(UIStrings.sinkViolations),
|
|
768
768
|
Protocol.DOMDebugger.CSPViolationType.TrustedtypeSinkViolation));
|
|
769
|
-
this
|
|
769
|
+
this.#cspViolationsToBreakOn.push(new CSPViolationBreakpoint(
|
|
770
770
|
i18nString(UIStrings.trustedTypeViolations), i18nString(UIStrings.policyViolations),
|
|
771
771
|
Protocol.DOMDebugger.CSPViolationType.TrustedtypePolicyViolation));
|
|
772
772
|
|
|
773
|
-
this
|
|
773
|
+
this.#eventListenerBreakpointsInternal = [];
|
|
774
774
|
this.createInstrumentationBreakpoints(
|
|
775
775
|
i18nString(UIStrings.animation),
|
|
776
776
|
['requestAnimationFrame', 'cancelAnimationFrame', 'requestAnimationFrame.callback']);
|
|
@@ -971,19 +971,19 @@ export class DOMDebuggerManager implements SDKModelObserver<DOMDebuggerModel> {
|
|
|
971
971
|
}
|
|
972
972
|
|
|
973
973
|
cspViolationBreakpoints(): CSPViolationBreakpoint[] {
|
|
974
|
-
return this
|
|
974
|
+
return this.#cspViolationsToBreakOn.slice();
|
|
975
975
|
}
|
|
976
976
|
|
|
977
977
|
private createInstrumentationBreakpoints(category: string, instrumentationNames: string[]): void {
|
|
978
978
|
for (const instrumentationName of instrumentationNames) {
|
|
979
|
-
this
|
|
979
|
+
this.#eventListenerBreakpointsInternal.push(
|
|
980
980
|
new EventListenerBreakpoint(instrumentationName, '', [], category, instrumentationName));
|
|
981
981
|
}
|
|
982
982
|
}
|
|
983
983
|
|
|
984
984
|
private createEventListenerBreakpoints(category: string, eventNames: string[], eventTargetNames: string[]): void {
|
|
985
985
|
for (const eventName of eventNames) {
|
|
986
|
-
this
|
|
986
|
+
this.#eventListenerBreakpointsInternal.push(
|
|
987
987
|
new EventListenerBreakpoint('', eventName, eventTargetNames, category, eventName));
|
|
988
988
|
}
|
|
989
989
|
}
|
|
@@ -1003,7 +1003,7 @@ export class DOMDebuggerManager implements SDKModelObserver<DOMDebuggerModel> {
|
|
|
1003
1003
|
}
|
|
1004
1004
|
eventTargetName = (eventTargetName || '*').toLowerCase();
|
|
1005
1005
|
let result: EventListenerBreakpoint|null = null;
|
|
1006
|
-
for (const breakpoint of this
|
|
1006
|
+
for (const breakpoint of this.#eventListenerBreakpointsInternal) {
|
|
1007
1007
|
if (instrumentationName && breakpoint.instrumentationName === instrumentationName) {
|
|
1008
1008
|
result = breakpoint;
|
|
1009
1009
|
}
|
|
@@ -1020,7 +1020,7 @@ export class DOMDebuggerManager implements SDKModelObserver<DOMDebuggerModel> {
|
|
|
1020
1020
|
}
|
|
1021
1021
|
|
|
1022
1022
|
eventListenerBreakpoints(): EventListenerBreakpoint[] {
|
|
1023
|
-
return this
|
|
1023
|
+
return this.#eventListenerBreakpointsInternal.slice();
|
|
1024
1024
|
}
|
|
1025
1025
|
|
|
1026
1026
|
resolveEventListenerBreakpointTitle(auxData: {
|
|
@@ -1057,7 +1057,7 @@ export class DOMDebuggerManager implements SDKModelObserver<DOMDebuggerModel> {
|
|
|
1057
1057
|
}
|
|
1058
1058
|
|
|
1059
1059
|
updateCSPViolationBreakpoints(): void {
|
|
1060
|
-
const violationTypes = this
|
|
1060
|
+
const violationTypes = this.#cspViolationsToBreakOn.filter(v => v.enabled()).map(v => v.type());
|
|
1061
1061
|
for (const model of TargetManager.instance().models(DOMDebuggerModel)) {
|
|
1062
1062
|
this.updateCSPViolationBreakpointsForModel(model, violationTypes);
|
|
1063
1063
|
}
|
|
@@ -1069,19 +1069,19 @@ export class DOMDebuggerManager implements SDKModelObserver<DOMDebuggerModel> {
|
|
|
1069
1069
|
}
|
|
1070
1070
|
|
|
1071
1071
|
xhrBreakpoints(): Map<string, boolean> {
|
|
1072
|
-
return this
|
|
1072
|
+
return this.#xhrBreakpointsInternal;
|
|
1073
1073
|
}
|
|
1074
1074
|
|
|
1075
1075
|
private saveXHRBreakpoints(): void {
|
|
1076
1076
|
const breakpoints = [];
|
|
1077
|
-
for (const url of this
|
|
1078
|
-
breakpoints.push({url: url, enabled: this
|
|
1077
|
+
for (const url of this.#xhrBreakpointsInternal.keys()) {
|
|
1078
|
+
breakpoints.push({url: url, enabled: this.#xhrBreakpointsInternal.get(url) || false});
|
|
1079
1079
|
}
|
|
1080
|
-
this
|
|
1080
|
+
this.#xhrBreakpointsSetting.set(breakpoints);
|
|
1081
1081
|
}
|
|
1082
1082
|
|
|
1083
1083
|
addXHRBreakpoint(url: string, enabled: boolean): void {
|
|
1084
|
-
this
|
|
1084
|
+
this.#xhrBreakpointsInternal.set(url, enabled);
|
|
1085
1085
|
if (enabled) {
|
|
1086
1086
|
for (const model of TargetManager.instance().models(DOMDebuggerModel)) {
|
|
1087
1087
|
model.agent.invoke_setXHRBreakpoint({url});
|
|
@@ -1091,8 +1091,8 @@ export class DOMDebuggerManager implements SDKModelObserver<DOMDebuggerModel> {
|
|
|
1091
1091
|
}
|
|
1092
1092
|
|
|
1093
1093
|
removeXHRBreakpoint(url: string): void {
|
|
1094
|
-
const enabled = this
|
|
1095
|
-
this
|
|
1094
|
+
const enabled = this.#xhrBreakpointsInternal.get(url);
|
|
1095
|
+
this.#xhrBreakpointsInternal.delete(url);
|
|
1096
1096
|
if (enabled) {
|
|
1097
1097
|
for (const model of TargetManager.instance().models(DOMDebuggerModel)) {
|
|
1098
1098
|
model.agent.invoke_removeXHRBreakpoint({url});
|
|
@@ -1102,7 +1102,7 @@ export class DOMDebuggerManager implements SDKModelObserver<DOMDebuggerModel> {
|
|
|
1102
1102
|
}
|
|
1103
1103
|
|
|
1104
1104
|
toggleXHRBreakpoint(url: string, enabled: boolean): void {
|
|
1105
|
-
this
|
|
1105
|
+
this.#xhrBreakpointsInternal.set(url, enabled);
|
|
1106
1106
|
for (const model of TargetManager.instance().models(DOMDebuggerModel)) {
|
|
1107
1107
|
if (enabled) {
|
|
1108
1108
|
model.agent.invoke_setXHRBreakpoint({url});
|
|
@@ -1114,17 +1114,17 @@ export class DOMDebuggerManager implements SDKModelObserver<DOMDebuggerModel> {
|
|
|
1114
1114
|
}
|
|
1115
1115
|
|
|
1116
1116
|
modelAdded(domDebuggerModel: DOMDebuggerModel): void {
|
|
1117
|
-
for (const url of this
|
|
1118
|
-
if (this
|
|
1117
|
+
for (const url of this.#xhrBreakpointsInternal.keys()) {
|
|
1118
|
+
if (this.#xhrBreakpointsInternal.get(url)) {
|
|
1119
1119
|
domDebuggerModel.agent.invoke_setXHRBreakpoint({url: url});
|
|
1120
1120
|
}
|
|
1121
1121
|
}
|
|
1122
|
-
for (const breakpoint of this
|
|
1122
|
+
for (const breakpoint of this.#eventListenerBreakpointsInternal) {
|
|
1123
1123
|
if (breakpoint.enabled()) {
|
|
1124
1124
|
breakpoint.updateOnModel(domDebuggerModel);
|
|
1125
1125
|
}
|
|
1126
1126
|
}
|
|
1127
|
-
const violationTypes = this
|
|
1127
|
+
const violationTypes = this.#cspViolationsToBreakOn.filter(v => v.enabled()).map(v => v.type());
|
|
1128
1128
|
this.updateCSPViolationBreakpointsForModel(domDebuggerModel, violationTypes);
|
|
1129
1129
|
}
|
|
1130
1130
|
|