chrome-devtools-frontend 1.0.1528866 → 1.0.1529904
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/Gzip.ts +10 -8
- package/front_end/core/host/UserMetrics.ts +2 -1
- package/front_end/core/root/Runtime.ts +10 -0
- package/front_end/core/sdk/NetworkManager.ts +85 -35
- package/front_end/core/sdk/SourceMap.ts +14 -0
- package/front_end/core/sdk/SourceMapScopesInfo.ts +32 -2
- package/front_end/entrypoints/main/MainImpl.ts +23 -4
- package/front_end/generated/SupportedCSSProperties.js +9 -0
- package/front_end/models/ai_assistance/BuiltInAi.ts +1 -1
- package/front_end/models/ai_assistance/ConversationHandler.ts +15 -14
- package/front_end/models/bindings/CompilerScriptMapping.ts +54 -4
- package/front_end/models/javascript_metadata/NativeFunctions.js +8 -0
- package/front_end/models/persistence/NetworkPersistenceManager.ts +3 -5
- package/front_end/models/persistence/PersistenceImpl.ts +0 -5
- package/front_end/models/persistence/persistence-meta.ts +0 -31
- package/front_end/models/persistence/persistence.ts +0 -6
- package/front_end/{models/persistence → panels/common}/PersistenceUtils.ts +15 -17
- package/front_end/panels/common/common.ts +1 -0
- package/front_end/panels/console/ConsoleInsightTeaser.ts +285 -22
- package/front_end/panels/console/ConsolePrompt.ts +10 -2
- package/front_end/panels/console/ConsoleViewMessage.ts +18 -1
- package/front_end/panels/console/console-meta.ts +14 -0
- package/front_end/panels/console/consoleInsightTeaser.css +28 -0
- package/front_end/panels/console/consolePrompt.css +3 -2
- package/front_end/panels/console/consoleView.css +10 -5
- package/front_end/panels/explain/ActionDelegate.ts +3 -0
- package/front_end/panels/explain/explain-meta.ts +7 -0
- package/front_end/panels/network/BlockedURLsPane.ts +139 -36
- package/front_end/panels/network/NetworkLogView.ts +1 -1
- package/front_end/{models/persistence → panels/settings}/EditFileSystemView.ts +2 -6
- package/front_end/panels/settings/WorkspaceSettingsTab.ts +2 -1
- package/front_end/panels/settings/settings.ts +2 -0
- package/front_end/panels/sources/AiCodeCompletionPlugin.ts +9 -4
- package/front_end/{models/persistence → panels/sources}/PersistenceActions.ts +8 -12
- package/front_end/panels/sources/TabbedEditorContainer.ts +2 -1
- package/front_end/panels/sources/sources-meta.ts +15 -0
- package/front_end/panels/sources/sources.ts +2 -0
- package/front_end/panels/timeline/TimelinePanel.ts +2 -3
- package/front_end/panels/utils/utils.ts +2 -1
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/diff/diff_match_patch.js +1 -1
- package/front_end/ui/legacy/ListWidget.ts +2 -2
- package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +1 -1
- package/front_end/ui/visual_logging/KnownContextValues.ts +9 -0
- package/package.json +1 -1
- /package/front_end/{models/persistence → panels/settings}/editFileSystemView.css +0 -0
|
@@ -49,16 +49,18 @@ export async function compress(str: string): Promise<ArrayBuffer> {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/** Private coder/decoder **/
|
|
52
|
-
function gzipCodec(
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
async function gzipCodec(
|
|
53
|
+
buffer: Uint8Array<ArrayBufferLike>|ArrayBuffer,
|
|
54
|
+
codecStream: CompressionStream|DecompressionStream): Promise<ArrayBuffer> {
|
|
55
|
+
const readable = new ReadableStream({
|
|
56
|
+
start(controller) {
|
|
57
|
+
controller.enqueue(buffer);
|
|
58
|
+
controller.close();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
55
61
|
const codecReadable = readable.pipeThrough(codecStream);
|
|
56
|
-
|
|
57
|
-
const writer = writable.getWriter();
|
|
58
|
-
void writer.write(buffer);
|
|
59
|
-
void writer.close();
|
|
60
62
|
// A response is a convenient way to get an ArrayBuffer from a ReadableStream.
|
|
61
|
-
return new Response(codecReadable).arrayBuffer();
|
|
63
|
+
return await new Response(codecReadable).arrayBuffer();
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
export function decompressStream(stream: ReadableStream): ReadableStream {
|
|
@@ -514,7 +514,8 @@ export enum Action {
|
|
|
514
514
|
AiCodeCompletionSuggestionAccepted = 187,
|
|
515
515
|
AiCodeCompletionError = 188,
|
|
516
516
|
AttributeLinkClicked = 189,
|
|
517
|
-
|
|
517
|
+
InsightRequestedViaTeaser = 190,
|
|
518
|
+
MAX_VALUE = 191,
|
|
518
519
|
/* eslint-enable @typescript-eslint/naming-convention */
|
|
519
520
|
}
|
|
520
521
|
|
|
@@ -527,6 +527,14 @@ interface AiPromptApi {
|
|
|
527
527
|
enabled: boolean;
|
|
528
528
|
}
|
|
529
529
|
|
|
530
|
+
interface DevToolsIndividualRequestThrottling {
|
|
531
|
+
enabled: boolean;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
export interface DevToolsEnableDurableMessages {
|
|
535
|
+
enabled: boolean;
|
|
536
|
+
}
|
|
537
|
+
|
|
530
538
|
/**
|
|
531
539
|
* The host configuration that we expect from the DevTools back-end.
|
|
532
540
|
*
|
|
@@ -554,6 +562,7 @@ export type HostConfig = Platform.TypeScriptUtilities.RecursivePartial<{
|
|
|
554
562
|
devToolsVeLogging: HostConfigVeLogging,
|
|
555
563
|
devToolsWellKnown: HostConfigWellKnown,
|
|
556
564
|
devToolsPrivacyUI: HostConfigPrivacyUI,
|
|
565
|
+
devToolsIndividualRequestThrottling: DevToolsIndividualRequestThrottling,
|
|
557
566
|
devToolsIpProtectionPanelInDevTools: HostConfigIPProtection,
|
|
558
567
|
/**
|
|
559
568
|
* OffTheRecord here indicates that the user's profile is either incognito,
|
|
@@ -574,6 +583,7 @@ export type HostConfig = Platform.TypeScriptUtilities.RecursivePartial<{
|
|
|
574
583
|
devToolsFlexibleLayout: DevToolsFlexibleLayout,
|
|
575
584
|
devToolsStartingStyleDebugging: DevToolsStartingStyleDebugging,
|
|
576
585
|
devToolsAiPromptApi: AiPromptApi,
|
|
586
|
+
devToolsEnableDurableMessages: DevToolsEnableDurableMessages,
|
|
577
587
|
}>;
|
|
578
588
|
|
|
579
589
|
/**
|
|
@@ -165,6 +165,8 @@ export class NetworkManager extends SDKModel<EventTypes> {
|
|
|
165
165
|
|
|
166
166
|
void this.#networkAgent.invoke_enable({
|
|
167
167
|
maxPostDataSize: MAX_EAGER_POST_REQUEST_BODY_LENGTH,
|
|
168
|
+
enableDurableMessages: Root.Runtime.hostConfig.devToolsEnableDurableMessages?.enabled,
|
|
169
|
+
maxTotalBufferSize: MAX_RESPONSE_BODY_TOTAL_BUFFER_LENGTH,
|
|
168
170
|
reportDirectSocketTraffic: true,
|
|
169
171
|
});
|
|
170
172
|
void this.#networkAgent.invoke_setAttachDebugStack({enabled: true});
|
|
@@ -520,6 +522,7 @@ export const Fast4GConditions: Conditions = {
|
|
|
520
522
|
};
|
|
521
523
|
|
|
522
524
|
const MAX_EAGER_POST_REQUEST_BODY_LENGTH = 64 * 1024; // bytes
|
|
525
|
+
const MAX_RESPONSE_BODY_TOTAL_BUFFER_LENGTH = 250 * 1024 * 1024; // bytes
|
|
523
526
|
|
|
524
527
|
export class FetchDispatcher implements ProtocolProxyApi.FetchDispatcher {
|
|
525
528
|
readonly #fetchAgent: ProtocolProxyApi.FetchApi;
|
|
@@ -1553,10 +1556,13 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
|
|
|
1553
1556
|
}
|
|
1554
1557
|
}
|
|
1555
1558
|
|
|
1556
|
-
|
|
1557
|
-
url: string
|
|
1558
|
-
enabled: boolean
|
|
1559
|
-
}
|
|
1559
|
+
type RequestConditionsSetting = {
|
|
1560
|
+
url: string,
|
|
1561
|
+
enabled: boolean,
|
|
1562
|
+
}|{
|
|
1563
|
+
urlPattern: URLPatternConstructorString,
|
|
1564
|
+
enabled: boolean,
|
|
1565
|
+
};
|
|
1560
1566
|
|
|
1561
1567
|
declare global {
|
|
1562
1568
|
// TS typedefs are not up to date
|
|
@@ -1621,34 +1627,62 @@ export class RequestURLPattern {
|
|
|
1621
1627
|
|
|
1622
1628
|
return tryCreate(pattern) // try as is
|
|
1623
1629
|
??
|
|
1624
|
-
// Try upgrade
|
|
1630
|
+
// Try to upgrade patterns created from the network panel, which either blocks the full url (sans
|
|
1625
1631
|
// protocol) or just the domain name. In both cases the wildcard patterns had implicit wildcards at the end.
|
|
1626
|
-
//
|
|
1627
|
-
//
|
|
1628
|
-
(pattern
|
|
1629
|
-
?
|
|
1630
|
-
tryCreate(`*://${pattern}*`) // Append a wildcard, since the pathname will be parsed from the pattern.
|
|
1631
|
-
:
|
|
1632
|
-
tryCreate(`*://${pattern}`)); // The pathname is empty, which automatically makes it a wildcard.
|
|
1632
|
+
// We explicitly add that here, which will match both domain names without path (implicitly setting pathname
|
|
1633
|
+
// to '*') and urls with path (appending * to the pathname).
|
|
1634
|
+
tryCreate(`*://${pattern}*`);
|
|
1633
1635
|
}
|
|
1634
1636
|
}
|
|
1635
1637
|
|
|
1636
1638
|
export class RequestCondition extends Common.ObjectWrapper.ObjectWrapper<RequestCondition.EventTypes> {
|
|
1637
|
-
#
|
|
1639
|
+
#pattern: RequestURLPattern|{wildcardURL: string, upgradedPattern?: RequestURLPattern};
|
|
1638
1640
|
#enabled: boolean;
|
|
1639
1641
|
|
|
1640
1642
|
constructor(setting: RequestConditionsSetting) {
|
|
1641
1643
|
super();
|
|
1642
|
-
|
|
1644
|
+
if ('urlPattern' in setting) {
|
|
1645
|
+
this.#pattern = RequestURLPattern.create(setting.urlPattern) ?? {
|
|
1646
|
+
wildcardURL: setting.urlPattern,
|
|
1647
|
+
upgradedPattern: RequestURLPattern.upgradeFromWildcard(setting.urlPattern) ?? undefined,
|
|
1648
|
+
};
|
|
1649
|
+
} else {
|
|
1650
|
+
this.#pattern = {
|
|
1651
|
+
wildcardURL: setting.url,
|
|
1652
|
+
upgradedPattern: RequestURLPattern.upgradeFromWildcard(setting.url) ?? undefined
|
|
1653
|
+
};
|
|
1654
|
+
}
|
|
1643
1655
|
this.#enabled = setting.enabled;
|
|
1644
1656
|
}
|
|
1645
1657
|
|
|
1646
|
-
get
|
|
1647
|
-
return this.#
|
|
1658
|
+
get constructorString(): string|undefined {
|
|
1659
|
+
return this.#pattern instanceof RequestURLPattern ? this.#pattern.constructorString :
|
|
1660
|
+
this.#pattern.upgradedPattern?.constructorString;
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
get wildcardURL(): string|undefined {
|
|
1664
|
+
return 'wildcardURL' in this.#pattern ? this.#pattern.wildcardURL : undefined;
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
get constructorStringOrWildcardURL(): string {
|
|
1668
|
+
return this.#pattern instanceof RequestURLPattern ?
|
|
1669
|
+
this.#pattern.constructorString :
|
|
1670
|
+
(this.#pattern.upgradedPattern?.constructorString ?? this.#pattern.wildcardURL);
|
|
1648
1671
|
}
|
|
1649
1672
|
|
|
1650
|
-
set
|
|
1651
|
-
|
|
1673
|
+
set pattern(pattern: RequestURLPattern|string) {
|
|
1674
|
+
if (typeof pattern === 'string') {
|
|
1675
|
+
// TODO(pfaffe) Remove once the feature flag is no longer required
|
|
1676
|
+
if (Root.Runtime.hostConfig.devToolsIndividualRequestThrottling?.enabled) {
|
|
1677
|
+
throw new Error('Should not use wildcard urls');
|
|
1678
|
+
}
|
|
1679
|
+
this.#pattern = {
|
|
1680
|
+
wildcardURL: pattern,
|
|
1681
|
+
upgradedPattern: RequestURLPattern.upgradeFromWildcard(pattern) ?? undefined
|
|
1682
|
+
};
|
|
1683
|
+
} else {
|
|
1684
|
+
this.#pattern = pattern;
|
|
1685
|
+
}
|
|
1652
1686
|
this.dispatchEventToListeners(RequestCondition.Events.REQUEST_CONDITION_CHANGED);
|
|
1653
1687
|
}
|
|
1654
1688
|
|
|
@@ -1662,8 +1696,13 @@ export class RequestCondition extends Common.ObjectWrapper.ObjectWrapper<Request
|
|
|
1662
1696
|
}
|
|
1663
1697
|
|
|
1664
1698
|
toSetting(): RequestConditionsSetting {
|
|
1665
|
-
const
|
|
1666
|
-
return {
|
|
1699
|
+
const enabled = this.enabled;
|
|
1700
|
+
return this.#pattern instanceof RequestURLPattern ? {enabled, urlPattern: this.#pattern.constructorString} :
|
|
1701
|
+
{enabled, url: this.#pattern.wildcardURL};
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
get originalOrUpgradedURLPattern(): URLPattern|undefined {
|
|
1705
|
+
return this.#pattern instanceof RequestURLPattern ? this.#pattern.pattern : this.#pattern.upgradedPattern?.pattern;
|
|
1667
1706
|
}
|
|
1668
1707
|
}
|
|
1669
1708
|
|
|
@@ -1671,6 +1710,7 @@ export namespace RequestCondition {
|
|
|
1671
1710
|
export const enum Events {
|
|
1672
1711
|
REQUEST_CONDITION_CHANGED = 'request-condition-changed',
|
|
1673
1712
|
}
|
|
1713
|
+
|
|
1674
1714
|
export interface EventTypes {
|
|
1675
1715
|
[Events.REQUEST_CONDITION_CHANGED]: void;
|
|
1676
1716
|
}
|
|
@@ -1693,8 +1733,15 @@ export class RequestConditions extends Common.ObjectWrapper.ObjectWrapper<Reques
|
|
|
1693
1733
|
return this.#conditions.length;
|
|
1694
1734
|
}
|
|
1695
1735
|
|
|
1736
|
+
findCondition(pattern: string): RequestCondition|undefined {
|
|
1737
|
+
if (Root.Runtime.hostConfig.devToolsIndividualRequestThrottling?.enabled) {
|
|
1738
|
+
return this.#conditions.find(condition => condition.constructorString === pattern);
|
|
1739
|
+
}
|
|
1740
|
+
return this.#conditions.find(condition => condition.wildcardURL === pattern);
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1696
1743
|
has(url: string): boolean {
|
|
1697
|
-
return Boolean(this
|
|
1744
|
+
return Boolean(this.findCondition(url));
|
|
1698
1745
|
}
|
|
1699
1746
|
|
|
1700
1747
|
add(...conditions: RequestCondition[]): void {
|
|
@@ -1729,12 +1776,22 @@ export class RequestConditions extends Common.ObjectWrapper.ObjectWrapper<Reques
|
|
|
1729
1776
|
return this.#conditions.values();
|
|
1730
1777
|
}
|
|
1731
1778
|
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1779
|
+
applyConditions(...agents: ProtocolProxyApi.NetworkApi[]): boolean {
|
|
1780
|
+
if (Root.Runtime.hostConfig.devToolsIndividualRequestThrottling?.enabled) {
|
|
1781
|
+
const urlPatterns = this.#conditions.filter(condition => condition.enabled && condition.constructorString)
|
|
1782
|
+
.map(condition => ({urlPattern: condition.constructorString as string, block: true}));
|
|
1783
|
+
|
|
1784
|
+
for (const agent of agents) {
|
|
1785
|
+
void agent.invoke_setBlockedURLs({urlPatterns});
|
|
1736
1786
|
}
|
|
1787
|
+
return urlPatterns.length > 0;
|
|
1788
|
+
}
|
|
1789
|
+
const urls = this.#conditions.filter(condition => condition.enabled && condition.wildcardURL)
|
|
1790
|
+
.map(condition => condition.wildcardURL as string);
|
|
1791
|
+
for (const agent of agents) {
|
|
1792
|
+
void agent.invoke_setBlockedURLs({urls});
|
|
1737
1793
|
}
|
|
1794
|
+
return urls.length > 0;
|
|
1738
1795
|
}
|
|
1739
1796
|
}
|
|
1740
1797
|
|
|
@@ -1847,10 +1904,7 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
1847
1904
|
void networkAgent.invoke_setUserAgentOverride(
|
|
1848
1905
|
{userAgent: this.currentUserAgent(), userAgentMetadata: this.#userAgentMetadataOverride || undefined});
|
|
1849
1906
|
}
|
|
1850
|
-
|
|
1851
|
-
if (blockedURLs.length) {
|
|
1852
|
-
void networkAgent.invoke_setBlockedURLs({urls: blockedURLs});
|
|
1853
|
-
}
|
|
1907
|
+
this.#requestConditions.applyConditions(networkAgent);
|
|
1854
1908
|
if (this.isIntercepting()) {
|
|
1855
1909
|
void fetchAgent.invoke_enable({patterns: this.#urlsForRequestInterceptor.valuesArray()});
|
|
1856
1910
|
}
|
|
@@ -2006,7 +2060,7 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
2006
2060
|
* @deprecated Kept for layout tests
|
|
2007
2061
|
* TODO(pfaffe) remove
|
|
2008
2062
|
*/
|
|
2009
|
-
setBlockedPatterns(patterns: Array<{url: string, enabled: boolean}>): void {
|
|
2063
|
+
private setBlockedPatterns(patterns: Array<{url: string, enabled: boolean}>): void {
|
|
2010
2064
|
this.requestConditions.clear();
|
|
2011
2065
|
this.requestConditions.add(...patterns.map(pattern => new RequestCondition(pattern)));
|
|
2012
2066
|
}
|
|
@@ -2019,11 +2073,7 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
2019
2073
|
}
|
|
2020
2074
|
|
|
2021
2075
|
private updateBlockedPatterns(): void {
|
|
2022
|
-
|
|
2023
|
-
this.#isBlocking = urls.length > 0;
|
|
2024
|
-
for (const agent of this.#networkAgents) {
|
|
2025
|
-
void agent.invoke_setBlockedURLs({urls});
|
|
2026
|
-
}
|
|
2076
|
+
this.#isBlocking = this.#requestConditions.applyConditions(...this.#networkAgents);
|
|
2027
2077
|
}
|
|
2028
2078
|
|
|
2029
2079
|
isIntercepting(): boolean {
|
|
@@ -205,6 +205,10 @@ export class SourceMap {
|
|
|
205
205
|
return this.#debugId ?? null;
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
+
sourceURLForSourceIndex(index: number): Platform.DevToolsPath.UrlString|undefined {
|
|
209
|
+
return this.#sourceInfos[index]?.sourceURL;
|
|
210
|
+
}
|
|
211
|
+
|
|
208
212
|
sourceURLs(): Platform.DevToolsPath.UrlString[] {
|
|
209
213
|
return [...this.#sourceInfoByURL.keys()];
|
|
210
214
|
}
|
|
@@ -775,6 +779,16 @@ export class SourceMap {
|
|
|
775
779
|
this.#ensureSourceMapProcessed();
|
|
776
780
|
return this.#scopesInfo?.findOriginalFunctionName(position) ?? null;
|
|
777
781
|
}
|
|
782
|
+
|
|
783
|
+
isOutlinedFrame(generatedLine: number, generatedColumn: number): boolean {
|
|
784
|
+
this.#ensureSourceMapProcessed();
|
|
785
|
+
return this.#scopesInfo?.isOutlinedFrame(generatedLine, generatedColumn) ?? false;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
hasInlinedFrames(generatedLine: number, generatedColumn: number): boolean {
|
|
789
|
+
this.#ensureSourceMapProcessed();
|
|
790
|
+
return this.#scopesInfo?.hasInlinedFrames(generatedLine, generatedColumn) ?? false;
|
|
791
|
+
}
|
|
778
792
|
}
|
|
779
793
|
|
|
780
794
|
const VLQ_BASE_SHIFT = 5;
|
|
@@ -6,6 +6,7 @@ import * as Protocol from '../../generated/protocol.js';
|
|
|
6
6
|
import * as Formatter from '../../models/formatter/formatter.js';
|
|
7
7
|
import type * as TextUtils from '../../models/text_utils/text_utils.js';
|
|
8
8
|
import type * as ScopesCodec from '../../third_party/source-map-scopes-codec/source-map-scopes-codec.js';
|
|
9
|
+
import type * as Platform from '../platform/platform.js';
|
|
9
10
|
|
|
10
11
|
import type {CallFrame, ScopeChainEntry} from './DebuggerModel.js';
|
|
11
12
|
import type {SourceMap} from './SourceMap.js';
|
|
@@ -120,6 +121,24 @@ export class SourceMapScopesInfo {
|
|
|
120
121
|
return false;
|
|
121
122
|
}
|
|
122
123
|
|
|
124
|
+
/**
|
|
125
|
+
* @returns true, iff the range surrounding the provided position contains multiple
|
|
126
|
+
* inlined original functions.
|
|
127
|
+
*/
|
|
128
|
+
hasInlinedFrames(generatedLine: number, generatedColumn: number): boolean {
|
|
129
|
+
const rangeChain = this.#findGeneratedRangeChain(generatedLine, generatedColumn);
|
|
130
|
+
for (let i = rangeChain.length - 1; i >= 0; --i) {
|
|
131
|
+
if (rangeChain[i].isStackFrame) {
|
|
132
|
+
// We stop looking for inlined original functions once we reach the current frame.
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
if (rangeChain[i].callSite) {
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
|
|
123
142
|
/**
|
|
124
143
|
* Given a generated position, returns the original name of the surrounding function as well as
|
|
125
144
|
* all the original function names that got inlined into the surrounding generated function and their
|
|
@@ -142,7 +161,10 @@ export class SourceMapScopesInfo {
|
|
|
142
161
|
|
|
143
162
|
if (range.callSite) {
|
|
144
163
|
// Record the name and call-site if the range corresponds to an inlined function.
|
|
145
|
-
result.inlinedFunctions.push({
|
|
164
|
+
result.inlinedFunctions.push({
|
|
165
|
+
name: range.originalScope?.name ?? '',
|
|
166
|
+
callsite: {...range.callSite, sourceURL: this.#sourceMap.sourceURLForSourceIndex(range.callSite.sourceIndex)}
|
|
167
|
+
});
|
|
146
168
|
}
|
|
147
169
|
if (range.isStackFrame) {
|
|
148
170
|
// We arrived at an actual generated JS function, don't go further.
|
|
@@ -394,7 +416,15 @@ export class SourceMapScopesInfo {
|
|
|
394
416
|
* The inlined functions are sorted from inner to outer (or top to bottom on the stack).
|
|
395
417
|
*/
|
|
396
418
|
export interface InlineInfo {
|
|
397
|
-
inlinedFunctions: Array<{
|
|
419
|
+
inlinedFunctions: Array<{
|
|
420
|
+
name: string,
|
|
421
|
+
callsite: {
|
|
422
|
+
line: number,
|
|
423
|
+
column: number,
|
|
424
|
+
sourceIndex: number,
|
|
425
|
+
sourceURL?: Platform.DevToolsPath.UrlString,
|
|
426
|
+
},
|
|
427
|
+
}>;
|
|
398
428
|
originalFunctionName: string;
|
|
399
429
|
}
|
|
400
430
|
|
|
@@ -54,7 +54,7 @@ import * as Logs from '../../models/logs/logs.js';
|
|
|
54
54
|
import * as Persistence from '../../models/persistence/persistence.js';
|
|
55
55
|
import * as ProjectSettings from '../../models/project_settings/project_settings.js';
|
|
56
56
|
import * as Workspace from '../../models/workspace/workspace.js';
|
|
57
|
-
import
|
|
57
|
+
import * as PanelCommon from '../../panels/common/common.js';
|
|
58
58
|
import * as Snippets from '../../panels/snippets/snippets.js';
|
|
59
59
|
import * as Buttons from '../../ui/components/buttons/buttons.js';
|
|
60
60
|
import * as Snackbar from '../../ui/components/snackbars/snackbars.js';
|
|
@@ -120,6 +120,10 @@ const UIStrings = {
|
|
|
120
120
|
* @description Text describing how to navigate the dock side menu
|
|
121
121
|
*/
|
|
122
122
|
dockSideNavigation: 'Use left and right arrow keys to navigate the options',
|
|
123
|
+
/**
|
|
124
|
+
* @description Notification shown to the user whenever DevTools receives an external request.
|
|
125
|
+
*/
|
|
126
|
+
externalRequestReceived: '`DevTools` received an external request',
|
|
123
127
|
} as const;
|
|
124
128
|
const str_ = i18n.i18n.registerUIStrings('entrypoints/main/MainImpl.ts', UIStrings);
|
|
125
129
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
@@ -476,11 +480,13 @@ export class MainImpl {
|
|
|
476
480
|
isolatedFileSystemManager.addPlatformFileSystem(
|
|
477
481
|
'snippet://' as Platform.DevToolsPath.UrlString, new Snippets.ScriptSnippetFileSystem.SnippetFileSystem());
|
|
478
482
|
|
|
479
|
-
Persistence.Persistence.PersistenceImpl.instance({
|
|
483
|
+
const persistenceImpl = Persistence.Persistence.PersistenceImpl.instance({
|
|
480
484
|
forceNew: true,
|
|
481
485
|
workspace: Workspace.Workspace.WorkspaceImpl.instance(),
|
|
482
486
|
breakpointManager: Breakpoints.BreakpointManager.BreakpointManager.instance(),
|
|
483
487
|
});
|
|
488
|
+
const linkDecorator = new PanelCommon.PersistenceUtils.LinkDecorator(persistenceImpl);
|
|
489
|
+
Components.Linkifier.Linkifier.setLinkDecorator(linkDecorator);
|
|
484
490
|
Persistence.NetworkPersistenceManager.NetworkPersistenceManager.instance(
|
|
485
491
|
{forceNew: true, workspace: Workspace.Workspace.WorkspaceImpl.instance()});
|
|
486
492
|
|
|
@@ -541,6 +547,14 @@ export class MainImpl {
|
|
|
541
547
|
});
|
|
542
548
|
}
|
|
543
549
|
|
|
550
|
+
const conversationHandler = AiAssistanceModel.ConversationHandler.ConversationHandler.instance();
|
|
551
|
+
conversationHandler.addEventListener(
|
|
552
|
+
AiAssistanceModel.ConversationHandler.ConversationHandlerEvents.EXTERNAL_REQUEST_RECEIVED,
|
|
553
|
+
() => Snackbar.Snackbar.Snackbar.show({message: i18nString(UIStrings.externalRequestReceived)}));
|
|
554
|
+
conversationHandler.addEventListener(
|
|
555
|
+
AiAssistanceModel.ConversationHandler.ConversationHandlerEvents.EXTERNAL_CONVERSATION_STARTED,
|
|
556
|
+
event => void VisualLogging.logFunctionCall(`start-conversation-${event.data}`, 'external'));
|
|
557
|
+
|
|
544
558
|
MainImpl.timeEnd('Main._createAppUI');
|
|
545
559
|
|
|
546
560
|
const appProvider = Common.AppProvider.getRegisteredAppProviders()[0];
|
|
@@ -570,7 +584,12 @@ export class MainImpl {
|
|
|
570
584
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(
|
|
571
585
|
Host.InspectorFrontendHostAPI.Events.RevealSourceLine, this.#revealSourceLine, this);
|
|
572
586
|
|
|
573
|
-
|
|
587
|
+
const inspectorView = UI.InspectorView.InspectorView.instance();
|
|
588
|
+
Persistence.NetworkPersistenceManager.NetworkPersistenceManager.instance().addEventListener(
|
|
589
|
+
Persistence.NetworkPersistenceManager.Events.LOCAL_OVERRIDES_REQUESTED, event => {
|
|
590
|
+
inspectorView.displaySelectOverrideFolderInfobar(event.data);
|
|
591
|
+
});
|
|
592
|
+
await inspectorView.createToolbars();
|
|
574
593
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.loadCompleted();
|
|
575
594
|
|
|
576
595
|
// Initialize elements for the live announcer functionality for a11y.
|
|
@@ -1100,7 +1119,7 @@ export async function handleExternalRequestGenerator(input: ExternalRequestInput
|
|
|
1100
1119
|
}
|
|
1101
1120
|
case 'NETWORK_DEBUGGER': {
|
|
1102
1121
|
const AiAssistanceModel = await import('../../models/ai_assistance/ai_assistance.js');
|
|
1103
|
-
const conversationHandler =
|
|
1122
|
+
const conversationHandler = AiAssistanceModel.ConversationHandler.ConversationHandler.instance();
|
|
1104
1123
|
return await conversationHandler.handleExternalRequest({
|
|
1105
1124
|
conversationType: AiAssistanceModel.AiHistoryStorage.ConversationType.NETWORK,
|
|
1106
1125
|
prompt: input.args.prompt,
|
|
@@ -3759,6 +3759,13 @@ export const generatedProperties = [
|
|
|
3759
3759
|
],
|
|
3760
3760
|
"name": "rule"
|
|
3761
3761
|
},
|
|
3762
|
+
{
|
|
3763
|
+
"longhands": [
|
|
3764
|
+
"row-rule-break",
|
|
3765
|
+
"column-rule-break"
|
|
3766
|
+
],
|
|
3767
|
+
"name": "rule-break"
|
|
3768
|
+
},
|
|
3762
3769
|
{
|
|
3763
3770
|
"longhands": [
|
|
3764
3771
|
"column-rule-color",
|
|
@@ -4375,6 +4382,7 @@ export const generatedProperties = [
|
|
|
4375
4382
|
"capitalize",
|
|
4376
4383
|
"uppercase",
|
|
4377
4384
|
"lowercase",
|
|
4385
|
+
"full-width",
|
|
4378
4386
|
"none",
|
|
4379
4387
|
"math-auto"
|
|
4380
4388
|
],
|
|
@@ -6803,6 +6811,7 @@ export const generatedPropertyValues = {
|
|
|
6803
6811
|
"capitalize",
|
|
6804
6812
|
"uppercase",
|
|
6805
6813
|
"lowercase",
|
|
6814
|
+
"full-width",
|
|
6806
6815
|
"none",
|
|
6807
6816
|
"math-auto"
|
|
6808
6817
|
]
|
|
@@ -8,8 +8,6 @@ import * as i18n from '../../core/i18n/i18n.js';
|
|
|
8
8
|
import * as Platform from '../../core/platform/platform.js';
|
|
9
9
|
import * as Root from '../../core/root/root.js';
|
|
10
10
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
11
|
-
import * as Snackbars from '../../ui/components/snackbars/snackbars.js';
|
|
12
|
-
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
13
11
|
import * as NetworkTimeCalculator from '../network_time_calculator/network_time_calculator.js';
|
|
14
12
|
|
|
15
13
|
import {
|
|
@@ -55,13 +53,6 @@ export interface ExternalPerformanceRequestParameters {
|
|
|
55
53
|
data: ExternalPerformanceAIConversationData;
|
|
56
54
|
}
|
|
57
55
|
|
|
58
|
-
const UIStrings = {
|
|
59
|
-
/**
|
|
60
|
-
* @description Notification shown to the user whenever DevTools receives an external request.
|
|
61
|
-
*/
|
|
62
|
-
externalRequestReceived: '`DevTools` received an external request',
|
|
63
|
-
} as const;
|
|
64
|
-
|
|
65
56
|
/*
|
|
66
57
|
* Strings that don't need to be translated at this time.
|
|
67
58
|
*/
|
|
@@ -72,8 +63,6 @@ const UIStringsNotTranslate = {
|
|
|
72
63
|
enableInSettings: 'For AI features to be available, you need to enable AI assistance in DevTools settings.',
|
|
73
64
|
} as const;
|
|
74
65
|
|
|
75
|
-
const str_ = i18n.i18n.registerUIStrings('models/ai_assistance/ConversationHandler.ts', UIStrings);
|
|
76
|
-
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
77
66
|
const lockedString = i18n.i18n.lockedString;
|
|
78
67
|
|
|
79
68
|
function isAiAssistanceServerSideLoggingEnabled(): boolean {
|
|
@@ -124,13 +113,14 @@ async function inspectNetworkRequestByUrl(selector: string): Promise<SDK.Network
|
|
|
124
113
|
|
|
125
114
|
let conversationHandlerInstance: ConversationHandler|undefined;
|
|
126
115
|
|
|
127
|
-
export class ConversationHandler {
|
|
116
|
+
export class ConversationHandler extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
|
128
117
|
#aiAssistanceEnabledSetting: Common.Settings.Setting<boolean>|undefined;
|
|
129
118
|
#aidaClient: Host.AidaClient.AidaClient;
|
|
130
119
|
#aidaAvailability?: Host.AidaClient.AidaAccessPreconditions;
|
|
131
120
|
|
|
132
121
|
private constructor(
|
|
133
122
|
aidaClient: Host.AidaClient.AidaClient, aidaAvailability?: Host.AidaClient.AidaAccessPreconditions) {
|
|
123
|
+
super();
|
|
134
124
|
this.#aidaClient = aidaClient;
|
|
135
125
|
if (aidaAvailability) {
|
|
136
126
|
this.#aidaAvailability = aidaAvailability;
|
|
@@ -186,7 +176,7 @@ export class ConversationHandler {
|
|
|
186
176
|
ExternalPerformanceRequestParameters,
|
|
187
177
|
): Promise<AsyncGenerator<ExternalRequestResponse, ExternalRequestResponse>> {
|
|
188
178
|
try {
|
|
189
|
-
|
|
179
|
+
this.dispatchEventToListeners(ConversationHandlerEvents.EXTERNAL_REQUEST_RECEIVED);
|
|
190
180
|
const disabledReasons = await this.#getDisabledReasons();
|
|
191
181
|
const aiAssistanceSetting = this.#aiAssistanceEnabledSetting?.getIfNotDisabled();
|
|
192
182
|
if (!aiAssistanceSetting) {
|
|
@@ -196,7 +186,8 @@ export class ConversationHandler {
|
|
|
196
186
|
return this.#generateErrorResponse(disabledReasons.join(' '));
|
|
197
187
|
}
|
|
198
188
|
|
|
199
|
-
|
|
189
|
+
this.dispatchEventToListeners(
|
|
190
|
+
ConversationHandlerEvents.EXTERNAL_CONVERSATION_STARTED, parameters.conversationType);
|
|
200
191
|
switch (parameters.conversationType) {
|
|
201
192
|
case ConversationType.STYLING: {
|
|
202
193
|
return await this.#handleExternalStylingConversation(parameters.prompt, parameters.selector);
|
|
@@ -356,3 +347,13 @@ export class ConversationHandler {
|
|
|
356
347
|
return agent;
|
|
357
348
|
}
|
|
358
349
|
}
|
|
350
|
+
|
|
351
|
+
export const enum ConversationHandlerEvents {
|
|
352
|
+
EXTERNAL_REQUEST_RECEIVED = 'ExternalRequestReceived',
|
|
353
|
+
EXTERNAL_CONVERSATION_STARTED = 'ExternalConversationStarted',
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export interface EventTypes {
|
|
357
|
+
[ConversationHandlerEvents.EXTERNAL_REQUEST_RECEIVED]: void;
|
|
358
|
+
[ConversationHandlerEvents.EXTERNAL_CONVERSATION_STARTED]: ConversationType;
|
|
359
|
+
}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
6
|
import * as Platform from '../../core/platform/platform.js';
|
|
7
7
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
8
|
-
|
|
8
|
+
// eslint-disable-next-line rulesdir/es-modules-import
|
|
9
|
+
import * as StackTraceImpl from '../stack_trace/stack_trace_impl.js';
|
|
9
10
|
import * as TextUtils from '../text_utils/text_utils.js';
|
|
10
11
|
import * as Workspace from '../workspace/workspace.js';
|
|
11
12
|
|
|
@@ -43,12 +44,14 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
|
|
|
43
44
|
readonly #sourceMapToProject = new Map<SDK.SourceMap.SourceMap, ContentProviderBasedProject>();
|
|
44
45
|
readonly #uiSourceCodeToSourceMaps =
|
|
45
46
|
new Platform.MapUtilities.Multimap<Workspace.UISourceCode.UISourceCode, SDK.SourceMap.SourceMap>();
|
|
47
|
+
readonly #debuggerModel: SDK.DebuggerModel.DebuggerModel;
|
|
46
48
|
|
|
47
49
|
constructor(
|
|
48
50
|
debuggerModel: SDK.DebuggerModel.DebuggerModel, workspace: Workspace.Workspace.WorkspaceImpl,
|
|
49
51
|
debuggerWorkspaceBinding: DebuggerWorkspaceBinding) {
|
|
50
52
|
this.#sourceMapManager = debuggerModel.sourceMapManager();
|
|
51
53
|
this.#debuggerWorkspaceBinding = debuggerWorkspaceBinding;
|
|
54
|
+
this.#debuggerModel = debuggerModel;
|
|
52
55
|
|
|
53
56
|
this.#stubProject = new ContentProviderBasedProject(
|
|
54
57
|
workspace, 'jsSourceMaps:stub:' + debuggerModel.target().id(), Workspace.Workspace.projectTypes.Service, '',
|
|
@@ -266,9 +269,56 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
|
|
|
266
269
|
}
|
|
267
270
|
|
|
268
271
|
translateRawFramesStep(
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
+
rawFrames: StackTraceImpl.Trie.RawFrame[],
|
|
273
|
+
translatedFrames: Awaited<ReturnType<StackTraceImpl.StackTraceModel.TranslateRawFrames>>): boolean {
|
|
274
|
+
const frame = rawFrames[0];
|
|
275
|
+
if (StackTraceImpl.Trie.isBuiltinFrame(frame)) {
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const sourceMapWithScopeInfoForFrame =
|
|
280
|
+
(rawFrame: StackTraceImpl.Trie.RawFrame): {sourceMap: SDK.SourceMap.SourceMap, script: SDK.Script.Script}|
|
|
281
|
+
null => {
|
|
282
|
+
const script = this.#debuggerModel.scriptForId(rawFrame.scriptId ?? '');
|
|
283
|
+
if (!script || this.#stubUISourceCodes.has(script)) {
|
|
284
|
+
// Use fallback while source map is being loaded.
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const sourceMap = script.sourceMap();
|
|
289
|
+
return sourceMap?.hasScopeInfo() ? {sourceMap, script} : null;
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
const sourceMapAndScript = sourceMapWithScopeInfoForFrame(frame);
|
|
293
|
+
if (!sourceMapAndScript) {
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
const {sourceMap, script} = sourceMapAndScript;
|
|
297
|
+
const {lineNumber, columnNumber} = script.relativeLocationToRawLocation(frame);
|
|
298
|
+
|
|
299
|
+
if (!sourceMap.hasInlinedFrames(lineNumber, columnNumber) && !sourceMap.isOutlinedFrame(lineNumber, columnNumber)) {
|
|
300
|
+
// No outlining or inlining: Get the original function name and map the call-site.
|
|
301
|
+
const mapping = sourceMap.findEntry(lineNumber, columnNumber);
|
|
302
|
+
if (!mapping?.sourceURL) {
|
|
303
|
+
return false;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const originalName = sourceMap.findOriginalFunctionName({line: lineNumber, column: columnNumber});
|
|
307
|
+
rawFrames.shift();
|
|
308
|
+
const project = this.#sourceMapToProject.get(sourceMap);
|
|
309
|
+
const uiSourceCode = project?.uiSourceCodeForURL(mapping.sourceURL);
|
|
310
|
+
translatedFrames.push([{
|
|
311
|
+
line: mapping.sourceLineNumber,
|
|
312
|
+
column: mapping.sourceColumnNumber,
|
|
313
|
+
name: originalName ?? undefined,
|
|
314
|
+
uiSourceCode: uiSourceCode ?? undefined,
|
|
315
|
+
url: uiSourceCode ? undefined : mapping.sourceURL
|
|
316
|
+
}]);
|
|
317
|
+
return true;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// TODO(crbug.com/433162438): Expand inlined frames.
|
|
321
|
+
// TODO(crbug.com/433162438): Consolidate outlined frames.
|
|
272
322
|
return false;
|
|
273
323
|
}
|
|
274
324
|
|
|
@@ -8439,6 +8439,14 @@ export const NativeFunctions = [
|
|
|
8439
8439
|
name: "sendPackets",
|
|
8440
8440
|
signatures: [["packets"]]
|
|
8441
8441
|
},
|
|
8442
|
+
{
|
|
8443
|
+
name: "addRemoteCandidate",
|
|
8444
|
+
signatures: [["candidate"]]
|
|
8445
|
+
},
|
|
8446
|
+
{
|
|
8447
|
+
name: "setRemoteDtlsParameters",
|
|
8448
|
+
signatures: [["params"]]
|
|
8449
|
+
},
|
|
8442
8450
|
{
|
|
8443
8451
|
name: "revoke",
|
|
8444
8452
|
signatures: [["permission"]]
|