chrome-devtools-frontend 1.0.1000934 → 1.0.1002543
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 +4 -3
- package/front_end/.eslintrc.js +1 -0
- package/front_end/core/common/ParsedURL.ts +3 -3
- package/front_end/core/host/InspectorFrontendHost.ts +30 -1
- package/front_end/core/i18n/locales/en-US.json +177 -12
- package/front_end/core/i18n/locales/en-XL.json +177 -12
- package/front_end/core/protocol_client/InspectorBackend.ts +4 -0
- package/front_end/core/root/Runtime.ts +7 -3
- package/front_end/core/sdk/ServiceWorkerManager.ts +6 -5
- package/front_end/entrypoints/formatter_worker/FormatterActions.ts +14 -0
- package/front_end/entrypoints/formatter_worker/ScopeParser.ts +491 -0
- package/front_end/entrypoints/formatter_worker/Substitute.ts +4 -440
- package/front_end/entrypoints/formatter_worker/formatter_worker.ts +2 -0
- package/front_end/generated/InspectorBackendCommands.js +38 -10
- package/front_end/generated/protocol-mapping.d.ts +5 -1
- package/front_end/generated/protocol-proxy-api.d.ts +4 -1
- package/front_end/generated/protocol.ts +50 -10
- package/front_end/models/bindings/BreakpointManager.ts +12 -11
- package/front_end/models/bindings/CompilerScriptMapping.ts +1 -1
- package/front_end/models/issues_manager/AttributionReportingIssue.ts +5 -36
- package/front_end/models/issues_manager/DeprecationIssue.ts +233 -257
- package/front_end/models/issues_manager/Issue.ts +8 -4
- package/front_end/models/persistence/PersistenceImpl.ts +2 -2
- package/front_end/models/timeline_model/TimelineModel.ts +0 -48
- package/front_end/panels/application/AppManifestView.ts +3 -3
- package/front_end/panels/application/ApplicationPanelCacheSection.ts +3 -1
- package/front_end/panels/application/ApplicationPanelSidebar.ts +11 -6
- package/front_end/panels/application/ApplicationPanelTreeElement.ts +2 -2
- package/front_end/panels/application/BackgroundServiceView.ts +5 -4
- package/front_end/panels/application/ResourcesPanel.ts +1 -1
- package/front_end/panels/application/components/BackForwardCacheView.ts +4 -5
- package/front_end/panels/application/components/FrameDetailsView.ts +19 -19
- package/front_end/panels/application/components/PermissionsPolicySection.ts +2 -2
- package/front_end/panels/console/ConsoleViewMessage.ts +6 -3
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +1 -1
- package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +3 -2
- package/front_end/panels/css_overview/cssOverviewCompletedView.css +4 -0
- package/front_end/panels/elements/StylePropertyTreeElement.ts +19 -13
- package/front_end/panels/elements/StylesSidebarPane.ts +53 -0
- package/front_end/panels/elements/components/QueryContainer.ts +1 -1
- package/front_end/panels/issues/AffectedResourcesView.ts +4 -3
- package/front_end/panels/issues/AffectedSourcesView.ts +2 -1
- package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +0 -43
- package/front_end/panels/issues/IssueView.ts +1 -1
- package/front_end/panels/lighthouse/LighthouseController.ts +5 -3
- package/front_end/panels/lighthouse/LighthouseReporterTypes.ts +2 -1
- package/front_end/panels/lighthouse/lighthousePanel.css +4 -0
- package/front_end/panels/network/components/RequestTrustTokensView.ts +7 -7
- package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +2 -2
- package/front_end/panels/profiler/HeapSnapshotView.ts +2 -1
- package/front_end/panels/profiler/ProfileDataGrid.ts +1 -1
- package/front_end/panels/security/SecurityPanel.ts +6 -5
- package/front_end/panels/settings/SettingsScreen.ts +2 -3
- package/front_end/panels/sources/DebuggerPlugin.ts +10 -9
- package/front_end/panels/sources/JavaScriptBreakpointsSidebarPane.ts +3 -3
- package/front_end/panels/timeline/PerformanceModel.ts +2 -6
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +1 -14
- package/front_end/panels/timeline/TimelineUIUtils.ts +14 -12
- package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1036 -1088
- package/front_end/third_party/lighthouse/locales/en-US.json +241 -4
- package/front_end/third_party/lighthouse/locales/en-XL.json +241 -4
- package/front_end/third_party/lighthouse/report/bundle.d.ts +2 -0
- package/front_end/third_party/lighthouse/report/bundle.js +18 -12
- package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
- package/front_end/third_party/puppeteer/package/README.md +11 -11
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.js +26 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js +7 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.js +19 -11
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.js +6 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/compat.d.ts +3 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/compat.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/compat.js +18 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/compat.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/constants.d.ts +2 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/constants.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/constants.js +7 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/constants.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts +2 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js +5 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initialize-node.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initialize-node.js +2 -15
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initialize-node.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.js +23 -15
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/NodeWebSocketTransport.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/NodeWebSocketTransport.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/NodeWebSocketTransport.js +17 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/NodeWebSocketTransport.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/install.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/install.js +1 -6
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/install.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/package.json +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Debug.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Debug.js +3 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Debug.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.js +7 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.js +19 -11
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.js +6 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/compat.d.ts +3 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/compat.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/compat.js +17 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/compat.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/constants.d.ts +2 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/constants.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/constants.js +4 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/constants.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts +2 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js +2 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.js +2 -15
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.js +21 -13
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.js +17 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.js +1 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +6 -6
- package/front_end/third_party/puppeteer/package/package.json +33 -18
- package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +4 -1
- package/front_end/ui/components/data_grid/DataGrid.ts +1 -1
- package/front_end/ui/components/data_grid/DataGridUtils.ts +1 -1
- package/front_end/ui/components/docs/linkifier/simple-url.ts +2 -1
- package/front_end/ui/components/docs/panel_feedback/basic.ts +3 -2
- package/front_end/ui/components/docs/panel_feedback/button.ts +2 -1
- package/front_end/ui/components/linkifier/LinkifierImpl.ts +4 -3
- package/front_end/ui/components/linkifier/LinkifierUtils.ts +2 -3
- package/front_end/ui/components/panel_feedback/FeedbackButton.ts +4 -6
- package/front_end/ui/components/panel_feedback/PanelFeedback.ts +5 -4
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +4 -4
- package/front_end/ui/legacy/EmptyWidget.ts +2 -1
- package/front_end/ui/legacy/UIUtils.ts +4 -4
- package/front_end/ui/legacy/XLink.ts +12 -13
- package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +2 -4
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +1 -1
- package/front_end/ui/legacy/components/perf_ui/LineLevelProfile.ts +0 -2
- package/front_end/ui/legacy/components/utils/ImagePreview.ts +3 -7
- package/front_end/ui/legacy/components/utils/Linkifier.ts +23 -23
- package/front_end/ui/legacy/toolbar.css +1 -1
- package/front_end/ui/lit-html/lit-html.ts +3 -0
- package/package.json +1 -1
- package/scripts/eslint_rules/lib/lit_template_result_or_nothing.js +4 -0
- package/scripts/eslint_rules/tests/lit_template_result_or_nothing_test.js +13 -0
- package/front_end/models/issues_manager/descriptions/arInvalidAttributionSourceEventId.md +0 -3
- package/front_end/models/issues_manager/descriptions/arInvalidAttributionSourceExpiry.md +0 -4
- package/front_end/models/issues_manager/descriptions/arInvalidAttributionSourcePriority.md +0 -4
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
import * as Host from '../../../core/host/host.js';
|
6
6
|
import * as i18n from '../../../core/i18n/i18n.js';
|
7
|
-
import
|
7
|
+
import * as Platform from '../../../core/platform/platform.js';
|
8
8
|
import * as ComponentHelpers from '../../components/helpers/helpers.js';
|
9
9
|
import * as LitHtml from '../../lit-html/lit-html.js';
|
10
10
|
import * as Buttons from '../buttons/buttons.js';
|
@@ -22,7 +22,7 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
22
22
|
const feedbackIconUrl = new URL('../../../Images/feedback_button_icon.svg', import.meta.url).toString();
|
23
23
|
|
24
24
|
export interface FeedbackButtonData {
|
25
|
-
feedbackUrl:
|
25
|
+
feedbackUrl: Platform.DevToolsPath.UrlString;
|
26
26
|
}
|
27
27
|
export class FeedbackButton extends HTMLElement {
|
28
28
|
static readonly litTagName = LitHtml.literal`devtools-feedback-button`;
|
@@ -30,7 +30,7 @@ export class FeedbackButton extends HTMLElement {
|
|
30
30
|
readonly #boundRender = this.#render.bind(this);
|
31
31
|
|
32
32
|
#props: FeedbackButtonData = {
|
33
|
-
feedbackUrl:
|
33
|
+
feedbackUrl: Platform.DevToolsPath.EmptyUrlString,
|
34
34
|
};
|
35
35
|
|
36
36
|
set data(data: FeedbackButtonData) {
|
@@ -39,9 +39,7 @@ export class FeedbackButton extends HTMLElement {
|
|
39
39
|
}
|
40
40
|
|
41
41
|
#onFeedbackClick(): void {
|
42
|
-
|
43
|
-
Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(
|
44
|
-
this.#props.feedbackUrl as Platform.DevToolsPath.UrlString);
|
42
|
+
Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(this.#props.feedbackUrl);
|
45
43
|
}
|
46
44
|
|
47
45
|
#render(): void {
|
@@ -3,6 +3,7 @@
|
|
3
3
|
// found in the LICENSE file.
|
4
4
|
|
5
5
|
import * as i18n from '../../../core/i18n/i18n.js';
|
6
|
+
import * as Platform from '../../../core/platform/platform.js';
|
6
7
|
import * as ComponentHelpers from '../../components/helpers/helpers.js';
|
7
8
|
import * as LitHtml from '../../lit-html/lit-html.js';
|
8
9
|
import * as IconButton from '../icon_button/icon_button.js';
|
@@ -35,8 +36,8 @@ const previewFeatureUrl = new URL('../../../Images/ic_preview_feature.svg', impo
|
|
35
36
|
const videoThumbnailUrl = new URL('../../../Images/preview_feature_video_thumbnail.svg', import.meta.url).toString();
|
36
37
|
|
37
38
|
export interface PanelFeedbackData {
|
38
|
-
feedbackUrl:
|
39
|
-
quickStartUrl:
|
39
|
+
feedbackUrl: Platform.DevToolsPath.UrlString;
|
40
|
+
quickStartUrl: Platform.DevToolsPath.UrlString;
|
40
41
|
quickStartLinkText: string;
|
41
42
|
}
|
42
43
|
export class PanelFeedback extends HTMLElement {
|
@@ -45,8 +46,8 @@ export class PanelFeedback extends HTMLElement {
|
|
45
46
|
readonly #boundRender = this.#render.bind(this);
|
46
47
|
|
47
48
|
#props: PanelFeedbackData = {
|
48
|
-
feedbackUrl:
|
49
|
-
quickStartUrl:
|
49
|
+
feedbackUrl: Platform.DevToolsPath.EmptyUrlString,
|
50
|
+
quickStartUrl: Platform.DevToolsPath.EmptyUrlString,
|
50
51
|
quickStartLinkText: '',
|
51
52
|
};
|
52
53
|
|
@@ -45,7 +45,7 @@ export interface RequestLinkIconData {
|
|
45
45
|
revealOverride?: (revealable: Object|null, omitFocus?: boolean|undefined) => Promise<void>;
|
46
46
|
}
|
47
47
|
|
48
|
-
export const extractShortPath = (path:
|
48
|
+
export const extractShortPath = (path: Platform.DevToolsPath.UrlString): string => {
|
49
49
|
// 1st regex matches everything after last '/'
|
50
50
|
// if path ends with '/', 2nd regex returns everything between the last two '/'
|
51
51
|
return (/[^/]+$/.exec(path) || /[^/]+\/$/.exec(path) || [''])[0];
|
@@ -163,14 +163,14 @@ export class RequestLinkIcon extends HTMLElement {
|
|
163
163
|
return i18nString(UIStrings.requestUnavailableInTheNetwork);
|
164
164
|
}
|
165
165
|
|
166
|
-
#getUrlForDisplaying():
|
166
|
+
#getUrlForDisplaying(): Platform.DevToolsPath.UrlString|undefined {
|
167
167
|
if (!this.#request) {
|
168
|
-
return this.#affectedRequest?.url;
|
168
|
+
return this.#affectedRequest?.url as Platform.DevToolsPath.UrlString;
|
169
169
|
}
|
170
170
|
return this.#request.url();
|
171
171
|
}
|
172
172
|
|
173
|
-
#maybeRenderURL(): LitHtml.
|
173
|
+
#maybeRenderURL(): LitHtml.LitTemplate {
|
174
174
|
if (!this.#displayURL) {
|
175
175
|
return LitHtml.nothing;
|
176
176
|
}
|
@@ -29,6 +29,7 @@
|
|
29
29
|
*/
|
30
30
|
|
31
31
|
import * as i18n from '../../core/i18n/i18n.js';
|
32
|
+
import type * as Platform from '../../core/platform/platform.js';
|
32
33
|
|
33
34
|
import emptyWidgetStyles from './emptyWidget.css.legacy.js';
|
34
35
|
import {VBox} from './Widget.js';
|
@@ -59,7 +60,7 @@ export class EmptyWidget extends VBox {
|
|
59
60
|
return this.contentElement.createChild('p');
|
60
61
|
}
|
61
62
|
|
62
|
-
appendLink(link:
|
63
|
+
appendLink(link: Platform.DevToolsPath.UrlString): HTMLElement {
|
63
64
|
return this.contentElement.appendChild(XLink.create(link, i18nString(UIStrings.learnMore))) as HTMLElement;
|
64
65
|
}
|
65
66
|
|
@@ -1490,25 +1490,25 @@ let measureTextWidthCache: Map<string, Map<string, number>>|null = null;
|
|
1490
1490
|
/**
|
1491
1491
|
* Adds a 'utm_source=devtools' as query parameter to the url.
|
1492
1492
|
*/
|
1493
|
-
export function addReferrerToURL(url:
|
1493
|
+
export function addReferrerToURL(url: Platform.DevToolsPath.UrlString): Platform.DevToolsPath.UrlString {
|
1494
1494
|
if (/(\?|&)utm_source=devtools/.test(url)) {
|
1495
1495
|
return url;
|
1496
1496
|
}
|
1497
1497
|
if (url.indexOf('?') === -1) {
|
1498
1498
|
// If the URL does not contain a query, add the referrer query after path
|
1499
1499
|
// and before (potential) anchor.
|
1500
|
-
return url.replace(/^([^#]*)(#.*)?$/g, '$1?utm_source=devtools$2');
|
1500
|
+
return url.replace(/^([^#]*)(#.*)?$/g, '$1?utm_source=devtools$2') as Platform.DevToolsPath.UrlString;
|
1501
1501
|
}
|
1502
1502
|
// If the URL already contains a query, add the referrer query after the last query
|
1503
1503
|
// and before (potential) anchor.
|
1504
|
-
return url.replace(/^([^#]*)(#.*)?$/g, '$1&utm_source=devtools$2');
|
1504
|
+
return url.replace(/^([^#]*)(#.*)?$/g, '$1&utm_source=devtools$2') as Platform.DevToolsPath.UrlString;
|
1505
1505
|
}
|
1506
1506
|
|
1507
1507
|
/**
|
1508
1508
|
* We want to add a referrer query param to every request to
|
1509
1509
|
* 'web.dev' or 'developers.google.com'.
|
1510
1510
|
*/
|
1511
|
-
export function addReferrerToURLIfNecessary(url:
|
1511
|
+
export function addReferrerToURLIfNecessary(url: Platform.DevToolsPath.UrlString): Platform.DevToolsPath.UrlString {
|
1512
1512
|
if (/(\/\/developers.google.com\/|\/\/web.dev\/|\/\/developer.chrome.com\/)/.test(url)) {
|
1513
1513
|
return addReferrerToURL(url);
|
1514
1514
|
}
|
@@ -2,8 +2,6 @@
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
3
3
|
// found in the LICENSE file.
|
4
4
|
|
5
|
-
// TODO(crbug.com/1253323): Casts to UrlString will be removed from this file when migration to branded types is complete.
|
6
|
-
|
7
5
|
import * as Host from '../../core/host/host.js';
|
8
6
|
import * as Platform from '../../core/platform/platform.js';
|
9
7
|
import * as ComponentHelpers from '../components/helpers/helpers.js';
|
@@ -22,7 +20,7 @@ import {
|
|
22
20
|
import {XElement} from './XElement.js';
|
23
21
|
|
24
22
|
export class XLink extends XElement {
|
25
|
-
hrefInternal:
|
23
|
+
hrefInternal: Platform.DevToolsPath.UrlString|null;
|
26
24
|
private clickable: boolean;
|
27
25
|
private readonly onClick: (arg0: Event) => void;
|
28
26
|
private readonly onKeyDown: (arg0: Event) => void;
|
@@ -54,15 +52,17 @@ export class XLink extends XElement {
|
|
54
52
|
|
55
53
|
this.onClick = (event: Event): void => {
|
56
54
|
event.consume(true);
|
57
|
-
|
58
|
-
|
55
|
+
if (this.hrefInternal) {
|
56
|
+
Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(this.hrefInternal);
|
57
|
+
}
|
59
58
|
this.dispatchEvent(new Event('x-link-invoke'));
|
60
59
|
};
|
61
60
|
this.onKeyDown = (event: Event): void => {
|
62
61
|
if (isEnterOrSpaceKey(event)) {
|
63
62
|
event.consume(true);
|
64
|
-
|
65
|
-
|
63
|
+
if (this.hrefInternal) {
|
64
|
+
Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(this.hrefInternal);
|
65
|
+
}
|
66
66
|
}
|
67
67
|
this.dispatchEvent(new Event('x-link-invoke'));
|
68
68
|
};
|
@@ -73,7 +73,7 @@ export class XLink extends XElement {
|
|
73
73
|
return XElement.observedAttributes.concat(['href', 'no-click']);
|
74
74
|
}
|
75
75
|
|
76
|
-
get href():
|
76
|
+
get href(): Platform.DevToolsPath.UrlString|null {
|
77
77
|
return this.hrefInternal;
|
78
78
|
}
|
79
79
|
|
@@ -89,11 +89,11 @@ export class XLink extends XElement {
|
|
89
89
|
if (!newValue) {
|
90
90
|
newValue = '';
|
91
91
|
}
|
92
|
-
let href:
|
92
|
+
let href: Platform.DevToolsPath.UrlString|null = null;
|
93
93
|
let url: URL|null = null;
|
94
94
|
try {
|
95
|
-
url = new URL(addReferrerToURLIfNecessary(newValue));
|
96
|
-
href = url.toString();
|
95
|
+
url = new URL(addReferrerToURLIfNecessary(newValue as Platform.DevToolsPath.UrlString));
|
96
|
+
href = url.toString() as Platform.DevToolsPath.UrlString;
|
97
97
|
} catch {
|
98
98
|
}
|
99
99
|
if (url && url.protocol === 'javascript:') {
|
@@ -147,8 +147,7 @@ export class ContextMenuProvider implements Provider {
|
|
147
147
|
const node: XLink = targetNode;
|
148
148
|
contextMenu.revealSection().appendItem(openLinkExternallyLabel(), () => {
|
149
149
|
if (node.href) {
|
150
|
-
Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(
|
151
|
-
node.href as Platform.DevToolsPath.UrlString);
|
150
|
+
Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(node.href);
|
152
151
|
}
|
153
152
|
});
|
154
153
|
contextMenu.revealSection().appendItem(copyLinkAddressLabel(), () => {
|
@@ -359,10 +359,8 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
359
359
|
}
|
360
360
|
|
361
361
|
private static showHelp(): void {
|
362
|
-
|
363
|
-
|
364
|
-
UI.UIUtils.addReferrerToURL('https://web.dev/color-and-contrast-accessibility/') as
|
365
|
-
Platform.DevToolsPath.UrlString);
|
362
|
+
Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(UI.UIUtils.addReferrerToURL(
|
363
|
+
'https://web.dev/color-and-contrast-accessibility/' as Platform.DevToolsPath.UrlString));
|
366
364
|
}
|
367
365
|
|
368
366
|
setVisible(visible: boolean): void {
|
@@ -392,7 +392,7 @@ export class ObjectPropertiesSection extends UI.TreeOutline.TreeOutlineInShadow
|
|
392
392
|
const rawLocation = value.debuggerModel().createRawLocationByScriptId(
|
393
393
|
value.value.scriptId, value.value.lineNumber, value.value.columnNumber);
|
394
394
|
if (rawLocation && linkifier) {
|
395
|
-
return new ObjectPropertyValue(linkifier.linkifyRawLocation(rawLocation,
|
395
|
+
return new ObjectPropertyValue(linkifier.linkifyRawLocation(rawLocation, Platform.DevToolsPath.EmptyUrlString));
|
396
396
|
}
|
397
397
|
propertyValue = new ObjectPropertyValue(createUnknownInternalLocationElement());
|
398
398
|
} else if (type === 'string' && typeof description === 'string') {
|
@@ -9,8 +9,6 @@ import * as SourceFrame from '../source_frame/source_frame.js';
|
|
9
9
|
import type * as Platform from '../../../../core/platform/platform.js';
|
10
10
|
import type * as Protocol from '../../../../generated/protocol.js';
|
11
11
|
|
12
|
-
// TODO(crbug.com/1253323): Casts to UrlString will be removed from this file when migration to branded types is complete.
|
13
|
-
|
14
12
|
let performanceInstance: Performance;
|
15
13
|
|
16
14
|
export class Performance {
|
@@ -2,8 +2,6 @@
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
3
3
|
// found in the LICENSE file.
|
4
4
|
|
5
|
-
// TODO(crbug.com/1253323): Casts to UrlString will be removed from this file when migration to branded types is complete.
|
6
|
-
|
7
5
|
import * as Common from '../../../../core/common/common.js';
|
8
6
|
import * as Host from '../../../../core/host/host.js';
|
9
7
|
import * as i18n from '../../../../core/i18n/i18n.js';
|
@@ -116,8 +114,7 @@ export class ImagePreview {
|
|
116
114
|
|
117
115
|
// Open image in new tab.
|
118
116
|
link.addEventListener('click', () => {
|
119
|
-
Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(
|
120
|
-
imageURL as Platform.DevToolsPath.UrlString);
|
117
|
+
Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(imageURL);
|
121
118
|
});
|
122
119
|
|
123
120
|
const intrinsicWidth = imageElement.naturalWidth;
|
@@ -162,8 +159,7 @@ export class ImagePreview {
|
|
162
159
|
HTMLLinkElement);
|
163
160
|
sourceLink.textContent = sourceText;
|
164
161
|
sourceLink.addEventListener('click', () => {
|
165
|
-
Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(
|
166
|
-
imageURL as Platform.DevToolsPath.UrlString);
|
162
|
+
Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(imageURL);
|
167
163
|
});
|
168
164
|
resolve(shadowBoundary);
|
169
165
|
}
|
@@ -196,7 +192,7 @@ export class ImagePreview {
|
|
196
192
|
}
|
197
193
|
}
|
198
194
|
|
199
|
-
static defaultAltTextForImageURL(url:
|
195
|
+
static defaultAltTextForImageURL(url: Platform.DevToolsPath.UrlString): string {
|
200
196
|
const parsedImageURL = new Common.ParsedURL.ParsedURL(url);
|
201
197
|
const imageSourceText = parsedImageURL.isValid ? parsedImageURL.displayName : i18nString(UIStrings.unknownSource);
|
202
198
|
return i18nString(UIStrings.imageFromS, {PH1: imageSourceText});
|
@@ -28,12 +28,10 @@
|
|
28
28
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
29
|
*/
|
30
30
|
|
31
|
-
// TODO(crbug.com/1253323): 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';
|
36
|
-
import
|
34
|
+
import * as Platform from '../../../../core/platform/platform.js';
|
37
35
|
import * as SDK from '../../../../core/sdk/sdk.js';
|
38
36
|
import * as Bindings from '../../../../models/bindings/bindings.js';
|
39
37
|
import * as TextUtils from '../../../../models/text_utils/text_utils.js';
|
@@ -195,8 +193,9 @@ export class Linkifier implements SDK.TargetManager.Observer {
|
|
195
193
|
}
|
196
194
|
|
197
195
|
maybeLinkifyScriptLocation(
|
198
|
-
target: SDK.Target.Target|null, scriptId: Protocol.Runtime.ScriptId|null,
|
199
|
-
lineNumber: number|undefined, options?: LinkifyOptions): HTMLElement
|
196
|
+
target: SDK.Target.Target|null, scriptId: Protocol.Runtime.ScriptId|null,
|
197
|
+
sourceURL: Platform.DevToolsPath.UrlString, lineNumber: number|undefined, options?: LinkifyOptions): HTMLElement
|
198
|
+
|null {
|
200
199
|
let fallbackAnchor: HTMLElement|null = null;
|
201
200
|
const linkifyURLOptions: LinkifyURLOptions = {
|
202
201
|
lineNumber,
|
@@ -267,8 +266,8 @@ export class Linkifier implements SDK.TargetManager.Observer {
|
|
267
266
|
}
|
268
267
|
|
269
268
|
linkifyScriptLocation(
|
270
|
-
target: SDK.Target.Target|null, scriptId: Protocol.Runtime.ScriptId|null,
|
271
|
-
lineNumber: number|undefined, options?: LinkifyOptions): HTMLElement {
|
269
|
+
target: SDK.Target.Target|null, scriptId: Protocol.Runtime.ScriptId|null,
|
270
|
+
sourceURL: Platform.DevToolsPath.UrlString, lineNumber: number|undefined, options?: LinkifyOptions): HTMLElement {
|
272
271
|
const scriptLink = this.maybeLinkifyScriptLocation(target, scriptId, sourceURL, lineNumber, options);
|
273
272
|
const linkifyURLOptions: LinkifyURLOptions = {
|
274
273
|
lineNumber,
|
@@ -283,7 +282,9 @@ export class Linkifier implements SDK.TargetManager.Observer {
|
|
283
282
|
return scriptLink || Linkifier.linkifyURL(sourceURL, linkifyURLOptions);
|
284
283
|
}
|
285
284
|
|
286
|
-
linkifyRawLocation(
|
285
|
+
linkifyRawLocation(
|
286
|
+
rawLocation: SDK.DebuggerModel.Location, fallbackUrl: Platform.DevToolsPath.UrlString,
|
287
|
+
className?: string): Element {
|
287
288
|
return this.linkifyScriptLocation(
|
288
289
|
rawLocation.debuggerModel.target(), rawLocation.scriptId, fallbackUrl, rawLocation.lineNumber, {
|
289
290
|
columnNumber: rawLocation.columnNumber,
|
@@ -303,7 +304,8 @@ export class Linkifier implements SDK.TargetManager.Observer {
|
|
303
304
|
className: options?.className,
|
304
305
|
};
|
305
306
|
return this.maybeLinkifyScriptLocation(
|
306
|
-
target, callFrame.scriptId, callFrame.url, callFrame.lineNumber,
|
307
|
+
target, callFrame.scriptId, callFrame.url as Platform.DevToolsPath.UrlString, callFrame.lineNumber,
|
308
|
+
linkifyOptions);
|
307
309
|
}
|
308
310
|
|
309
311
|
linkifyStackTraceTopFrame(target: SDK.Target.Target, stackTrace: Protocol.Runtime.StackTrace, className?: string):
|
@@ -311,7 +313,7 @@ export class Linkifier implements SDK.TargetManager.Observer {
|
|
311
313
|
console.assert(stackTrace.callFrames.length > 0);
|
312
314
|
|
313
315
|
const {url, lineNumber, columnNumber} = stackTrace.callFrames[0];
|
314
|
-
const fallbackAnchor = Linkifier.linkifyURL(url, {
|
316
|
+
const fallbackAnchor = Linkifier.linkifyURL(url as Platform.DevToolsPath.UrlString, {
|
315
317
|
className,
|
316
318
|
lineNumber,
|
317
319
|
columnNumber,
|
@@ -478,7 +480,7 @@ export class Linkifier implements SDK.TargetManager.Observer {
|
|
478
480
|
info.icon = icon;
|
479
481
|
}
|
480
482
|
|
481
|
-
static linkifyURL(url:
|
483
|
+
static linkifyURL(url: Platform.DevToolsPath.UrlString, options?: LinkifyURLOptions): HTMLElement {
|
482
484
|
options = options || {
|
483
485
|
showColumnNumber: false,
|
484
486
|
inlineFrameIndex: 0,
|
@@ -500,7 +502,7 @@ export class Linkifier implements SDK.TargetManager.Observer {
|
|
500
502
|
return element;
|
501
503
|
}
|
502
504
|
|
503
|
-
let linkText = text || Bindings.ResourceUtils.displayNameForURL(url
|
505
|
+
let linkText = text || Bindings.ResourceUtils.displayNameForURL(url);
|
504
506
|
if (typeof lineNumber === 'number' && !text) {
|
505
507
|
linkText += ':' + (lineNumber + 1);
|
506
508
|
if (showColumnNumber && typeof columnNumber === 'number') {
|
@@ -508,7 +510,7 @@ export class Linkifier implements SDK.TargetManager.Observer {
|
|
508
510
|
}
|
509
511
|
}
|
510
512
|
const title = linkText !== url ? url : '';
|
511
|
-
const linkOptions = {maxLength, title, href: url, preventClick, tabStop: options.tabStop, bypassURLTrimming};
|
513
|
+
const linkOptions = {maxLength, title, href: (url), preventClick, tabStop: options.tabStop, bypassURLTrimming};
|
512
514
|
const {link, linkInfo} = Linkifier.createLink(linkText, className, linkOptions);
|
513
515
|
if (lineNumber) {
|
514
516
|
linkInfo.lineNumber = lineNumber;
|
@@ -520,11 +522,11 @@ export class Linkifier implements SDK.TargetManager.Observer {
|
|
520
522
|
}
|
521
523
|
|
522
524
|
static linkifyRevealable(
|
523
|
-
revealable: Object, text: string|HTMLElement, fallbackHref?:
|
525
|
+
revealable: Object, text: string|HTMLElement, fallbackHref?: Platform.DevToolsPath.UrlString, title?: string,
|
524
526
|
className?: string): HTMLElement {
|
525
527
|
const createLinkOptions: _CreateLinkOptions = {
|
526
528
|
maxLength: UI.UIUtils.MaxLengthForDisplayedURLs,
|
527
|
-
href: fallbackHref,
|
529
|
+
href: (fallbackHref),
|
528
530
|
title,
|
529
531
|
};
|
530
532
|
const {link, linkInfo} = Linkifier.createLink(text, className || '', createLinkOptions);
|
@@ -708,20 +710,19 @@ export class Linkifier implements SDK.TargetManager.Observer {
|
|
708
710
|
return result;
|
709
711
|
}
|
710
712
|
|
711
|
-
let url =
|
713
|
+
let url = Platform.DevToolsPath.EmptyUrlString;
|
712
714
|
let uiLocation: Workspace.UISourceCode.UILocation|(Workspace.UISourceCode.UILocation | null)|null = null;
|
713
715
|
if (info.uiLocation) {
|
714
716
|
uiLocation = info.uiLocation;
|
715
717
|
url = uiLocation.uiSourceCode.contentURL();
|
716
718
|
} else if (info.url) {
|
717
719
|
url = info.url;
|
718
|
-
const uiSourceCode =
|
719
|
-
Workspace.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(url as Platform.DevToolsPath.UrlString) ||
|
720
|
+
const uiSourceCode = Workspace.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(url) ||
|
720
721
|
Workspace.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(
|
721
722
|
Common.ParsedURL.ParsedURL.urlWithoutHash(url) as Platform.DevToolsPath.UrlString);
|
722
723
|
uiLocation = uiSourceCode ? uiSourceCode.uiLocation(info.lineNumber || 0, info.columnNumber || 0) : null;
|
723
724
|
}
|
724
|
-
const resource = url ? Bindings.ResourceUtils.resourceForURL(url
|
725
|
+
const resource = url ? Bindings.ResourceUtils.resourceForURL(url) : null;
|
725
726
|
const contentProvider = uiLocation ? uiLocation.uiSourceCode : resource;
|
726
727
|
|
727
728
|
const revealable = info.revealable || uiLocation || resource;
|
@@ -756,8 +757,7 @@ export class Linkifier implements SDK.TargetManager.Observer {
|
|
756
757
|
result.push({
|
757
758
|
section: 'reveal',
|
758
759
|
title: UI.UIUtils.openLinkExternallyLabel(),
|
759
|
-
handler: (): void => Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(
|
760
|
-
url as Platform.DevToolsPath.UrlString),
|
760
|
+
handler: (): void => Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(url),
|
761
761
|
});
|
762
762
|
result.push({
|
763
763
|
section: 'clipboard',
|
@@ -953,7 +953,7 @@ export interface _LinkInfo {
|
|
953
953
|
enableDecorator: boolean;
|
954
954
|
uiLocation: Workspace.UISourceCode.UILocation|null;
|
955
955
|
liveLocation: Bindings.LiveLocation.LiveLocation|null;
|
956
|
-
url:
|
956
|
+
url: Platform.DevToolsPath.UrlString|null;
|
957
957
|
lineNumber: number|null;
|
958
958
|
columnNumber: number|null;
|
959
959
|
inlineFrameIndex: number;
|
@@ -987,7 +987,7 @@ export interface LinkifyOptions {
|
|
987
987
|
export interface _CreateLinkOptions {
|
988
988
|
maxLength?: number;
|
989
989
|
title?: string;
|
990
|
-
href?:
|
990
|
+
href?: Platform.DevToolsPath.UrlString;
|
991
991
|
preventClick?: boolean;
|
992
992
|
tabStop?: boolean;
|
993
993
|
bypassURLTrimming?: boolean;
|
@@ -180,7 +180,7 @@ it. */
|
|
180
180
|
.toolbar-button.copied-to-clipboard::after {
|
181
181
|
content: attr(data-content);
|
182
182
|
position: fixed;
|
183
|
-
top: var(--toolbar-height);
|
183
|
+
margin-top: calc(2 * var(--toolbar-height));
|
184
184
|
padding: 3px 5px;
|
185
185
|
color: var(--color-text-secondary);
|
186
186
|
background: var(--color-background-elevation-1);
|
@@ -9,6 +9,8 @@ export {Directive, type TemplateResult} from '../../third_party/lit-html/lit-htm
|
|
9
9
|
const {render, svg, Directives, nothing, noChange} = LitHtml;
|
10
10
|
const {html, literal, flattenTemplate} = Static;
|
11
11
|
|
12
|
+
type LitTemplate = LitHtml.TemplateResult|typeof nothing;
|
13
|
+
|
12
14
|
export {
|
13
15
|
render,
|
14
16
|
Directives,
|
@@ -18,4 +20,5 @@ export {
|
|
18
20
|
html,
|
19
21
|
literal,
|
20
22
|
flattenTemplate, // Exposed for unit testing.
|
23
|
+
type LitTemplate,
|
21
24
|
};
|
package/package.json
CHANGED
@@ -31,6 +31,19 @@ ruleTester.run('lit_template_result_or_nothing', rule, {
|
|
31
31
|
code: 'function foo(): LitHtml.TemplateResult|string {}',
|
32
32
|
filename: 'front_end/components/datagrid.ts',
|
33
33
|
},
|
34
|
+
{
|
35
|
+
// No return type in class method should be valid
|
36
|
+
code: `class Foo {
|
37
|
+
constructor() {
|
38
|
+
}
|
39
|
+
}`,
|
40
|
+
filename: 'front_end/components/datagrid.ts',
|
41
|
+
},
|
42
|
+
{
|
43
|
+
// No return type in class method should be valid
|
44
|
+
code: 'function foo() {}',
|
45
|
+
filename: 'front_end/components/datagrid.ts',
|
46
|
+
},
|
34
47
|
],
|
35
48
|
invalid: [
|
36
49
|
{
|