chrome-devtools-frontend 1.0.1661063 → 1.0.1662965

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 (131) hide show
  1. package/.agents/skills/devtools-unicode-escaping/SKILL.md +64 -0
  2. package/.agents/skills/evaluate-ai-css-completion/SKILL.md +19 -9
  3. package/.agents/skills/evaluate-ai-css-completion/scripts/evaluate.js +44 -16
  4. package/.agents/skills/migrate-chromium-test/SKILL.md +32 -2
  5. package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +7 -1
  6. package/docs/ui_engineering.md +75 -42
  7. package/front_end/core/common/SettingRegistration.ts +0 -10
  8. package/front_end/core/common/Settings.ts +69 -3
  9. package/front_end/core/platform/ArrayUtilities.ts +10 -0
  10. package/front_end/core/platform/StringUtilities.ts +38 -6
  11. package/front_end/core/sdk/ServiceWorkerCacheModel.ts +0 -10
  12. package/front_end/core/sdk/StorageBucketsModel.ts +0 -10
  13. package/front_end/core/sdk/sdk-meta.ts +0 -1
  14. package/front_end/entrypoints/inspector_main/OutermostTargetSelector.ts +0 -13
  15. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +8 -3
  16. package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +3 -3
  17. package/front_end/entrypoints/main/MainImpl.ts +7 -2
  18. package/front_end/foundation/README.md +86 -0
  19. package/front_end/foundation/Universe.ts +16 -0
  20. package/front_end/generated/InspectorBackendCommands.ts +6 -19
  21. package/front_end/generated/protocol-mapping.d.ts +0 -53
  22. package/front_end/generated/protocol-proxy-api.d.ts +0 -46
  23. package/front_end/generated/protocol.ts +20 -186
  24. package/front_end/models/ai_assistance/AiAgent2.ts +3 -3
  25. package/front_end/models/ai_assistance/AiConversation.ts +21 -10
  26. package/front_end/models/ai_assistance/AiHistoryStorage.ts +21 -10
  27. package/front_end/models/ai_assistance/ChangeManager.ts +2 -2
  28. package/front_end/models/ai_assistance/ExtensionScope.ts +6 -2
  29. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +1 -1
  30. package/front_end/models/ai_assistance/agents/AiAgent.ts +8 -1
  31. package/front_end/models/ai_assistance/agents/StylingAgent.ts +1 -1
  32. package/front_end/models/badges/UserBadges.ts +31 -17
  33. package/front_end/models/bindings/CompilerScriptMapping.ts +5 -4
  34. package/front_end/models/bindings/ContentProviderBasedProject.ts +2 -3
  35. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +4 -3
  36. package/front_end/models/bindings/DefaultScriptMapping.ts +3 -3
  37. package/front_end/models/bindings/NetworkProject.ts +22 -1
  38. package/front_end/models/bindings/ResourceMapping.ts +4 -3
  39. package/front_end/models/bindings/ResourceScriptMapping.ts +2 -1
  40. package/front_end/models/bindings/SASSSourceMapping.ts +4 -3
  41. package/front_end/models/bindings/StylesSourceMapping.ts +3 -3
  42. package/front_end/models/emulation/DeviceModeModel.ts +67 -5
  43. package/front_end/models/extensions/RecorderExtensionEndpoint.ts +7 -5
  44. package/front_end/models/extensions/RecorderPluginManager.ts +10 -6
  45. package/front_end/models/har/Log.snapshot.txt +193 -0
  46. package/front_end/models/har/Log.ts +3 -2
  47. package/front_end/models/heap_snapshot/HeapSnapshotProxy.ts +14 -5
  48. package/front_end/models/issues_manager/CheckFormsIssuesTrigger.ts +8 -9
  49. package/front_end/models/issues_manager/RelatedIssue.ts +10 -8
  50. package/front_end/models/javascript_metadata/NativeFunctions.js +1 -1
  51. package/front_end/models/logs/RequestResolver.ts +2 -2
  52. package/front_end/models/persistence/AutomaticFileSystemWorkspaceBinding.ts +0 -5
  53. package/front_end/models/source_map_scopes/FunctionCodeResolver.ts +8 -6
  54. package/front_end/models/source_map_scopes/NamesResolver.ts +36 -30
  55. package/front_end/models/stack_trace/StackTrace.ts +17 -0
  56. package/front_end/models/trace/handlers/FramesHandler.ts +4 -7
  57. package/front_end/models/trace/handlers/ModelHandlers.ts +0 -1
  58. package/front_end/models/trace/handlers/RendererHandler.ts +2 -15
  59. package/front_end/models/trace/handlers/Threads.ts +4 -11
  60. package/front_end/models/trace/insights/DOMSize.ts +1 -1
  61. package/front_end/models/workspace/WorkspaceImpl.ts +1 -10
  62. package/front_end/panels/application/ApplicationPanelSidebar.ts +0 -44
  63. package/front_end/panels/application/CookieItemsView.ts +1 -1
  64. package/front_end/panels/application/FrameDetailsView.ts +1 -1
  65. package/front_end/panels/application/IndexedDBModel.ts +0 -10
  66. package/front_end/panels/application/IndexedDBViews.ts +240 -164
  67. package/front_end/panels/application/ServiceWorkersView.ts +494 -411
  68. package/front_end/panels/application/SharedStorageModel.ts +0 -10
  69. package/front_end/panels/application/application.ts +0 -6
  70. package/front_end/panels/application/components/AdsView.ts +23 -0
  71. package/front_end/panels/application/components/SharedStorageAccessGrid.ts +1 -1
  72. package/front_end/panels/application/components/adsView.css +21 -1
  73. package/front_end/panels/application/components/components.ts +0 -2
  74. package/front_end/panels/application/indexedDBViews.css +1 -1
  75. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +1 -1
  76. package/front_end/panels/application/serviceWorkersView.css +40 -4
  77. package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +147 -123
  78. package/front_end/panels/common/ExtensionServer.ts +3 -3
  79. package/front_end/panels/console/ConsoleView.ts +1 -1
  80. package/front_end/panels/emulation/DeviceModeView.ts +139 -70
  81. package/front_end/panels/issues/AffectedResourcesView.ts +1 -1
  82. package/front_end/panels/lighthouse/LighthouseProtocolService.ts +53 -12
  83. package/front_end/panels/network/NetworkDataGridNode.ts +43 -1
  84. package/front_end/panels/network/RequestInitiatorView.ts +24 -2
  85. package/front_end/panels/network/RequestPayloadView.ts +77 -39
  86. package/front_end/panels/network/components/ResponseHeaderSection.ts +5 -3
  87. package/front_end/panels/network/networkLogView.css +5 -0
  88. package/front_end/panels/network/requestInitiatorViewTree.css +5 -0
  89. package/front_end/panels/profiler/HeapProfileView.ts +198 -79
  90. package/front_end/panels/profiler/HeapSnapshotView.ts +2 -2
  91. package/front_end/panels/recorder/README.md +1 -2
  92. package/front_end/panels/recorder/RecorderPanel.ts +1749 -17
  93. package/front_end/panels/recorder/recorder.ts +0 -2
  94. package/front_end/panels/settings/AISettingsTab.ts +13 -0
  95. package/front_end/panels/sources/SourcesNavigator.ts +3 -2
  96. package/front_end/panels/sources/SourcesView.ts +0 -17
  97. package/front_end/panels/sources/UISourceCodeFrame.ts +42 -0
  98. package/front_end/panels/sources/sources.ts +0 -2
  99. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +0 -17
  100. package/front_end/panels/timeline/ThreadAppender.ts +0 -106
  101. package/front_end/third_party/chromium/README.chromium +1 -1
  102. package/front_end/ui/components/report_view/ReportView.ts +11 -5
  103. package/front_end/ui/components/report_view/report.css +4 -1
  104. package/front_end/ui/components/spinners/Spinner.ts +29 -32
  105. package/front_end/ui/components/spinners/spinner.css +32 -84
  106. package/front_end/ui/legacy/TextPrompt.ts +49 -1
  107. package/front_end/ui/legacy/Treeoutline.ts +14 -6
  108. package/front_end/ui/legacy/UIUtils.ts +36 -11
  109. package/front_end/ui/legacy/Widget.ts +17 -10
  110. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +2 -2
  111. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +36 -7
  112. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +63 -68
  113. package/front_end/ui/legacy/components/object_ui/RemoteObjectPreviewFormatter.ts +1 -1
  114. package/front_end/ui/legacy/components/object_ui/objectValue.css +2 -1
  115. package/front_end/ui/legacy/inspectorCommon.css +4 -4
  116. package/front_end/ui/legacy/textPrompt.css +10 -0
  117. package/front_end/ui/lit/lit.ts +1 -0
  118. package/front_end/ui/lit/render.ts +44 -10
  119. package/front_end/ui/lit/strip-whitespace.ts +23 -2
  120. package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
  121. package/package.json +1 -1
  122. package/front_end/models/trace/handlers/AuctionWorkletsHandler.ts +0 -183
  123. package/front_end/panels/application/InterestGroupStorageModel.ts +0 -81
  124. package/front_end/panels/application/InterestGroupStorageView.ts +0 -151
  125. package/front_end/panels/application/InterestGroupTreeElement.ts +0 -65
  126. package/front_end/panels/application/components/InterestGroupAccessGrid.ts +0 -135
  127. package/front_end/panels/application/components/interestGroupAccessGrid.css +0 -27
  128. package/front_end/panels/application/interestGroupStorageView.css +0 -9
  129. package/front_end/panels/recorder/RecorderController.ts +0 -1595
  130. package/front_end/panels/sources/InplaceFormatterEditorAction.ts +0 -149
  131. /package/front_end/panels/recorder/{recorderController.css → recorderPanel.css} +0 -0
@@ -9,7 +9,7 @@
9
9
  // See https://bugs.webkit.org/show_bug.cgi?id=58127 for details.
10
10
 
11
11
  import * as Common from '../../core/common/common.js';
12
- import type * as Platform from '../../core/platform/platform.js';
12
+ import * as Platform from '../../core/platform/platform.js';
13
13
  import * as SDK from '../../core/sdk/sdk.js';
14
14
  import type * as Protocol from '../../generated/protocol.js';
15
15
 
@@ -33,7 +33,8 @@ export class Log {
33
33
  }
34
34
 
35
35
  private creator(): Creator {
36
- const webKitVersion = /AppleWebKit\/([^ ]+)/.exec(window.navigator.userAgent);
36
+ const userAgent = Platform.HostRuntime.HOST_RUNTIME.getUserAgent();
37
+ const webKitVersion = /AppleWebKit\/([^ ]+)/.exec(userAgent);
37
38
 
38
39
  return {name: 'WebInspector', version: webKitVersion ? webKitVersion[1] : 'n/a'};
39
40
  }
@@ -11,6 +11,7 @@ import type * as HeapSnapshotModel from './HeapSnapshotModel.js';
11
11
 
12
12
  export class HeapSnapshotWorkerProxy extends Common.ObjectWrapper.ObjectWrapper<HeapSnapshotWorkerProxy.EventTypes> {
13
13
  readonly eventHandler: (arg0: string, arg1: string) => void;
14
+ #console: Common.Console.Console;
14
15
  nextObjectId = 1;
15
16
  nextCallId = 1;
16
17
  callbacks = new Map<number, (...args: any[]) => void>();
@@ -19,9 +20,14 @@ export class HeapSnapshotWorkerProxy extends Common.ObjectWrapper.ObjectWrapper<
19
20
  interval?: number;
20
21
  readonly workerUrl?: string;
21
22
 
22
- constructor(eventHandler: (arg0: string, arg1: string) => void, workerUrl?: string) {
23
+ constructor(
24
+ eventHandler: (arg0: string, arg1: string) => void,
25
+ console: Common.Console.Console,
26
+ workerUrl?: string,
27
+ ) {
23
28
  super();
24
29
  this.eventHandler = eventHandler;
30
+ this.#console = console;
25
31
  this.workerUrl = workerUrl;
26
32
  this.worker = Platform.HostRuntime.HOST_RUNTIME.createWorker(
27
33
  workerUrl ?? import.meta.resolve('../../entrypoints/heap_snapshot_worker/heap_snapshot_worker-entrypoint.js'),
@@ -29,6 +35,10 @@ export class HeapSnapshotWorkerProxy extends Common.ObjectWrapper.ObjectWrapper<
29
35
  this.worker.onmessage = this.messageReceived.bind(this);
30
36
  }
31
37
 
38
+ get console(): Common.Console.Console {
39
+ return this.#console;
40
+ }
41
+
32
42
  createLoader(profileUid: number, snapshotReceivedCallback: (arg0: HeapSnapshotProxy) => void):
33
43
  HeapSnapshotLoaderProxy {
34
44
  const objectId = this.nextObjectId++;
@@ -159,9 +169,8 @@ export class HeapSnapshotWorkerProxy extends Common.ObjectWrapper.ObjectWrapper<
159
169
  return;
160
170
  }
161
171
  if (data.error) {
162
- Common.Console.Console.instance().error(
163
- `An error occurred when a call to method '${data.errorMethodName}' was requested`);
164
- Common.Console.Console.instance().error(data['errorCallStack']);
172
+ this.#console.error(`An error occurred when a call to method '${data.errorMethodName}' was requested`);
173
+ this.#console.error(data['errorCallStack']);
165
174
  this.callbacks.delete(data.callId);
166
175
  return;
167
176
  }
@@ -238,7 +247,7 @@ export class HeapSnapshotLoaderProxy extends HeapSnapshotProxyObject implements
238
247
 
239
248
  async close(): Promise<void> {
240
249
  await this.callMethodPromise('close');
241
- const secondWorker = new HeapSnapshotWorkerProxy(() => {}, this.worker.workerUrl);
250
+ const secondWorker = new HeapSnapshotWorkerProxy(() => {}, this.worker.console, this.worker.workerUrl);
242
251
  const channel = new MessageChannel();
243
252
  await secondWorker.setupForSecondaryInit(channel.port2);
244
253
  const snapshotProxy = await this.callFactoryMethodPromise('buildSnapshot', HeapSnapshotProxy, [channel.port1]);
@@ -3,20 +3,19 @@
3
3
  // Use of this source code is governed by a BSD-style license that can be
4
4
  // found in the LICENSE file.
5
5
  import type * as Common from '../../core/common/common.js';
6
+ import * as Root from '../../core/root/root.js';
6
7
  import * as SDK from '../../core/sdk/sdk.js';
7
8
 
8
9
  /**
9
10
  * Responsible for asking autofill for current form issues. This currently happens when devtools is first open.
10
11
  */
11
12
  // TODO(crbug.com/1399414): Trigger check form issues when an element with an associated issue is editted in the issues panel.
12
- let checkFormsIssuesTriggerInstance: CheckFormsIssuesTrigger|null = null;
13
13
  export class CheckFormsIssuesTrigger {
14
- constructor() {
15
- SDK.TargetManager.TargetManager.instance().addModelListener(
16
- SDK.ResourceTreeModel.ResourceTreeModel, SDK.ResourceTreeModel.Events.Load, this.#pageLoaded, this,
17
- {scoped: true});
14
+ constructor(targetManager: SDK.TargetManager.TargetManager = SDK.TargetManager.TargetManager.instance()) {
15
+ targetManager.addModelListener(SDK.ResourceTreeModel.ResourceTreeModel, SDK.ResourceTreeModel.Events.Load,
16
+ this.#pageLoaded, this, {scoped: true});
18
17
 
19
- for (const model of SDK.TargetManager.TargetManager.instance().models(SDK.ResourceTreeModel.ResourceTreeModel)) {
18
+ for (const model of targetManager.models(SDK.ResourceTreeModel.ResourceTreeModel)) {
20
19
  if (model.target().outermostTarget() !== model.target()) {
21
20
  continue;
22
21
  }
@@ -26,10 +25,10 @@ export class CheckFormsIssuesTrigger {
26
25
  }
27
26
 
28
27
  static instance({forceNew}: {forceNew: boolean} = {forceNew: false}): CheckFormsIssuesTrigger {
29
- if (!checkFormsIssuesTriggerInstance || forceNew) {
30
- checkFormsIssuesTriggerInstance = new CheckFormsIssuesTrigger();
28
+ if (!Root.DevToolsContext.globalInstance().has(CheckFormsIssuesTrigger) || forceNew) {
29
+ Root.DevToolsContext.globalInstance().set(CheckFormsIssuesTrigger, new CheckFormsIssuesTrigger());
31
30
  }
32
- return checkFormsIssuesTriggerInstance;
31
+ return Root.DevToolsContext.globalInstance().get(CheckFormsIssuesTrigger);
33
32
  }
34
33
 
35
34
  // TODO(crbug.com/1399414): Handle response by dropping current issues in favor of new ones.
@@ -6,7 +6,7 @@ import * as Common from '../../core/common/common.js';
6
6
  import * as SDK from '../../core/sdk/sdk.js';
7
7
 
8
8
  import type {Issue, IssueCategory} from './Issue.js';
9
- import {IssuesManager} from './IssuesManager.js';
9
+ import type {IssuesManager} from './IssuesManager.js';
10
10
 
11
11
  export type IssuesAssociatable = Readonly<SDK.NetworkRequest.NetworkRequest>|SDK.Cookie.Cookie|string;
12
12
 
@@ -45,24 +45,26 @@ export function issuesAssociatedWith(issues: Issue[], obj: IssuesAssociatable):
45
45
  throw new Error(`issues can not be associated with ${JSON.stringify(obj)}`);
46
46
  }
47
47
 
48
- export function hasIssues(obj: IssuesAssociatable): boolean {
49
- const issues = Array.from(IssuesManager.instance().issues());
48
+ export function hasIssues(obj: IssuesAssociatable, issuesManager: IssuesManager): boolean {
49
+ const issues = Array.from(issuesManager.issues());
50
50
  return issuesAssociatedWith(issues, obj).length > 0;
51
51
  }
52
52
 
53
- export function hasIssueOfCategory(obj: IssuesAssociatable, category: IssueCategory): boolean {
54
- const issues = Array.from(IssuesManager.instance().issues());
53
+ export function hasIssueOfCategory(obj: IssuesAssociatable, category: IssueCategory,
54
+ issuesManager: IssuesManager): boolean {
55
+ const issues = Array.from(issuesManager.issues());
55
56
  return issuesAssociatedWith(issues, obj).some(issue => issue.getCategory() === category);
56
57
  }
57
58
 
58
- export async function reveal(obj: IssuesAssociatable, category?: IssueCategory): Promise<void|undefined> {
59
+ export async function reveal(obj: IssuesAssociatable, issuesManager: IssuesManager,
60
+ category?: IssueCategory): Promise<void|undefined> {
59
61
  if (typeof obj === 'string') {
60
- const issue = IssuesManager.instance().getIssueById(obj);
62
+ const issue = issuesManager.getIssueById(obj);
61
63
  if (issue) {
62
64
  return await Common.Revealer.reveal(issue);
63
65
  }
64
66
  }
65
- const issues = Array.from(IssuesManager.instance().issues());
67
+ const issues = Array.from(issuesManager.issues());
66
68
  const candidates = issuesAssociatedWith(issues, obj).filter(issue => !category || issue.getCategory() === category);
67
69
  if (candidates.length > 0) {
68
70
  return await Common.Revealer.reveal(candidates[0]);
@@ -8292,7 +8292,7 @@ export const NativeFunctions = [
8292
8292
  },
8293
8293
  {
8294
8294
  name: "setAttributionReporting",
8295
- signatures: [["attributionReporting"]]
8295
+ signatures: [["options"]]
8296
8296
  },
8297
8297
  {
8298
8298
  name: "Worker",
@@ -6,7 +6,7 @@ import * as Common from '../../core/common/common.js';
6
6
  import type * as SDK from '../../core/sdk/sdk.js';
7
7
  import type * as Protocol from '../../generated/protocol.js';
8
8
 
9
- import {Events as NetworkLogEvents, NetworkLog} from './NetworkLog.js';
9
+ import {Events as NetworkLogEvents, type NetworkLog} from './NetworkLog.js';
10
10
 
11
11
  /**
12
12
  * A class that facilitates resolving a requestId to a network request. If the requestId does not resolve, a listener
@@ -22,7 +22,7 @@ export class RequestResolver extends
22
22
  private networkListener: Common.EventTarget.EventDescriptor|null = null;
23
23
  private networkLog: NetworkLog;
24
24
 
25
- constructor(networkLog: NetworkLog = NetworkLog.instance()) {
25
+ constructor(networkLog: NetworkLog) {
26
26
  super();
27
27
  this.networkLog = networkLog;
28
28
  }
@@ -6,7 +6,6 @@ import * as Common from '../../core/common/common.js';
6
6
  import * as Host from '../../core/host/host.js';
7
7
  import type * as Platform from '../../core/platform/platform.js';
8
8
  import * as Root from '../../core/root/root.js';
9
- import type * as SDK from '../../core/sdk/sdk.js';
10
9
  import type {ContentDataOrError} from '../text_utils/ContentData.js';
11
10
  import type {SearchMatch} from '../text_utils/ContentProvider.js';
12
11
  import * as Workspace from '../workspace/workspace.js';
@@ -169,10 +168,6 @@ export class FileSystem implements Workspace.Workspace.Project {
169
168
  uiSourceCodes(): Iterable<Workspace.UISourceCode.UISourceCode> {
170
169
  return [];
171
170
  }
172
-
173
- target(): SDK.Target.Target|null {
174
- return null;
175
- }
176
171
  }
177
172
 
178
173
  /**
@@ -216,17 +216,18 @@ function createFunctionCode(
216
216
  */
217
217
  export async function getFunctionCodeFromLocation(
218
218
  target: SDK.Target.Target, url: Platform.DevToolsPath.UrlString, line: number, column: number,
219
- options?: CreateFunctionCodeOptions): Promise<FunctionCode|null> {
219
+ options?: CreateFunctionCodeOptions,
220
+ debuggerWorkspaceBinding =
221
+ Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance()): Promise<FunctionCode|null> {
220
222
  const debuggerModel = target.model(SDK.DebuggerModel.DebuggerModel);
221
223
  if (!debuggerModel) {
222
224
  throw new Error('missing debugger model');
223
225
  }
224
226
 
225
227
  let uiSourceCode: Workspace.UISourceCode.UISourceCode|null = null;
226
- const debuggerWorkspaceBinding = Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance();
227
228
  const projects = debuggerWorkspaceBinding.workspace.projectsForType(Workspace.Workspace.projectTypes.Network);
228
229
  for (const project of projects) {
229
- if (project.target() !== target) {
230
+ if (Bindings.NetworkProject.NetworkProject.getTargetForProject(project) !== target) {
230
231
  continue;
231
232
  }
232
233
  uiSourceCode = project.uiSourceCodeForURL(url);
@@ -245,7 +246,7 @@ export async function getFunctionCodeFromLocation(
245
246
  return null;
246
247
  }
247
248
 
248
- return await getFunctionCodeFromRawLocation(rawLocation, options);
249
+ return await getFunctionCodeFromRawLocation(rawLocation, options, debuggerWorkspaceBinding);
249
250
  }
250
251
 
251
252
  async function format(uiSourceCode: Workspace.UISourceCode.UISourceCode, content: string,
@@ -264,8 +265,9 @@ async function format(uiSourceCode: Workspace.UISourceCode.UISourceCode, content
264
265
  * Returns a {@link FunctionCode} for the given raw location.
265
266
  */
266
267
  export async function getFunctionCodeFromRawLocation(
267
- rawLocation: SDK.DebuggerModel.Location, options?: CreateFunctionCodeOptions): Promise<FunctionCode|null> {
268
- const debuggerWorkspaceBinding = Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance();
268
+ rawLocation: SDK.DebuggerModel.Location, options?: CreateFunctionCodeOptions,
269
+ debuggerWorkspaceBinding =
270
+ Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance()): Promise<FunctionCode|null> {
269
271
  const functionBounds = await debuggerWorkspaceBinding.functionBoundsAtRawLocation(rawLocation);
270
272
  if (!functionBounds) {
271
273
  return null;
@@ -2,7 +2,6 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- import * as Common from '../../core/common/common.js';
6
5
  import * as SDK from '../../core/sdk/sdk.js';
7
6
  import * as Protocol from '../../generated/protocol.js';
8
7
  import * as Bindings from '../bindings/bindings.js';
@@ -190,7 +189,11 @@ const enum Punctuation {
190
189
 
191
190
  const resolveDebuggerScope = async(scope: SDK.DebuggerModel.ScopeChainEntry):
192
191
  Promise<{variableMapping: Map<string, string>, thisMapping: string | null}> => {
193
- if (!Common.Settings.Settings.instance().moduleSetting('js-source-maps-enabled').get()) {
192
+ if (!scope.callFrame()
193
+ .debuggerModel.target()
194
+ .targetManager()
195
+ .settings.moduleSetting('js-source-maps-enabled')
196
+ .get()) {
194
197
  return {variableMapping: new Map(), thisMapping: null};
195
198
  }
196
199
  const script = scope.callFrame().script;
@@ -278,16 +281,17 @@ const resolveScope = async(script: SDK.Script.Script, scopeChain: Formatter.Form
278
281
 
279
282
  async function resolveSourceName(
280
283
  script: SDK.Script.Script, sourceMap: SDK.SourceMap.SourceMap, name: string,
281
- position: {lineNumber: number, columnNumber: number}): Promise<string|null> {
284
+ position: {lineNumber: number, columnNumber: number},
285
+ debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding =
286
+ Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance()): Promise<string|null> {
282
287
  const ranges = sourceMap.findEntryRanges(position.lineNumber, position.columnNumber);
283
288
  if (!ranges) {
284
289
  return null;
285
290
  }
286
291
  // Extract the underlying text from the compiled code's range and make sure that
287
292
  // it starts with the identifier |name|.
288
- const uiSourceCode =
289
- Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().uiSourceCodeForSourceMapSourceURL(
290
- script.debuggerModel, ranges.sourceURL, script.isContentScript());
293
+ const uiSourceCode = debuggerWorkspaceBinding.uiSourceCodeForSourceMapSourceURL(
294
+ script.debuggerModel, ranges.sourceURL, script.isContentScript());
291
295
  if (!uiSourceCode) {
292
296
  return null;
293
297
  }
@@ -363,24 +367,27 @@ const resolveScope = async(script: SDK.Script.Script, scopeChain: Formatter.Form
363
367
  };
364
368
 
365
369
  export const resolveScopeChain =
366
- async function(callFrame: SDK.DebuggerModel.CallFrame): Promise<SDK.DebuggerModel.ScopeChainEntry[]> {
367
- const {pluginManager} = Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance();
368
- const scopeChain: SDK.DebuggerModel.ScopeChainEntry[]|null|undefined =
369
- await pluginManager.resolveScopeChain(callFrame);
370
- if (scopeChain) {
371
- return scopeChain;
372
- }
370
+ async function(callFrame: SDK.DebuggerModel.CallFrame,
371
+ debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding =
372
+ Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance()):
373
+ Promise<SDK.DebuggerModel.ScopeChainEntry[]> {
374
+ const {pluginManager} = debuggerWorkspaceBinding;
375
+ const scopeChain: SDK.DebuggerModel.ScopeChainEntry[]|null|undefined =
376
+ await pluginManager.resolveScopeChain(callFrame);
377
+ if (scopeChain) {
378
+ return scopeChain;
379
+ }
373
380
 
374
- // TODO(crbug.com/465968290): Re-enable creating the scope chain from the source map once:
375
- // 1) We have a flag indicating whether the source map contained variable/binding information.
376
- // 2) We have a chrome feature flag.
381
+ // TODO(crbug.com/465968290): Re-enable creating the scope chain from the source map once:
382
+ // 1) We have a flag indicating whether the source map contained variable/binding information.
383
+ // 2) We have a chrome feature flag.
377
384
 
378
- if (callFrame.script.isWasm()) {
379
- return callFrame.scopeChain();
380
- }
381
- const thisObject = await resolveThisObject(callFrame);
382
- return callFrame.scopeChain().map(scope => new ScopeWithSourceMappedVariables(scope, thisObject));
383
- };
385
+ if (callFrame.script.isWasm()) {
386
+ return callFrame.scopeChain();
387
+ }
388
+ const thisObject = await resolveThisObject(callFrame);
389
+ return callFrame.scopeChain().map(scope => new ScopeWithSourceMappedVariables(scope, thisObject));
390
+ };
384
391
 
385
392
  /**
386
393
  * @returns A mapping from original name -> compiled name. If the orignal name is unavailable (e.g. because the compiled name was
@@ -388,7 +395,7 @@ export const resolveScopeChain =
388
395
  */
389
396
  export const allVariablesInCallFrame =
390
397
  async(callFrame: SDK.DebuggerModel.CallFrame): Promise<Map<string, string|null>> => {
391
- if (!Common.Settings.Settings.instance().moduleSetting('js-source-maps-enabled').get()) {
398
+ if (!callFrame.debuggerModel.target().targetManager().settings.moduleSetting('js-source-maps-enabled').get()) {
392
399
  return new Map<string, string|null>();
393
400
  }
394
401
  const cachedMap = cachedMapByCallFrame.get(callFrame);
@@ -424,13 +431,13 @@ export const allVariablesInCallFrame =
424
431
  export const allVariablesAtPosition =
425
432
  async(location: SDK.DebuggerModel.Location): Promise<Map<string, string|null>> => {
426
433
  const reverseMapping = new Map<string, string|null>();
427
- if (!Common.Settings.Settings.instance().moduleSetting('js-source-maps-enabled').get()) {
428
- return reverseMapping;
429
- }
430
434
  const script = location.script();
431
435
  if (!script) {
432
436
  return reverseMapping;
433
437
  }
438
+ if (!script.debuggerModel.target().targetManager().settings.moduleSetting('js-source-maps-enabled').get()) {
439
+ return reverseMapping;
440
+ }
434
441
 
435
442
  const scopeTreeAndText = await computeScopeTree(script);
436
443
  if (!scopeTreeAndText) {
@@ -727,8 +734,9 @@ export async function resolveDebuggerFrameFunctionName(frame: SDK.DebuggerModel.
727
734
  }
728
735
 
729
736
  export async function resolveProfileFrameFunctionName(
730
- {scriptId, lineNumber, columnNumber}: Partial<Protocol.Runtime.CallFrame>,
731
- target: SDK.Target.Target|null): Promise<string|null> {
737
+ {scriptId, lineNumber, columnNumber}: Partial<Protocol.Runtime.CallFrame>, target: SDK.Target.Target|null,
738
+ debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding =
739
+ Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance()): Promise<string|null> {
732
740
  if (!target || lineNumber === undefined || columnNumber === undefined || scriptId === undefined) {
733
741
  return null;
734
742
  }
@@ -738,8 +746,6 @@ export async function resolveProfileFrameFunctionName(
738
746
  if (!debuggerModel || !script) {
739
747
  return null;
740
748
  }
741
-
742
- const debuggerWorkspaceBinding = Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance();
743
749
  const location = new SDK.DebuggerModel.Location(debuggerModel, scriptId, lineNumber, columnNumber);
744
750
  const functionInfoFromPlugin = await debuggerWorkspaceBinding.pluginManager.getFunctionInfo(script, location);
745
751
  if (functionInfoFromPlugin && 'frames' in functionInfoFromPlugin) {
@@ -4,6 +4,7 @@
4
4
 
5
5
  import type * as Common from '../../core/common/common.js';
6
6
  import type * as SDK from '../../core/sdk/sdk.js';
7
+ import type * as Protocol from '../../generated/protocol.js';
7
8
  import type * as Workspace from '../workspace/workspace.js';
8
9
 
9
10
  export type StackTrace = BaseStackTrace<Fragment>;
@@ -131,3 +132,19 @@ export class DebuggableFrameFlavor {
131
132
  return DebuggableFrameFlavor.#last;
132
133
  }
133
134
  }
135
+
136
+ /**
137
+ * Returns whether the given stack trace originated from a direct console
138
+ * invocation. A console-originated stack trace has exactly one frame with
139
+ * no url and no function name.
140
+ *
141
+ * TODO(crbug.com/40726969): Accept a translated `StackTrace` instead of a raw `Protocol.Runtime.StackTrace`.
142
+ */
143
+ export function isConsoleOriginated(stackTrace: Protocol.Runtime.StackTrace): boolean {
144
+ const callFrames = stackTrace.callFrames;
145
+ if (callFrames.length !== 1) {
146
+ return false;
147
+ }
148
+ const frame = callFrames[0];
149
+ return frame.url === '' && frame.functionName === '';
150
+ }
@@ -6,7 +6,6 @@ import * as Platform from '../../../core/platform/platform.js';
6
6
  import * as Helpers from '../helpers/helpers.js';
7
7
  import * as Types from '../types/types.js';
8
8
 
9
- import {type AuctionWorkletsData, data as auctionWorkletsData} from './AuctionWorkletsHandler.js';
10
9
  import {data as layerTreeHandlerData, type LayerTreeData} from './LayerTreeHandler.js';
11
10
  import {data as metaHandlerData, type MetaHandlerData} from './MetaHandler.js';
12
11
  import {data as rendererHandlerData, type RendererHandlerData} from './RendererHandler.js';
@@ -81,7 +80,6 @@ export async function finalize(): Promise<void> {
81
80
  const modelForTrace = new TimelineFrameModel(
82
81
  relevantFrameEvents,
83
82
  rendererHandlerData(),
84
- auctionWorkletsData(),
85
83
  metaHandlerData(),
86
84
  layerTreeHandlerData(),
87
85
  );
@@ -101,7 +99,7 @@ export function data(): FramesData {
101
99
  }
102
100
 
103
101
  export function deps(): HandlerName[] {
104
- return ['Meta', 'Renderer', 'AuctionWorklets', 'LayerTree'];
102
+ return ['Meta', 'Renderer', 'LayerTree'];
105
103
  }
106
104
 
107
105
  export class TimelineFrameModel {
@@ -122,13 +120,12 @@ export class TimelineFrameModel {
122
120
  #activeThreadId: Types.Events.ThreadID|null = null;
123
121
  #layerTreeData: LayerTreeData;
124
122
 
125
- constructor(
126
- allEvents: readonly Types.Events.Event[], rendererData: RendererHandlerData,
127
- auctionWorkletsData: AuctionWorkletsData, metaData: MetaHandlerData, layerTreeData: LayerTreeData) {
123
+ constructor(allEvents: readonly Types.Events.Event[], rendererData: RendererHandlerData, metaData: MetaHandlerData,
124
+ layerTreeData: LayerTreeData) {
128
125
  // We only care about getting threads from the Renderer, not Samples,
129
126
  // because Frames don't exist in a CPU Profile (which won't have Renderer
130
127
  // threads.)
131
- const mainThreads = Threads.threadsInRenderer(rendererData, auctionWorkletsData).filter(thread => {
128
+ const mainThreads = Threads.threadsInRenderer(rendererData).filter(thread => {
132
129
  return thread.type === Threads.ThreadType.MAIN_THREAD && thread.processIsOnMainFrame;
133
130
  });
134
131
  const threadData = mainThreads.map(thread => {
@@ -5,7 +5,6 @@
5
5
  export * as AnimationFrames from './AnimationFramesHandler.js';
6
6
  export * as Animations from './AnimationHandler.js';
7
7
  export * as AsyncJSCalls from './AsyncJSCallsHandler.js';
8
- export * as AuctionWorklets from './AuctionWorkletsHandler.js';
9
8
  export * as DOMStats from './DOMStatsHandler.js';
10
9
  export * as ExtensionTraceData from './ExtensionTraceDataHandler.js';
11
10
  export * as Flows from './FlowsHandler.js';
@@ -6,7 +6,6 @@ import * as Platform from '../../../core/platform/platform.js';
6
6
  import * as Helpers from '../helpers/helpers.js';
7
7
  import * as Types from '../types/types.js';
8
8
 
9
- import {data as auctionWorkletsData} from './AuctionWorkletsHandler.js';
10
9
  import * as HandlerHelpers from './helpers.js';
11
10
  import {data as metaHandlerData, type FrameProcessData} from './MetaHandler.js';
12
11
  import {data as networkRequestHandlerData} from './NetworkRequestsHandler.js';
@@ -248,7 +247,6 @@ export function assignThreadName(
248
247
  * - Deletes processes with an unknown origin.
249
248
  */
250
249
  export function sanitizeProcesses(processes: Map<Types.Events.ProcessID, RendererProcess>): void {
251
- const auctionWorklets = auctionWorkletsData().worklets;
252
250
  const metaData = metaHandlerData();
253
251
  if (metaData.traceIsGeneric) {
254
252
  return;
@@ -258,19 +256,8 @@ export function sanitizeProcesses(processes: Map<Types.Events.ProcessID, Rendere
258
256
  // parsed for some reason, or if it's an "about:" origin, delete it.
259
257
  // This is done because we don't really care about processes for which we
260
258
  // can't provide actionable insights to the user (e.g. about:blank pages).
261
- //
262
- // There is one exception; AuctionWorklet processes get parsed in a
263
- // separate handler, so at this point we check to see if the process has
264
- // been found by the AuctionWorkletsHandler, and if so we update the URL.
265
- // This ensures that we keep this process around and do not drop it due to
266
- // the lack of a URL.
267
259
  if (process.url === null) {
268
- const maybeWorklet = auctionWorklets.get(pid);
269
- if (maybeWorklet) {
270
- process.url = maybeWorklet.host;
271
- } else {
272
- processes.delete(pid);
273
- }
260
+ processes.delete(pid);
274
261
  continue;
275
262
  }
276
263
  }
@@ -392,7 +379,7 @@ export function makeCompleteEvent(event: Types.Events.Begin|Types.Events.End): T
392
379
  }
393
380
 
394
381
  export function deps(): HandlerName[] {
395
- return ['Meta', 'Samples', 'AuctionWorklets', 'NetworkRequests'];
382
+ return ['Meta', 'Samples', 'NetworkRequests'];
396
383
  }
397
384
 
398
385
  export interface RendererHandlerData {
@@ -5,7 +5,6 @@
5
5
  import type * as Helpers from '../helpers/helpers.js';
6
6
  import type * as Types from '../types/types.js';
7
7
 
8
- import type {AuctionWorkletsData} from './AuctionWorkletsHandler.js';
9
8
  import type * as Renderer from './RendererHandler.js';
10
9
  import type {HandlerData} from './types.js';
11
10
 
@@ -24,15 +23,12 @@ export const enum ThreadType {
24
23
  MAIN_THREAD = 'MAIN_THREAD',
25
24
  WORKER = 'WORKER',
26
25
  RASTERIZER = 'RASTERIZER',
27
- AUCTION_WORKLET = 'AUCTION_WORKLET',
28
26
  OTHER = 'OTHER',
29
27
  CPU_PROFILE = 'CPU_PROFILE',
30
28
  THREAD_POOL = 'THREAD_POOL',
31
29
  }
32
30
 
33
- function getThreadTypeForRendererThread(
34
- pid: Types.Events.ProcessID, thread: Renderer.RendererThread,
35
- auctionWorkletsData: AuctionWorkletsData): ThreadType {
31
+ function getThreadTypeForRendererThread(pid: Types.Events.ProcessID, thread: Renderer.RendererThread): ThreadType {
36
32
  let threadType = ThreadType.OTHER;
37
33
  if (thread.name === 'CrRendererMain') {
38
34
  threadType = ThreadType.MAIN_THREAD;
@@ -40,8 +36,6 @@ function getThreadTypeForRendererThread(
40
36
  threadType = ThreadType.WORKER;
41
37
  } else if (thread.name?.startsWith('CompositorTileWorker')) {
42
38
  threadType = ThreadType.RASTERIZER;
43
- } else if (auctionWorkletsData.worklets.has(pid)) {
44
- threadType = ThreadType.AUCTION_WORKLET;
45
39
  } else if (thread.name?.startsWith('ThreadPool')) {
46
40
  // TODO(paulirish): perhaps exclude ThreadPoolServiceThread entirely
47
41
  threadType = ThreadType.THREAD_POOL;
@@ -49,8 +43,7 @@ function getThreadTypeForRendererThread(
49
43
  return threadType;
50
44
  }
51
45
 
52
- export function threadsInRenderer(
53
- rendererData: Renderer.RendererHandlerData, auctionWorkletsData: AuctionWorkletsData): readonly ThreadData[] {
46
+ export function threadsInRenderer(rendererData: Renderer.RendererHandlerData): readonly ThreadData[] {
54
47
  const foundThreads: ThreadData[] = [];
55
48
  // If we have Renderer threads, we prefer to use those. In the event that a
56
49
  // trace is a CPU Profile trace, we will never have Renderer threads, so we
@@ -65,7 +58,7 @@ export function threadsInRenderer(
65
58
  // filtering we need.
66
59
  continue;
67
60
  }
68
- const threadType = getThreadTypeForRendererThread(pid, thread, auctionWorkletsData);
61
+ const threadType = getThreadTypeForRendererThread(pid, thread);
69
62
  foundThreads.push({
70
63
  name: thread.name,
71
64
  pid,
@@ -99,7 +92,7 @@ export function threadsInTrace(handlerData: HandlerData): readonly ThreadData[]
99
92
  }
100
93
 
101
94
  // If we have Renderer threads, we prefer to use those.
102
- const threadsFromRenderer = threadsInRenderer(handlerData.Renderer, handlerData.AuctionWorklets);
95
+ const threadsFromRenderer = threadsInRenderer(handlerData.Renderer);
103
96
  if (threadsFromRenderer.length) {
104
97
  threadsInHandlerDataCache.set(handlerData, threadsFromRenderer);
105
98
  return threadsFromRenderer;
@@ -117,7 +117,7 @@ export function generateInsight(data: Handlers.Types.HandlerData, context: Insig
117
117
  const largeLayoutUpdates: Types.Events.Layout[] = [];
118
118
  const largeStyleRecalcs: Types.Events.RecalcStyle[] = [];
119
119
 
120
- const threads = Handlers.Threads.threadsInRenderer(data.Renderer, data.AuctionWorklets);
120
+ const threads = Handlers.Threads.threadsInRenderer(data.Renderer);
121
121
  for (const thread of threads) {
122
122
  if (thread.type !== Handlers.Threads.ThreadType.MAIN_THREAD) {
123
123
  continue;
@@ -5,7 +5,6 @@
5
5
  import * as Common from '../../core/common/common.js';
6
6
  import type * as Platform from '../../core/platform/platform.js';
7
7
  import * as Root from '../../core/root/root.js';
8
- import type * as SDK from '../../core/sdk/sdk.js';
9
8
  import type * as TextUtils from '../text_utils/text_utils.js';
10
9
 
11
10
  import type {SearchConfig} from './SearchConfig.js';
@@ -55,7 +54,6 @@ export interface Project {
55
54
  * @returns an iterator for the sources provided by this project.
56
55
  */
57
56
  uiSourceCodes(): Iterable<UISourceCode>;
58
- target(): SDK.Target.Target|null;
59
57
  }
60
58
 
61
59
  /* eslint-disable @typescript-eslint/naming-convention -- Used by web_tests. */
@@ -76,15 +74,12 @@ export abstract class ProjectStore implements Project {
76
74
  readonly #type: projectTypes;
77
75
  readonly #displayName: string;
78
76
  readonly #uiSourceCodes = new Map<Platform.DevToolsPath.UrlString, UISourceCode>();
79
- readonly #target: SDK.Target.Target|null = null;
80
77
 
81
- constructor(workspace: WorkspaceImpl, id: string, type: projectTypes, displayName: string,
82
- target: SDK.Target.Target|null = null) {
78
+ constructor(workspace: WorkspaceImpl, id: string, type: projectTypes, displayName: string) {
83
79
  this.#workspace = workspace;
84
80
  this.#id = id;
85
81
  this.#type = type;
86
82
  this.#displayName = displayName;
87
- this.#target = target;
88
83
  }
89
84
 
90
85
  id(): string {
@@ -140,10 +135,6 @@ export abstract class ProjectStore implements Project {
140
135
  return this.#uiSourceCodes.values();
141
136
  }
142
137
 
143
- target(): SDK.Target.Target|null {
144
- return this.#target;
145
- }
146
-
147
138
  renameUISourceCode(uiSourceCode: UISourceCode, newName: string): void {
148
139
  const oldPath = uiSourceCode.url();
149
140
  const newPath = uiSourceCode.parentURL() ?