chrome-devtools-frontend 1.0.1548980 → 1.0.1549484
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/docs/contributing/settings-experiments-features.md +35 -0
- package/docs/styleguide/ux/patterns.md +27 -0
- package/eslint.config.mjs +1 -0
- package/front_end/Tests.js +2 -0
- package/front_end/core/host/InspectorFrontendHost.ts +26 -558
- package/front_end/core/host/InspectorFrontendHostAPI.ts +6 -3
- package/front_end/core/host/InspectorFrontendHostStub.ts +558 -0
- package/front_end/core/host/ResourceLoader.ts +9 -23
- package/front_end/core/host/UserMetrics.ts +4 -4
- package/front_end/core/root/DevToolsContext.ts +4 -0
- package/front_end/core/root/Runtime.ts +10 -0
- package/front_end/core/sdk/CSSMatchedStyles.ts +2 -2
- package/front_end/core/sdk/CSSModel.ts +24 -24
- package/front_end/core/sdk/CSSPropertyParserMatchers.ts +11 -11
- package/front_end/core/sdk/CSSQuery.ts +1 -1
- package/front_end/core/sdk/CSSRule.ts +2 -2
- package/front_end/core/sdk/CSSStyleDeclaration.ts +1 -1
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +1 -1
- package/front_end/core/sdk/DOMModel.ts +3 -0
- package/front_end/core/sdk/NetworkManager.ts +29 -31
- package/front_end/core/sdk/NetworkRequest.ts +4 -0
- package/front_end/core/sdk/OverlayModel.ts +2 -2
- package/front_end/core/sdk/PageResourceLoader.ts +63 -37
- package/front_end/core/sdk/SourceMap.ts +6 -0
- package/front_end/core/sdk/SourceMapCache.ts +21 -0
- package/front_end/core/sdk/SourceMapManager.ts +7 -6
- package/front_end/core/sdk/SourceMapScopesInfo.ts +6 -2
- package/front_end/core/sdk/TargetManager.ts +14 -2
- package/front_end/core/sdk/sdk-meta.ts +13 -0
- package/front_end/entrypoints/formatter_worker/FormatterActions.ts +1 -0
- package/front_end/entrypoints/formatter_worker/ScopeParser.ts +1 -1
- package/front_end/entrypoints/main/MainImpl.ts +13 -3
- package/front_end/foundation/Universe.ts +1 -1
- package/front_end/generated/Deprecation.ts +18 -4
- package/front_end/generated/InspectorBackendCommands.ts +33 -31
- package/front_end/generated/SupportedCSSProperties.js +41 -41
- package/front_end/generated/protocol-mapping.d.ts +12 -0
- package/front_end/generated/protocol-proxy-api.d.ts +11 -0
- package/front_end/generated/protocol.ts +70 -35
- package/front_end/models/ai_assistance/AiConversation.ts +5 -4
- package/front_end/models/ai_assistance/ChangeManager.ts +4 -4
- package/front_end/models/ai_assistance/ConversationHandler.ts +0 -15
- package/front_end/models/ai_assistance/agents/AiAgent.ts +9 -6
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +135 -3
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +24 -0
- package/front_end/models/bindings/CompilerScriptMapping.ts +43 -0
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +19 -0
- package/front_end/models/bindings/ResourceMapping.ts +73 -0
- package/front_end/models/bindings/ResourceScriptMapping.ts +50 -0
- package/front_end/models/issues_manager/GenericIssue.ts +17 -0
- package/front_end/models/issues_manager/descriptions/genericNavigationEntryMarkedSkippable.md +7 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +7 -3
- package/front_end/models/source_map_scopes/FunctionCodeResolver.snapshot.txt +98 -0
- package/front_end/models/source_map_scopes/FunctionCodeResolver.ts +270 -0
- package/front_end/models/source_map_scopes/source_map_scopes.ts +2 -0
- package/front_end/models/workspace/UISourceCode.ts +51 -44
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +76 -34
- package/front_end/panels/ai_assistance/aiAssistancePanel.css +1 -0
- package/front_end/panels/ai_assistance/components/ChatView.ts +23 -11
- package/front_end/panels/application/AppManifestView.ts +3 -2
- package/front_end/panels/application/FrameDetailsView.ts +5 -6
- package/front_end/panels/application/ServiceWorkersView.ts +2 -2
- package/front_end/panels/application/TrustTokensTreeElement.ts +2 -6
- package/front_end/panels/application/components/PermissionsPolicySection.ts +201 -157
- package/front_end/panels/application/components/ProtocolHandlersView.ts +117 -80
- package/front_end/panels/application/components/ServiceWorkerRouterView.ts +47 -41
- package/front_end/panels/application/components/StorageMetadataView.ts +31 -34
- package/front_end/panels/application/components/TrustTokensView.ts +76 -68
- package/front_end/panels/console/ConsoleView.ts +3 -2
- package/front_end/panels/console/ConsoleViewMessage.ts +6 -4
- package/front_end/panels/console/console-meta.ts +0 -13
- package/front_end/panels/developer_resources/DeveloperResourcesView.ts +3 -1
- package/front_end/panels/elements/CSSRuleValidator.ts +7 -7
- package/front_end/panels/elements/CSSRuleValidatorHelper.ts +2 -2
- package/front_end/panels/elements/ElementsTreeElement.ts +16 -13
- package/front_end/panels/elements/ElementsTreeOutline.ts +2 -1
- package/front_end/panels/elements/LayoutPane.ts +12 -10
- package/front_end/panels/elements/StylePropertyTreeElement.ts +12 -12
- package/front_end/panels/elements/components/AdornerManager.ts +3 -3
- package/front_end/panels/elements/components/StylePropertyEditor.ts +6 -6
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts +27 -49
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +15 -11
- package/front_end/panels/media/PlayerListView.ts +100 -73
- package/front_end/panels/media/playerListView.css +5 -0
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +3 -3
- package/front_end/panels/network/RequestConditionsDrawer.ts +5 -5
- package/front_end/panels/network/components/DirectSocketConnectionView.ts +17 -0
- package/front_end/panels/network/resourceChunkView.css +4 -0
- package/front_end/panels/security/CookieControlsView.ts +1 -1
- package/front_end/panels/sensors/LocationsSettingsTab.ts +1 -1
- package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +1 -1
- package/front_end/panels/settings/KeybindsSettingsTab.ts +1 -1
- package/front_end/panels/settings/SettingsScreen.ts +6 -6
- package/front_end/panels/settings/WorkspaceSettingsTab.ts +1 -1
- package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +1 -1
- package/front_end/panels/snippets/SnippetsQuickOpen.ts +4 -2
- package/front_end/panels/sources/CSSPlugin.ts +1 -1
- package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +13 -5
- package/front_end/panels/sources/GoToLineQuickOpen.ts +4 -2
- package/front_end/panels/sources/NavigatorView.ts +2 -2
- package/front_end/panels/sources/OpenFileQuickOpen.ts +7 -8
- package/front_end/panels/sources/OutlineQuickOpen.ts +6 -3
- package/front_end/panels/sources/ProfilePlugin.ts +21 -12
- package/front_end/panels/sources/UISourceCodeFrame.ts +0 -1
- package/front_end/panels/sources/filteredUISourceCodeListProvider.css +41 -0
- package/front_end/panels/timeline/TimelinePanel.ts +17 -18
- package/front_end/panels/timeline/TimelineSelectorStatsView.ts +3 -3
- package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +2 -2
- package/front_end/panels/timeline/docs/flame_chart_migration.md +11 -16
- package/front_end/panels/utils/utils.ts +17 -3
- package/front_end/panels/whats_new/ReleaseNoteText.ts +10 -20
- package/front_end/panels/whats_new/resources/WNDT.md +8 -8
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer/third_party/mitt/README.chromium +1 -0
- package/front_end/third_party/puppeteer/third_party/parsel/README.chromium +1 -0
- package/front_end/third_party/puppeteer/third_party/rxjs/README.chromium +1 -0
- package/front_end/ui/components/adorners/Adorner.ts +1 -1
- package/front_end/ui/components/annotations/AnnotationRepository.ts +98 -0
- package/front_end/ui/components/annotations/AnnotationType.ts +10 -0
- package/front_end/ui/components/annotations/annotations.ts +6 -0
- package/front_end/ui/components/buttons/Button.ts +1 -1
- package/front_end/ui/components/buttons/FloatingButton.ts +1 -1
- package/front_end/ui/components/chrome_link/ChromeLink.ts +1 -1
- package/front_end/ui/components/dialogs/ButtonDialog.ts +1 -1
- package/front_end/ui/components/dialogs/Dialog.ts +1 -1
- package/front_end/ui/components/dialogs/ShortcutDialog.ts +1 -0
- package/front_end/ui/components/diff_view/DiffView.ts +1 -1
- package/front_end/ui/components/expandable_list/ExpandableList.ts +1 -1
- package/front_end/ui/components/highlighting/HighlightElement.ts +1 -0
- package/front_end/ui/components/highlighting/MarkupHighlight.ts +162 -0
- package/front_end/ui/components/highlighting/highlighting.ts +7 -0
- package/front_end/ui/components/icon_button/FileSourceIcon.ts +1 -1
- package/front_end/ui/components/icon_button/Icon.ts +4 -2
- package/front_end/ui/components/icon_button/IconButton.ts +1 -1
- package/front_end/ui/components/issue_counter/IssueCounter.ts +1 -1
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +1 -1
- package/front_end/ui/components/legacy_wrapper/LegacyWrapper.ts +1 -1
- package/front_end/ui/components/linkifier/LinkifierImpl.ts +1 -1
- package/front_end/ui/components/list/List.ts +184 -0
- package/front_end/ui/components/list/list.css +90 -0
- package/front_end/ui/components/{cards/cards.ts → list/lists.ts} +3 -3
- package/front_end/ui/components/markdown_view/CodeBlock.ts +1 -1
- package/front_end/ui/components/markdown_view/MarkdownImage.ts +1 -1
- package/front_end/ui/components/markdown_view/MarkdownLink.ts +1 -1
- package/front_end/ui/components/markdown_view/MarkdownView.ts +1 -1
- package/front_end/ui/components/menus/Menu.ts +1 -1
- package/front_end/ui/components/menus/SelectMenu.ts +1 -1
- package/front_end/ui/components/node_text/NodeText.ts +1 -1
- package/front_end/ui/components/panel_feedback/FeedbackButton.ts +1 -1
- package/front_end/ui/components/panel_feedback/PanelFeedback.ts +1 -1
- package/front_end/ui/components/panel_feedback/PreviewToggle.ts +1 -1
- package/front_end/ui/components/panel_introduction_steps/PanelIntroductionSteps.ts +1 -1
- package/front_end/ui/components/report_view/ReportView.ts +1 -1
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -1
- package/front_end/ui/components/settings/SettingCheckbox.ts +1 -1
- package/front_end/ui/components/settings/SettingDeprecationWarning.ts +1 -1
- package/front_end/ui/components/snackbars/Snackbar.ts +1 -1
- package/front_end/ui/components/spinners/Spinner.ts +1 -1
- package/front_end/ui/components/srgb_overlay/SrgbOverlay.ts +1 -1
- package/front_end/ui/components/suggestion_input/SuggestionInput.ts +1 -0
- package/front_end/ui/components/survey_link/SurveyLink.ts +1 -1
- package/front_end/ui/components/switch/SwitchImpl.ts +1 -1
- package/front_end/ui/components/text_editor/TextEditor.ts +1 -0
- package/front_end/ui/components/text_prompt/TextPrompt.ts +1 -1
- package/front_end/ui/components/tooltips/Tooltip.ts +1 -1
- package/front_end/ui/components/tree_outline/TreeOutline.ts +1 -1
- package/front_end/ui/kit/kit.ts +5 -0
- package/front_end/ui/legacy/TabbedPane.ts +98 -0
- package/front_end/ui/legacy/UIUtils.ts +0 -184
- package/front_end/ui/legacy/ViewManager.ts +23 -8
- package/front_end/ui/legacy/ViewRegistration.ts +21 -22
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +5 -4
- package/front_end/ui/legacy/components/perf_ui/LineLevelProfile.ts +73 -35
- package/front_end/ui/legacy/components/perf_ui/LiveHeapProfile.ts +11 -2
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +12 -13
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +7 -16
- package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +5 -6
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +18 -65
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +2 -1
- package/front_end/ui/legacy/tabbedPane.css +10 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
- package/inspector_overlay/README.md +3 -3
- package/mcp/HostBindings.ts +310 -0
- package/mcp/mcp.ts +17 -0
- package/mcp/tsconfig.json +6 -1
- package/package.json +26 -24
- /package/front_end/ui/{components → kit}/cards/Card.ts +0 -0
- /package/front_end/ui/{components → kit}/cards/card.css +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright 2022 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
5
4
|
|
|
6
5
|
import '../../../ui/components/icon_button/icon_button.js';
|
|
7
6
|
|
|
@@ -12,13 +11,18 @@ import * as Buttons from '../../../ui/components/buttons/buttons.js';
|
|
|
12
11
|
import * as Input from '../../../ui/components/input/input.js';
|
|
13
12
|
import * as uiI18n from '../../../ui/i18n/i18n.js';
|
|
14
13
|
import * as UI from '../../../ui/legacy/legacy.js';
|
|
15
|
-
import
|
|
14
|
+
import {
|
|
15
|
+
html,
|
|
16
|
+
i18nTemplate as unboundI18nTemplate,
|
|
17
|
+
type LitTemplate,
|
|
18
|
+
nothing,
|
|
19
|
+
render,
|
|
20
|
+
type TemplateResult
|
|
21
|
+
} from '../../../ui/lit/lit.js';
|
|
16
22
|
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
|
|
17
23
|
|
|
18
24
|
import protocolHandlersViewStyles from './protocolHandlersView.css.js';
|
|
19
25
|
|
|
20
|
-
const {html} = Lit;
|
|
21
|
-
|
|
22
26
|
const PROTOCOL_DOCUMENT_URL = 'https://web.dev/url-protocol-handler/';
|
|
23
27
|
const UIStrings = {
|
|
24
28
|
/**
|
|
@@ -66,6 +70,50 @@ const UIStrings = {
|
|
|
66
70
|
|
|
67
71
|
const str_ = i18n.i18n.registerUIStrings('panels/application/components/ProtocolHandlersView.ts', UIStrings);
|
|
68
72
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
73
|
+
const i18nTemplate = unboundI18nTemplate.bind(undefined, str_);
|
|
74
|
+
|
|
75
|
+
function renderStatusMessage(
|
|
76
|
+
protocolHandlers: readonly ProtocolHandler[], manifestLink: Platform.DevToolsPath.UrlString): TemplateResult {
|
|
77
|
+
const manifestInTextLink =
|
|
78
|
+
UI.XLink.XLink.create(manifestLink, i18nString(UIStrings.manifest), undefined, undefined, 'manifest');
|
|
79
|
+
const statusString = protocolHandlers.length > 0 ? UIStrings.protocolDetected : UIStrings.protocolNotDetected;
|
|
80
|
+
// clang-format off
|
|
81
|
+
return html`
|
|
82
|
+
<div class="protocol-handlers-row status">
|
|
83
|
+
<devtools-icon class="inline-icon"
|
|
84
|
+
name=${protocolHandlers.length > 0 ? 'check-circle' : 'info'}>
|
|
85
|
+
</devtools-icon>
|
|
86
|
+
${uiI18n.getFormatLocalizedString(str_, statusString, {PH1: manifestInTextLink })}
|
|
87
|
+
</div>`;
|
|
88
|
+
// clang-format on
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function renderProtocolTest(
|
|
92
|
+
protocolHandlers: readonly ProtocolHandler[], queryInputState: string,
|
|
93
|
+
protocolSelectHandler: (evt: HTMLSelectElementEvent) => void,
|
|
94
|
+
queryInputChangeHandler: (evt: HTMLInputElementEvent) => void, testProtocolClickHandler: () => void): LitTemplate {
|
|
95
|
+
if (protocolHandlers.length === 0) {
|
|
96
|
+
return nothing;
|
|
97
|
+
}
|
|
98
|
+
// clang-format off
|
|
99
|
+
return html`
|
|
100
|
+
<div class="protocol-handlers-row">
|
|
101
|
+
<select class="protocol-select" @change=${protocolSelectHandler}
|
|
102
|
+
aria-label=${i18nString(UIStrings.dropdownLabel)}>
|
|
103
|
+
${protocolHandlers.filter(p => p.protocol).map(({protocol}) => html`
|
|
104
|
+
<option value=${protocol} jslog=${VisualLogging.item(protocol).track({click: true})}>
|
|
105
|
+
${protocol}://
|
|
106
|
+
</option>`)}
|
|
107
|
+
</select>
|
|
108
|
+
<input .value=${queryInputState} class="devtools-text-input" type="text"
|
|
109
|
+
@change=${queryInputChangeHandler} aria-label=${i18nString(UIStrings.textboxLabel)}
|
|
110
|
+
placeholder=${i18nString(UIStrings.textboxPlaceholder)} />
|
|
111
|
+
<devtools-button .variant=${Buttons.Button.Variant.PRIMARY} @click=${testProtocolClickHandler}>
|
|
112
|
+
${i18nString(UIStrings.testProtocol)}
|
|
113
|
+
</devtools-button>
|
|
114
|
+
</div>`;
|
|
115
|
+
// clang-format on
|
|
116
|
+
}
|
|
69
117
|
|
|
70
118
|
interface HTMLSelectElementEvent extends Event {
|
|
71
119
|
target: HTMLSelectElement;
|
|
@@ -75,6 +123,38 @@ interface HTMLInputElementEvent extends Event {
|
|
|
75
123
|
target: HTMLInputElement;
|
|
76
124
|
}
|
|
77
125
|
|
|
126
|
+
interface ViewInput {
|
|
127
|
+
protocolHandler: ProtocolHandler[];
|
|
128
|
+
manifestLink: Platform.DevToolsPath.UrlString;
|
|
129
|
+
queryInputState: string;
|
|
130
|
+
protocolSelectHandler: (evt: HTMLSelectElementEvent) => void;
|
|
131
|
+
queryInputChangeHandler: (evt: HTMLInputElementEvent) => void;
|
|
132
|
+
testProtocolClickHandler: () => void;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
type View = (input: ViewInput, output: undefined, target: HTMLElement) => void;
|
|
136
|
+
|
|
137
|
+
const DEFAULT_VIEW: View = (input, _output, target) => {
|
|
138
|
+
// inspectorCommonStyles is used for the <select> styling that is used for the dropdown
|
|
139
|
+
// clang-format off
|
|
140
|
+
render(html`
|
|
141
|
+
<style>${protocolHandlersViewStyles}</style>
|
|
142
|
+
<style>${UI.inspectorCommonStyles}</style>
|
|
143
|
+
<style>${Input.textInputStyles}</style>
|
|
144
|
+
${renderStatusMessage(input.protocolHandler, input.manifestLink)}
|
|
145
|
+
<div class="protocol-handlers-row">
|
|
146
|
+
${i18nTemplate(UIStrings.needHelpReadOur, {PH1: html`
|
|
147
|
+
<x-link href=${PROTOCOL_DOCUMENT_URL} tabindex=0 class="devtools-link" jslog=${
|
|
148
|
+
VisualLogging.link('learn-more').track({click: true, keydown: 'Enter|Space'})}>
|
|
149
|
+
${i18nString(UIStrings.protocolHandlerRegistrations)}
|
|
150
|
+
</x-link>`})}
|
|
151
|
+
</div>
|
|
152
|
+
${renderProtocolTest(input.protocolHandler, input.queryInputState, input.protocolSelectHandler,
|
|
153
|
+
input.queryInputChangeHandler, input.testProtocolClickHandler)}
|
|
154
|
+
`, target);
|
|
155
|
+
// clang-format on
|
|
156
|
+
};
|
|
157
|
+
|
|
78
158
|
export interface ProtocolHandler {
|
|
79
159
|
protocol: string;
|
|
80
160
|
url: string;
|
|
@@ -85,69 +165,39 @@ export interface ProtocolHandlersData {
|
|
|
85
165
|
manifestLink: Platform.DevToolsPath.UrlString;
|
|
86
166
|
}
|
|
87
167
|
|
|
88
|
-
export class ProtocolHandlersView extends
|
|
89
|
-
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
168
|
+
export class ProtocolHandlersView extends UI.Widget.Widget {
|
|
90
169
|
#protocolHandlers: ProtocolHandler[] = [];
|
|
91
170
|
#manifestLink: Platform.DevToolsPath.UrlString = Platform.DevToolsPath.EmptyUrlString;
|
|
92
171
|
#selectedProtocolState = '';
|
|
93
172
|
#queryInputState = '';
|
|
173
|
+
#view: View;
|
|
94
174
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
this.#
|
|
98
|
-
this.#manifestLink = data.manifestLink;
|
|
99
|
-
if (isNewManifest) {
|
|
100
|
-
this.#update();
|
|
101
|
-
}
|
|
175
|
+
constructor(element?: HTMLElement, view: View = DEFAULT_VIEW) {
|
|
176
|
+
super(element, {useShadowDom: false});
|
|
177
|
+
this.#view = view;
|
|
102
178
|
}
|
|
103
179
|
|
|
104
|
-
|
|
105
|
-
this.#
|
|
106
|
-
this
|
|
107
|
-
this.#render();
|
|
180
|
+
set protocolHandlers(protocolHandlers: ProtocolHandler[]) {
|
|
181
|
+
this.#protocolHandlers = protocolHandlers;
|
|
182
|
+
this.requestUpdate();
|
|
108
183
|
}
|
|
109
184
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
UI.XLink.XLink.create(this.#manifestLink, i18nString(UIStrings.manifest), undefined, undefined, 'manifest');
|
|
113
|
-
const statusString = this.#protocolHandlers.length > 0 ? UIStrings.protocolDetected : UIStrings.protocolNotDetected;
|
|
114
|
-
// clang-format off
|
|
115
|
-
return html`
|
|
116
|
-
<div class="protocol-handlers-row status">
|
|
117
|
-
<devtools-icon class="inline-icon"
|
|
118
|
-
name=${this.#protocolHandlers.length > 0 ? 'check-circle' : 'info'}>
|
|
119
|
-
</devtools-icon>
|
|
120
|
-
${uiI18n.getFormatLocalizedString(str_, statusString, {
|
|
121
|
-
PH1: manifestInTextLink,
|
|
122
|
-
})}
|
|
123
|
-
</div>
|
|
124
|
-
`;
|
|
125
|
-
// clang-format on
|
|
185
|
+
get protocolHandlers(): ProtocolHandler[] {
|
|
186
|
+
return this.#protocolHandlers;
|
|
126
187
|
}
|
|
127
188
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
189
|
+
set manifestLink(manifestLink: Platform.DevToolsPath.UrlString) {
|
|
190
|
+
const isNewManifest = this.#manifestLink !== manifestLink;
|
|
191
|
+
this.#manifestLink = manifestLink;
|
|
192
|
+
if (isNewManifest) {
|
|
193
|
+
this.#queryInputState = '';
|
|
194
|
+
this.#selectedProtocolState = this.#protocolHandlers[0]?.protocol ?? '';
|
|
131
195
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return html`
|
|
138
|
-
<div class="protocol-handlers-row">
|
|
139
|
-
<select class="protocol-select" @change=${this.#handleProtocolSelect} aria-label=${
|
|
140
|
-
i18nString(UIStrings.dropdownLabel)}>
|
|
141
|
-
${protocolOptions}
|
|
142
|
-
</select>
|
|
143
|
-
<input .value=${this.#queryInputState} class="devtools-text-input" type="text" @change=${
|
|
144
|
-
this.#handleQueryInputChange} aria-label=${i18nString(UIStrings.textboxLabel)}
|
|
145
|
-
placeholder=${i18nString(UIStrings.textboxPlaceholder)} />
|
|
146
|
-
<devtools-button .variant=${Buttons.Button.Variant.PRIMARY} @click=${this.#handleTestProtocolClick}>
|
|
147
|
-
${i18nString(UIStrings.testProtocol)}
|
|
148
|
-
</devtools-button>
|
|
149
|
-
</div>
|
|
150
|
-
`;
|
|
196
|
+
this.requestUpdate();
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
get manifestLink(): Platform.DevToolsPath.UrlString {
|
|
200
|
+
return this.#manifestLink;
|
|
151
201
|
}
|
|
152
202
|
|
|
153
203
|
#handleProtocolSelect = (evt: HTMLSelectElementEvent): void => {
|
|
@@ -156,7 +206,7 @@ export class ProtocolHandlersView extends HTMLElement {
|
|
|
156
206
|
|
|
157
207
|
#handleQueryInputChange = (evt: HTMLInputElementEvent): void => {
|
|
158
208
|
this.#queryInputState = evt.target.value;
|
|
159
|
-
this
|
|
209
|
+
this.requestUpdate();
|
|
160
210
|
};
|
|
161
211
|
|
|
162
212
|
#handleTestProtocolClick = (): void => {
|
|
@@ -165,29 +215,16 @@ export class ProtocolHandlersView extends HTMLElement {
|
|
|
165
215
|
Host.userMetrics.actionTaken(Host.UserMetrics.Action.CaptureTestProtocolClicked);
|
|
166
216
|
};
|
|
167
217
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
${uiI18n.getFormatLocalizedString(str_, UIStrings.needHelpReadOur, {PH1: protocolDocLink})}
|
|
180
|
-
</div>
|
|
181
|
-
${this.#renderProtocolTest()}
|
|
182
|
-
`, this.#shadow, {host: this});
|
|
183
|
-
// clang-format on
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
customElements.define('devtools-protocol-handlers-view', ProtocolHandlersView);
|
|
188
|
-
|
|
189
|
-
declare global {
|
|
190
|
-
interface HTMLElementTagNameMap {
|
|
191
|
-
'devtools-protocol-handlers-view': ProtocolHandlersView;
|
|
218
|
+
override performUpdate(): void {
|
|
219
|
+
this.#view(
|
|
220
|
+
{
|
|
221
|
+
protocolHandler: this.#protocolHandlers,
|
|
222
|
+
manifestLink: this.#manifestLink,
|
|
223
|
+
queryInputState: this.#queryInputState,
|
|
224
|
+
protocolSelectHandler: this.#handleProtocolSelect,
|
|
225
|
+
queryInputChangeHandler: this.#handleQueryInputChange,
|
|
226
|
+
testProtocolClickHandler: this.#handleTestProtocolClick,
|
|
227
|
+
},
|
|
228
|
+
undefined, this.contentElement);
|
|
192
229
|
}
|
|
193
230
|
}
|
|
@@ -1,61 +1,67 @@
|
|
|
1
1
|
// Copyright 2023 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
5
4
|
|
|
6
5
|
import type * as SDK from '../../../core/sdk/sdk.js';
|
|
7
|
-
import * as
|
|
8
|
-
import
|
|
6
|
+
import * as UI from '../../../ui/legacy/legacy.js';
|
|
7
|
+
import {html, render, type TemplateResult} from '../../../ui/lit/lit.js';
|
|
9
8
|
|
|
10
9
|
import serviceWorkerRouterViewStyles from './serviceWorkerRouterView.css.js';
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
function renderRouterRule(rule: SDK.ServiceWorkerManager.ServiceWorkerRouterRule): TemplateResult {
|
|
12
|
+
return html`
|
|
13
|
+
<li class="router-rule">
|
|
14
|
+
<div class="rule-id">Rule ${rule.id}</div>
|
|
15
|
+
<ul class="item">
|
|
16
|
+
<li class="condition">
|
|
17
|
+
<div class="rule-type">Condition</div>
|
|
18
|
+
<div class="rule-value">${rule.condition}</div>
|
|
19
|
+
</li>
|
|
20
|
+
<li class="source">
|
|
21
|
+
<div class="rule-type">Source</div>
|
|
22
|
+
<div class="rule-value">${rule.source}</div>
|
|
23
|
+
</li>
|
|
24
|
+
</ul>
|
|
25
|
+
</li>`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface ViewInterface {
|
|
29
|
+
rules: SDK.ServiceWorkerManager.ServiceWorkerRouterRule[];
|
|
30
|
+
}
|
|
13
31
|
|
|
14
|
-
|
|
15
|
-
|
|
32
|
+
type View = (input: ViewInterface, output: undefined, target: HTMLElement) => void;
|
|
33
|
+
|
|
34
|
+
const DEFAULT_VIEW: View = (input, _output, target) => {
|
|
35
|
+
// clang-format off
|
|
36
|
+
render(html`
|
|
37
|
+
<style>${serviceWorkerRouterViewStyles}</style>
|
|
38
|
+
<ul class="router-rules">
|
|
39
|
+
${input.rules.map(renderRouterRule)}
|
|
40
|
+
</ul>`, target);
|
|
41
|
+
// clang-format on
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export class ServiceWorkerRouterView extends UI.Widget.Widget {
|
|
16
45
|
#rules: SDK.ServiceWorkerManager.ServiceWorkerRouterRule[] = [];
|
|
46
|
+
#view: View;
|
|
17
47
|
|
|
18
|
-
|
|
48
|
+
constructor(element?: HTMLElement, view = DEFAULT_VIEW) {
|
|
49
|
+
super(element, {useShadowDom: true});
|
|
50
|
+
this.#view = view;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
set rules(rules: SDK.ServiceWorkerManager.ServiceWorkerRouterRule[]) {
|
|
19
54
|
this.#rules = rules;
|
|
20
55
|
if (this.#rules.length > 0) {
|
|
21
|
-
this
|
|
56
|
+
this.requestUpdate();
|
|
22
57
|
}
|
|
23
58
|
}
|
|
24
59
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
render(html`
|
|
28
|
-
<style>${serviceWorkerRouterViewStyles}</style>
|
|
29
|
-
<ul class="router-rules">
|
|
30
|
-
${this.#rules.map(this.#renderRouterRule)}
|
|
31
|
-
</ul>
|
|
32
|
-
`, this.#shadow, {host: this});
|
|
33
|
-
// clang-format on
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
#renderRouterRule(rule: SDK.ServiceWorkerManager.ServiceWorkerRouterRule): Lit.TemplateResult {
|
|
37
|
-
return html`
|
|
38
|
-
<li class="router-rule">
|
|
39
|
-
<div class="rule-id">Rule ${rule.id}</div>
|
|
40
|
-
<ul class="item">
|
|
41
|
-
<li class="condition">
|
|
42
|
-
<div class="rule-type">Condition</div>
|
|
43
|
-
<div class="rule-value">${rule.condition}</div>
|
|
44
|
-
</li>
|
|
45
|
-
<li class="source">
|
|
46
|
-
<div class="rule-type">Source</div>
|
|
47
|
-
<div class="rule-value">${rule.source}</div>
|
|
48
|
-
</li>
|
|
49
|
-
</ul>
|
|
50
|
-
</li>
|
|
51
|
-
`;
|
|
60
|
+
get rules(): SDK.ServiceWorkerManager.ServiceWorkerRouterRule[] {
|
|
61
|
+
return this.#rules;
|
|
52
62
|
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
customElements.define('devtools-service-worker-router-view', ServiceWorkerRouterView);
|
|
56
63
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
'devtools-service-worker-router-view': ServiceWorkerRouterView;
|
|
64
|
+
override performUpdate(): void {
|
|
65
|
+
this.#view({rules: this.#rules}, undefined, this.contentElement);
|
|
60
66
|
}
|
|
61
67
|
}
|
|
@@ -12,12 +12,10 @@ import * as Buttons from '../../../ui/components/buttons/buttons.js';
|
|
|
12
12
|
import * as LegacyWrapper from '../../../ui/components/legacy_wrapper/legacy_wrapper.js';
|
|
13
13
|
import * as RenderCoordinator from '../../../ui/components/render_coordinator/render_coordinator.js';
|
|
14
14
|
import * as UI from '../../../ui/legacy/legacy.js';
|
|
15
|
-
import
|
|
15
|
+
import {html, type LitTemplate, nothing, render, type TemplateResult} from '../../../ui/lit/lit.js';
|
|
16
16
|
|
|
17
17
|
import storageMetadataViewStyle from './storageMetadataView.css.js';
|
|
18
18
|
|
|
19
|
-
const {html} = Lit;
|
|
20
|
-
|
|
21
19
|
const UIStrings = {
|
|
22
20
|
/**
|
|
23
21
|
* @description The origin of a URL (https://web.dev/same-site-same-origin/#origin).
|
|
@@ -147,10 +145,8 @@ export class StorageMetadataView extends LegacyWrapper.LegacyWrapper.WrappableCo
|
|
|
147
145
|
return RenderCoordinator.write('StorageMetadataView render', async () => {
|
|
148
146
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
149
147
|
// clang-format off
|
|
150
|
-
|
|
151
|
-
<style>
|
|
152
|
-
${storageMetadataViewStyle}
|
|
153
|
-
</style>
|
|
148
|
+
render(html`
|
|
149
|
+
<style>${storageMetadataViewStyle}</style>
|
|
154
150
|
<devtools-report .data=${{reportTitle: this.getTitle() ?? i18nString(UIStrings.loading)}}>
|
|
155
151
|
${await this.renderReportContent()}
|
|
156
152
|
</devtools-report>`, this.#shadow, {host: this});
|
|
@@ -167,17 +163,17 @@ export class StorageMetadataView extends LegacyWrapper.LegacyWrapper.WrappableCo
|
|
|
167
163
|
return this.#storageBucketsModel ? `${bucketName} - ${origin}` : origin;
|
|
168
164
|
}
|
|
169
165
|
|
|
170
|
-
key(content: string|
|
|
166
|
+
key(content: string|TemplateResult): TemplateResult {
|
|
171
167
|
return html`<devtools-report-key>${content}</devtools-report-key>`;
|
|
172
168
|
}
|
|
173
169
|
|
|
174
|
-
value(content: string|
|
|
170
|
+
value(content: string|TemplateResult): TemplateResult {
|
|
175
171
|
return html`<devtools-report-value>${content}</devtools-report-value>`;
|
|
176
172
|
}
|
|
177
173
|
|
|
178
|
-
async renderReportContent(): Promise<
|
|
174
|
+
async renderReportContent(): Promise<LitTemplate> {
|
|
179
175
|
if (!this.#storageKey) {
|
|
180
|
-
return
|
|
176
|
+
return nothing;
|
|
181
177
|
}
|
|
182
178
|
const origin = this.#storageKey.origin;
|
|
183
179
|
const ancestorChainHasCrossSite =
|
|
@@ -196,26 +192,28 @@ export class StorageMetadataView extends LegacyWrapper.LegacyWrapper.WrappableCo
|
|
|
196
192
|
|
|
197
193
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
198
194
|
// clang-format off
|
|
199
|
-
|
|
195
|
+
return html`
|
|
200
196
|
${(isIframeOrEmbedded) ?
|
|
201
197
|
html`${this.key(i18nString(UIStrings.origin))}
|
|
202
198
|
${this.value(html`<div class="text-ellipsis" title=${origin}>${origin}</div>`)}`
|
|
203
|
-
:
|
|
204
|
-
${(topLevelSite || topLevelSiteIsOpaque) ?
|
|
205
|
-
|
|
206
|
-
${
|
|
207
|
-
${
|
|
199
|
+
: nothing}
|
|
200
|
+
${(topLevelSite || topLevelSiteIsOpaque) ?
|
|
201
|
+
this.key(i18nString(UIStrings.topLevelSite)) : nothing}
|
|
202
|
+
${topLevelSite ? this.value(topLevelSite) : nothing}
|
|
203
|
+
${topLevelSiteIsOpaque ? this.value(i18nString(UIStrings.opaque)) : nothing}
|
|
204
|
+
${thirdPartyReason ? html`
|
|
205
|
+
${this.key(i18nString(UIStrings.isThirdParty))}${this.value(thirdPartyReason)}` : nothing}
|
|
208
206
|
${hasNonce || topLevelSiteIsOpaque ?
|
|
209
|
-
|
|
210
|
-
${hasNonce ? this.value(i18nString(UIStrings.yes)) :
|
|
207
|
+
this.key(i18nString(UIStrings.isOpaque)) : nothing}
|
|
208
|
+
${hasNonce ? this.value(i18nString(UIStrings.yes)) : nothing}
|
|
211
209
|
${topLevelSiteIsOpaque ?
|
|
212
|
-
|
|
213
|
-
${this.#storageBucket ? this.#renderStorageBucketInfo() :
|
|
214
|
-
${this.#storageBucketsModel ? this.#renderBucketControls() :
|
|
210
|
+
this.value(i18nString(UIStrings.yesBecauseTopLevelIsOpaque)) : nothing}
|
|
211
|
+
${this.#storageBucket ? this.#renderStorageBucketInfo() : nothing}
|
|
212
|
+
${this.#storageBucketsModel ? this.#renderBucketControls() : nothing}`;
|
|
215
213
|
// clang-format on
|
|
216
214
|
}
|
|
217
215
|
|
|
218
|
-
#renderStorageBucketInfo():
|
|
216
|
+
#renderStorageBucketInfo(): LitTemplate {
|
|
219
217
|
if (!this.#storageBucket) {
|
|
220
218
|
throw new Error('Should not call #renderStorageBucketInfo if #bucket is null.');
|
|
221
219
|
}
|
|
@@ -260,18 +258,17 @@ export class StorageMetadataView extends LegacyWrapper.LegacyWrapper.WrappableCo
|
|
|
260
258
|
return (new Date(expiration * 1000)).toLocaleString();
|
|
261
259
|
}
|
|
262
260
|
|
|
263
|
-
#renderBucketControls():
|
|
261
|
+
#renderBucketControls(): TemplateResult {
|
|
264
262
|
// clang-format off
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
</devtools-report-section>`;
|
|
263
|
+
return html`
|
|
264
|
+
<devtools-report-divider></devtools-report-divider>
|
|
265
|
+
<devtools-report-section>
|
|
266
|
+
<devtools-button aria-label=${i18nString(UIStrings.deleteBucket)}
|
|
267
|
+
.variant=${Buttons.Button.Variant.OUTLINED}
|
|
268
|
+
@click=${this.#deleteBucket}>
|
|
269
|
+
${i18nString(UIStrings.deleteBucket)}
|
|
270
|
+
</devtools-button>
|
|
271
|
+
</devtools-report-section>`;
|
|
275
272
|
// clang-format on
|
|
276
273
|
}
|
|
277
274
|
|