chrome-devtools-frontend 1.0.1583146 → 1.0.1585664
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/host/InspectorFrontendHostAPI.ts +1 -0
- package/front_end/core/host/InspectorFrontendHostStub.ts +2 -0
- package/front_end/core/root/Runtime.ts +12 -6
- package/front_end/core/sdk/CSSMatchedStyles.ts +3 -0
- package/front_end/core/sdk/CSSMetadata.ts +3 -0
- package/front_end/entrypoints/main/MainImpl.ts +1 -0
- package/front_end/generated/Deprecation.ts +21 -0
- package/front_end/generated/InspectorBackendCommands.ts +5 -3
- package/front_end/generated/SupportedCSSProperties.js +10 -4
- package/front_end/generated/protocol-mapping.d.ts +2 -1
- package/front_end/generated/protocol-proxy-api.d.ts +2 -1
- package/front_end/generated/protocol.ts +14 -0
- package/front_end/models/ai_assistance/AiConversation.ts +34 -2
- package/front_end/models/ai_assistance/BuiltInAi.ts +1 -2
- package/front_end/models/ai_assistance/agents/AiAgent.ts +3 -10
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +17 -9
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +0 -24
- package/front_end/models/ai_code_completion/AiCodeCompletion.ts +12 -0
- package/front_end/models/ai_code_generation/AiCodeGeneration.ts +5 -0
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +16 -8
- package/front_end/models/computed_style/ComputedStyleModel.ts +20 -15
- package/front_end/models/greendev/Prototypes.ts +1 -5
- package/front_end/models/issues_manager/CorsIssue.ts +2 -9
- package/front_end/models/issues_manager/descriptions/corsLocalNetworkAccessPermissionDenied.md +2 -2
- package/front_end/models/javascript_metadata/NativeFunctions.js +20 -0
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +13 -36
- package/front_end/panels/ai_assistance/components/ChatInput.ts +73 -95
- package/front_end/panels/ai_assistance/components/ChatView.ts +13 -2
- package/front_end/panels/application/FrameDetailsView.ts +4 -9
- package/front_end/panels/common/AiCodeGenerationTeaser.ts +10 -0
- package/front_end/panels/console/ConsoleView.ts +1 -2
- package/front_end/panels/console/ConsoleViewMessage.ts +19 -12
- package/front_end/panels/elements/ComputedStyleWidget.ts +41 -21
- package/front_end/panels/elements/ElementsPanel.ts +18 -5
- package/front_end/panels/elements/ElementsTreeElement.ts +173 -169
- package/front_end/panels/elements/NodeStackTraceWidget.ts +3 -13
- package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +69 -0
- package/front_end/panels/elements/computedStyleWidget.css +1 -6
- package/front_end/panels/elements/elements.ts +3 -1
- package/front_end/panels/issues/AffectedResourcesView.ts +1 -2
- package/front_end/panels/network/NetworkDataGridNode.ts +0 -8
- package/front_end/panels/network/RequestConditionsDrawer.ts +138 -112
- package/front_end/panels/network/RequestInitiatorView.ts +2 -10
- package/front_end/panels/settings/SettingsScreen.ts +12 -4
- package/front_end/panels/snippets/SnippetsQuickOpen.ts +6 -9
- package/front_end/panels/sources/CallStackSidebarPane.ts +4 -6
- package/front_end/panels/sources/DebuggerPlugin.ts +2 -1
- package/front_end/panels/sources/GoToLineQuickOpen.ts +0 -4
- package/front_end/panels/sources/OpenFileQuickOpen.ts +0 -4
- package/front_end/panels/sources/OutlineQuickOpen.ts +0 -4
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +3 -1
- package/front_end/panels/sources/sources-meta.ts +9 -6
- package/front_end/panels/timeline/TimelineFlameChartView.ts +0 -12
- package/front_end/panels/timeline/TimelinePanel.ts +35 -15
- package/front_end/panels/timeline/TimelineUIUtils.ts +2 -6
- package/front_end/panels/timeline/components/Sidebar.ts +21 -0
- package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +1 -20
- package/front_end/panels/timeline/components/insights/InsightRenderer.ts +0 -1
- 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/bidi/core/BrowsingContext.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js +2 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/encoding.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/encoding.js +5 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/encoding.js.map +1 -1
- 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 +8 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js +2 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/encoding.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/encoding.js +5 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/encoding.js.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/package.json +4 -4
- package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +4 -3
- package/front_end/third_party/puppeteer/package/src/revisions.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/util/encoding.ts +5 -3
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/ui/components/linkifier/LinkifierImpl.ts +3 -0
- package/front_end/ui/components/linkifier/LinkifierUtils.ts +3 -0
- package/front_end/ui/components/text_editor/AiCodeGenerationParser.ts +29 -7
- package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +34 -18
- package/front_end/ui/legacy/InspectorView.ts +41 -15
- package/front_end/ui/legacy/UIUtils.ts +30 -6
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +4 -3
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +2 -1
- package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +8 -2
- package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +8 -8
- package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +20 -150
- package/front_end/ui/legacy/components/utils/Linkifier.ts +120 -87
- package/front_end/ui/legacy/components/utils/jsUtils.css +0 -9
- package/front_end/ui/legacy/legacy.ts +0 -2
- package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
- package/mcp/HostBindings.ts +3 -0
- package/package.json +1 -1
- package/front_end/models/issues_manager/descriptions/corsInsecurePrivateNetwork.md +0 -10
- package/front_end/models/issues_manager/descriptions/corsPreflightAllowPrivateNetworkError.md +0 -10
- package/front_end/models/issues_manager/descriptions/corsPrivateNetworkPermissionDenied.md +0 -10
- package/front_end/ui/legacy/Floaty.ts +0 -438
- package/front_end/ui/legacy/floaty.css +0 -77
|
@@ -697,19 +697,42 @@ export class ElementFocusRestorer {
|
|
|
697
697
|
export function runCSSAnimationOnce(element: Element, className: string): void {
|
|
698
698
|
function animationEndCallback(): void {
|
|
699
699
|
element.classList.remove(className);
|
|
700
|
-
element.removeEventListener('
|
|
700
|
+
element.removeEventListener('animationend', animationEndCallback, false);
|
|
701
701
|
element.removeEventListener('animationcancel', animationEndCallback, false);
|
|
702
702
|
}
|
|
703
703
|
|
|
704
|
-
if
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
element.addEventListener('webkitAnimationEnd', animationEndCallback, false);
|
|
704
|
+
// Remove class if it exists.
|
|
705
|
+
element.classList.toggle(className, /* force=*/ false);
|
|
706
|
+
element.addEventListener('animationend', animationEndCallback, false);
|
|
709
707
|
element.addEventListener('animationcancel', animationEndCallback, false);
|
|
710
708
|
element.classList.add(className);
|
|
711
709
|
}
|
|
712
710
|
|
|
711
|
+
class AnimateOnDirective extends Lit.Directive.Directive {
|
|
712
|
+
#previousValue = false;
|
|
713
|
+
|
|
714
|
+
render(_condition: boolean, _className: string): void {
|
|
715
|
+
return undefined; // Directives don't have to render HTML
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
override update(part: Lit.Directive.ElementPart, [condition, className]: [boolean, string]): void {
|
|
719
|
+
const el = part.element as HTMLElement;
|
|
720
|
+
|
|
721
|
+
// Only trigger if the condition transitioned from false -> true
|
|
722
|
+
if (condition && !this.#previousValue) {
|
|
723
|
+
this.#animate(el, className);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
this.#previousValue = condition;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
#animate(el: HTMLElement, className: string): void {
|
|
730
|
+
runCSSAnimationOnce(el, className);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
export const animateOn = Lit.Directive.directive(AnimateOnDirective);
|
|
735
|
+
|
|
713
736
|
export function measurePreferredSize(element: Element, containerElement?: Element|null): Geometry.Size {
|
|
714
737
|
const oldParent = element.parentElement;
|
|
715
738
|
const oldNextSibling = element.nextSibling;
|
|
@@ -1530,6 +1553,7 @@ export function createFileSelectorElement(callback: (arg0: File) => void, accept
|
|
|
1530
1553
|
}
|
|
1531
1554
|
|
|
1532
1555
|
export const MaxLengthForDisplayedURLs = 150;
|
|
1556
|
+
export const MaxLengthForDisplayedURLsInConsole = 40;
|
|
1533
1557
|
|
|
1534
1558
|
export class MessageDialog {
|
|
1535
1559
|
static async show(header: string, message: string, where?: Element|Document, jslogContext?: string): Promise<void> {
|
|
@@ -275,8 +275,8 @@ export const enum PanelOrDrawer {
|
|
|
275
275
|
export class CommandMenuProvider extends Provider {
|
|
276
276
|
private commands: Command[];
|
|
277
277
|
|
|
278
|
-
constructor(commandsForTest: Command[] = []) {
|
|
279
|
-
super(
|
|
278
|
+
constructor(jslogContext: string, commandsForTest: Command[] = []) {
|
|
279
|
+
super(jslogContext);
|
|
280
280
|
this.commands = commandsForTest;
|
|
281
281
|
}
|
|
282
282
|
|
|
@@ -455,8 +455,9 @@ export class ShowActionDelegate implements UI.ActionRegistration.ActionDelegate
|
|
|
455
455
|
registerProvider({
|
|
456
456
|
prefix: '>',
|
|
457
457
|
iconName: 'chevron-right',
|
|
458
|
-
provider: () => Promise.resolve(new CommandMenuProvider()),
|
|
458
|
+
provider: (jslogContext: string) => Promise.resolve(new CommandMenuProvider(jslogContext)),
|
|
459
459
|
helpTitle: () => i18nString(UIStrings.runCommand),
|
|
460
460
|
titlePrefix: () => i18nString(UIStrings.run),
|
|
461
461
|
titleSuggestion: () => i18nString(UIStrings.command),
|
|
462
|
+
jslogContext: 'command',
|
|
462
463
|
});
|
|
@@ -657,8 +657,9 @@ export function getRegisteredProviders(): ProviderRegistration[] {
|
|
|
657
657
|
export interface ProviderRegistration {
|
|
658
658
|
prefix: string;
|
|
659
659
|
iconName: string;
|
|
660
|
-
provider: () => Promise<Provider>;
|
|
660
|
+
provider: (jslogContext: string) => Promise<Provider>;
|
|
661
661
|
helpTitle: (() => string);
|
|
662
662
|
titlePrefix: (() => string);
|
|
663
663
|
titleSuggestion?: (() => string);
|
|
664
|
+
jslogContext: string;
|
|
664
665
|
}
|
|
@@ -24,11 +24,16 @@ export class HelpQuickOpen extends Provider {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
private async addProvider(extension: ProviderRegistration): Promise<void> {
|
|
27
|
+
// We want to exclude Help menu as we are already in it.
|
|
28
|
+
if (extension.prefix === '?') {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
27
32
|
this.providers.push({
|
|
28
33
|
prefix: extension.prefix || '',
|
|
29
34
|
iconName: extension.iconName,
|
|
30
35
|
title: extension.helpTitle(),
|
|
31
|
-
jslogContext:
|
|
36
|
+
jslogContext: extension.jslogContext,
|
|
32
37
|
});
|
|
33
38
|
}
|
|
34
39
|
|
|
@@ -69,8 +74,9 @@ export class HelpQuickOpen extends Provider {
|
|
|
69
74
|
registerProvider({
|
|
70
75
|
prefix: '?',
|
|
71
76
|
iconName: 'help',
|
|
72
|
-
provider:
|
|
77
|
+
provider: jslogContext => Promise.resolve(new HelpQuickOpen(jslogContext)),
|
|
73
78
|
helpTitle: () => 'Help',
|
|
74
79
|
titlePrefix: () => 'Help',
|
|
75
80
|
titleSuggestion: undefined,
|
|
81
|
+
jslogContext: 'help'
|
|
76
82
|
});
|
|
@@ -5,7 +5,12 @@
|
|
|
5
5
|
import * as i18n from '../../../../core/i18n/i18n.js';
|
|
6
6
|
import type * as UI from '../../legacy.js';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
FilteredListWidget,
|
|
10
|
+
getRegisteredProviders,
|
|
11
|
+
type Provider,
|
|
12
|
+
type ProviderRegistration
|
|
13
|
+
} from './FilteredListWidget.js';
|
|
9
14
|
|
|
10
15
|
const UIStrings = {
|
|
11
16
|
/**
|
|
@@ -42,19 +47,14 @@ export class QuickOpenImpl {
|
|
|
42
47
|
filteredListWidget.setQuery(query);
|
|
43
48
|
}
|
|
44
49
|
|
|
45
|
-
private addProvider(extension: {
|
|
46
|
-
prefix: string,
|
|
47
|
-
provider: () => Promise<Provider>,
|
|
48
|
-
titlePrefix: () => string,
|
|
49
|
-
titleSuggestion?: (() => string),
|
|
50
|
-
}): void {
|
|
50
|
+
private addProvider(extension: ProviderRegistration): void {
|
|
51
51
|
const prefix = extension.prefix;
|
|
52
52
|
if (prefix === null) {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
this.prefixes.push(prefix);
|
|
56
56
|
this.providers.set(prefix, {
|
|
57
|
-
provider: extension.provider,
|
|
57
|
+
provider: () => extension.provider(extension.jslogContext),
|
|
58
58
|
titlePrefix: extension.titlePrefix,
|
|
59
59
|
titleSuggestion: extension.titleSuggestion,
|
|
60
60
|
});
|
|
@@ -34,17 +34,15 @@
|
|
|
34
34
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
|
-
import * as Common from '../../../../core/common/common.js';
|
|
38
37
|
import * as i18n from '../../../../core/i18n/i18n.js';
|
|
39
38
|
import * as SDK from '../../../../core/sdk/sdk.js';
|
|
40
|
-
import type * as Protocol from '../../../../generated/protocol.js';
|
|
41
39
|
import * as StackTrace from '../../../../models/stack_trace/stack_trace.js';
|
|
42
40
|
import * as Workspace from '../../../../models/workspace/workspace.js';
|
|
43
41
|
import * as VisualLogging from '../../../visual_logging/visual_logging.js';
|
|
44
42
|
import * as UI from '../../legacy.js';
|
|
45
43
|
|
|
46
44
|
import jsUtilsStyles from './jsUtils.css.js';
|
|
47
|
-
import {
|
|
45
|
+
import {Linkifier} from './Linkifier.js';
|
|
48
46
|
|
|
49
47
|
const UIStrings = {
|
|
50
48
|
/**
|
|
@@ -63,10 +61,6 @@ const UIStrings = {
|
|
|
63
61
|
* @description A link to rehide frames that are by default hidden.
|
|
64
62
|
*/
|
|
65
63
|
showLess: 'Show less',
|
|
66
|
-
/**
|
|
67
|
-
* @description Text indicating that source url of a link is currently unknown
|
|
68
|
-
*/
|
|
69
|
-
unknownSource: 'unknown',
|
|
70
64
|
} as const;
|
|
71
65
|
const str_ = i18n.i18n.registerUIStrings('ui/legacy/components/utils/JSPresentationUtils.ts', UIStrings);
|
|
72
66
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
@@ -95,74 +89,8 @@ function populateContextMenu(link: Element, event: Event): void {
|
|
|
95
89
|
void contextMenu.show();
|
|
96
90
|
}
|
|
97
91
|
|
|
98
|
-
// TODO(crbug.com/456517732): remove when all usages of runtimeStackTrace are migrated.
|
|
99
|
-
function buildStackTraceRowsForLegacyRuntimeStackTrace(
|
|
100
|
-
stackTrace: Protocol.Runtime.StackTrace,
|
|
101
|
-
target: SDK.Target.Target|null,
|
|
102
|
-
linkifier: Linkifier,
|
|
103
|
-
tabStops: boolean|undefined,
|
|
104
|
-
updateCallback?: (arg0: Array<StackTraceRegularRow|StackTraceAsyncRow>) => void,
|
|
105
|
-
showColumnNumber?: boolean,
|
|
106
|
-
): Array<StackTraceRegularRow|StackTraceAsyncRow> {
|
|
107
|
-
const stackTraceRows: Array<StackTraceRegularRow|StackTraceAsyncRow> = [];
|
|
108
|
-
|
|
109
|
-
if (updateCallback) {
|
|
110
|
-
const throttler = new Common.Throttler.Throttler(100);
|
|
111
|
-
linkifier.addEventListener(LinkifierEvents.LIVE_LOCATION_UPDATED, () => {
|
|
112
|
-
void throttler.schedule(async () => updateCallback(stackTraceRows));
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function buildStackTraceRowsHelper(
|
|
117
|
-
stackTrace: Protocol.Runtime.StackTrace,
|
|
118
|
-
previousCallFrames: Protocol.Runtime.CallFrame[]|undefined = undefined): void {
|
|
119
|
-
let asyncRow: StackTraceAsyncRow|null = null;
|
|
120
|
-
if (previousCallFrames) {
|
|
121
|
-
asyncRow = {
|
|
122
|
-
asyncDescription: UI.UIUtils.asyncStackTraceLabel(stackTrace.description, previousCallFrames),
|
|
123
|
-
};
|
|
124
|
-
stackTraceRows.push(asyncRow);
|
|
125
|
-
}
|
|
126
|
-
let previousStackFrameWasBreakpointCondition = false;
|
|
127
|
-
for (const stackFrame of stackTrace.callFrames) {
|
|
128
|
-
const functionName = UI.UIUtils.beautifyFunctionName(stackFrame.functionName);
|
|
129
|
-
const link = linkifier.maybeLinkifyConsoleCallFrame(target, stackFrame, {
|
|
130
|
-
showColumnNumber,
|
|
131
|
-
tabStop: Boolean(tabStops),
|
|
132
|
-
inlineFrameIndex: 0,
|
|
133
|
-
revealBreakpoint: previousStackFrameWasBreakpointCondition,
|
|
134
|
-
});
|
|
135
|
-
if (link) {
|
|
136
|
-
link.setAttribute('jslog', `${VisualLogging.link('stack-trace').track({click: true})}`);
|
|
137
|
-
link.addEventListener('contextmenu', populateContextMenu.bind(null, link));
|
|
138
|
-
|
|
139
|
-
if (!link.textContent) {
|
|
140
|
-
link.textContent = i18nString(UIStrings.unknownSource);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
stackTraceRows.push({functionName, link});
|
|
144
|
-
previousStackFrameWasBreakpointCondition = [
|
|
145
|
-
SDK.DebuggerModel.COND_BREAKPOINT_SOURCE_URL,
|
|
146
|
-
SDK.DebuggerModel.LOGPOINT_SOURCE_URL,
|
|
147
|
-
].includes(stackFrame.url);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
buildStackTraceRowsHelper(stackTrace);
|
|
152
|
-
let previousCallFrames = stackTrace.callFrames;
|
|
153
|
-
for (let asyncStackTrace = stackTrace.parent; asyncStackTrace; asyncStackTrace = asyncStackTrace.parent) {
|
|
154
|
-
if (asyncStackTrace.callFrames.length) {
|
|
155
|
-
buildStackTraceRowsHelper(asyncStackTrace, previousCallFrames);
|
|
156
|
-
}
|
|
157
|
-
previousCallFrames = asyncStackTrace.callFrames;
|
|
158
|
-
}
|
|
159
|
-
return stackTraceRows;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
92
|
function buildStackTraceRows(
|
|
163
93
|
stackTrace: StackTrace.StackTrace.StackTrace,
|
|
164
|
-
target: SDK.Target.Target|null,
|
|
165
|
-
linkifier: Linkifier,
|
|
166
94
|
tabStops: boolean|undefined,
|
|
167
95
|
showColumnNumber?: boolean,
|
|
168
96
|
): Array<StackTraceRegularRow|StackTraceAsyncRow> {
|
|
@@ -183,11 +111,12 @@ function buildStackTraceRows(
|
|
|
183
111
|
let previousStackFrameWasBreakpointCondition = false;
|
|
184
112
|
for (const frame of fragment.frames) {
|
|
185
113
|
const functionName = UI.UIUtils.beautifyFunctionName(frame.name ?? '');
|
|
186
|
-
const link =
|
|
114
|
+
const link = Linkifier.linkifyStackTraceFrame(frame, {
|
|
187
115
|
showColumnNumber,
|
|
188
116
|
tabStop: Boolean(tabStops),
|
|
189
117
|
inlineFrameIndex: 0,
|
|
190
118
|
revealBreakpoint: previousStackFrameWasBreakpointCondition,
|
|
119
|
+
maxLength: UI.UIUtils.MaxLengthForDisplayedURLsInConsole,
|
|
191
120
|
});
|
|
192
121
|
link.setAttribute('jslog', `${VisualLogging.link('stack-trace').track({click: true})}`);
|
|
193
122
|
link.addEventListener('contextmenu', populateContextMenu.bind(null, link));
|
|
@@ -213,9 +142,8 @@ function buildStackTraceRows(
|
|
|
213
142
|
|
|
214
143
|
function renderStackTraceTable(
|
|
215
144
|
container: Element, parent: Element, expandable: boolean,
|
|
216
|
-
stackTraceRows: Array<StackTraceRegularRow|StackTraceAsyncRow>):
|
|
145
|
+
stackTraceRows: Array<StackTraceRegularRow|StackTraceAsyncRow>): void {
|
|
217
146
|
container.removeChildren();
|
|
218
|
-
const links: HTMLElement[] = [];
|
|
219
147
|
|
|
220
148
|
// The tableSection groups one or more synchronous call frames together.
|
|
221
149
|
// Wherever there is an asynchronous call, a new section is created.
|
|
@@ -249,10 +177,7 @@ function renderStackTraceTable(
|
|
|
249
177
|
} else {
|
|
250
178
|
row.createChild('td', 'function-name').textContent = item.functionName;
|
|
251
179
|
row.createChild('td').textContent = ' @ ';
|
|
252
|
-
|
|
253
|
-
row.createChild('td', 'link').appendChild(item.link);
|
|
254
|
-
links.push(item.link);
|
|
255
|
-
}
|
|
180
|
+
row.createChild('td', 'link').appendChild(item.link);
|
|
256
181
|
}
|
|
257
182
|
}
|
|
258
183
|
|
|
@@ -285,13 +210,9 @@ function renderStackTraceTable(
|
|
|
285
210
|
// If we are in a popup, this will trigger a re-layout
|
|
286
211
|
UI.GlassPane.GlassPane.containerMoved(container);
|
|
287
212
|
}, false);
|
|
288
|
-
|
|
289
|
-
return links;
|
|
290
213
|
}
|
|
291
214
|
|
|
292
215
|
export interface Options {
|
|
293
|
-
// TODO(crbug.com/456517732): remove when all usages of runtimeStackTrace are migrated.
|
|
294
|
-
runtimeStackTrace?: Protocol.Runtime.StackTrace;
|
|
295
216
|
tabStops?: boolean;
|
|
296
217
|
// Whether the width of stack trace preview
|
|
297
218
|
// is constrained to its container or whether
|
|
@@ -303,7 +224,7 @@ export interface Options {
|
|
|
303
224
|
|
|
304
225
|
interface StackTraceRegularRow {
|
|
305
226
|
functionName: string;
|
|
306
|
-
link: HTMLElement
|
|
227
|
+
link: HTMLElement;
|
|
307
228
|
}
|
|
308
229
|
|
|
309
230
|
interface StackTraceAsyncRow {
|
|
@@ -312,90 +233,43 @@ interface StackTraceAsyncRow {
|
|
|
312
233
|
|
|
313
234
|
export class StackTracePreviewContent extends UI.Widget.Widget {
|
|
314
235
|
#stackTrace?: StackTrace.StackTrace.StackTrace;
|
|
315
|
-
#
|
|
316
|
-
#linkifier?: Linkifier;
|
|
317
|
-
#ownedLinkifier?: Linkifier;
|
|
318
|
-
#options: Options;
|
|
319
|
-
#links: HTMLElement[] = [];
|
|
236
|
+
#options: Options = {};
|
|
320
237
|
|
|
321
238
|
readonly #table: HTMLElement;
|
|
322
|
-
/**
|
|
323
|
-
* Updated when we update to define if we have any rows for the StackTrace;
|
|
324
|
-
* allowing the caller to know if this element is empty or not.
|
|
325
|
-
*/
|
|
326
|
-
#hasRows = false;
|
|
327
|
-
|
|
328
|
-
constructor(element?: HTMLElement, target?: SDK.Target.Target, linkifier?: Linkifier, options?: Options) {
|
|
329
|
-
super(element, {useShadowDom: true});
|
|
330
|
-
|
|
331
|
-
this.#target = target;
|
|
332
|
-
this.#linkifier = linkifier;
|
|
333
|
-
if (!this.#linkifier) {
|
|
334
|
-
this.#ownedLinkifier = new Linkifier();
|
|
335
|
-
this.#linkifier = this.#ownedLinkifier;
|
|
336
|
-
}
|
|
337
|
-
this.#options = options || {
|
|
338
|
-
widthConstrained: false,
|
|
339
|
-
};
|
|
340
239
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
this.element.classList.toggle('width-constrained', this.#options.widthConstrained ?? false);
|
|
344
|
-
this.element.style.display = 'inline-block';
|
|
240
|
+
constructor(element?: HTMLElement) {
|
|
241
|
+
super(element, {useShadowDom: true, classes: ['monospace', 'stack-preview-container']});
|
|
345
242
|
|
|
346
243
|
UI.DOMUtilities.appendStyle(this.element.shadowRoot as ShadowRoot, jsUtilsStyles);
|
|
347
244
|
|
|
348
245
|
this.#table = this.contentElement.createChild('table', 'stack-preview-container');
|
|
349
|
-
this.#table.classList.toggle('width-constrained', this.#options.widthConstrained ?? false);
|
|
350
|
-
|
|
351
|
-
this.performUpdate();
|
|
352
246
|
}
|
|
353
247
|
|
|
354
248
|
hasContent(): boolean {
|
|
355
|
-
|
|
249
|
+
if (!this.#stackTrace) {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
const {syncFragment, asyncFragments} = this.#stackTrace;
|
|
253
|
+
return syncFragment.frames.length > 0 || asyncFragments.some(f => f.frames.length > 0);
|
|
356
254
|
}
|
|
357
255
|
|
|
358
256
|
override performUpdate(): void {
|
|
359
|
-
if (!this.#
|
|
257
|
+
if (!this.#stackTrace) {
|
|
360
258
|
return;
|
|
361
259
|
}
|
|
362
260
|
|
|
363
|
-
const
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
const stackTraceRows = buildStackTraceRows(
|
|
367
|
-
this.#stackTrace, this.#target ?? null, this.#linkifier, tabStops, this.#options.showColumnNumber);
|
|
368
|
-
this.#hasRows = stackTraceRows.length > 0;
|
|
369
|
-
this.#links = renderStackTraceTable(this.#table, this.element, this.#options.expandable ?? false, stackTraceRows);
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
// TODO(crbug.com/456517732): remove when all usages of runtimeStackTrace are migrated.
|
|
374
|
-
const updateCallback =
|
|
375
|
-
renderStackTraceTable.bind(null, this.#table, this.element, this.#options.expandable ?? false);
|
|
376
|
-
const stackTraceRows = buildStackTraceRowsForLegacyRuntimeStackTrace(
|
|
377
|
-
runtimeStackTrace ?? {callFrames: []}, this.#target ?? null, this.#linkifier, tabStops, updateCallback,
|
|
378
|
-
this.#options.showColumnNumber);
|
|
379
|
-
this.#hasRows = stackTraceRows.length > 0;
|
|
380
|
-
this.#links = renderStackTraceTable(this.#table, this.element, this.#options.expandable ?? false, stackTraceRows);
|
|
261
|
+
const stackTraceRows =
|
|
262
|
+
buildStackTraceRows(this.#stackTrace, this.#options.tabStops, this.#options.showColumnNumber);
|
|
263
|
+
renderStackTraceTable(this.#table, this.element, this.#options.expandable ?? false, stackTraceRows);
|
|
381
264
|
}
|
|
382
265
|
|
|
383
266
|
get linkElements(): readonly HTMLElement[] {
|
|
384
|
-
return this
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
set target(target: SDK.Target.Target|undefined) {
|
|
388
|
-
this.#target = target;
|
|
389
|
-
this.requestUpdate();
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
set linkifier(linkifier: Linkifier) {
|
|
393
|
-
this.#linkifier = linkifier;
|
|
394
|
-
this.requestUpdate();
|
|
267
|
+
return [...this.contentElement.querySelectorAll<HTMLElement>('td.link > .devtools-link')];
|
|
395
268
|
}
|
|
396
269
|
|
|
397
270
|
set options(options: Options) {
|
|
398
271
|
this.#options = options;
|
|
272
|
+
this.#table.classList.toggle('width-constrained', this.#options.widthConstrained ?? false);
|
|
399
273
|
this.requestUpdate();
|
|
400
274
|
}
|
|
401
275
|
|
|
@@ -407,8 +281,4 @@ export class StackTracePreviewContent extends UI.Widget.Widget {
|
|
|
407
281
|
this.#stackTrace.addEventListener(StackTrace.StackTrace.Events.UPDATED, this.requestUpdate, this);
|
|
408
282
|
this.requestUpdate();
|
|
409
283
|
}
|
|
410
|
-
|
|
411
|
-
override onDetach(): void {
|
|
412
|
-
this.#ownedLinkifier?.dispose();
|
|
413
|
-
}
|
|
414
284
|
}
|