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.
- package/config/gni/devtools_grd_files.gni +10 -8
- package/front_end/core/common/ParsedURL.ts +9 -3
- package/front_end/core/host/UserMetrics.ts +2 -1
- package/front_end/core/i18n/locales/en-US.json +24 -0
- package/front_end/core/i18n/locales/en-XL.json +24 -0
- package/front_end/core/sdk/CSSModel.ts +21 -0
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +10 -10
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +6 -4
- package/front_end/core/sdk/DOMDebuggerModel.ts +4 -3
- package/front_end/core/sdk/DebuggerModel.ts +17 -16
- package/front_end/core/sdk/NetworkManager.ts +17 -9
- package/front_end/core/sdk/NetworkRequest.ts +18 -16
- package/front_end/core/sdk/Resource.ts +10 -10
- package/front_end/core/sdk/ResourceTreeModel.ts +16 -13
- package/front_end/core/sdk/Script.ts +10 -10
- package/front_end/core/sdk/SourceMap.ts +8 -6
- package/front_end/entrypoints/lighthouse_worker/{LighthouseService.ts → LighthouseWorkerService.ts} +69 -38
- package/front_end/entrypoints/lighthouse_worker/lighthouse_worker.ts +1 -1
- package/front_end/entrypoints/main/MainImpl.ts +5 -0
- package/front_end/generated/InspectorBackendCommands.js +14 -8
- package/front_end/generated/SupportedCSSProperties.js +2 -0
- package/front_end/generated/protocol-mapping.d.ts +5 -0
- package/front_end/generated/protocol-proxy-api.d.ts +5 -0
- package/front_end/generated/protocol.ts +20 -12
- package/front_end/models/bindings/BreakpointManager.ts +7 -5
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +2 -16
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +2 -1
- package/front_end/models/bindings/ResourceMapping.ts +2 -1
- package/front_end/models/bindings/ResourceScriptMapping.ts +2 -1
- package/front_end/models/bindings/SASSSourceMapping.ts +4 -3
- package/front_end/models/bindings/StylesSourceMapping.ts +2 -1
- package/front_end/models/har/HARFormat.ts +4 -2
- package/front_end/models/har/Importer.ts +0 -1
- package/front_end/models/issues_manager/FederatedAuthRequestIssue.ts +12 -12
- package/front_end/models/issues_manager/descriptions/{federatedAuthRequestClientIdMetadataHttpNotFound.md → federatedAuthRequestClientMetadataHttpNotFound.md} +0 -0
- package/front_end/models/issues_manager/descriptions/{federatedAuthRequestClientIdMetadataInvalidResponse.md → federatedAuthRequestClientMetadataInvalidResponse.md} +0 -0
- package/front_end/models/issues_manager/descriptions/{federatedAuthRequestClientIdMetadataNoResponse.md → federatedAuthRequestClientMetadataNoResponse.md} +0 -0
- package/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -0
- package/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -0
- package/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestNoResponse.md +1 -0
- package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +5 -5
- package/front_end/models/persistence/IsolatedFileSystem.ts +10 -13
- package/front_end/models/persistence/PersistenceActions.ts +1 -4
- package/front_end/models/persistence/PlatformFileSystem.ts +3 -3
- package/front_end/{panels/sources/SourceMapNamesResolver.ts → models/source_map_scopes/NamesResolver.ts} +5 -5
- package/front_end/models/source_map_scopes/source_map_scopes.ts +7 -0
- package/front_end/models/text_utils/ContentProvider.ts +2 -1
- package/front_end/models/text_utils/StaticContentProvider.ts +7 -5
- package/front_end/models/workspace/UISourceCode.ts +7 -7
- package/front_end/models/workspace/WorkspaceImpl.ts +1 -3
- package/front_end/models/workspace_diff/WorkspaceDiff.ts +20 -8
- package/front_end/panels/application/ServiceWorkerCacheViews.ts +3 -2
- package/front_end/panels/changes/ChangesView.ts +4 -4
- package/front_end/panels/console/ConsolePrompt.ts +25 -2
- package/front_end/panels/console/ConsoleViewMessage.ts +41 -8
- package/front_end/panels/coverage/CoverageModel.ts +1 -1
- package/front_end/panels/elements/ElementsTreeElement.ts +0 -6
- package/front_end/panels/elements/StylesSidebarPane.ts +43 -33
- package/front_end/panels/elements/components/LayoutPane.ts +1 -1
- package/front_end/panels/issues/AffectedResourcesView.ts +1 -1
- package/front_end/panels/issues/AffectedSourcesView.ts +1 -1
- package/front_end/panels/lighthouse/LighthouseController.ts +13 -2
- package/front_end/panels/lighthouse/LighthousePanel.ts +57 -8
- package/front_end/panels/lighthouse/LighthouseProtocolService.ts +94 -30
- package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +0 -5
- package/front_end/panels/lighthouse/LighthouseStartView.ts +6 -2
- package/front_end/panels/lighthouse/LighthouseStartViewFR.ts +61 -0
- package/front_end/panels/lighthouse/LighthouseTimespanView.ts +99 -0
- package/front_end/panels/network/NetworkDataGridNode.ts +1 -1
- package/front_end/panels/profiler/CPUProfileView.ts +1 -1
- package/front_end/panels/profiler/HeapProfileView.ts +0 -2
- package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +0 -1
- package/front_end/panels/profiler/HeapSnapshotView.ts +2 -3
- package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +1 -1
- package/front_end/panels/sources/DebuggerPlugin.ts +5 -4
- package/front_end/panels/sources/NavigatorView.ts +5 -5
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +6 -3
- package/front_end/panels/sources/SourcesNavigator.ts +7 -1
- package/front_end/panels/sources/sources-legacy.ts +5 -3
- package/front_end/panels/sources/sources.ts +0 -2
- package/front_end/panels/timeline/TimelineUIUtils.ts +4 -47
- package/front_end/third_party/codemirror.next/bundle.ts +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/json.js +2 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +28 -2
- package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +10 -10
- package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1047 -1158
- package/front_end/third_party/lighthouse/locales/en-US.json +7 -1
- package/front_end/third_party/lighthouse/locales/en-XL.json +7 -1
- package/front_end/third_party/lighthouse/report/bundle.d.ts +0 -3
- package/front_end/third_party/lighthouse/report/bundle.js +38 -24
- package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
- package/front_end/ui/components/expandable_list/expandableList.css +1 -1
- package/front_end/ui/components/text_editor/config.ts +1 -0
- package/front_end/ui/legacy/ViewManager.ts +2 -1
- package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +7 -4
- package/front_end/ui/legacy/components/source_frame/FontView.ts +1 -1
- package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -1
- package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +2 -3
- package/front_end/ui/legacy/components/utils/Linkifier.ts +20 -59
- package/front_end/ui/legacy/tabbedPane.css +1 -0
- package/package.json +1 -1
- package/scripts/hosted_mode/server.js +13 -0
- package/front_end/models/issues_manager/descriptions/federatedAuthRequestWellKnownHttpNotFound.md +0 -1
- package/front_end/models/issues_manager/descriptions/federatedAuthRequestWellKnownInvalidResponse.md +0 -1
- 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!:
|
46
|
-
readonly #documentURLInternal:
|
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:
|
62
|
-
|
63
|
-
type: Common.ResourceType.ResourceType, mimeType: string,
|
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():
|
105
|
+
get url(): Platform.DevToolsPath.UrlString {
|
105
106
|
return this.#urlInternal;
|
106
107
|
}
|
107
108
|
|
108
|
-
set url(x:
|
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():
|
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
|
-
|
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,
|
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
|
346
|
-
subresource.
|
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,
|
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:
|
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,
|
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:
|
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():
|
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:
|
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:
|
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:
|
81
|
-
startColumn: number, endLine: number, endColumn: number, executionContextId: number,
|
82
|
-
|
83
|
-
|
84
|
-
|
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
|
-
|
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<
|
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():
|
206
|
+
sourceURLs(): Platform.DevToolsPath.UrlString[] {
|
205
207
|
return [...this.#sourceInfos.keys()];
|
206
208
|
}
|
207
209
|
|
208
|
-
sourceContentProvider(sourceURL:
|
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);
|
package/front_end/entrypoints/lighthouse_worker/{LighthouseService.ts → LighthouseWorkerService.ts}
RENAMED
@@ -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
|
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
|
77
|
-
let
|
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
|
89
|
+
async function invokeLH(action: string, args: any): Promise<unknown> {
|
81
90
|
if (Root.Runtime.Runtime.queryParam('isUnderTest')) {
|
82
91
|
disableLoggingForTest();
|
83
|
-
|
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
|
-
|
96
|
-
|
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(
|
103
|
-
const 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 (
|
126
|
+
if (action === 'navigation' && flags.legacyNavigation) {
|
107
127
|
// @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
|
108
|
-
const connection = self.setUpWorkerConnection(
|
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} =
|
114
|
-
|
133
|
+
const {mainTargetId, mainFrameId, mainSessionId} = args.target;
|
134
|
+
cdpConnection = new ConnectionProxy(mainSessionId);
|
115
135
|
puppeteerConnection =
|
116
|
-
await Puppeteer.PuppeteerConnection.getPuppeteerConnection(
|
136
|
+
await Puppeteer.PuppeteerConnection.getPuppeteerConnection(cdpConnection, mainFrameId, mainTargetId);
|
137
|
+
const {page} = puppeteerConnection;
|
117
138
|
|
118
|
-
if (
|
139
|
+
if (action === 'snapshot') {
|
119
140
|
// @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
|
120
|
-
return await self.runLighthouseSnapshot({
|
121
|
-
|
122
|
-
|
123
|
-
|
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
|
-
|
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(
|
183
|
-
self.postMessage(JSON.stringify({
|
211
|
+
function notifyFrontendViaWorkerMessage(action: string, args: any): void {
|
212
|
+
self.postMessage(JSON.stringify({action, args}));
|
184
213
|
}
|
185
214
|
|
186
|
-
|
215
|
+
async function onFrontendMessage(event: MessageEvent): Promise<void> {
|
187
216
|
const messageFromFrontend = JSON.parse(event.data);
|
188
|
-
switch (messageFromFrontend.
|
189
|
-
case '
|
190
|
-
case '
|
217
|
+
switch (messageFromFrontend.action) {
|
218
|
+
case 'startTimespan':
|
219
|
+
case 'endTimespan':
|
191
220
|
case 'snapshot':
|
192
|
-
case '
|
193
|
-
const result = await
|
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
|
-
|
199
|
-
JSON.parse(messageFromFrontend.
|
227
|
+
cdpConnection?.onMessage?.(
|
228
|
+
JSON.parse(messageFromFrontend.args.message),
|
200
229
|
);
|
201
|
-
|
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 './
|
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
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
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
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
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',
|