chrome-devtools-frontend 1.0.1697998 → 1.0.1699061
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/.agents/skills/devtools-verification/SKILL.md +19 -0
- package/.agents/skills/{repro-flaky-tests → fix-tests}/SKILL.md +2 -2
- package/.agents/skills/version-control/SKILL.md +21 -9
- package/front_end/core/platform/HostRuntime.ts +12 -0
- package/front_end/core/platform/api/HostRuntime.ts +13 -0
- package/front_end/core/platform/browser/HostRuntime.ts +34 -0
- package/front_end/core/platform/node/HostRuntime.ts +40 -0
- package/front_end/core/sdk/AnimationModel.ts +12 -98
- package/front_end/core/sdk/CSSModel.ts +4 -2
- package/front_end/core/sdk/CSSPropertyParser.ts +4 -4
- package/front_end/core/sdk/CSSPropertyParserMatchers.ts +4 -44
- package/front_end/core/sdk/Connections.ts +6 -1
- package/front_end/core/sdk/ConsoleModel.ts +1 -12
- package/front_end/core/sdk/DOMModel.ts +6 -56
- package/front_end/core/sdk/DebuggerModel.ts +9 -8
- package/front_end/core/sdk/NetworkManager.ts +2 -2
- package/front_end/core/sdk/NetworkRequest.ts +1 -1
- package/front_end/core/sdk/OverlayModel.ts +11 -12
- package/front_end/core/sdk/PageFunctions.ts +187 -0
- package/front_end/core/sdk/Resource.ts +1 -1
- package/front_end/core/sdk/RuntimeModel.ts +1 -20
- package/front_end/core/sdk/Script.ts +21 -0
- package/front_end/core/sdk/SourceMap.ts +15 -2
- package/front_end/core/sdk/SourceMapCache.ts +13 -10
- package/front_end/core/sdk/SourceMapManager.ts +11 -9
- package/front_end/core/sdk/SourceMapScopeChainEntry.ts +109 -15
- package/front_end/core/sdk/SourceMapScopesInfo.ts +8 -2
- package/front_end/entrypoints/heap_snapshot_worker/ContextAnalyzer.ts +635 -0
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +26 -12
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +16 -2
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +4 -4
- package/front_end/entrypoints/heap_snapshot_worker/heap_snapshot_worker.ts +2 -0
- package/front_end/entrypoints/shell/shell.ts +1 -1
- package/front_end/models/ai_assistance/DOMHelpers.ts +95 -0
- package/front_end/models/ai_assistance/EvaluateAction.ts +5 -42
- package/front_end/models/ai_assistance/ExtensionScope.ts +2 -31
- package/front_end/models/ai_assistance/agents/AiAgent.ts +2 -1
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +3 -4
- package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
- package/front_end/models/ai_assistance/contexts/DOMNodeContext.ts +10 -7
- package/front_end/models/ai_assistance/contexts/FileContext.ts +2 -10
- package/front_end/models/ai_assistance/tools/GetSourceContent.ts +3 -2
- package/front_end/models/ai_assistance/tools/ListSources.ts +21 -14
- package/front_end/models/bindings/CompilerScriptMapping.ts +3 -10
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +48 -17
- package/front_end/models/bindings/ResourceScriptMapping.ts +2 -2
- package/front_end/models/bindings/StylesSourceMapping.ts +1 -1
- package/front_end/models/comment_manager/CD4ABridge.ts +55 -12
- package/front_end/models/comment_manager/CommentManager.ts +46 -91
- package/front_end/models/comment_manager/CommentThread.ts +145 -0
- package/front_end/models/comment_manager/comment_manager.ts +2 -0
- package/front_end/models/emulation/DeviceModeModel.ts +54 -1
- package/front_end/models/extensions/ExtensionAPI.ts +8 -6
- package/front_end/models/extensions/ExtensionEndpoint.ts +11 -8
- package/front_end/models/extensions/HostUrlPattern.ts +4 -3
- package/front_end/models/extensions/LanguageExtensionEndpoint.ts +3 -2
- package/front_end/models/extensions/RecorderExtensionEndpoint.ts +2 -1
- package/front_end/models/formatter/FormatterWorkerPool.ts +4 -6
- package/front_end/models/heap_snapshot/HeapSnapshotModel.ts +55 -0
- package/front_end/models/heap_snapshot/HeapSnapshotProxy.ts +18 -14
- package/front_end/models/issues_manager/CookieIssue.ts +0 -13
- package/front_end/models/issues_manager/IssuesManager.ts +5 -0
- package/front_end/models/issues_manager/WebInstallIssue.ts +63 -0
- package/front_end/models/issues_manager/descriptions/webInstallManifestMissingId.md +3 -0
- package/front_end/models/issues_manager/descriptions/webInstallManifestMissingNameOrShortName.md +3 -0
- package/front_end/models/issues_manager/descriptions/webInstallManifestParsingOrNetworkError.md +3 -0
- package/front_end/models/issues_manager/descriptions/webInstallNoManifest.md +3 -0
- package/front_end/models/issues_manager/descriptions/webInstallStartUrlInvalid.md +3 -0
- package/front_end/models/issues_manager/issues_manager.ts +2 -0
- package/front_end/models/source_map_scopes/NamesResolver.ts +11 -3
- package/front_end/models/source_map_scopes/ScopeChainModel.ts +10 -6
- package/front_end/models/workspace/UISourceCode.ts +20 -0
- package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingView.ts +281 -3
- package/front_end/panels/accessibility/accessibilityAnnouncementRecordingView.css +85 -0
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +5 -8
- package/front_end/panels/ai_assistance/components/AIv2MarkdownRenderer.ts +4 -10
- package/front_end/panels/animation/AnimationTimeline.ts +1 -1
- package/front_end/panels/application/CrashReportContextView.ts +1 -1
- package/front_end/panels/application/IndexedDBViews.ts +1 -1
- package/front_end/panels/application/KeyValueStorageItemsView.ts +1 -0
- package/front_end/panels/application/components/AdsView.ts +63 -1
- package/front_end/panels/application/components/adsView.css +11 -1
- package/front_end/{ui/comments → panels/common}/CommentThreadWidget.ts +5 -20
- package/front_end/{ui/comments → panels/common}/CommentsOverlayWidget.ts +39 -62
- package/front_end/{ui/comments → panels/common}/CommentsStatusBarPill.ts +5 -5
- package/front_end/panels/common/ExtensionServer.ts +2 -1
- package/front_end/{ui/comments → panels/common}/commentThreadWidget.css +0 -12
- package/front_end/{ui/comments → panels/common}/commentsOverlay.css +2 -1
- package/front_end/{ui/comments/comments-meta.ts → panels/common/common-meta.ts} +11 -11
- package/front_end/panels/common/common.ts +3 -0
- package/front_end/panels/elements/AdoptedStyleSheetTreeElement.ts +3 -3
- package/front_end/panels/elements/CSSRuleValidator.ts +1 -1
- package/front_end/panels/elements/ElementsPanel.ts +9 -5
- package/front_end/panels/elements/ElementsTreeElement.ts +11 -3
- package/front_end/panels/elements/ElementsTreeOutline.ts +69 -74
- package/front_end/panels/elements/PropertiesWidget.ts +11 -10
- package/front_end/panels/elements/PropertyRenderer.ts +29 -25
- package/front_end/panels/elements/StylePropertyTreeElement.ts +6 -6
- package/front_end/panels/elements/elementsTreeOutline.css +11 -5
- package/front_end/panels/emulation/DeviceModeToolbar.ts +2 -3
- package/front_end/panels/event_listeners/EventListenersView.ts +33 -44
- package/front_end/panels/lighthouse/LighthouseController.ts +1 -1
- package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorController.ts +6 -7
- package/front_end/panels/linear_memory_inspector/components/linearMemoryInspector.css +5 -1
- package/front_end/panels/linear_memory_inspector/linear_memory_inspector-meta.ts +1 -1
- package/front_end/panels/mobile_throttling/NetworkPanelIndicator.ts +1 -1
- package/front_end/panels/mobile_throttling/ThrottlingManager.ts +1 -1
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +1 -1
- package/front_end/panels/recorder/StepView.ts +19 -4
- package/front_end/panels/recorder/TimelineSection.ts +1 -1
- package/front_end/panels/recorder/stepView.css +1 -0
- package/front_end/panels/security/SecurityPanel.ts +5 -5
- package/front_end/panels/security/SecurityPanelSidebar.ts +2 -11
- package/front_end/panels/settings/BackendLinkingSettingsTab.ts +2 -1
- package/front_end/panels/settings/EditFileSystemView.ts +1 -1
- package/front_end/panels/sources/CallStackSidebarPane.ts +1 -1
- package/front_end/panels/sources/DebuggerPlugin.ts +2 -2
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +11 -16
- package/front_end/panels/sources/sources-meta.ts +1 -1
- package/front_end/panels/timeline/components/DetailsView.ts +3 -3
- package/front_end/panels/timeline/components/OriginMap.ts +1 -1
- package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +2 -3
- package/front_end/panels/timeline/overlays/OverlaysImpl.ts +0 -3
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/comments/CommentOverlayManager.ts +28 -110
- package/front_end/ui/comments/comments.ts +0 -6
- package/front_end/ui/components/buttons/Button.ts +19 -1
- package/front_end/ui/legacy/ContextMenu.ts +16 -1
- package/front_end/ui/legacy/PlusButton.ts +5 -6
- package/front_end/ui/legacy/Treeoutline.ts +6 -0
- package/front_end/ui/legacy/Widget.ts +33 -0
- package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +3 -0
- package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +14 -4
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +36 -32
- package/front_end/ui/visual_logging/KnownContextValues.ts +4 -0
- package/package.json +1 -1
- package/.agents/skills/devtools-ci/SKILL.md +0 -65
- package/.agents/skills/evaluate-ai-css-completion/SKILL.md +0 -143
- package/.agents/skills/evaluate-ai-css-completion/scripts/evaluate.js +0 -104
- package/.agents/skills/fixing-skipped-tests/SKILL.md +0 -32
- package/.agents/skills/gerrit-cli/SKILL.md +0 -74
- package/.agents/skills/gerrit-cli/references/commands.md +0 -169
- package/.agents/skills/gerrit-cli/references/workflows.md +0 -63
- package/.agents/skills/gerrit-cli/scripts/import_upstream.py +0 -85
- package/front_end/models/issues_manager/descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +0 -4
|
@@ -7,13 +7,13 @@ import * as Platform from '../platform/platform.js';
|
|
|
7
7
|
|
|
8
8
|
import type {FrameAssociated} from './FrameAssociated.js';
|
|
9
9
|
import {PageResourceLoader, type PageResourceLoadInitiator, type ResourceLoader} from './PageResourceLoader.js';
|
|
10
|
-
import {type DebugId, parseSourceMap, SourceMap, type SourceMapV3} from './SourceMap.js';
|
|
10
|
+
import {type DebugId, parseSourceMap, SourceMap, type SourceMapProvenance, type SourceMapV3} from './SourceMap.js';
|
|
11
11
|
import {SourceMapCache} from './SourceMapCache.js';
|
|
12
12
|
import {type Target, Type} from './Target.js';
|
|
13
13
|
|
|
14
14
|
export type SourceMapFactory<T> =
|
|
15
15
|
(compiledURL: Platform.DevToolsPath.UrlString, sourceMappingURL: Platform.DevToolsPath.UrlString,
|
|
16
|
-
payload: SourceMapV3, client: T) => SourceMap;
|
|
16
|
+
payload: SourceMapV3, client: T, provenance: SourceMapProvenance) => SourceMap;
|
|
17
17
|
|
|
18
18
|
export const lazyLoadingSettingDescriptor: Common.Settings.SettingDescriptor<boolean> = {
|
|
19
19
|
name: 'source-maps-lazy-loading',
|
|
@@ -37,8 +37,8 @@ export class SourceMapManager<T extends FrameAssociated> extends Common.ObjectWr
|
|
|
37
37
|
|
|
38
38
|
this.#target = target;
|
|
39
39
|
this.#factory = factory ??
|
|
40
|
-
((compiledURL, sourceMappingURL, payload) =>
|
|
41
|
-
|
|
40
|
+
((compiledURL, sourceMappingURL, payload, _client, provenance) => new SourceMap(
|
|
41
|
+
compiledURL, sourceMappingURL, payload, this.#target.targetManager().getConsole(), undefined, provenance));
|
|
42
42
|
const settings = target.targetManager().settings;
|
|
43
43
|
this.#lazyLoadingSetting = settings.resolve(lazyLoadingSettingDescriptor);
|
|
44
44
|
}
|
|
@@ -60,8 +60,8 @@ export class SourceMapManager<T extends FrameAssociated> extends Common.ObjectWr
|
|
|
60
60
|
this.detachSourceMap(client);
|
|
61
61
|
}
|
|
62
62
|
this.#isEnabled = isEnabled;
|
|
63
|
-
for (const [client, {relativeSourceURL, relativeSourceMapURL}] of clientData) {
|
|
64
|
-
this.attachSourceMap(client, relativeSourceURL, relativeSourceMapURL);
|
|
63
|
+
for (const [client, {relativeSourceURL, relativeSourceMapURL, provenance}] of clientData) {
|
|
64
|
+
this.attachSourceMap(client, relativeSourceURL, relativeSourceMapURL, provenance);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -97,8 +97,8 @@ export class SourceMapManager<T extends FrameAssociated> extends Common.ObjectWr
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
// TODO(bmeurer): We are lying about the type of |relativeSourceURL| here.
|
|
100
|
-
attachSourceMap(
|
|
101
|
-
|
|
100
|
+
attachSourceMap(client: T, relativeSourceURL: Platform.DevToolsPath.UrlString, relativeSourceMapURL: string|undefined,
|
|
101
|
+
provenance: SourceMapProvenance): void {
|
|
102
102
|
if (this.#clientData.has(client)) {
|
|
103
103
|
throw new Error('SourceMap is already attached or being attached to client');
|
|
104
104
|
}
|
|
@@ -109,6 +109,7 @@ export class SourceMapManager<T extends FrameAssociated> extends Common.ObjectWr
|
|
|
109
109
|
const clientData: ClientData = {
|
|
110
110
|
relativeSourceURL,
|
|
111
111
|
relativeSourceMapURL,
|
|
112
|
+
provenance,
|
|
112
113
|
getSourceMap: () => Promise.resolve(undefined),
|
|
113
114
|
};
|
|
114
115
|
this.#clientData.set(client, clientData);
|
|
@@ -142,7 +143,7 @@ export class SourceMapManager<T extends FrameAssociated> extends Common.ObjectWr
|
|
|
142
143
|
loadSourceMap(resourceLoader, this.#sourceMapCache, sourceMapURL, client.debugId(), initiator)
|
|
143
144
|
.then(
|
|
144
145
|
payload => {
|
|
145
|
-
const sourceMap = this.#factory(sourceURL, sourceMapURL, payload, client);
|
|
146
|
+
const sourceMap = this.#factory(sourceURL, sourceMapURL, payload, client, provenance);
|
|
146
147
|
if (this.#clientData.get(client) === clientData) {
|
|
147
148
|
clientData.sourceMap = sourceMap;
|
|
148
149
|
this.#sourceMaps.set(sourceMap, client);
|
|
@@ -257,6 +258,7 @@ interface ClientData {
|
|
|
257
258
|
// Stores the raw sourceMappingURL as provided by V8. These are not guaranteed to
|
|
258
259
|
// be valid URLs and will be checked and resolved once `attachSourceMap` is called.
|
|
259
260
|
relativeSourceMapURL: string;
|
|
261
|
+
provenance: SourceMapProvenance;
|
|
260
262
|
sourceMap?: SourceMap;
|
|
261
263
|
getSourceMap: () => Promise<SourceMap|undefined>;
|
|
262
264
|
}
|
|
@@ -27,6 +27,10 @@ const UIStrings = {
|
|
|
27
27
|
* @description Title of a section in the debugger showing JavaScript variables from the global scope.
|
|
28
28
|
*/
|
|
29
29
|
global: 'Global',
|
|
30
|
+
/**
|
|
31
|
+
* @description Text in Scope Chain section of the Sources panel.
|
|
32
|
+
*/
|
|
33
|
+
exception: 'Exception',
|
|
30
34
|
/**
|
|
31
35
|
* @description Text in Scope Chain section of the Sources panel.
|
|
32
36
|
*/
|
|
@@ -42,6 +46,7 @@ export class SourceMapScopeChainEntry implements ScopeChainEntry {
|
|
|
42
46
|
readonly #isInnerMostFunction: boolean;
|
|
43
47
|
readonly #returnValue?: RemoteObject;
|
|
44
48
|
readonly #scopeNumber?: number;
|
|
49
|
+
#object?: SourceMapScopeRemoteObject;
|
|
45
50
|
|
|
46
51
|
/**
|
|
47
52
|
* @param isInnerMostFunction If `scope` is the innermost 'function' scope. Only used for labeling as we name the
|
|
@@ -59,13 +64,23 @@ export class SourceMapScopeChainEntry implements ScopeChainEntry {
|
|
|
59
64
|
this.#scopeNumber = scopeNumber;
|
|
60
65
|
}
|
|
61
66
|
|
|
67
|
+
originalScope(): ScopesCodec.OriginalScope {
|
|
68
|
+
return this.#scope;
|
|
69
|
+
}
|
|
70
|
+
|
|
62
71
|
extraProperties(): RemoteObjectProperty[] {
|
|
72
|
+
const extraProperties = [];
|
|
73
|
+
if (this.#isInnerMostFunction && this.#callFrame.exception) {
|
|
74
|
+
extraProperties.push(new RemoteObjectProperty(i18nString(UIStrings.exception), this.#callFrame.exception,
|
|
75
|
+
undefined, undefined, undefined, undefined, undefined,
|
|
76
|
+
/* synthetic */ true));
|
|
77
|
+
}
|
|
63
78
|
if (this.#returnValue) {
|
|
64
|
-
|
|
79
|
+
extraProperties.push(new RemoteObjectProperty(
|
|
65
80
|
i18nString(UIStrings.returnValue), this.#returnValue, undefined, undefined, undefined, undefined, undefined,
|
|
66
|
-
/* synthetic */ true)
|
|
81
|
+
/* synthetic */ true, this.#callFrame.setReturnValue.bind(this.#callFrame)));
|
|
67
82
|
}
|
|
68
|
-
return
|
|
83
|
+
return extraProperties;
|
|
69
84
|
}
|
|
70
85
|
|
|
71
86
|
callFrame(): CallFrame {
|
|
@@ -108,7 +123,10 @@ export class SourceMapScopeChainEntry implements ScopeChainEntry {
|
|
|
108
123
|
}
|
|
109
124
|
|
|
110
125
|
object(): RemoteObject {
|
|
111
|
-
|
|
126
|
+
if (!this.#object) {
|
|
127
|
+
this.#object = new SourceMapScopeRemoteObject(this.#callFrame, this.#scope, this.#range, this.#scopeNumber);
|
|
128
|
+
}
|
|
129
|
+
return this.#object;
|
|
112
130
|
}
|
|
113
131
|
|
|
114
132
|
description(): string {
|
|
@@ -125,6 +143,8 @@ class SourceMapScopeRemoteObject extends RemoteObjectImpl {
|
|
|
125
143
|
readonly #scope: ScopesCodec.OriginalScope;
|
|
126
144
|
readonly #range?: ScopesCodec.GeneratedRange;
|
|
127
145
|
readonly #scopeNumber?: number;
|
|
146
|
+
#propertiesPromise?: Promise<GetPropertiesResult>;
|
|
147
|
+
#cachedWithPreview = false;
|
|
128
148
|
|
|
129
149
|
constructor(callFrame: CallFrame, scope: ScopesCodec.OriginalScope, range: ScopesCodec.GeneratedRange|undefined,
|
|
130
150
|
scopeNumber: number|undefined) {
|
|
@@ -143,12 +163,89 @@ class SourceMapScopeRemoteObject extends RemoteObjectImpl {
|
|
|
143
163
|
if (accessorPropertiesOnly) {
|
|
144
164
|
return {properties: [], internalProperties: []};
|
|
145
165
|
}
|
|
166
|
+
if (!this.#propertiesPromise || (generatePreview && !this.#cachedWithPreview)) {
|
|
167
|
+
this.#cachedWithPreview = generatePreview;
|
|
168
|
+
this.#propertiesPromise = this.#evaluateProperties(generatePreview);
|
|
169
|
+
}
|
|
170
|
+
return await this.#propertiesPromise;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
async #evaluateProperties(generatePreview: boolean): Promise<GetPropertiesResult> {
|
|
174
|
+
if (this.#scope.variables.length === 0) {
|
|
175
|
+
return {properties: [], internalProperties: []};
|
|
176
|
+
}
|
|
177
|
+
const expressions = this.#scope.variables.map((_, index) => this.#findExpression(index));
|
|
178
|
+
const values = await this.#evaluateAsBatch(expressions, generatePreview) ??
|
|
179
|
+
await this.#evaluateSeparately(expressions, generatePreview);
|
|
180
|
+
|
|
181
|
+
const properties = this.#scope.variables.map((variable, index) => {
|
|
182
|
+
const value = values[index];
|
|
183
|
+
if (value === null) {
|
|
184
|
+
return SourceMapScopeRemoteObject.#unavailableProperty(variable);
|
|
185
|
+
}
|
|
186
|
+
return new RemoteObjectProperty(variable, value, /* enumerable */ false, /* writable */ false, /* isOwn */ true,
|
|
187
|
+
/* wasThrown */ false);
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
return {properties, internalProperties: []};
|
|
191
|
+
}
|
|
146
192
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
193
|
+
/**
|
|
194
|
+
* Evaluates all binding expressions of this scope with a single `evaluateOnCallFrame` call.
|
|
195
|
+
*
|
|
196
|
+
* We build an object literal that spreads in one `{index: value}` object per binding, each produced by
|
|
197
|
+
* its own arrow function wrapped in `try`/`catch`. A binding that throws contributes nothing, which is
|
|
198
|
+
* how we tell it apart from one that legitimately evaluates to `undefined`, and it doesn't take the
|
|
199
|
+
* rest of the scope down with it.
|
|
200
|
+
*
|
|
201
|
+
* The expressions are inlined rather than passed to `eval`. `eval` in the evaluated code is the page's
|
|
202
|
+
* `eval`, which a `script-src` CSP without `'unsafe-eval'` blocks. `Runtime.evaluate` can opt out of
|
|
203
|
+
* that via `allowUnsafeEvalBlockedByCSP`, but `Debugger.evaluateOnCallFrame` has no such option.
|
|
204
|
+
* Inlining also means we don't introduce bindings of our own that could shadow the names a binding
|
|
205
|
+
* expression refers to, and arrow functions keep `this` pointing at the paused frame's receiver.
|
|
206
|
+
*
|
|
207
|
+
* @returns The value for each expression, or null if the batch failed as a whole. The latter happens
|
|
208
|
+
* when a binding expression doesn't parse, since that takes out the entire object literal.
|
|
209
|
+
*/
|
|
210
|
+
async #evaluateAsBatch(expressions: Array<string|null>,
|
|
211
|
+
generatePreview: boolean): Promise<Array<RemoteObject|null>|null> {
|
|
212
|
+
const spreads: string[] = [];
|
|
213
|
+
for (const [index, expression] of expressions.entries()) {
|
|
214
|
+
if (expression !== null) {
|
|
215
|
+
spreads.push(`...(() => { try { return {${index}: (${expression})}; } catch {} })()`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (spreads.length === 0) {
|
|
219
|
+
return expressions.map(() => null);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const result = await this.#callFrame.evaluate({
|
|
223
|
+
expression: `({__proto__: null, ${spreads.join(', ')}})`,
|
|
224
|
+
// The wrapper object is a throw-away. We only need previews for the values inside of it.
|
|
225
|
+
generatePreview: false,
|
|
226
|
+
scopeNumber: this.#scopeNumber,
|
|
227
|
+
});
|
|
228
|
+
if ('error' in result || result.exceptionDetails || !result.object) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const {properties} = await result.object.getOwnProperties(generatePreview);
|
|
233
|
+
result.object.release();
|
|
234
|
+
|
|
235
|
+
const valueByIndex = new Map(properties?.map(({name, value}) => [name, value] as const));
|
|
236
|
+
return expressions.map((_, index) => valueByIndex.get(String(index)) ?? null);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Fallback for when {@link #evaluateAsBatch} fails as a whole, so that a single binding expression
|
|
241
|
+
* that doesn't parse only costs us that one variable.
|
|
242
|
+
*/
|
|
243
|
+
async #evaluateSeparately(expressions: Array<string|null>,
|
|
244
|
+
generatePreview: boolean): Promise<Array<RemoteObject|null>> {
|
|
245
|
+
const values: Array<RemoteObject|null> = [];
|
|
246
|
+
for (const expression of expressions) {
|
|
150
247
|
if (expression === null) {
|
|
151
|
-
|
|
248
|
+
values.push(null);
|
|
152
249
|
continue;
|
|
153
250
|
}
|
|
154
251
|
|
|
@@ -156,15 +253,12 @@ class SourceMapScopeRemoteObject extends RemoteObjectImpl {
|
|
|
156
253
|
if ('error' in result || result.exceptionDetails) {
|
|
157
254
|
// TODO(crbug.com/40277685): Make these errors user-visible to aid tooling developers.
|
|
158
255
|
// E.g. show the error on hover or expose it in the developer resources panel.
|
|
159
|
-
|
|
256
|
+
values.push(null);
|
|
160
257
|
} else {
|
|
161
|
-
|
|
162
|
-
variable, result.object, /* enumerable */ false, /* writable */ false, /* isOwn */ true,
|
|
163
|
-
/* wasThrown */ false));
|
|
258
|
+
values.push(result.object);
|
|
164
259
|
}
|
|
165
260
|
}
|
|
166
|
-
|
|
167
|
-
return {properties, internalProperties: []};
|
|
261
|
+
return values;
|
|
168
262
|
}
|
|
169
263
|
|
|
170
264
|
/** @returns null if the variable is unavailable at the current paused location */
|
|
@@ -177,7 +271,7 @@ class SourceMapScopeRemoteObject extends RemoteObjectImpl {
|
|
|
177
271
|
if (typeof expressionOrSubRanges === 'string') {
|
|
178
272
|
return expressionOrSubRanges;
|
|
179
273
|
}
|
|
180
|
-
if (expressionOrSubRanges
|
|
274
|
+
if (!expressionOrSubRanges) {
|
|
181
275
|
return null;
|
|
182
276
|
}
|
|
183
277
|
|
|
@@ -355,9 +355,10 @@ export class SourceMapScopesInfo {
|
|
|
355
355
|
// w.r.t. each other.
|
|
356
356
|
|
|
357
357
|
let seenFunctionScope = false;
|
|
358
|
-
const result:
|
|
358
|
+
const result: ScopeChainEntry[] = [];
|
|
359
359
|
// Walk the original scope chain outwards and try to find the corresponding generated range along the way.
|
|
360
|
-
for (let originalScope =
|
|
360
|
+
for (let originalScope: ScopesCodec.OriginalScope|null|undefined = innerMostOriginalScope; originalScope;
|
|
361
|
+
originalScope = originalScope.parent) {
|
|
361
362
|
const range = rangeChain.findLast(r => r.originalScope === originalScope);
|
|
362
363
|
// `kind` is just a label for scope UI views and has no semantic significance, so `isStackFrame`
|
|
363
364
|
// decides whether this scope is a function scope.
|
|
@@ -370,6 +371,11 @@ export class SourceMapScopesInfo {
|
|
|
370
371
|
seenFunctionScope ||= isFunctionScope;
|
|
371
372
|
}
|
|
372
373
|
|
|
374
|
+
const globalScope = callFrame.scopeChain()?.find(s => s.type() === Protocol.Debugger.ScopeType.Global);
|
|
375
|
+
if (globalScope) {
|
|
376
|
+
result.push(globalScope);
|
|
377
|
+
}
|
|
378
|
+
|
|
373
379
|
// If we are paused on a return statement, we need to drop inner block scopes. This is because V8 only emits a
|
|
374
380
|
// single return bytecode and "gotos" at the functions' end, where we are now paused.
|
|
375
381
|
if (callFrame.returnValue() !== null) {
|