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.
Files changed (145) hide show
  1. package/.agents/skills/devtools-verification/SKILL.md +19 -0
  2. package/.agents/skills/{repro-flaky-tests → fix-tests}/SKILL.md +2 -2
  3. package/.agents/skills/version-control/SKILL.md +21 -9
  4. package/front_end/core/platform/HostRuntime.ts +12 -0
  5. package/front_end/core/platform/api/HostRuntime.ts +13 -0
  6. package/front_end/core/platform/browser/HostRuntime.ts +34 -0
  7. package/front_end/core/platform/node/HostRuntime.ts +40 -0
  8. package/front_end/core/sdk/AnimationModel.ts +12 -98
  9. package/front_end/core/sdk/CSSModel.ts +4 -2
  10. package/front_end/core/sdk/CSSPropertyParser.ts +4 -4
  11. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +4 -44
  12. package/front_end/core/sdk/Connections.ts +6 -1
  13. package/front_end/core/sdk/ConsoleModel.ts +1 -12
  14. package/front_end/core/sdk/DOMModel.ts +6 -56
  15. package/front_end/core/sdk/DebuggerModel.ts +9 -8
  16. package/front_end/core/sdk/NetworkManager.ts +2 -2
  17. package/front_end/core/sdk/NetworkRequest.ts +1 -1
  18. package/front_end/core/sdk/OverlayModel.ts +11 -12
  19. package/front_end/core/sdk/PageFunctions.ts +187 -0
  20. package/front_end/core/sdk/Resource.ts +1 -1
  21. package/front_end/core/sdk/RuntimeModel.ts +1 -20
  22. package/front_end/core/sdk/Script.ts +21 -0
  23. package/front_end/core/sdk/SourceMap.ts +15 -2
  24. package/front_end/core/sdk/SourceMapCache.ts +13 -10
  25. package/front_end/core/sdk/SourceMapManager.ts +11 -9
  26. package/front_end/core/sdk/SourceMapScopeChainEntry.ts +109 -15
  27. package/front_end/core/sdk/SourceMapScopesInfo.ts +8 -2
  28. package/front_end/entrypoints/heap_snapshot_worker/ContextAnalyzer.ts +635 -0
  29. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +26 -12
  30. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +16 -2
  31. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +4 -4
  32. package/front_end/entrypoints/heap_snapshot_worker/heap_snapshot_worker.ts +2 -0
  33. package/front_end/entrypoints/shell/shell.ts +1 -1
  34. package/front_end/models/ai_assistance/DOMHelpers.ts +95 -0
  35. package/front_end/models/ai_assistance/EvaluateAction.ts +5 -42
  36. package/front_end/models/ai_assistance/ExtensionScope.ts +2 -31
  37. package/front_end/models/ai_assistance/agents/AiAgent.ts +2 -1
  38. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +3 -4
  39. package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
  40. package/front_end/models/ai_assistance/contexts/DOMNodeContext.ts +10 -7
  41. package/front_end/models/ai_assistance/contexts/FileContext.ts +2 -10
  42. package/front_end/models/ai_assistance/tools/GetSourceContent.ts +3 -2
  43. package/front_end/models/ai_assistance/tools/ListSources.ts +21 -14
  44. package/front_end/models/bindings/CompilerScriptMapping.ts +3 -10
  45. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +48 -17
  46. package/front_end/models/bindings/ResourceScriptMapping.ts +2 -2
  47. package/front_end/models/bindings/StylesSourceMapping.ts +1 -1
  48. package/front_end/models/comment_manager/CD4ABridge.ts +55 -12
  49. package/front_end/models/comment_manager/CommentManager.ts +46 -91
  50. package/front_end/models/comment_manager/CommentThread.ts +145 -0
  51. package/front_end/models/comment_manager/comment_manager.ts +2 -0
  52. package/front_end/models/emulation/DeviceModeModel.ts +54 -1
  53. package/front_end/models/extensions/ExtensionAPI.ts +8 -6
  54. package/front_end/models/extensions/ExtensionEndpoint.ts +11 -8
  55. package/front_end/models/extensions/HostUrlPattern.ts +4 -3
  56. package/front_end/models/extensions/LanguageExtensionEndpoint.ts +3 -2
  57. package/front_end/models/extensions/RecorderExtensionEndpoint.ts +2 -1
  58. package/front_end/models/formatter/FormatterWorkerPool.ts +4 -6
  59. package/front_end/models/heap_snapshot/HeapSnapshotModel.ts +55 -0
  60. package/front_end/models/heap_snapshot/HeapSnapshotProxy.ts +18 -14
  61. package/front_end/models/issues_manager/CookieIssue.ts +0 -13
  62. package/front_end/models/issues_manager/IssuesManager.ts +5 -0
  63. package/front_end/models/issues_manager/WebInstallIssue.ts +63 -0
  64. package/front_end/models/issues_manager/descriptions/webInstallManifestMissingId.md +3 -0
  65. package/front_end/models/issues_manager/descriptions/webInstallManifestMissingNameOrShortName.md +3 -0
  66. package/front_end/models/issues_manager/descriptions/webInstallManifestParsingOrNetworkError.md +3 -0
  67. package/front_end/models/issues_manager/descriptions/webInstallNoManifest.md +3 -0
  68. package/front_end/models/issues_manager/descriptions/webInstallStartUrlInvalid.md +3 -0
  69. package/front_end/models/issues_manager/issues_manager.ts +2 -0
  70. package/front_end/models/source_map_scopes/NamesResolver.ts +11 -3
  71. package/front_end/models/source_map_scopes/ScopeChainModel.ts +10 -6
  72. package/front_end/models/workspace/UISourceCode.ts +20 -0
  73. package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingView.ts +281 -3
  74. package/front_end/panels/accessibility/accessibilityAnnouncementRecordingView.css +85 -0
  75. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +5 -8
  76. package/front_end/panels/ai_assistance/components/AIv2MarkdownRenderer.ts +4 -10
  77. package/front_end/panels/animation/AnimationTimeline.ts +1 -1
  78. package/front_end/panels/application/CrashReportContextView.ts +1 -1
  79. package/front_end/panels/application/IndexedDBViews.ts +1 -1
  80. package/front_end/panels/application/KeyValueStorageItemsView.ts +1 -0
  81. package/front_end/panels/application/components/AdsView.ts +63 -1
  82. package/front_end/panels/application/components/adsView.css +11 -1
  83. package/front_end/{ui/comments → panels/common}/CommentThreadWidget.ts +5 -20
  84. package/front_end/{ui/comments → panels/common}/CommentsOverlayWidget.ts +39 -62
  85. package/front_end/{ui/comments → panels/common}/CommentsStatusBarPill.ts +5 -5
  86. package/front_end/panels/common/ExtensionServer.ts +2 -1
  87. package/front_end/{ui/comments → panels/common}/commentThreadWidget.css +0 -12
  88. package/front_end/{ui/comments → panels/common}/commentsOverlay.css +2 -1
  89. package/front_end/{ui/comments/comments-meta.ts → panels/common/common-meta.ts} +11 -11
  90. package/front_end/panels/common/common.ts +3 -0
  91. package/front_end/panels/elements/AdoptedStyleSheetTreeElement.ts +3 -3
  92. package/front_end/panels/elements/CSSRuleValidator.ts +1 -1
  93. package/front_end/panels/elements/ElementsPanel.ts +9 -5
  94. package/front_end/panels/elements/ElementsTreeElement.ts +11 -3
  95. package/front_end/panels/elements/ElementsTreeOutline.ts +69 -74
  96. package/front_end/panels/elements/PropertiesWidget.ts +11 -10
  97. package/front_end/panels/elements/PropertyRenderer.ts +29 -25
  98. package/front_end/panels/elements/StylePropertyTreeElement.ts +6 -6
  99. package/front_end/panels/elements/elementsTreeOutline.css +11 -5
  100. package/front_end/panels/emulation/DeviceModeToolbar.ts +2 -3
  101. package/front_end/panels/event_listeners/EventListenersView.ts +33 -44
  102. package/front_end/panels/lighthouse/LighthouseController.ts +1 -1
  103. package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorController.ts +6 -7
  104. package/front_end/panels/linear_memory_inspector/components/linearMemoryInspector.css +5 -1
  105. package/front_end/panels/linear_memory_inspector/linear_memory_inspector-meta.ts +1 -1
  106. package/front_end/panels/mobile_throttling/NetworkPanelIndicator.ts +1 -1
  107. package/front_end/panels/mobile_throttling/ThrottlingManager.ts +1 -1
  108. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +1 -1
  109. package/front_end/panels/recorder/StepView.ts +19 -4
  110. package/front_end/panels/recorder/TimelineSection.ts +1 -1
  111. package/front_end/panels/recorder/stepView.css +1 -0
  112. package/front_end/panels/security/SecurityPanel.ts +5 -5
  113. package/front_end/panels/security/SecurityPanelSidebar.ts +2 -11
  114. package/front_end/panels/settings/BackendLinkingSettingsTab.ts +2 -1
  115. package/front_end/panels/settings/EditFileSystemView.ts +1 -1
  116. package/front_end/panels/sources/CallStackSidebarPane.ts +1 -1
  117. package/front_end/panels/sources/DebuggerPlugin.ts +2 -2
  118. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +11 -16
  119. package/front_end/panels/sources/sources-meta.ts +1 -1
  120. package/front_end/panels/timeline/components/DetailsView.ts +3 -3
  121. package/front_end/panels/timeline/components/OriginMap.ts +1 -1
  122. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +2 -3
  123. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +0 -3
  124. package/front_end/third_party/chromium/README.chromium +1 -1
  125. package/front_end/ui/comments/CommentOverlayManager.ts +28 -110
  126. package/front_end/ui/comments/comments.ts +0 -6
  127. package/front_end/ui/components/buttons/Button.ts +19 -1
  128. package/front_end/ui/legacy/ContextMenu.ts +16 -1
  129. package/front_end/ui/legacy/PlusButton.ts +5 -6
  130. package/front_end/ui/legacy/Treeoutline.ts +6 -0
  131. package/front_end/ui/legacy/Widget.ts +33 -0
  132. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +3 -0
  133. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +14 -4
  134. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +36 -32
  135. package/front_end/ui/visual_logging/KnownContextValues.ts +4 -0
  136. package/package.json +1 -1
  137. package/.agents/skills/devtools-ci/SKILL.md +0 -65
  138. package/.agents/skills/evaluate-ai-css-completion/SKILL.md +0 -143
  139. package/.agents/skills/evaluate-ai-css-completion/scripts/evaluate.js +0 -104
  140. package/.agents/skills/fixing-skipped-tests/SKILL.md +0 -32
  141. package/.agents/skills/gerrit-cli/SKILL.md +0 -74
  142. package/.agents/skills/gerrit-cli/references/commands.md +0 -169
  143. package/.agents/skills/gerrit-cli/references/workflows.md +0 -63
  144. package/.agents/skills/gerrit-cli/scripts/import_upstream.py +0 -85
  145. 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
- new SourceMap(compiledURL, sourceMappingURL, payload, this.#target.targetManager().getConsole()));
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
- client: T, relativeSourceURL: Platform.DevToolsPath.UrlString, relativeSourceMapURL: string|undefined): void {
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
- return [new RemoteObjectProperty(
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
- return new SourceMapScopeRemoteObject(this.#callFrame, this.#scope, this.#range, this.#scopeNumber);
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
- const properties: RemoteObjectProperty[] = [];
148
- for (const [index, variable] of this.#scope.variables.entries()) {
149
- const expression = this.#findExpression(index);
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
- properties.push(SourceMapScopeRemoteObject.#unavailableProperty(variable));
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
- properties.push(SourceMapScopeRemoteObject.#unavailableProperty(variable));
256
+ values.push(null);
160
257
  } else {
161
- properties.push(new RemoteObjectProperty(
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 === null) {
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: SourceMapScopeChainEntry[] = [];
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 = rangeChain.at(-1)?.originalScope; originalScope; originalScope = originalScope.parent) {
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) {