chrome-devtools-frontend 1.0.971140 → 1.0.973253

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 (107) hide show
  1. package/config/gni/devtools_grd_files.gni +10 -8
  2. package/front_end/core/common/ParsedURL.ts +9 -3
  3. package/front_end/core/host/UserMetrics.ts +2 -1
  4. package/front_end/core/i18n/locales/en-US.json +24 -0
  5. package/front_end/core/i18n/locales/en-XL.json +24 -0
  6. package/front_end/core/sdk/CSSModel.ts +21 -0
  7. package/front_end/core/sdk/CSSStyleSheetHeader.ts +10 -10
  8. package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +6 -4
  9. package/front_end/core/sdk/DOMDebuggerModel.ts +4 -3
  10. package/front_end/core/sdk/DebuggerModel.ts +17 -16
  11. package/front_end/core/sdk/NetworkManager.ts +17 -9
  12. package/front_end/core/sdk/NetworkRequest.ts +18 -16
  13. package/front_end/core/sdk/Resource.ts +10 -10
  14. package/front_end/core/sdk/ResourceTreeModel.ts +16 -13
  15. package/front_end/core/sdk/Script.ts +10 -10
  16. package/front_end/core/sdk/SourceMap.ts +8 -6
  17. package/front_end/entrypoints/lighthouse_worker/{LighthouseService.ts → LighthouseWorkerService.ts} +69 -38
  18. package/front_end/entrypoints/lighthouse_worker/lighthouse_worker.ts +1 -1
  19. package/front_end/entrypoints/main/MainImpl.ts +5 -0
  20. package/front_end/generated/InspectorBackendCommands.js +14 -8
  21. package/front_end/generated/SupportedCSSProperties.js +2 -0
  22. package/front_end/generated/protocol-mapping.d.ts +5 -0
  23. package/front_end/generated/protocol-proxy-api.d.ts +5 -0
  24. package/front_end/generated/protocol.ts +20 -12
  25. package/front_end/models/bindings/BreakpointManager.ts +7 -5
  26. package/front_end/models/bindings/CSSWorkspaceBinding.ts +2 -16
  27. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +2 -1
  28. package/front_end/models/bindings/ResourceMapping.ts +2 -1
  29. package/front_end/models/bindings/ResourceScriptMapping.ts +2 -1
  30. package/front_end/models/bindings/SASSSourceMapping.ts +4 -3
  31. package/front_end/models/bindings/StylesSourceMapping.ts +2 -1
  32. package/front_end/models/har/HARFormat.ts +4 -2
  33. package/front_end/models/har/Importer.ts +0 -1
  34. package/front_end/models/issues_manager/FederatedAuthRequestIssue.ts +12 -12
  35. package/front_end/models/issues_manager/descriptions/{federatedAuthRequestClientIdMetadataHttpNotFound.md → federatedAuthRequestClientMetadataHttpNotFound.md} +0 -0
  36. package/front_end/models/issues_manager/descriptions/{federatedAuthRequestClientIdMetadataInvalidResponse.md → federatedAuthRequestClientMetadataInvalidResponse.md} +0 -0
  37. package/front_end/models/issues_manager/descriptions/{federatedAuthRequestClientIdMetadataNoResponse.md → federatedAuthRequestClientMetadataNoResponse.md} +0 -0
  38. package/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -0
  39. package/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -0
  40. package/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestNoResponse.md +1 -0
  41. package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +5 -5
  42. package/front_end/models/persistence/IsolatedFileSystem.ts +10 -13
  43. package/front_end/models/persistence/PersistenceActions.ts +1 -4
  44. package/front_end/models/persistence/PlatformFileSystem.ts +3 -3
  45. package/front_end/{panels/sources/SourceMapNamesResolver.ts → models/source_map_scopes/NamesResolver.ts} +5 -5
  46. package/front_end/models/source_map_scopes/source_map_scopes.ts +7 -0
  47. package/front_end/models/text_utils/ContentProvider.ts +2 -1
  48. package/front_end/models/text_utils/StaticContentProvider.ts +7 -5
  49. package/front_end/models/workspace/UISourceCode.ts +7 -7
  50. package/front_end/models/workspace/WorkspaceImpl.ts +1 -3
  51. package/front_end/models/workspace_diff/WorkspaceDiff.ts +20 -8
  52. package/front_end/panels/application/ServiceWorkerCacheViews.ts +3 -2
  53. package/front_end/panels/changes/ChangesView.ts +4 -4
  54. package/front_end/panels/console/ConsolePrompt.ts +25 -2
  55. package/front_end/panels/console/ConsoleViewMessage.ts +41 -8
  56. package/front_end/panels/coverage/CoverageModel.ts +1 -1
  57. package/front_end/panels/elements/ElementsTreeElement.ts +0 -6
  58. package/front_end/panels/elements/StylesSidebarPane.ts +43 -33
  59. package/front_end/panels/elements/components/LayoutPane.ts +1 -1
  60. package/front_end/panels/issues/AffectedResourcesView.ts +1 -1
  61. package/front_end/panels/issues/AffectedSourcesView.ts +1 -1
  62. package/front_end/panels/lighthouse/LighthouseController.ts +13 -2
  63. package/front_end/panels/lighthouse/LighthousePanel.ts +57 -8
  64. package/front_end/panels/lighthouse/LighthouseProtocolService.ts +94 -30
  65. package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +0 -5
  66. package/front_end/panels/lighthouse/LighthouseStartView.ts +6 -2
  67. package/front_end/panels/lighthouse/LighthouseStartViewFR.ts +61 -0
  68. package/front_end/panels/lighthouse/LighthouseTimespanView.ts +99 -0
  69. package/front_end/panels/network/NetworkDataGridNode.ts +1 -1
  70. package/front_end/panels/profiler/CPUProfileView.ts +1 -1
  71. package/front_end/panels/profiler/HeapProfileView.ts +0 -2
  72. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +0 -1
  73. package/front_end/panels/profiler/HeapSnapshotView.ts +2 -3
  74. package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +1 -1
  75. package/front_end/panels/sources/DebuggerPlugin.ts +5 -4
  76. package/front_end/panels/sources/NavigatorView.ts +5 -5
  77. package/front_end/panels/sources/ScopeChainSidebarPane.ts +6 -3
  78. package/front_end/panels/sources/SourcesNavigator.ts +7 -1
  79. package/front_end/panels/sources/sources-legacy.ts +5 -3
  80. package/front_end/panels/sources/sources.ts +0 -2
  81. package/front_end/panels/timeline/TimelineUIUtils.ts +4 -47
  82. package/front_end/third_party/codemirror.next/bundle.ts +1 -1
  83. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  84. package/front_end/third_party/codemirror.next/chunk/json.js +2 -1
  85. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +28 -2
  86. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
  87. package/front_end/third_party/codemirror.next/package.json +10 -10
  88. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1047 -1158
  89. package/front_end/third_party/lighthouse/locales/en-US.json +7 -1
  90. package/front_end/third_party/lighthouse/locales/en-XL.json +7 -1
  91. package/front_end/third_party/lighthouse/report/bundle.d.ts +0 -3
  92. package/front_end/third_party/lighthouse/report/bundle.js +38 -24
  93. package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
  94. package/front_end/ui/components/expandable_list/expandableList.css +1 -1
  95. package/front_end/ui/components/text_editor/config.ts +1 -0
  96. package/front_end/ui/legacy/ViewManager.ts +2 -1
  97. package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +7 -4
  98. package/front_end/ui/legacy/components/source_frame/FontView.ts +1 -1
  99. package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -1
  100. package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +2 -3
  101. package/front_end/ui/legacy/components/utils/Linkifier.ts +20 -59
  102. package/front_end/ui/legacy/tabbedPane.css +1 -0
  103. package/package.json +1 -1
  104. package/scripts/hosted_mode/server.js +13 -0
  105. package/front_end/models/issues_manager/descriptions/federatedAuthRequestWellKnownHttpNotFound.md +0 -1
  106. package/front_end/models/issues_manager/descriptions/federatedAuthRequestWellKnownInvalidResponse.md +0 -1
  107. package/front_end/models/issues_manager/descriptions/federatedAuthRequestWellKnownNoResponse.md +0 -1
@@ -42,8 +42,8 @@ import type {ResourceTreeFrame, ResourceTreeModel} from './ResourceTreeModel.js'
42
42
  export class Resource implements TextUtils.ContentProvider.ContentProvider {
43
43
  readonly #resourceTreeModel: ResourceTreeModel;
44
44
  #requestInternal: NetworkRequest|null;
45
- #urlInternal!: string;
46
- readonly #documentURLInternal: string;
45
+ #urlInternal!: Platform.DevToolsPath.UrlString;
46
+ readonly #documentURLInternal: Platform.DevToolsPath.UrlString;
47
47
  readonly #frameIdInternal: Protocol.Page.FrameId|null;
48
48
  readonly #loaderIdInternal: Protocol.Network.LoaderId|null;
49
49
  readonly #type: Common.ResourceType.ResourceType;
@@ -58,9 +58,10 @@ export class Resource implements TextUtils.ContentProvider.ContentProvider {
58
58
  #contentRequested?: boolean;
59
59
 
60
60
  constructor(
61
- resourceTreeModel: ResourceTreeModel, request: NetworkRequest|null, url: string, documentURL: string,
62
- frameId: Protocol.Page.FrameId|null, loaderId: Protocol.Network.LoaderId|null,
63
- type: Common.ResourceType.ResourceType, mimeType: string, lastModified: Date|null, contentSize: number|null) {
61
+ resourceTreeModel: ResourceTreeModel, request: NetworkRequest|null, url: Platform.DevToolsPath.UrlString,
62
+ documentURL: Platform.DevToolsPath.UrlString, frameId: Protocol.Page.FrameId|null,
63
+ loaderId: Protocol.Network.LoaderId|null, type: Common.ResourceType.ResourceType, mimeType: string,
64
+ lastModified: Date|null, contentSize: number|null) {
64
65
  this.#resourceTreeModel = resourceTreeModel;
65
66
  this.#requestInternal = request;
66
67
  this.url = url;
@@ -101,11 +102,11 @@ export class Resource implements TextUtils.ContentProvider.ContentProvider {
101
102
  return this.#requestInternal;
102
103
  }
103
104
 
104
- get url(): string {
105
+ get url(): Platform.DevToolsPath.UrlString {
105
106
  return this.#urlInternal;
106
107
  }
107
108
 
108
- set url(x: string) {
109
+ set url(x: Platform.DevToolsPath.UrlString) {
109
110
  this.#urlInternal = x;
110
111
  this.#parsedURLInternal = new Common.ParsedURL.ParsedURL(x);
111
112
  }
@@ -114,7 +115,7 @@ export class Resource implements TextUtils.ContentProvider.ContentProvider {
114
115
  return this.#parsedURLInternal;
115
116
  }
116
117
 
117
- get documentURL(): string {
118
+ get documentURL(): Platform.DevToolsPath.UrlString {
118
119
  return this.#documentURLInternal;
119
120
  }
120
121
 
@@ -150,8 +151,7 @@ export class Resource implements TextUtils.ContentProvider.ContentProvider {
150
151
  this.#isGeneratedInternal = val;
151
152
  }
152
153
 
153
- // TODO(crbug.com/1253323): Cast to RawPathString will be removed when migration to branded types is complete.
154
- contentURL(): string {
154
+ contentURL(): Platform.DevToolsPath.UrlString {
155
155
  return this.#urlInternal;
156
156
  }
157
157
 
@@ -34,6 +34,7 @@
34
34
 
35
35
  import * as Common from '../common/common.js';
36
36
  import * as i18n from '../i18n/i18n.js';
37
+ import type * as Platform from '../platform/platform.js';
37
38
  import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
38
39
  import * as Protocol from '../../generated/protocol.js';
39
40
 
@@ -237,8 +238,8 @@ export class ResourceTreeModel extends SDKModel<EventTypes> {
237
238
  const frame = this.framesInternal.get(framePayload.id);
238
239
  if (frame && !frame.getResourcesMap().get(framePayload.url)) {
239
240
  const frameResource = this.createResourceFromFramePayload(
240
- framePayload, framePayload.url, Common.ResourceType.resourceTypes.Document, framePayload.mimeType, null,
241
- null);
241
+ framePayload, framePayload.url as Platform.DevToolsPath.UrlString, Common.ResourceType.resourceTypes.Document,
242
+ framePayload.mimeType, null, null);
242
243
  frameResource.isGenerated = true;
243
244
  frame.addResource(frameResource);
244
245
  }
@@ -342,25 +343,27 @@ export class ResourceTreeModel extends SDKModel<EventTypes> {
342
343
  for (let i = 0; i < frameTreePayload.resources.length; ++i) {
343
344
  const subresource = frameTreePayload.resources[i];
344
345
  const resource = this.createResourceFromFramePayload(
345
- framePayload, subresource.url, Common.ResourceType.resourceTypes[subresource.type], subresource.mimeType,
346
- subresource.lastModified || null, subresource.contentSize || null);
346
+ framePayload, subresource.url as Platform.DevToolsPath.UrlString,
347
+ Common.ResourceType.resourceTypes[subresource.type], subresource.mimeType, subresource.lastModified || null,
348
+ subresource.contentSize || null);
347
349
  frame.addResource(resource);
348
350
  }
349
351
 
350
352
  if (!frame.getResourcesMap().get(framePayload.url)) {
351
353
  const frameResource = this.createResourceFromFramePayload(
352
- framePayload, framePayload.url, Common.ResourceType.resourceTypes.Document, framePayload.mimeType, null,
353
- null);
354
+ framePayload, framePayload.url as Platform.DevToolsPath.UrlString, Common.ResourceType.resourceTypes.Document,
355
+ framePayload.mimeType, null, null);
354
356
  frame.addResource(frameResource);
355
357
  }
356
358
  }
357
359
 
358
360
  private createResourceFromFramePayload(
359
- frame: Protocol.Page.Frame, url: string, type: Common.ResourceType.ResourceType, mimeType: string,
360
- lastModifiedTime: number|null, contentSize: number|null): Resource {
361
+ frame: Protocol.Page.Frame, url: Platform.DevToolsPath.UrlString, type: Common.ResourceType.ResourceType,
362
+ mimeType: string, lastModifiedTime: number|null, contentSize: number|null): Resource {
361
363
  const lastModified = typeof lastModifiedTime === 'number' ? new Date(lastModifiedTime * 1000) : null;
362
364
  return new Resource(
363
- this, null, url, frame.url, frame.id, frame.loaderId, type, mimeType, lastModified, contentSize);
365
+ this, null, url, frame.url as Platform.DevToolsPath.UrlString, frame.id, frame.loaderId, type, mimeType,
366
+ lastModified, contentSize);
364
367
  }
365
368
 
366
369
  suspendReload(): void {
@@ -601,7 +604,7 @@ export class ResourceTreeFrame {
601
604
  crossTargetParentFrameId: string|null;
602
605
  #loaderIdInternal: string;
603
606
  #nameInternal: string|null|undefined;
604
- #urlInternal: string;
607
+ #urlInternal: Platform.DevToolsPath.UrlString;
605
608
  #domainAndRegistryInternal: string;
606
609
  #securityOriginInternal: string|null;
607
610
  #unreachableUrlInternal: string;
@@ -633,7 +636,7 @@ export class ResourceTreeFrame {
633
636
 
634
637
  this.#loaderIdInternal = (payload && payload.loaderId) || '';
635
638
  this.#nameInternal = payload && payload.name;
636
- this.#urlInternal = (payload && payload.url) || '';
639
+ this.#urlInternal = ((payload && payload.url) || '') as Platform.DevToolsPath.UrlString;
637
640
  this.#domainAndRegistryInternal = (payload && payload.domainAndRegistry) || '';
638
641
  this.#securityOriginInternal = payload && payload.securityOrigin;
639
642
  this.#unreachableUrlInternal = (payload && payload.unreachableUrl) || '';
@@ -685,7 +688,7 @@ export class ResourceTreeFrame {
685
688
  navigate(framePayload: Protocol.Page.Frame): void {
686
689
  this.#loaderIdInternal = framePayload.loaderId;
687
690
  this.#nameInternal = framePayload.name;
688
- this.#urlInternal = framePayload.url;
691
+ this.#urlInternal = framePayload.url as Platform.DevToolsPath.UrlString;
689
692
  this.#domainAndRegistryInternal = framePayload.domainAndRegistry;
690
693
  this.#securityOriginInternal = framePayload.securityOrigin;
691
694
  this.#unreachableUrlInternal = framePayload.unreachableUrl || '';
@@ -719,7 +722,7 @@ export class ResourceTreeFrame {
719
722
  return this.#nameInternal || '';
720
723
  }
721
724
 
722
- get url(): string {
725
+ get url(): Platform.DevToolsPath.UrlString {
723
726
  return this.#urlInternal;
724
727
  }
725
728
 
@@ -29,6 +29,7 @@
29
29
 
30
30
  import * as Protocol from '../../generated/protocol.js';
31
31
  import * as TextUtils from '../../models/text_utils/text_utils.js';
32
+ import type * as Platform from '../../core/platform/platform.js';
32
33
  import * as Common from '../common/common.js';
33
34
  import * as i18n from '../i18n/i18n.js';
34
35
 
@@ -56,7 +57,7 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
56
57
  export class Script implements TextUtils.ContentProvider.ContentProvider, FrameAssociated {
57
58
  debuggerModel: DebuggerModel;
58
59
  scriptId: Protocol.Runtime.ScriptId;
59
- sourceURL: string;
60
+ sourceURL: Platform.DevToolsPath.UrlString;
60
61
  lineOffset: number;
61
62
  columnOffset: number;
62
63
  endLine: number;
@@ -65,7 +66,7 @@ export class Script implements TextUtils.ContentProvider.ContentProvider, FrameA
65
66
  hash: string;
66
67
  readonly #isContentScriptInternal: boolean;
67
68
  readonly #isLiveEditInternal: boolean;
68
- sourceMapURL: string|undefined;
69
+ sourceMapURL: Platform.DevToolsPath.UrlString|undefined;
69
70
  debugSymbols: Protocol.Debugger.DebugSymbols|null;
70
71
  hasSourceURL: boolean;
71
72
  contentLength: number;
@@ -77,12 +78,12 @@ export class Script implements TextUtils.ContentProvider.ContentProvider, FrameA
77
78
  readonly #embedderNameInternal: string|null;
78
79
  readonly isModule: boolean|null;
79
80
  constructor(
80
- debuggerModel: DebuggerModel, scriptId: Protocol.Runtime.ScriptId, sourceURL: string, startLine: number,
81
- startColumn: number, endLine: number, endColumn: number, executionContextId: number, hash: string,
82
- isContentScript: boolean, isLiveEdit: boolean, sourceMapURL: string|undefined, hasSourceURL: boolean,
83
- length: number, isModule: boolean|null, originStackTrace: Protocol.Runtime.StackTrace|null,
84
- codeOffset: number|null, scriptLanguage: string|null, debugSymbols: Protocol.Debugger.DebugSymbols|null,
85
- embedderName: string|null) {
81
+ debuggerModel: DebuggerModel, scriptId: Protocol.Runtime.ScriptId, sourceURL: Platform.DevToolsPath.UrlString,
82
+ startLine: number, startColumn: number, endLine: number, endColumn: number, executionContextId: number,
83
+ hash: string, isContentScript: boolean, isLiveEdit: boolean,
84
+ sourceMapURL: Platform.DevToolsPath.UrlString|undefined, hasSourceURL: boolean, length: number,
85
+ isModule: boolean|null, originStackTrace: Protocol.Runtime.StackTrace|null, codeOffset: number|null,
86
+ scriptLanguage: string|null, debugSymbols: Protocol.Debugger.DebugSymbols|null, embedderName: string|null) {
86
87
  this.debuggerModel = debuggerModel;
87
88
  this.scriptId = scriptId;
88
89
  this.sourceURL = sourceURL;
@@ -163,8 +164,7 @@ export class Script implements TextUtils.ContentProvider.ContentProvider, FrameA
163
164
  return this.#isLiveEditInternal;
164
165
  }
165
166
 
166
- // TODO(crbug.com/1253323): Cast to RawPathString will be removed when migration to branded types is complete.
167
- contentURL(): string {
167
+ contentURL(): Platform.DevToolsPath.UrlString {
168
168
  return this.sourceURL;
169
169
  }
170
170
 
@@ -32,6 +32,8 @@
32
32
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
33
  */
34
34
 
35
+ // TODO(crbug.com/1253323): Casts to UrlString will be removed from this file when migration to branded types is complete.
36
+
35
37
  import * as TextUtils from '../../models/text_utils/text_utils.js';
36
38
  import * as Common from '../common/common.js';
37
39
  import * as i18n from '../i18n/i18n.js';
@@ -143,7 +145,7 @@ export class TextSourceMap implements SourceMap {
143
145
  readonly #sourceMappingURL: string;
144
146
  readonly #baseURL: string;
145
147
  #mappingsInternal: SourceMapEntry[]|null;
146
- readonly #sourceInfos: Map<string, TextSourceMap.SourceInfo>;
148
+ readonly #sourceInfos: Map<Platform.DevToolsPath.UrlString, TextSourceMap.SourceInfo>;
147
149
 
148
150
  /**
149
151
  * Implements Source Map V3 model. See https://github.com/google/closure-compiler/wiki/Source-Maps
@@ -201,11 +203,11 @@ export class TextSourceMap implements SourceMap {
201
203
  return this.#sourceMappingURL;
202
204
  }
203
205
 
204
- sourceURLs(): string[] {
206
+ sourceURLs(): Platform.DevToolsPath.UrlString[] {
205
207
  return [...this.#sourceInfos.keys()];
206
208
  }
207
209
 
208
- sourceContentProvider(sourceURL: string, contentType: Common.ResourceType.ResourceType):
210
+ sourceContentProvider(sourceURL: Platform.DevToolsPath.UrlString, contentType: Common.ResourceType.ResourceType):
209
211
  TextUtils.ContentProvider.ContentProvider {
210
212
  const info = this.#sourceInfos.get(sourceURL);
211
213
  if (info && info.content) {
@@ -215,7 +217,7 @@ export class TextSourceMap implements SourceMap {
215
217
  }
216
218
 
217
219
  embeddedContentByURL(sourceURL: string): string|null {
218
- const entry = this.#sourceInfos.get(sourceURL);
220
+ const entry = this.#sourceInfos.get(sourceURL as Platform.DevToolsPath.UrlString);
219
221
  if (!entry) {
220
222
  return null;
221
223
  }
@@ -307,7 +309,7 @@ export class TextSourceMap implements SourceMap {
307
309
  }
308
310
 
309
311
  private reversedMappings(sourceURL: string): number[] {
310
- const info = this.#sourceInfos.get(sourceURL);
312
+ const info = this.#sourceInfos.get(sourceURL as Platform.DevToolsPath.UrlString);
311
313
  if (!info) {
312
314
  return [];
313
315
  }
@@ -371,7 +373,7 @@ export class TextSourceMap implements SourceMap {
371
373
  if (url === this.#compiledURLInternal && source) {
372
374
  url += '? [sm]';
373
375
  }
374
- this.#sourceInfos.set(url, new TextSourceMap.SourceInfo(source || null, null));
376
+ this.#sourceInfos.set(url as Platform.DevToolsPath.UrlString, new TextSourceMap.SourceInfo(source || null, null));
375
377
  sourcesList.push(url);
376
378
  }
377
379
  sourceMapToSourceList.set(sourceMap, sourcesList);
@@ -11,13 +11,17 @@ function disableLoggingForTest(): void {
11
11
  }
12
12
 
13
13
  /**
14
+ * LegacyPort is provided to Lighthouse as the CDP connection in legacyNavigation mode.
15
+ * Its complement is https://github.com/GoogleChrome/lighthouse/blob/v9.3.1/lighthouse-core/gather/connections/raw.js
16
+ * It speaks pure CDP via notifyFrontendViaWorkerMessage
17
+ *
14
18
  * Any message that comes back from Lighthouse has to go via a so-called "port".
15
19
  * This class holds the relevant callbacks that Lighthouse provides and that
16
20
  * can be called in the onmessage callback of the worker, so that the frontend
17
21
  * can communicate to Lighthouse. Lighthouse itself communicates to the frontend
18
22
  * via status updates defined below.
19
23
  */
20
- class LighthousePort {
24
+ class LegacyPort {
21
25
  onMessage?: (message: string) => void;
22
26
  onClose?: () => void;
23
27
  on(eventName: string, callback: (arg?: string) => void): void {
@@ -35,6 +39,10 @@ class LighthousePort {
35
39
  }
36
40
  }
37
41
 
42
+ /**
43
+ * ConnectionProxy is a SDK interface, but the implementation has no knowledge it's a parallelConnection.
44
+ * The CDP traffic is smuggled back and forth by the system described in LighthouseProtocolService
45
+ */
38
46
  class ConnectionProxy implements SDK.Connections.ParallelConnectionInterface {
39
47
  sessionId: string;
40
48
  onMessage: ((arg0: Object) => void)|null;
@@ -73,14 +81,15 @@ class ConnectionProxy implements SDK.Connections.ParallelConnectionInterface {
73
81
  }
74
82
  }
75
83
 
76
- const port = new LighthousePort();
77
- let rawConnection: ConnectionProxy|undefined;
84
+ const legacyPort = new LegacyPort();
85
+ let cdpConnection: ConnectionProxy|undefined;
86
+ let endTimespan: (() => unknown)|undefined;
78
87
 
79
88
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
80
- async function start(method: string, params: any): Promise<unknown> {
89
+ async function invokeLH(action: string, args: any): Promise<unknown> {
81
90
  if (Root.Runtime.Runtime.queryParam('isUnderTest')) {
82
91
  disableLoggingForTest();
83
- params.flags.maxWaitForLoad = 2 * 1000;
92
+ args.flags.maxWaitForLoad = 2 * 1000;
84
93
  }
85
94
 
86
95
  // @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
@@ -92,44 +101,55 @@ async function start(method: string, params: any): Promise<unknown> {
92
101
  undefined;
93
102
 
94
103
  try {
95
- const locale = await fetchLocaleData(params.locales);
96
- const flags = params.flags;
104
+ // For timespan we only need to perform setup on startTimespan.
105
+ // Config, flags, locale, etc. should be stored in the closure of endTimespan.
106
+ if (action === 'endTimespan') {
107
+ if (!endTimespan) {
108
+ throw new Error('Cannot end a timespan before starting one');
109
+ }
110
+ const result = await endTimespan();
111
+ endTimespan = undefined;
112
+ return result;
113
+ }
114
+
115
+ const locale = await fetchLocaleData(args.locales);
116
+ const flags = args.flags;
97
117
  flags.logLevel = flags.logLevel || 'info';
98
118
  flags.channel = 'devtools';
99
119
  flags.locale = locale;
100
120
 
101
121
  // @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
102
- const config = self.createConfig(params.categoryIDs, flags.emulatedFormFactor);
103
- const url = params.url;
122
+ const config = self.createConfig(args.categoryIDs, flags.emulatedFormFactor);
123
+ const url = args.url;
104
124
 
105
125
  // Handle legacy Lighthouse runner path.
106
- if (method === 'legacyNavigation') {
126
+ if (action === 'navigation' && flags.legacyNavigation) {
107
127
  // @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
108
- const connection = self.setUpWorkerConnection(port);
128
+ const connection = self.setUpWorkerConnection(legacyPort);
109
129
  // @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
110
130
  return await self.runLighthouse(url, flags, config, connection);
111
131
  }
112
132
 
113
- const {mainTargetId, mainFrameId, mainSessionId} = params.target;
114
- rawConnection = new ConnectionProxy(mainSessionId);
133
+ const {mainTargetId, mainFrameId, mainSessionId} = args.target;
134
+ cdpConnection = new ConnectionProxy(mainSessionId);
115
135
  puppeteerConnection =
116
- await Puppeteer.PuppeteerConnection.getPuppeteerConnection(rawConnection, mainFrameId, mainTargetId);
136
+ await Puppeteer.PuppeteerConnection.getPuppeteerConnection(cdpConnection, mainFrameId, mainTargetId);
137
+ const {page} = puppeteerConnection;
117
138
 
118
- if (method === 'snapshot') {
139
+ if (action === 'snapshot') {
119
140
  // @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
120
- return await self.runLighthouseSnapshot({
121
- url,
122
- config,
123
- page: puppeteerConnection.page,
124
- });
141
+ return await self.runLighthouseSnapshot({config, page});
142
+ }
143
+
144
+ if (action === 'startTimespan') {
145
+ // @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
146
+ const timespan = await self.startLighthouseTimespan({config, page});
147
+ endTimespan = timespan.endTimespan;
148
+ return;
125
149
  }
126
150
 
127
151
  // @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
128
- return await self.runLighthouseNavigation({
129
- url,
130
- config,
131
- page: puppeteerConnection.page,
132
- });
152
+ return await self.runLighthouseNavigation(url, {config, page});
133
153
  } catch (err) {
134
154
  return ({
135
155
  fatal: true,
@@ -137,7 +157,10 @@ async function start(method: string, params: any): Promise<unknown> {
137
157
  stack: err.stack,
138
158
  });
139
159
  } finally {
140
- puppeteerConnection?.browser.disconnect();
160
+ // endTimespan will need to use the same connection as startTimespan.
161
+ if (action !== 'startTimespan') {
162
+ puppeteerConnection?.browser.disconnect();
163
+ }
141
164
  }
142
165
  }
143
166
 
@@ -178,34 +201,42 @@ async function fetchLocaleData(locales: string[]): Promise<string|void> {
178
201
  return;
179
202
  }
180
203
 
204
+ /**
205
+ * `notifyFrontendViaWorkerMessage` and `onFrontendMessage` work with the FE's ProtocolService.
206
+ *
207
+ * onFrontendMessage takes action-wrapped messages and either invoking lighthouse or delivering it CDP traffic.
208
+ * notifyFrontendViaWorkerMessage posts action-wrapped messages to the FE.
209
+ */
181
210
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
182
- function notifyFrontendViaWorkerMessage(method: string, params: any): void {
183
- self.postMessage(JSON.stringify({method, params}));
211
+ function notifyFrontendViaWorkerMessage(action: string, args: any): void {
212
+ self.postMessage(JSON.stringify({action, args}));
184
213
  }
185
214
 
186
- self.onmessage = async(event: MessageEvent): Promise<void> => {
215
+ async function onFrontendMessage(event: MessageEvent): Promise<void> {
187
216
  const messageFromFrontend = JSON.parse(event.data);
188
- switch (messageFromFrontend.method) {
189
- case 'navigation':
190
- case 'timespan':
217
+ switch (messageFromFrontend.action) {
218
+ case 'startTimespan':
219
+ case 'endTimespan':
191
220
  case 'snapshot':
192
- case 'legacyNavigation': {
193
- const result = await start(messageFromFrontend.method, messageFromFrontend.params);
221
+ case 'navigation': {
222
+ const result = await invokeLH(messageFromFrontend.action, messageFromFrontend.args);
194
223
  self.postMessage(JSON.stringify({id: messageFromFrontend.id, result}));
195
224
  break;
196
225
  }
197
226
  case 'dispatchProtocolMessage': {
198
- rawConnection?.onMessage?.(
199
- JSON.parse(messageFromFrontend.params.message),
227
+ cdpConnection?.onMessage?.(
228
+ JSON.parse(messageFromFrontend.args.message),
200
229
  );
201
- port.onMessage?.(messageFromFrontend.params.message);
230
+ legacyPort.onMessage?.(messageFromFrontend.args.message);
202
231
  break;
203
232
  }
204
233
  default: {
205
234
  throw new Error(`Unknown event: ${event.data}`);
206
235
  }
207
236
  }
208
- };
237
+ }
238
+
239
+ self.onmessage = onFrontendMessage;
209
240
 
210
241
  // Make lighthouse and traceviewer happy.
211
242
  // @ts-ignore https://github.com/GoogleChrome/lighthouse/issues/11628
@@ -2,7 +2,7 @@
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 './LighthouseService.js';
5
+ import './LighthouseWorkerService.js';
6
6
  import '../../third_party/lighthouse/lighthouse-dt-bundle.js';
7
7
 
8
8
  self.postMessage('workerReady');
@@ -309,9 +309,14 @@ export class MainImpl {
309
309
  'timelineV8RuntimeCallStats', 'Timeline: V8 Runtime Call Stats on Timeline', true);
310
310
  Root.Runtime.experiments.register('timelineWebGL', 'Timeline: WebGL-based flamechart');
311
311
  Root.Runtime.experiments.register('timelineReplayEvent', 'Timeline: Replay input events', true);
312
+
313
+ // Debugging
312
314
  Root.Runtime.experiments.register(
313
315
  'wasmDWARFDebugging', 'WebAssembly Debugging: Enable DWARF support', undefined,
314
316
  'https://developer.chrome.com/blog/wasm-debugging-2020/');
317
+ Root.Runtime.experiments.register(
318
+ 'evaluateExpressionsWithSourceMaps', 'Console: Resolve variable names in expressions using source maps',
319
+ undefined);
315
320
 
316
321
  // Dual-screen
317
322
  Root.Runtime.experiments.register(
@@ -285,12 +285,12 @@ export function registerCommands(inspectorBackend) {
285
285
  inspectorBackend.registerEnum('Audits.FederatedAuthRequestIssueReason', {
286
286
  ApprovalDeclined: 'ApprovalDeclined',
287
287
  TooManyRequests: 'TooManyRequests',
288
- WellKnownHttpNotFound: 'WellKnownHttpNotFound',
289
- WellKnownNoResponse: 'WellKnownNoResponse',
290
- WellKnownInvalidResponse: 'WellKnownInvalidResponse',
291
- ClientIdMetadataHttpNotFound: 'ClientIdMetadataHttpNotFound',
292
- ClientIdMetadataNoResponse: 'ClientIdMetadataNoResponse',
293
- ClientIdMetadataInvalidResponse: 'ClientIdMetadataInvalidResponse',
288
+ ManifestHttpNotFound: 'ManifestHttpNotFound',
289
+ ManifestNoResponse: 'ManifestNoResponse',
290
+ ManifestInvalidResponse: 'ManifestInvalidResponse',
291
+ ClientMetadataHttpNotFound: 'ClientMetadataHttpNotFound',
292
+ ClientMetadataNoResponse: 'ClientMetadataNoResponse',
293
+ ClientMetadataInvalidResponse: 'ClientMetadataInvalidResponse',
294
294
  ErrorFetchingSignin: 'ErrorFetchingSignin',
295
295
  InvalidSigninResponse: 'InvalidSigninResponse',
296
296
  AccountsHttpNotFound: 'AccountsHttpNotFound',
@@ -552,6 +552,13 @@ export function registerCommands(inspectorBackend) {
552
552
  {'name': 'range', 'type': 'object', 'optional': false}, {'name': 'text', 'type': 'string', 'optional': false}
553
553
  ],
554
554
  ['containerQuery']);
555
+ inspectorBackend.registerCommand(
556
+ 'CSS.setSupportsText',
557
+ [
558
+ {'name': 'styleSheetId', 'type': 'string', 'optional': false},
559
+ {'name': 'range', 'type': 'object', 'optional': false}, {'name': 'text', 'type': 'string', 'optional': false}
560
+ ],
561
+ ['supports']);
555
562
  inspectorBackend.registerCommand(
556
563
  'CSS.setRuleSelector',
557
564
  [
@@ -1124,7 +1131,6 @@ export function registerCommands(inspectorBackend) {
1124
1131
  [
1125
1132
  {'name': 'policy', 'type': 'string', 'optional': false}, {'name': 'budget', 'type': 'number', 'optional': true},
1126
1133
  {'name': 'maxVirtualTimeTaskStarvationCount', 'type': 'number', 'optional': true},
1127
- {'name': 'waitForNavigation', 'type': 'boolean', 'optional': true},
1128
1134
  {'name': 'initialVirtualTime', 'type': 'number', 'optional': true}
1129
1135
  ],
1130
1136
  ['virtualTimeTicksBase']);
@@ -2033,6 +2039,7 @@ export function registerCommands(inspectorBackend) {
2033
2039
  ChViewportHeight: 'ch-viewport-height',
2034
2040
  ChViewportWidth: 'ch-viewport-width',
2035
2041
  ChWidth: 'ch-width',
2042
+ ChPartitionedCookies: 'ch-partitioned-cookies',
2036
2043
  ClipboardRead: 'clipboard-read',
2037
2044
  ClipboardWrite: 'clipboard-write',
2038
2045
  CrossOriginIsolated: 'cross-origin-isolated',
@@ -2050,7 +2057,6 @@ export function registerCommands(inspectorBackend) {
2050
2057
  Gyroscope: 'gyroscope',
2051
2058
  Hid: 'hid',
2052
2059
  IdleDetection: 'idle-detection',
2053
- InterestCohort: 'interest-cohort',
2054
2060
  JoinAdInterestGroup: 'join-ad-interest-group',
2055
2061
  KeyboardMap: 'keyboard-map',
2056
2062
  Magnetometer: 'magnetometer',
@@ -152,6 +152,7 @@ export const generatedProperties = [
152
152
  {'name': 'background-repeat-x'},
153
153
  {'name': 'background-repeat-y'},
154
154
  {'name': 'background-size', 'keywords': ['auto', 'cover', 'contain']},
155
+ {'name': 'base-palette'},
155
156
  {'name': 'baseline-shift', 'keywords': ['baseline', 'sub', 'super']},
156
157
  {'name': 'block-size', 'keywords': ['auto']},
157
158
  {
@@ -619,6 +620,7 @@ export const generatedProperties = [
619
620
  {'name': 'overflow-wrap', 'inherited': true, 'keywords': ['normal', 'break-word', 'anywhere']},
620
621
  {'name': 'overflow-x', 'keywords': ['visible', 'hidden', 'scroll', 'auto', 'overlay', 'clip']},
621
622
  {'name': 'overflow-y', 'keywords': ['visible', 'hidden', 'scroll', 'auto', 'overlay', 'clip']},
623
+ {'name': 'override-colors'},
622
624
  {'longhands': ['overscroll-behavior-x', 'overscroll-behavior-y'], 'name': 'overscroll-behavior'},
623
625
  {'name': 'overscroll-behavior-block'},
624
626
  {'name': 'overscroll-behavior-inline'},
@@ -1011,6 +1011,11 @@ export namespace ProtocolMapping {
1011
1011
  'CSS.setContainerQueryText': {
1012
1012
  paramsType: [Protocol.CSS.SetContainerQueryTextRequest]; returnType: Protocol.CSS.SetContainerQueryTextResponse;
1013
1013
  };
1014
+ /**
1015
+ * Modifies the expression of a supports at-rule.
1016
+ */
1017
+ 'CSS.setSupportsText':
1018
+ {paramsType: [Protocol.CSS.SetSupportsTextRequest]; returnType: Protocol.CSS.SetSupportsTextResponse;};
1014
1019
  /**
1015
1020
  * Modifies the rule selector.
1016
1021
  */
@@ -631,6 +631,11 @@ declare namespace ProtocolProxyApi {
631
631
  invoke_setContainerQueryText(params: Protocol.CSS.SetContainerQueryTextRequest):
632
632
  Promise<Protocol.CSS.SetContainerQueryTextResponse>;
633
633
 
634
+ /**
635
+ * Modifies the expression of a supports at-rule.
636
+ */
637
+ invoke_setSupportsText(params: Protocol.CSS.SetSupportsTextRequest): Promise<Protocol.CSS.SetSupportsTextResponse>;
638
+
634
639
  /**
635
640
  * Modifies the rule selector.
636
641
  */
@@ -1065,12 +1065,12 @@ export namespace Audits {
1065
1065
  export const enum FederatedAuthRequestIssueReason {
1066
1066
  ApprovalDeclined = 'ApprovalDeclined',
1067
1067
  TooManyRequests = 'TooManyRequests',
1068
- WellKnownHttpNotFound = 'WellKnownHttpNotFound',
1069
- WellKnownNoResponse = 'WellKnownNoResponse',
1070
- WellKnownInvalidResponse = 'WellKnownInvalidResponse',
1071
- ClientIdMetadataHttpNotFound = 'ClientIdMetadataHttpNotFound',
1072
- ClientIdMetadataNoResponse = 'ClientIdMetadataNoResponse',
1073
- ClientIdMetadataInvalidResponse = 'ClientIdMetadataInvalidResponse',
1068
+ ManifestHttpNotFound = 'ManifestHttpNotFound',
1069
+ ManifestNoResponse = 'ManifestNoResponse',
1070
+ ManifestInvalidResponse = 'ManifestInvalidResponse',
1071
+ ClientMetadataHttpNotFound = 'ClientMetadataHttpNotFound',
1072
+ ClientMetadataNoResponse = 'ClientMetadataNoResponse',
1073
+ ClientMetadataInvalidResponse = 'ClientMetadataInvalidResponse',
1074
1074
  ErrorFetchingSignin = 'ErrorFetchingSignin',
1075
1075
  InvalidSigninResponse = 'InvalidSigninResponse',
1076
1076
  AccountsHttpNotFound = 'AccountsHttpNotFound',
@@ -2554,6 +2554,19 @@ export namespace CSS {
2554
2554
  containerQuery: CSSContainerQuery;
2555
2555
  }
2556
2556
 
2557
+ export interface SetSupportsTextRequest {
2558
+ styleSheetId: StyleSheetId;
2559
+ range: SourceRange;
2560
+ text: string;
2561
+ }
2562
+
2563
+ export interface SetSupportsTextResponse extends ProtocolResponseWithError {
2564
+ /**
2565
+ * The resulting CSS Supports rule after modification.
2566
+ */
2567
+ supports: CSSSupports;
2568
+ }
2569
+
2557
2570
  export interface SetRuleSelectorRequest {
2558
2571
  styleSheetId: StyleSheetId;
2559
2572
  range: SourceRange;
@@ -5273,11 +5286,6 @@ export namespace Emulation {
5273
5286
  * forwards to prevent deadlock.
5274
5287
  */
5275
5288
  maxVirtualTimeTaskStarvationCount?: integer;
5276
- /**
5277
- * If set the virtual time policy change should be deferred until any frame starts navigating.
5278
- * Note any previous deferred policy change is superseded.
5279
- */
5280
- waitForNavigation?: boolean;
5281
5289
  /**
5282
5290
  * If set, base::Time::Now will be overridden to initially return this value.
5283
5291
  */
@@ -10052,6 +10060,7 @@ export namespace Page {
10052
10060
  ChViewportHeight = 'ch-viewport-height',
10053
10061
  ChViewportWidth = 'ch-viewport-width',
10054
10062
  ChWidth = 'ch-width',
10063
+ ChPartitionedCookies = 'ch-partitioned-cookies',
10055
10064
  ClipboardRead = 'clipboard-read',
10056
10065
  ClipboardWrite = 'clipboard-write',
10057
10066
  CrossOriginIsolated = 'cross-origin-isolated',
@@ -10069,7 +10078,6 @@ export namespace Page {
10069
10078
  Gyroscope = 'gyroscope',
10070
10079
  Hid = 'hid',
10071
10080
  IdleDetection = 'idle-detection',
10072
- InterestCohort = 'interest-cohort',
10073
10081
  JoinAdInterestGroup = 'join-ad-interest-group',
10074
10082
  KeyboardMap = 'keyboard-map',
10075
10083
  Magnetometer = 'magnetometer',