chrome-devtools-frontend 1.0.970391 → 1.0.972361
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 +11 -7
- package/config/gni/devtools_image_files.gni +1 -0
- package/front_end/Images/src/ic_changes.svg +5 -0
- package/front_end/core/common/ParsedURL.ts +33 -4
- package/front_end/core/host/UserMetrics.ts +4 -1
- package/front_end/core/i18n/locales/en-US.json +21 -3
- package/front_end/core/i18n/locales/en-XL.json +21 -3
- package/front_end/core/platform/UserVisibleError.ts +28 -0
- package/front_end/core/platform/platform.ts +2 -0
- package/front_end/core/sdk/CSSModel.ts +21 -0
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +10 -10
- package/front_end/core/sdk/ChildTargetManager.ts +0 -1
- 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 +21 -16
- package/front_end/core/sdk/NetworkManager.ts +17 -3
- package/front_end/core/sdk/NetworkRequest.ts +16 -5
- package/front_end/core/sdk/Resource.ts +10 -10
- package/front_end/core/sdk/ResourceTreeModel.ts +18 -13
- package/front_end/core/sdk/Script.ts +10 -10
- package/front_end/core/sdk/SourceMap.ts +3 -1
- package/front_end/entrypoints/lighthouse_worker/LighthouseService.ts +14 -7
- package/front_end/entrypoints/main/MainImpl.ts +8 -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 +10 -3
- 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/StylesSourceMapping.ts +2 -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/Automapping.ts +3 -33
- package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +12 -10
- package/front_end/models/persistence/IsolatedFileSystem.ts +26 -22
- package/front_end/models/persistence/NetworkPersistenceManager.ts +8 -4
- package/front_end/models/persistence/PersistenceActions.ts +1 -4
- package/front_end/models/persistence/PlatformFileSystem.ts +6 -5
- 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 +5 -4
- package/front_end/models/workspace/UISourceCode.ts +18 -21
- package/front_end/models/workspace/WorkspaceImpl.ts +3 -1
- package/front_end/models/workspace_diff/WorkspaceDiff.ts +20 -8
- package/front_end/panels/application/ServiceWorkerCacheViews.ts +1 -1
- package/front_end/panels/browser_debugger/categorizedBreakpointsSidebarPane.css +0 -1
- 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/ElementsPanel.ts +25 -11
- package/front_end/panels/elements/ElementsTreeElement.ts +0 -6
- package/front_end/panels/elements/StylesSidebarPane.ts +236 -51
- package/front_end/panels/elements/elementsTreeOutline.css +0 -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 +30 -0
- package/front_end/panels/lighthouse/LighthousePanel.ts +7 -1
- package/front_end/panels/lighthouse/LighthouseProtocolService.ts +6 -1
- package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +0 -5
- package/front_end/panels/lighthouse/LighthouseStartView.ts +2 -2
- package/front_end/panels/lighthouse/LighthouseStartViewFR.ts +39 -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/sensors/sensors.css +0 -1
- package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +5 -5
- package/front_end/panels/snippets/SnippetsQuickOpen.ts +1 -1
- package/front_end/panels/sources/DebuggerPlugin.ts +5 -4
- package/front_end/panels/sources/NavigatorView.ts +13 -7
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +6 -3
- package/front_end/panels/sources/SourcesNavigator.ts +7 -1
- package/front_end/panels/sources/TabbedEditorContainer.ts +9 -0
- package/front_end/panels/sources/sources-legacy.ts +5 -16
- package/front_end/panels/sources/sources.ts +0 -2
- package/front_end/panels/sources/sourcesView.css +0 -4
- package/front_end/panels/timeline/TimelineUIUtils.ts +4 -47
- 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/legacy/ViewManager.ts +2 -1
- package/front_end/ui/legacy/closeButton.css +0 -1
- 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 +0 -2
- package/front_end/ui/legacy/toolbar.css +28 -3
- package/package.json +1 -1
- package/scripts/hosted_mode/server.js +13 -0
- package/scripts/npm_test.js +1 -1
- 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
@@ -100,8 +100,7 @@ export class CSSWorkspaceBinding implements SDK.TargetManager.SDKModelObserver<S
|
|
100
100
|
return locationPromise;
|
101
101
|
}
|
102
102
|
|
103
|
-
|
104
|
-
|null {
|
103
|
+
propertyRawLocation(cssProperty: SDK.CSSProperty.CSSProperty, forName: boolean): SDK.CSSModel.CSSLocation|null {
|
105
104
|
const style = cssProperty.ownerStyle;
|
106
105
|
if (!style || style.type !== SDK.CSSStyleDeclaration.Type.Regular || !style.styleSheetId) {
|
107
106
|
return null;
|
@@ -118,8 +117,16 @@ export class CSSWorkspaceBinding implements SDK.TargetManager.SDKModelObserver<S
|
|
118
117
|
|
119
118
|
const lineNumber = range.startLine;
|
120
119
|
const columnNumber = range.startColumn;
|
121
|
-
|
120
|
+
return new SDK.CSSModel.CSSLocation(
|
122
121
|
header, header.lineNumberInSource(lineNumber), header.columnNumberInSource(lineNumber, columnNumber));
|
122
|
+
}
|
123
|
+
|
124
|
+
propertyUILocation(cssProperty: SDK.CSSProperty.CSSProperty, forName: boolean): Workspace.UISourceCode.UILocation
|
125
|
+
|null {
|
126
|
+
const rawLocation = this.propertyRawLocation(cssProperty, forName);
|
127
|
+
if (!rawLocation) {
|
128
|
+
return null;
|
129
|
+
}
|
123
130
|
return this.rawLocationToUILocation(rawLocation);
|
124
131
|
}
|
125
132
|
|
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
6
6
|
import * as i18n from '../../core/i18n/i18n.js';
|
7
|
+
import type * as Platform from '../../core/platform/platform.js';
|
7
8
|
import * as SDK from '../../core/sdk/sdk.js';
|
8
9
|
import * as Protocol from '../../generated/protocol.js';
|
9
10
|
import * as Workspace from '../workspace/workspace.js';
|
@@ -1315,7 +1316,7 @@ class ModelData {
|
|
1315
1316
|
this.uiSourceCodeToScripts.set(uiSourceCode, [script]);
|
1316
1317
|
|
1317
1318
|
const contentProvider = new SDK.CompilerSourceMappingContentProvider.CompilerSourceMappingContentProvider(
|
1318
|
-
url, Common.ResourceType.resourceTypes.SourceMapScript, initiator);
|
1319
|
+
url as Platform.DevToolsPath.UrlString, Common.ResourceType.resourceTypes.SourceMapScript, initiator);
|
1319
1320
|
const mimeType = Common.ResourceType.ResourceType.mimeFromURL(url) || 'text/javascript';
|
1320
1321
|
this.project.addUISourceCodeWithProvider(uiSourceCode, contentProvider, null, mimeType);
|
1321
1322
|
} else {
|
@@ -3,6 +3,7 @@
|
|
3
3
|
// found in the LICENSE file.
|
4
4
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
6
|
+
import type * as Platform from '../../core/platform/platform.js';
|
6
7
|
import * as SDK from '../../core/sdk/sdk.js';
|
7
8
|
import * as TextUtils from '../text_utils/text_utils.js';
|
8
9
|
import * as Workspace from '../workspace/workspace.js';
|
@@ -420,7 +421,7 @@ class Binding implements TextUtils.ContentProvider.ContentProvider {
|
|
420
421
|
return this.resources.values().next().value;
|
421
422
|
}
|
422
423
|
|
423
|
-
contentURL():
|
424
|
+
contentURL(): Platform.DevToolsPath.UrlString {
|
424
425
|
return this.firstResource().contentURL();
|
425
426
|
}
|
426
427
|
|
@@ -30,6 +30,7 @@
|
|
30
30
|
|
31
31
|
import * as Common from '../../core/common/common.js';
|
32
32
|
import * as i18n from '../../core/i18n/i18n.js';
|
33
|
+
import type * as Platform from '../../core/platform/platform.js';
|
33
34
|
import * as SDK from '../../core/sdk/sdk.js';
|
34
35
|
import * as Workspace from '../workspace/workspace.js';
|
35
36
|
import type * as Protocol from '../../generated/protocol.js';
|
@@ -411,7 +412,7 @@ export class ResourceScriptFile extends Common.ObjectWrapper.ObjectWrapper<Resou
|
|
411
412
|
Workspace.UISourceCode.Events.WorkingCopyCommitted, this.workingCopyCommitted, this);
|
412
413
|
}
|
413
414
|
|
414
|
-
addSourceMapURL(sourceMapURL:
|
415
|
+
addSourceMapURL(sourceMapURL: Platform.DevToolsPath.UrlString): void {
|
415
416
|
if (!this.scriptInternal) {
|
416
417
|
return;
|
417
418
|
}
|
@@ -29,6 +29,7 @@
|
|
29
29
|
*/
|
30
30
|
|
31
31
|
import * as Common from '../../core/common/common.js';
|
32
|
+
import type * as Platform from '../../core/platform/platform.js';
|
32
33
|
import * as SDK from '../../core/sdk/sdk.js';
|
33
34
|
import type * as TextUtils from '../text_utils/text_utils.js';
|
34
35
|
import * as Workspace from '../workspace/workspace.js';
|
@@ -297,7 +298,7 @@ export class StyleFile implements TextUtils.ContentProvider.ContentProvider {
|
|
297
298
|
Common.EventTarget.removeEventListeners(this.#eventListeners);
|
298
299
|
}
|
299
300
|
|
300
|
-
contentURL():
|
301
|
+
contentURL(): Platform.DevToolsPath.UrlString {
|
301
302
|
console.assert(this.headers.size > 0);
|
302
303
|
return this.headers.values().next().value.originalContentProvider().contentURL();
|
303
304
|
}
|
@@ -93,9 +93,9 @@ const issueDescriptions: Map<Protocol.Audits.FederatedAuthRequestIssueReason, La
|
|
93
93
|
},
|
94
94
|
],
|
95
95
|
[
|
96
|
-
Protocol.Audits.FederatedAuthRequestIssueReason.
|
96
|
+
Protocol.Audits.FederatedAuthRequestIssueReason.ManifestHttpNotFound,
|
97
97
|
{
|
98
|
-
file: '
|
98
|
+
file: 'federatedAuthRequestManifestHttpNotFound.md',
|
99
99
|
links: [{
|
100
100
|
link: 'https://fedidcg.github.io/FedCM/',
|
101
101
|
linkTitle: i18nLazyString(UIStrings.fedCm),
|
@@ -103,9 +103,9 @@ const issueDescriptions: Map<Protocol.Audits.FederatedAuthRequestIssueReason, La
|
|
103
103
|
},
|
104
104
|
],
|
105
105
|
[
|
106
|
-
Protocol.Audits.FederatedAuthRequestIssueReason.
|
106
|
+
Protocol.Audits.FederatedAuthRequestIssueReason.ManifestNoResponse,
|
107
107
|
{
|
108
|
-
file: '
|
108
|
+
file: 'federatedAuthRequestManifestNoResponse.md',
|
109
109
|
links: [{
|
110
110
|
link: 'https://fedidcg.github.io/FedCM/',
|
111
111
|
linkTitle: i18nLazyString(UIStrings.fedCm),
|
@@ -113,9 +113,9 @@ const issueDescriptions: Map<Protocol.Audits.FederatedAuthRequestIssueReason, La
|
|
113
113
|
},
|
114
114
|
],
|
115
115
|
[
|
116
|
-
Protocol.Audits.FederatedAuthRequestIssueReason.
|
116
|
+
Protocol.Audits.FederatedAuthRequestIssueReason.ManifestInvalidResponse,
|
117
117
|
{
|
118
|
-
file: '
|
118
|
+
file: 'federatedAuthRequestManifestInvalidResponse.md',
|
119
119
|
links: [{
|
120
120
|
link: 'https://fedidcg.github.io/FedCM/',
|
121
121
|
linkTitle: i18nLazyString(UIStrings.fedCm),
|
@@ -123,9 +123,9 @@ const issueDescriptions: Map<Protocol.Audits.FederatedAuthRequestIssueReason, La
|
|
123
123
|
},
|
124
124
|
],
|
125
125
|
[
|
126
|
-
Protocol.Audits.FederatedAuthRequestIssueReason.
|
126
|
+
Protocol.Audits.FederatedAuthRequestIssueReason.ClientMetadataHttpNotFound,
|
127
127
|
{
|
128
|
-
file: '
|
128
|
+
file: 'federatedAuthRequestClientMetadataHttpNotFound.md',
|
129
129
|
links: [{
|
130
130
|
link: 'https://fedidcg.github.io/FedCM/',
|
131
131
|
linkTitle: i18nLazyString(UIStrings.fedCm),
|
@@ -133,9 +133,9 @@ const issueDescriptions: Map<Protocol.Audits.FederatedAuthRequestIssueReason, La
|
|
133
133
|
},
|
134
134
|
],
|
135
135
|
[
|
136
|
-
Protocol.Audits.FederatedAuthRequestIssueReason.
|
136
|
+
Protocol.Audits.FederatedAuthRequestIssueReason.ClientMetadataNoResponse,
|
137
137
|
{
|
138
|
-
file: '
|
138
|
+
file: 'federatedAuthRequestClientMetadataNoResponse.md',
|
139
139
|
links: [{
|
140
140
|
link: 'https://fedidcg.github.io/FedCM/',
|
141
141
|
linkTitle: i18nLazyString(UIStrings.fedCm),
|
@@ -143,9 +143,9 @@ const issueDescriptions: Map<Protocol.Audits.FederatedAuthRequestIssueReason, La
|
|
143
143
|
},
|
144
144
|
],
|
145
145
|
[
|
146
|
-
Protocol.Audits.FederatedAuthRequestIssueReason.
|
146
|
+
Protocol.Audits.FederatedAuthRequestIssueReason.ClientMetadataInvalidResponse,
|
147
147
|
{
|
148
|
-
file: '
|
148
|
+
file: 'federatedAuthRequestClientMetadataInvalidResponse.md',
|
149
149
|
links: [{
|
150
150
|
link: 'https://fedidcg.github.io/FedCM/',
|
151
151
|
linkTitle: i18nLazyString(UIStrings.fedCm),
|
File without changes
|
File without changes
|
File without changes
|
package/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestHttpNotFound.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# The provider's FedCM manifest configuration cannot be found.
|
package/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestInvalidResponse.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Provider's FedCM manifest configuration is invalid.
|
package/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestNoResponse.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# The response body is empty when fetching the provider's FedCM manifest configuration.
|
@@ -4,7 +4,6 @@
|
|
4
4
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
6
6
|
import * as Host from '../../core/host/host.js';
|
7
|
-
import * as i18n from '../../core/i18n/i18n.js';
|
8
7
|
import * as Platform from '../../core/platform/platform.js';
|
9
8
|
import * as SDK from '../../core/sdk/sdk.js';
|
10
9
|
import * as Bindings from '../bindings/bindings.js';
|
@@ -14,16 +13,6 @@ import type {FileSystem} from './FileSystemWorkspaceBinding.js';
|
|
14
13
|
import {FileSystemWorkspaceBinding} from './FileSystemWorkspaceBinding.js';
|
15
14
|
import {PathEncoder, PersistenceImpl} from './PersistenceImpl.js';
|
16
15
|
|
17
|
-
const UIStrings = {
|
18
|
-
/**
|
19
|
-
*@description Error message when attempting to create a binding from a malformed URI.
|
20
|
-
*@example {file://%E0%A4%A} PH1
|
21
|
-
*/
|
22
|
-
theAttemptToBindSInTheWorkspace: 'The attempt to bind "{PH1}" in the workspace failed as this URI is malformed.',
|
23
|
-
};
|
24
|
-
const str_ = i18n.i18n.registerUIStrings('models/persistence/Automapping.ts', UIStrings);
|
25
|
-
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
26
|
-
|
27
16
|
export class Automapping {
|
28
17
|
private readonly workspace: Workspace.Workspace.WorkspaceImpl;
|
29
18
|
private readonly onStatusAdded: (arg0: AutomappingStatus) => Promise<void>;
|
@@ -323,11 +312,7 @@ export class Automapping {
|
|
323
312
|
private createBinding(networkSourceCode: Workspace.UISourceCode.UISourceCode): Promise<AutomappingStatus|null> {
|
324
313
|
const url = networkSourceCode.url();
|
325
314
|
if (url.startsWith('file://') || url.startsWith('snippet://')) {
|
326
|
-
const
|
327
|
-
if (!decodedUrl) {
|
328
|
-
return Promise.resolve(null as AutomappingStatus | null);
|
329
|
-
}
|
330
|
-
const fileSourceCode = this.fileSystemUISourceCodes.get(decodedUrl);
|
315
|
+
const fileSourceCode = this.fileSystemUISourceCodes.get(url);
|
331
316
|
const status = fileSourceCode ? new AutomappingStatus(networkSourceCode, fileSourceCode, false) : null;
|
332
317
|
return Promise.resolve(status);
|
333
318
|
}
|
@@ -338,16 +323,11 @@ export class Automapping {
|
|
338
323
|
}
|
339
324
|
|
340
325
|
if (networkPath.endsWith('/')) {
|
341
|
-
networkPath
|
342
|
-
}
|
343
|
-
|
344
|
-
const urlDecodedNetworkPath = sanitizeSourceUrl(networkPath);
|
345
|
-
if (!urlDecodedNetworkPath) {
|
346
|
-
return Promise.resolve(null as AutomappingStatus | null);
|
326
|
+
networkPath = networkPath + 'index.html' as Platform.DevToolsPath.EncodedPathString;
|
347
327
|
}
|
348
328
|
|
349
329
|
const similarFiles =
|
350
|
-
this.filesIndex.similarFiles(
|
330
|
+
this.filesIndex.similarFiles(networkPath).map(path => this.fileSystemUISourceCodes.get(path)) as
|
351
331
|
Workspace.UISourceCode.UISourceCode[];
|
352
332
|
if (!similarFiles.length) {
|
353
333
|
return Promise.resolve(null as AutomappingStatus | null);
|
@@ -355,16 +335,6 @@ export class Automapping {
|
|
355
335
|
|
356
336
|
return this.pullMetadatas(similarFiles.concat(networkSourceCode)).then(onMetadatas.bind(this));
|
357
337
|
|
358
|
-
function sanitizeSourceUrl(url: string): string|null {
|
359
|
-
try {
|
360
|
-
const decodedUrl = decodeURI(url);
|
361
|
-
return decodedUrl;
|
362
|
-
} catch (error) {
|
363
|
-
Common.Console.Console.instance().error(i18nString(UIStrings.theAttemptToBindSInTheWorkspace, {PH1: url}));
|
364
|
-
return null;
|
365
|
-
}
|
366
|
-
}
|
367
|
-
|
368
338
|
function onMetadatas(this: Automapping): AutomappingStatus|null {
|
369
339
|
const activeFiles =
|
370
340
|
similarFiles.filter(
|
@@ -59,9 +59,9 @@ export class FileSystemWorkspaceBinding {
|
|
59
59
|
return fileSystemPath;
|
60
60
|
}
|
61
61
|
|
62
|
-
static relativePath(uiSourceCode: Workspace.UISourceCode.UISourceCode):
|
62
|
+
static relativePath(uiSourceCode: Workspace.UISourceCode.UISourceCode): Platform.DevToolsPath.EncodedPathString[] {
|
63
63
|
const baseURL = (uiSourceCode.project() as FileSystem).fileSystemBaseURL;
|
64
|
-
return uiSourceCode.url().substring(baseURL.length).split('/');
|
64
|
+
return uiSourceCode.url().substring(baseURL.length).split('/') as Platform.DevToolsPath.EncodedPathString[];
|
65
65
|
}
|
66
66
|
|
67
67
|
static tooltipForUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode): string {
|
@@ -193,12 +193,14 @@ export class FileSystem extends Workspace.Workspace.ProjectStore {
|
|
193
193
|
return this.fileSystemInternal.mimeFromPath(uiSourceCode.url());
|
194
194
|
}
|
195
195
|
|
196
|
-
initialGitFolders():
|
197
|
-
return this.fileSystemInternal.initialGitFolders().map(folder => this.fileSystemPathInternal + '/' + folder)
|
196
|
+
initialGitFolders(): Platform.DevToolsPath.EncodedPathString[] {
|
197
|
+
return this.fileSystemInternal.initialGitFolders().map(folder => this.fileSystemPathInternal + '/' + folder) as
|
198
|
+
Platform.DevToolsPath.EncodedPathString[];
|
198
199
|
}
|
199
200
|
|
200
|
-
private filePathForUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode):
|
201
|
-
|
201
|
+
private filePathForUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode):
|
202
|
+
Platform.DevToolsPath.EncodedPathString {
|
203
|
+
return uiSourceCode.url().substring(this.fileSystemPathInternal.length) as Platform.DevToolsPath.EncodedPathString;
|
202
204
|
}
|
203
205
|
|
204
206
|
isServiceProject(): boolean {
|
@@ -274,9 +276,9 @@ export class FileSystem extends Workspace.Workspace.ProjectStore {
|
|
274
276
|
}
|
275
277
|
console.assert(Boolean(newName));
|
276
278
|
const slash = filePath.lastIndexOf('/');
|
277
|
-
const parentPath =
|
278
|
-
filePath = parentPath
|
279
|
-
filePath =
|
279
|
+
const parentPath = Common.ParsedURL.ParsedURL.substr(filePath, 0, slash);
|
280
|
+
filePath = Common.ParsedURL.ParsedURL.encodedFromParentPathAndName(parentPath, newName);
|
281
|
+
filePath = Common.ParsedURL.ParsedURL.substr(filePath, 1);
|
280
282
|
const newURL = this.fileSystemBaseURL + filePath;
|
281
283
|
const newContentType = this.fileSystemInternal.contentType(newName);
|
282
284
|
this.renameUISourceCode(uiSourceCode, newName);
|
@@ -412,7 +414,7 @@ export class FileSystem extends Workspace.Workspace.ProjectStore {
|
|
412
414
|
void uiSourceCode.checkContentUpdated();
|
413
415
|
}
|
414
416
|
|
415
|
-
tooltipForURL(url:
|
417
|
+
tooltipForURL(url: Platform.DevToolsPath.UrlString): string {
|
416
418
|
return this.fileSystemInternal.tooltipForURL(url);
|
417
419
|
}
|
418
420
|
|
@@ -28,8 +28,6 @@
|
|
28
28
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
29
|
*/
|
30
30
|
|
31
|
-
// TODO(crbug.com/1253323): All casts to UrlString will be removed from this file when migration to branded types is complete.
|
32
|
-
|
33
31
|
import * as Common from '../../core/common/common.js';
|
34
32
|
import * as Host from '../../core/host/host.js';
|
35
33
|
import * as i18n from '../../core/i18n/i18n.js';
|
@@ -77,8 +75,8 @@ export class IsolatedFileSystem extends PlatformFileSystem {
|
|
77
75
|
private readonly excludedFoldersSetting: Common.Settings.Setting<{[path: string]: string[]}>;
|
78
76
|
private excludedFoldersInternal: Set<string>;
|
79
77
|
private readonly excludedEmbedderFolders: string[];
|
80
|
-
private readonly initialFilePathsInternal: Set<
|
81
|
-
private readonly initialGitFoldersInternal: Set<
|
78
|
+
private readonly initialFilePathsInternal: Set<Platform.DevToolsPath.EncodedPathString>;
|
79
|
+
private readonly initialGitFoldersInternal: Set<Platform.DevToolsPath.EncodedPathString>;
|
82
80
|
private readonly fileLocks: Map<string, Promise<void>>;
|
83
81
|
|
84
82
|
constructor(
|
@@ -129,7 +127,7 @@ export class IsolatedFileSystem extends PlatformFileSystem {
|
|
129
127
|
const promise = new Promise<Metadata|null>(f => {
|
130
128
|
fulfill = f;
|
131
129
|
});
|
132
|
-
this.domFileSystem.root.getFile(path, undefined, fileEntryLoaded, errorHandler);
|
130
|
+
this.domFileSystem.root.getFile(decodeURIComponent(path), undefined, fileEntryLoaded, errorHandler);
|
133
131
|
return promise;
|
134
132
|
|
135
133
|
function fileEntryLoaded(entry: FileEntry): void {
|
@@ -143,11 +141,11 @@ export class IsolatedFileSystem extends PlatformFileSystem {
|
|
143
141
|
}
|
144
142
|
}
|
145
143
|
|
146
|
-
initialFilePaths():
|
144
|
+
initialFilePaths(): Platform.DevToolsPath.EncodedPathString[] {
|
147
145
|
return [...this.initialFilePathsInternal];
|
148
146
|
}
|
149
147
|
|
150
|
-
initialGitFolders():
|
148
|
+
initialGitFolders(): Platform.DevToolsPath.EncodedPathString[] {
|
151
149
|
return [...this.initialGitFoldersInternal];
|
152
150
|
}
|
153
151
|
|
@@ -168,16 +166,19 @@ export class IsolatedFileSystem extends PlatformFileSystem {
|
|
168
166
|
if (this.isFileExcluded(entry.fullPath)) {
|
169
167
|
continue;
|
170
168
|
}
|
171
|
-
this.initialFilePathsInternal.add(
|
169
|
+
this.initialFilePathsInternal.add(Common.ParsedURL.ParsedURL.rawPathToEncodedPathString(
|
170
|
+
Common.ParsedURL.ParsedURL.substr(entry.fullPath as Platform.DevToolsPath.RawPathString, 1)));
|
172
171
|
} else {
|
173
172
|
if (entry.fullPath.endsWith('/.git')) {
|
174
173
|
const lastSlash = entry.fullPath.lastIndexOf('/');
|
175
|
-
const parentFolder =
|
176
|
-
|
174
|
+
const parentFolder = Common.ParsedURL.ParsedURL.substr(
|
175
|
+
entry.fullPath as Platform.DevToolsPath.RawPathString, 1, lastSlash);
|
176
|
+
this.initialGitFoldersInternal.add(Common.ParsedURL.ParsedURL.rawPathToEncodedPathString(parentFolder));
|
177
177
|
}
|
178
178
|
if (this.isFileExcluded(entry.fullPath + '/')) {
|
179
|
-
|
180
|
-
|
179
|
+
const url = Common.ParsedURL.ParsedURL.concatenate(this.path(), entry.fullPath);
|
180
|
+
this.excludedEmbedderFolders.push(
|
181
|
+
Common.ParsedURL.ParsedURL.urlToRawPathString(url, Host.Platform.isWin()));
|
181
182
|
continue;
|
182
183
|
}
|
183
184
|
++pendingRequests;
|
@@ -221,7 +222,7 @@ export class IsolatedFileSystem extends PlatformFileSystem {
|
|
221
222
|
}
|
222
223
|
|
223
224
|
async createFile(path: string, name: string|null): Promise<string|null> {
|
224
|
-
const dirEntry = await this.createFoldersIfNotExist(path);
|
225
|
+
const dirEntry = await this.createFoldersIfNotExist(decodeURIComponent(path));
|
225
226
|
if (!dirEntry) {
|
226
227
|
return null;
|
227
228
|
}
|
@@ -230,7 +231,8 @@ export class IsolatedFileSystem extends PlatformFileSystem {
|
|
230
231
|
if (!fileEntry) {
|
231
232
|
return null;
|
232
233
|
}
|
233
|
-
return
|
234
|
+
return Common.ParsedURL.ParsedURL.rawPathToEncodedPathString(
|
235
|
+
Common.ParsedURL.ParsedURL.substr(fileEntry.fullPath as Platform.DevToolsPath.RawPathString, 1));
|
234
236
|
|
235
237
|
function createFileCandidate(
|
236
238
|
this: IsolatedFileSystem, name: string, newFileIndex?: number): Promise<FileEntry|null> {
|
@@ -256,7 +258,8 @@ export class IsolatedFileSystem extends PlatformFileSystem {
|
|
256
258
|
const promise = new Promise<boolean>(resolve => {
|
257
259
|
resolveCallback = resolve;
|
258
260
|
});
|
259
|
-
this.domFileSystem.root.getFile(
|
261
|
+
this.domFileSystem.root.getFile(
|
262
|
+
decodeURIComponent(path), undefined, fileEntryLoaded.bind(this), errorHandler.bind(this));
|
260
263
|
return promise;
|
261
264
|
|
262
265
|
function fileEntryLoaded(this: IsolatedFileSystem, fileEntry: FileEntry): void {
|
@@ -279,7 +282,7 @@ export class IsolatedFileSystem extends PlatformFileSystem {
|
|
279
282
|
|
280
283
|
requestFileBlob(path: string): Promise<Blob|null> {
|
281
284
|
return new Promise(resolve => {
|
282
|
-
this.domFileSystem.root.getFile(path, undefined, entry => {
|
285
|
+
this.domFileSystem.root.getFile(decodeURIComponent(path), undefined, entry => {
|
283
286
|
entry.file(resolve, errorHandler.bind(this));
|
284
287
|
}, errorHandler.bind(this));
|
285
288
|
|
@@ -347,7 +350,8 @@ export class IsolatedFileSystem extends PlatformFileSystem {
|
|
347
350
|
// @ts-ignore TODO(crbug.com/1172300) Properly type this after jsdoc to ts migration
|
348
351
|
callback = x;
|
349
352
|
});
|
350
|
-
this.domFileSystem.root.getFile(
|
353
|
+
this.domFileSystem.root.getFile(
|
354
|
+
decodeURIComponent(path), {create: true}, fileEntryLoaded.bind(this), errorHandler.bind(this));
|
351
355
|
return promise;
|
352
356
|
};
|
353
357
|
|
@@ -391,7 +395,8 @@ export class IsolatedFileSystem extends PlatformFileSystem {
|
|
391
395
|
let fileEntry: FileEntry;
|
392
396
|
let dirEntry: DirectoryEntry;
|
393
397
|
|
394
|
-
this.domFileSystem.root.getFile(
|
398
|
+
this.domFileSystem.root.getFile(
|
399
|
+
decodeURIComponent(path), undefined, fileEntryLoaded.bind(this), errorHandler.bind(this));
|
395
400
|
|
396
401
|
function fileEntryLoaded(this: IsolatedFileSystem, entry: FileEntry): void {
|
397
402
|
if (entry.name === newName) {
|
@@ -458,7 +463,7 @@ export class IsolatedFileSystem extends PlatformFileSystem {
|
|
458
463
|
}
|
459
464
|
|
460
465
|
private requestEntries(path: string, callback: (arg0: Array<FileEntry>) => void): void {
|
461
|
-
this.domFileSystem.root.getDirectory(path, undefined, innerCallback.bind(this), errorHandler);
|
466
|
+
this.domFileSystem.root.getDirectory(decodeURIComponent(path), undefined, innerCallback.bind(this), errorHandler);
|
462
467
|
|
463
468
|
function innerCallback(this: IsolatedFileSystem, dirEntry: DirectoryEntry): void {
|
464
469
|
this.readDirectory(dirEntry, callback);
|
@@ -553,10 +558,9 @@ export class IsolatedFileSystem extends PlatformFileSystem {
|
|
553
558
|
Common.ResourceType.resourceTypes.Document;
|
554
559
|
}
|
555
560
|
|
556
|
-
tooltipForURL(url:
|
561
|
+
tooltipForURL(url: Platform.DevToolsPath.UrlString): string {
|
557
562
|
const path = Platform.StringUtilities.trimMiddle(
|
558
|
-
Common.ParsedURL.ParsedURL.urlToRawPathString(url
|
559
|
-
150);
|
563
|
+
Common.ParsedURL.ParsedURL.urlToRawPathString(url, Host.Platform.isWin()), 150);
|
560
564
|
return i18nString(UIStrings.linkedToS, {PH1: path});
|
561
565
|
}
|
562
566
|
|
@@ -248,6 +248,11 @@ export class NetworkPersistenceManager extends Common.ObjectWrapper.ObjectWrappe
|
|
248
248
|
}
|
249
249
|
}
|
250
250
|
|
251
|
+
private fileUrlFromNetworkUrl(url: Platform.DevToolsPath.UrlString): Platform.DevToolsPath.UrlString {
|
252
|
+
return (this.projectInternal as FileSystem).fileSystemPath() + '/' + this.encodedPathFromUrl(url) as
|
253
|
+
Platform.DevToolsPath.UrlString;
|
254
|
+
}
|
255
|
+
|
251
256
|
private decodeLocalPathToUrlPath(path: string): string {
|
252
257
|
try {
|
253
258
|
return unescape(path);
|
@@ -341,12 +346,11 @@ export class NetworkPersistenceManager extends Common.ObjectWrapper.ObjectWrappe
|
|
341
346
|
!this.canHandleNetworkUISourceCode(uiSourceCode)) {
|
342
347
|
return;
|
343
348
|
}
|
344
|
-
const url = Common.ParsedURL.ParsedURL.urlWithoutHash(uiSourceCode.url());
|
349
|
+
const url = Common.ParsedURL.ParsedURL.urlWithoutHash(uiSourceCode.url()) as Platform.DevToolsPath.UrlString;
|
345
350
|
this.networkUISourceCodeForEncodedPath.set(this.encodedPathFromUrl(url), uiSourceCode);
|
346
351
|
|
347
352
|
const project = this.projectInternal as FileSystem;
|
348
|
-
const fileSystemUISourceCode =
|
349
|
-
project.uiSourceCodeForURL(project.fileSystemPath() + '/' + this.encodedPathFromUrl(url));
|
353
|
+
const fileSystemUISourceCode = project.uiSourceCodeForURL(this.fileUrlFromNetworkUrl(url));
|
350
354
|
if (fileSystemUISourceCode) {
|
351
355
|
await this.bind(uiSourceCode, fileSystemUISourceCode);
|
352
356
|
}
|
@@ -571,7 +575,7 @@ export class NetworkPersistenceManager extends Common.ObjectWrapper.ObjectWrappe
|
|
571
575
|
return;
|
572
576
|
}
|
573
577
|
const proj = this.projectInternal as FileSystem;
|
574
|
-
const path =
|
578
|
+
const path = this.fileUrlFromNetworkUrl(interceptedRequest.request.url as Platform.DevToolsPath.UrlString);
|
575
579
|
const fileSystemUISourceCode = proj.uiSourceCodeForURL(path);
|
576
580
|
let responseHeaders: Protocol.Fetch.HeaderEntry[] = [];
|
577
581
|
if (Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.HEADER_OVERRIDES)) {
|
@@ -5,7 +5,6 @@
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
6
6
|
import * as Host from '../../core/host/host.js';
|
7
7
|
import * as i18n from '../../core/i18n/i18n.js';
|
8
|
-
import type * as Platform from '../../core/platform/platform.js';
|
9
8
|
import * as SDK from '../../core/sdk/sdk.js';
|
10
9
|
|
11
10
|
import type * as TextUtils from '../text_utils/text_utils.js';
|
@@ -93,9 +92,7 @@ export class ContextMenuProvider implements UI.ContextMenu.Provider {
|
|
93
92
|
const binding = uiSourceCode && PersistenceImpl.instance().binding(uiSourceCode);
|
94
93
|
const fileURL = binding ? binding.fileSystem.contentURL() : contentProvider.contentURL();
|
95
94
|
if (fileURL.startsWith('file://')) {
|
96
|
-
|
97
|
-
const path = Common.ParsedURL.ParsedURL.urlToRawPathString(
|
98
|
-
fileURL as Platform.DevToolsPath.UrlString, Host.Platform.isWin());
|
95
|
+
const path = Common.ParsedURL.ParsedURL.urlToRawPathString(fileURL, Host.Platform.isWin());
|
99
96
|
contextMenu.revealSection().appendItem(
|
100
97
|
i18nString(UIStrings.openInContainingFolder),
|
101
98
|
() => Host.InspectorFrontendHost.InspectorFrontendHostInstance.showItemInFolder(path));
|
@@ -3,6 +3,7 @@
|
|
3
3
|
// found in the LICENSE file.
|
4
4
|
|
5
5
|
import type * as Common from '../../core/common/common.js';
|
6
|
+
import type * as Platform from '../../core/platform/platform.js';
|
6
7
|
import * as i18n from '../../core/i18n/i18n.js';
|
7
8
|
import type * as TextUtils from '../text_utils/text_utils.js';
|
8
9
|
|
@@ -26,16 +27,16 @@ export class PlatformFileSystem {
|
|
26
27
|
return Promise.resolve(null);
|
27
28
|
}
|
28
29
|
|
29
|
-
initialFilePaths():
|
30
|
+
initialFilePaths(): Platform.DevToolsPath.EncodedPathString[] {
|
30
31
|
return [];
|
31
32
|
}
|
32
33
|
|
33
|
-
initialGitFolders():
|
34
|
+
initialGitFolders(): Platform.DevToolsPath.EncodedPathString[] {
|
34
35
|
return [];
|
35
36
|
}
|
36
37
|
|
37
|
-
path():
|
38
|
-
return this.pathInternal;
|
38
|
+
path(): Platform.DevToolsPath.UrlString {
|
39
|
+
return this.pathInternal as Platform.DevToolsPath.UrlString;
|
39
40
|
}
|
40
41
|
|
41
42
|
embedderPath(): string {
|
@@ -110,7 +111,7 @@ export class PlatformFileSystem {
|
|
110
111
|
throw new Error('Not implemented');
|
111
112
|
}
|
112
113
|
|
113
|
-
tooltipForURL(_url:
|
114
|
+
tooltipForURL(_url: Platform.DevToolsPath.UrlString): string {
|
114
115
|
throw new Error('Not implemented');
|
115
116
|
}
|
116
117
|
|
@@ -1,13 +1,13 @@
|
|
1
|
-
// Copyright
|
1
|
+
// Copyright 2022 The Chromium Authors. All rights reserved.
|
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
5
|
import * as Platform from '../../core/platform/platform.js';
|
6
6
|
import * as SDK from '../../core/sdk/sdk.js';
|
7
|
-
import * as Bindings from '
|
8
|
-
import * as Formatter from '
|
9
|
-
import * as TextUtils from '
|
10
|
-
import type * as Workspace from '
|
7
|
+
import * as Bindings from '../bindings/bindings.js';
|
8
|
+
import * as Formatter from '../formatter/formatter.js';
|
9
|
+
import * as TextUtils from '../text_utils/text_utils.js';
|
10
|
+
import type * as Workspace from '../workspace/workspace.js';
|
11
11
|
import * as Protocol from '../../generated/protocol.js';
|
12
12
|
|
13
13
|
interface CachedScopeMap {
|
@@ -29,9 +29,10 @@
|
|
29
29
|
*/
|
30
30
|
|
31
31
|
import type * as Common from '../../core/common/common.js';
|
32
|
+
import type * as Platform from '../../core/platform/platform.js';
|
32
33
|
|
33
34
|
export abstract class ContentProvider {
|
34
|
-
abstract contentURL():
|
35
|
+
abstract contentURL(): Platform.DevToolsPath.UrlString;
|
35
36
|
abstract contentType(): Common.ResourceType.ResourceType;
|
36
37
|
abstract contentEncoded(): Promise<boolean>;
|
37
38
|
abstract requestContent(): Promise<DeferredContent>;
|
@@ -3,18 +3,20 @@
|
|
3
3
|
// found in the LICENSE file.
|
4
4
|
|
5
5
|
import type * as Common from '../../core/common/common.js';
|
6
|
+
import type * as Platform from '../../core/platform/platform.js';
|
6
7
|
|
7
8
|
import type {ContentProvider, DeferredContent, SearchMatch} from './ContentProvider.js';
|
8
9
|
import {performSearchInContent} from './TextUtils.js';
|
9
10
|
|
10
11
|
export class StaticContentProvider implements ContentProvider {
|
11
|
-
private readonly contentURLInternal:
|
12
|
+
private readonly contentURLInternal: Platform.DevToolsPath.UrlString;
|
12
13
|
private readonly contentTypeInternal: Common.ResourceType.ResourceType;
|
13
14
|
private readonly lazyContent: () => Promise<DeferredContent>;
|
14
15
|
|
15
16
|
constructor(
|
16
17
|
contentURL: string, contentType: Common.ResourceType.ResourceType, lazyContent: () => Promise<DeferredContent>) {
|
17
|
-
|
18
|
+
// TODO(crbug.com/1253323): Cast to UrlString will be removed when migration to branded types is complete.
|
19
|
+
this.contentURLInternal = contentURL as Platform.DevToolsPath.UrlString;
|
18
20
|
this.contentTypeInternal = contentType;
|
19
21
|
this.lazyContent = lazyContent;
|
20
22
|
}
|
@@ -28,8 +30,7 @@ export class StaticContentProvider implements ContentProvider {
|
|
28
30
|
return new StaticContentProvider(contentURL, contentType, lazyContent);
|
29
31
|
}
|
30
32
|
|
31
|
-
|
32
|
-
contentURL(): string {
|
33
|
+
contentURL(): Platform.DevToolsPath.UrlString {
|
33
34
|
return this.contentURLInternal;
|
34
35
|
}
|
35
36
|
|