chrome-devtools-frontend 1.0.1585664 → 1.0.1586699
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/front_end/core/common/Srcset.ts +61 -0
- package/front_end/core/common/common.ts +2 -0
- package/front_end/models/ai_assistance/AiConversation.ts +6 -2
- package/front_end/models/javascript_metadata/NativeFunctions.js +2 -2
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +1 -0
- package/front_end/panels/console/PromptBuilder.ts +15 -3
- package/front_end/panels/elements/ElementsTreeElement.ts +4 -56
- package/front_end/panels/network/components/RequestHeadersView.ts +85 -153
- package/front_end/panels/sources/CallStackSidebarPane.ts +3 -7
- package/front_end/panels/utils/utils.ts +13 -5
- 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/cdp/FrameManager.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/FrameManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/util.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/util.js +7 -7
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/util.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
- 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.js +7 -7
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/FrameManager.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/FrameManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/util.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/util.js +7 -7
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/util.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
- 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/package.json +2 -2
- package/front_end/third_party/puppeteer/package/src/cdp/FrameManager.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/common/util.ts +9 -8
- package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/ui/legacy/UIUtils.ts +31 -14
- package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +90 -77
- package/package.json +1 -1
|
@@ -41,6 +41,7 @@ import * as Host from '../../core/host/host.js';
|
|
|
41
41
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
42
42
|
import * as Platform from '../../core/platform/platform.js';
|
|
43
43
|
import * as Geometry from '../../models/geometry/geometry.js';
|
|
44
|
+
import type * as StackTrace from '../../models/stack_trace/stack_trace.js';
|
|
44
45
|
import * as Buttons from '../components/buttons/buttons.js';
|
|
45
46
|
import {Icon, type IconData} from '../kit/kit.js';
|
|
46
47
|
import * as Lit from '../lit/lit.js';
|
|
@@ -628,23 +629,39 @@ export function anotherProfilerActiveLabel(): string {
|
|
|
628
629
|
return i18nString(UIStrings.anotherProfilerIsAlreadyActive);
|
|
629
630
|
}
|
|
630
631
|
|
|
631
|
-
export function
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
632
|
+
export function asyncFragmentLabel(
|
|
633
|
+
stackTrace: StackTrace.StackTrace.StackTrace|StackTrace.StackTrace.DebuggableStackTrace,
|
|
634
|
+
asyncFragment: StackTrace.StackTrace.AsyncFragment): string {
|
|
635
|
+
const description = asyncFragment.description;
|
|
636
|
+
if (!description) {
|
|
637
|
+
return i18nString(UIStrings.asyncCall);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
if (description === 'Promise.resolve') {
|
|
641
|
+
return i18nString(UIStrings.promiseResolvedAsync);
|
|
642
|
+
}
|
|
643
|
+
if (description === 'Promise.reject') {
|
|
644
|
+
return i18nString(UIStrings.promiseRejectedAsync);
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
if (description === 'await') {
|
|
648
|
+
const asyncFragments = stackTrace.asyncFragments;
|
|
649
|
+
const index = asyncFragments.indexOf(asyncFragment);
|
|
650
|
+
let previousFragment: StackTrace.StackTrace.Fragment|undefined;
|
|
651
|
+
|
|
652
|
+
if (index === 0) {
|
|
653
|
+
previousFragment = stackTrace.syncFragment;
|
|
654
|
+
} else if (index > 0) {
|
|
655
|
+
previousFragment = asyncFragments[index - 1];
|
|
639
656
|
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
657
|
+
|
|
658
|
+
const lastPreviousFrame = previousFragment?.frames.at(-1);
|
|
659
|
+
if (lastPreviousFrame) {
|
|
660
|
+
const lastPreviousFrameName = beautifyFunctionName(lastPreviousFrame.name || '');
|
|
661
|
+
return `await in ${lastPreviousFrameName}`;
|
|
644
662
|
}
|
|
645
|
-
return description;
|
|
646
663
|
}
|
|
647
|
-
return
|
|
664
|
+
return description;
|
|
648
665
|
}
|
|
649
666
|
|
|
650
667
|
export function addPlatformClass(element: HTMLElement): void {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright 2021 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-imperative-dom-api */
|
|
5
4
|
|
|
6
5
|
/*
|
|
7
6
|
* Copyright (C) 2011 Google Inc. All rights reserved.
|
|
@@ -38,12 +37,15 @@ import * as i18n from '../../../../core/i18n/i18n.js';
|
|
|
38
37
|
import * as SDK from '../../../../core/sdk/sdk.js';
|
|
39
38
|
import * as StackTrace from '../../../../models/stack_trace/stack_trace.js';
|
|
40
39
|
import * as Workspace from '../../../../models/workspace/workspace.js';
|
|
40
|
+
import {Directives, html, render} from '../../../lit/lit.js';
|
|
41
41
|
import * as VisualLogging from '../../../visual_logging/visual_logging.js';
|
|
42
42
|
import * as UI from '../../legacy.js';
|
|
43
43
|
|
|
44
44
|
import jsUtilsStyles from './jsUtils.css.js';
|
|
45
45
|
import {Linkifier} from './Linkifier.js';
|
|
46
46
|
|
|
47
|
+
const {classMap, createRef, ref} = Directives;
|
|
48
|
+
|
|
47
49
|
const UIStrings = {
|
|
48
50
|
/**
|
|
49
51
|
* @description Text to stop preventing the debugger from stepping into library code
|
|
@@ -89,31 +91,53 @@ function populateContextMenu(link: Element, event: Event): void {
|
|
|
89
91
|
void contextMenu.show();
|
|
90
92
|
}
|
|
91
93
|
|
|
92
|
-
|
|
94
|
+
export interface ViewInput {
|
|
95
|
+
stackTrace?: StackTrace.StackTrace.StackTrace;
|
|
96
|
+
tabStops?: boolean;
|
|
97
|
+
widthConstrained?: boolean;
|
|
98
|
+
showColumnNumber?: boolean;
|
|
99
|
+
expandable?: boolean;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export type View = (input: ViewInput, output: {table?: HTMLElement}, target: HTMLElement) => void;
|
|
103
|
+
|
|
104
|
+
export const DEFAULT_VIEW: View = (input, output, target) => {
|
|
105
|
+
const classes = {
|
|
106
|
+
'stack-preview-container': true,
|
|
107
|
+
'width-constrained': Boolean(input.widthConstrained),
|
|
108
|
+
};
|
|
109
|
+
// TODO(crbug.com/483576322): Remove once fully migrated.
|
|
110
|
+
const tableRef = createRef<HTMLElement>();
|
|
111
|
+
// clang-format off
|
|
112
|
+
render(html`
|
|
113
|
+
<style>${jsUtilsStyles}</style>
|
|
114
|
+
<table class=${classMap(classes)} ${ref(tableRef)}>
|
|
115
|
+
</table>
|
|
116
|
+
`, target);
|
|
117
|
+
// clang-format on
|
|
118
|
+
output.table = tableRef.value;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
function renderStackTraceTable(
|
|
122
|
+
container: Element,
|
|
123
|
+
parent: Element,
|
|
93
124
|
stackTrace: StackTrace.StackTrace.StackTrace,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const stackTraceRows: Array<StackTraceRegularRow|StackTraceAsyncRow> = [];
|
|
125
|
+
options: Options,
|
|
126
|
+
): void {
|
|
127
|
+
container.removeChildren();
|
|
98
128
|
|
|
99
|
-
function buildStackTraceRowsHelper(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (previousFragment && isAsync) {
|
|
105
|
-
asyncRow = {
|
|
106
|
-
asyncDescription: UI.UIUtils.asyncStackTraceLabel(
|
|
107
|
-
fragment.description, previousFragment.frames.map(f => ({functionName: f.name ?? ''}))),
|
|
108
|
-
};
|
|
109
|
-
stackTraceRows.push(asyncRow);
|
|
129
|
+
function buildStackTraceRowsHelper(fragment: StackTrace.StackTrace.Fragment|StackTrace.StackTrace.AsyncFragment):
|
|
130
|
+
Array<StackTraceRegularRow|StackTraceAsyncRow> {
|
|
131
|
+
const stackTraceRows: Array<StackTraceRegularRow|StackTraceAsyncRow> = [];
|
|
132
|
+
if ('description' in fragment) {
|
|
133
|
+
stackTraceRows.push({asyncDescription: UI.UIUtils.asyncFragmentLabel(stackTrace, fragment)});
|
|
110
134
|
}
|
|
111
135
|
let previousStackFrameWasBreakpointCondition = false;
|
|
112
136
|
for (const frame of fragment.frames) {
|
|
113
137
|
const functionName = UI.UIUtils.beautifyFunctionName(frame.name ?? '');
|
|
114
138
|
const link = Linkifier.linkifyStackTraceFrame(frame, {
|
|
115
|
-
showColumnNumber,
|
|
116
|
-
tabStop: Boolean(tabStops),
|
|
139
|
+
showColumnNumber: Boolean(options.showColumnNumber),
|
|
140
|
+
tabStop: Boolean(options.tabStops),
|
|
117
141
|
inlineFrameIndex: 0,
|
|
118
142
|
revealBreakpoint: previousStackFrameWasBreakpointCondition,
|
|
119
143
|
maxLength: UI.UIUtils.MaxLengthForDisplayedURLsInConsole,
|
|
@@ -127,61 +151,50 @@ function buildStackTraceRows(
|
|
|
127
151
|
SDK.DebuggerModel.LOGPOINT_SOURCE_URL,
|
|
128
152
|
].includes(frame.url ?? '');
|
|
129
153
|
}
|
|
130
|
-
}
|
|
131
154
|
|
|
132
|
-
|
|
133
|
-
let previousFragment = stackTrace.syncFragment;
|
|
134
|
-
for (const asyncFragment of stackTrace.asyncFragments) {
|
|
135
|
-
if (asyncFragment.frames.length) {
|
|
136
|
-
buildStackTraceRowsHelper(asyncFragment, previousFragment);
|
|
137
|
-
}
|
|
138
|
-
previousFragment = asyncFragment;
|
|
155
|
+
return stackTraceRows;
|
|
139
156
|
}
|
|
140
|
-
return stackTraceRows;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function renderStackTraceTable(
|
|
144
|
-
container: Element, parent: Element, expandable: boolean,
|
|
145
|
-
stackTraceRows: Array<StackTraceRegularRow|StackTraceAsyncRow>): void {
|
|
146
|
-
container.removeChildren();
|
|
147
157
|
|
|
148
158
|
// The tableSection groups one or more synchronous call frames together.
|
|
149
159
|
// Wherever there is an asynchronous call, a new section is created.
|
|
150
|
-
let tableSection: Element|null = null;
|
|
151
160
|
let firstRow = true;
|
|
152
|
-
for (const
|
|
153
|
-
if (
|
|
154
|
-
|
|
161
|
+
for (const fragment of [stackTrace.syncFragment, ...stackTrace.asyncFragments]) {
|
|
162
|
+
if (fragment.frames.length === 0) {
|
|
163
|
+
continue;
|
|
155
164
|
}
|
|
156
165
|
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
166
|
+
const stackTraceRows = buildStackTraceRowsHelper(fragment);
|
|
167
|
+
const tableSection = container.createChild('tbody');
|
|
168
|
+
for (const item of stackTraceRows) {
|
|
169
|
+
const row = tableSection.createChild('tr');
|
|
170
|
+
if (firstRow && options.expandable) {
|
|
171
|
+
const button = row.createChild('td').createChild('button', 'arrow-icon-button');
|
|
172
|
+
button.createChild('span', 'arrow-icon');
|
|
173
|
+
parent.classList.add('expandable');
|
|
174
|
+
container.classList.add('expandable');
|
|
175
|
+
button.addEventListener('click', () => {
|
|
176
|
+
button.setAttribute('jslog', `${VisualLogging.expand().track({click: true})}`);
|
|
177
|
+
parent.classList.toggle('expanded');
|
|
178
|
+
container.classList.toggle('expanded');
|
|
179
|
+
});
|
|
180
|
+
firstRow = false;
|
|
181
|
+
} else {
|
|
182
|
+
row.createChild('td').textContent = '\n';
|
|
183
|
+
}
|
|
184
|
+
if ('asyncDescription' in item) {
|
|
185
|
+
row.createChild('td', 'stack-preview-async-description').textContent = item.asyncDescription;
|
|
186
|
+
row.createChild('td');
|
|
187
|
+
row.createChild('td');
|
|
188
|
+
row.classList.add('stack-preview-async-row');
|
|
189
|
+
} else {
|
|
190
|
+
row.createChild('td', 'function-name').textContent = item.functionName;
|
|
191
|
+
row.createChild('td').textContent = ' @ ';
|
|
192
|
+
row.createChild('td', 'link').appendChild(item.link);
|
|
193
|
+
}
|
|
181
194
|
}
|
|
182
195
|
}
|
|
183
196
|
|
|
184
|
-
tableSection = container.createChild('tfoot');
|
|
197
|
+
const tableSection = container.createChild('tfoot');
|
|
185
198
|
const showAllRow = tableSection.createChild('tr', 'show-all-link');
|
|
186
199
|
showAllRow.createChild('td');
|
|
187
200
|
const cell = showAllRow.createChild('td');
|
|
@@ -232,17 +245,14 @@ interface StackTraceAsyncRow {
|
|
|
232
245
|
}
|
|
233
246
|
|
|
234
247
|
export class StackTracePreviewContent extends UI.Widget.Widget {
|
|
248
|
+
readonly #view: View;
|
|
249
|
+
|
|
235
250
|
#stackTrace?: StackTrace.StackTrace.StackTrace;
|
|
236
251
|
#options: Options = {};
|
|
237
252
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
constructor(element?: HTMLElement) {
|
|
253
|
+
constructor(element?: HTMLElement, view = DEFAULT_VIEW) {
|
|
241
254
|
super(element, {useShadowDom: true, classes: ['monospace', 'stack-preview-container']});
|
|
242
|
-
|
|
243
|
-
UI.DOMUtilities.appendStyle(this.element.shadowRoot as ShadowRoot, jsUtilsStyles);
|
|
244
|
-
|
|
245
|
-
this.#table = this.contentElement.createChild('table', 'stack-preview-container');
|
|
255
|
+
this.#view = view;
|
|
246
256
|
}
|
|
247
257
|
|
|
248
258
|
hasContent(): boolean {
|
|
@@ -254,13 +264,17 @@ export class StackTracePreviewContent extends UI.Widget.Widget {
|
|
|
254
264
|
}
|
|
255
265
|
|
|
256
266
|
override performUpdate(): void {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
267
|
+
const output: {table?: HTMLElement} = {};
|
|
268
|
+
this.#view(
|
|
269
|
+
{
|
|
270
|
+
stackTrace: this.#stackTrace,
|
|
271
|
+
...this.#options,
|
|
272
|
+
},
|
|
273
|
+
output, this.contentElement);
|
|
260
274
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
275
|
+
if (this.#stackTrace && output.table) {
|
|
276
|
+
renderStackTraceTable(output.table, this.element, this.#stackTrace, this.#options);
|
|
277
|
+
}
|
|
264
278
|
}
|
|
265
279
|
|
|
266
280
|
get linkElements(): readonly HTMLElement[] {
|
|
@@ -269,7 +283,6 @@ export class StackTracePreviewContent extends UI.Widget.Widget {
|
|
|
269
283
|
|
|
270
284
|
set options(options: Options) {
|
|
271
285
|
this.#options = options;
|
|
272
|
-
this.#table.classList.toggle('width-constrained', this.#options.widthConstrained ?? false);
|
|
273
286
|
this.requestUpdate();
|
|
274
287
|
}
|
|
275
288
|
|
package/package.json
CHANGED