chrome-devtools-frontend 1.0.951410 → 1.0.952713
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 +3 -0
- package/extension-api/ExtensionAPI.d.ts +1 -1
- package/front_end/.eslintrc.js +6 -0
- package/front_end/Tests.js +10 -0
- package/front_end/core/common/App.ts +0 -3
- package/front_end/core/common/AppProvider.ts +0 -3
- package/front_end/core/common/JavaScriptMetaData.ts +0 -3
- package/front_end/core/common/QueryParamHandler.ts +0 -3
- package/front_end/core/common/Runnable.ts +0 -3
- package/front_end/core/common/SimpleHistoryManager.ts +0 -3
- package/front_end/core/host/UserMetrics.ts +2 -1
- package/front_end/core/i18n/locales/en-US.json +3 -0
- package/front_end/core/i18n/locales/en-XL.json +3 -0
- package/front_end/core/root/Runtime.ts +4 -12
- package/front_end/core/sdk/OverlayPersistentHighlighter.ts +0 -12
- package/front_end/core/sdk/PageResourceLoader.ts +2 -1
- package/front_end/core/sdk/TracingManager.ts +0 -3
- package/front_end/entrypoints/formatter_worker/AcornTokenizer.ts +39 -39
- package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +54 -54
- package/front_end/entrypoints/formatter_worker/ESTreeWalker.ts +20 -20
- package/front_end/entrypoints/formatter_worker/FormattedContentBuilder.ts +54 -54
- package/front_end/entrypoints/formatter_worker/HTMLFormatter.ts +145 -144
- package/front_end/entrypoints/formatter_worker/JavaScriptFormatter.ts +40 -40
- package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +64 -69
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +203 -203
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +109 -108
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +17 -17
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +30 -30
- package/front_end/entrypoints/inspector_main/RenderingOptions.ts +25 -25
- package/front_end/entrypoints/main/ExecutionContextSelector.ts +52 -55
- package/front_end/entrypoints/main/MainImpl.ts +49 -49
- package/front_end/entrypoints/node_app/NodeConnectionsPanel.ts +43 -43
- package/front_end/entrypoints/node_app/NodeMain.ts +38 -38
- package/front_end/generated/InspectorBackendCommands.js +5 -1
- package/front_end/generated/protocol.d.ts +16 -0
- package/front_end/legacy/legacy-defs.d.ts +0 -21
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +0 -3
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -3
- package/front_end/models/bindings/FileUtils.ts +0 -3
- package/front_end/models/extensions/ExtensionAPI.ts +2 -1
- package/front_end/models/extensions/ExtensionTraceProvider.ts +0 -3
- package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +1 -1
- package/front_end/models/issues_manager/ClientHintIssue.ts +95 -0
- package/front_end/models/issues_manager/ContentSecurityPolicyIssue.ts +6 -6
- package/front_end/models/issues_manager/ContrastCheckTrigger.ts +15 -15
- package/front_end/models/issues_manager/CorsIssue.ts +9 -9
- package/front_end/models/issues_manager/CrossOriginEmbedderPolicyIssue.ts +5 -5
- package/front_end/models/issues_manager/DeprecationIssue.ts +7 -7
- package/front_end/models/issues_manager/GenericIssue.ts +5 -5
- package/front_end/models/issues_manager/HeavyAdIssue.ts +5 -5
- package/front_end/models/issues_manager/Issue.ts +10 -10
- package/front_end/models/issues_manager/IssueResolver.ts +11 -10
- package/front_end/models/issues_manager/IssuesManager.ts +61 -56
- package/front_end/models/issues_manager/LowTextContrastIssue.ts +4 -4
- package/front_end/models/issues_manager/MixedContentIssue.ts +7 -7
- package/front_end/models/issues_manager/NavigatorUserAgentIssue.ts +7 -7
- package/front_end/models/issues_manager/QuirksModeIssue.ts +4 -4
- package/front_end/models/issues_manager/SameSiteCookieIssue.ts +16 -16
- package/front_end/models/issues_manager/SharedArrayBufferIssue.ts +5 -5
- package/front_end/models/issues_manager/SourceFrameIssuesManager.ts +32 -31
- package/front_end/models/issues_manager/TrustedWebActivityIssue.ts +5 -5
- package/front_end/models/issues_manager/WasmCrossOriginModuleSharingIssue.ts +5 -5
- package/front_end/models/issues_manager/descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
- package/front_end/models/issues_manager/descriptions/clientHintMetaTagModifiedHTML.md +4 -0
- package/front_end/models/issues_manager/issues_manager.ts +2 -0
- package/front_end/models/timeline_model/TimelineModel.ts +1 -1
- package/front_end/panels/application/components/BackForwardCacheView.ts +33 -33
- package/front_end/panels/application/components/EndpointsGrid.ts +12 -12
- package/front_end/panels/application/components/FrameDetailsView.ts +108 -110
- package/front_end/panels/application/components/OriginTrialTreeView.ts +45 -45
- package/front_end/panels/application/components/PermissionsPolicySection.ts +19 -19
- package/front_end/panels/application/components/ReportsGrid.ts +30 -30
- package/front_end/panels/application/components/StackTrace.ts +48 -47
- package/front_end/panels/application/components/TrustTokensView.ts +31 -31
- package/front_end/panels/console/ConsoleView.ts +1 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +1 -25
- package/front_end/panels/console/consoleView.css +5 -0
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +41 -52
- package/front_end/panels/css_overview/CSSOverviewController.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewPanel.ts +18 -27
- package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +6 -6
- package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +4 -4
- package/front_end/panels/elements/ElementsTreeElement.ts +2 -6
- package/front_end/panels/elements/components/AccessibilityTreeNode.ts +17 -17
- package/front_end/panels/elements/components/AdornerManager.ts +21 -21
- package/front_end/panels/elements/components/AdornerSettingsPane.ts +14 -14
- package/front_end/panels/elements/components/CSSQuery.ts +16 -16
- package/front_end/panels/elements/components/ComputedStyleProperty.ts +14 -14
- package/front_end/panels/elements/components/ComputedStyleTrace.ts +15 -15
- package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +78 -78
- package/front_end/panels/elements/components/ElementsPanelLink.ts +16 -16
- package/front_end/panels/elements/components/LayoutPane.ts +47 -47
- package/front_end/panels/elements/components/NodeText.ts +18 -18
- package/front_end/panels/elements/components/QueryContainer.ts +40 -40
- package/front_end/panels/elements/components/StylePropertyEditor.ts +18 -18
- package/front_end/panels/emulation/components/DeviceSizeInputElement.ts +4 -4
- package/front_end/panels/event_listeners/EventListenersUtils.ts +2 -1
- package/front_end/panels/issues/AffectedBlockedByResponseView.ts +4 -4
- package/front_end/panels/issues/AffectedCookiesView.ts +4 -5
- package/front_end/panels/issues/AffectedDirectivesView.ts +19 -19
- package/front_end/panels/issues/AffectedDocumentsInQuirksModeView.ts +7 -8
- package/front_end/panels/issues/AffectedElementsView.ts +4 -4
- package/front_end/panels/issues/AffectedElementsWithLowContrastView.ts +7 -8
- package/front_end/panels/issues/AffectedHeavyAdView.ts +8 -8
- package/front_end/panels/issues/AffectedResourcesView.ts +25 -26
- package/front_end/panels/issues/AffectedSharedArrayBufferIssueDetailsView.ts +8 -8
- package/front_end/panels/issues/AffectedSourcesView.ts +4 -4
- package/front_end/panels/issues/AffectedTrustedWebActivityIssueDetailsView.ts +4 -4
- package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +17 -17
- package/front_end/panels/issues/CSPViolationsListView.ts +22 -23
- package/front_end/panels/issues/CSPViolationsView.ts +17 -17
- package/front_end/panels/issues/ComboBoxOfCheckBoxes.ts +13 -13
- package/front_end/panels/issues/CorsIssueDetailsView.ts +23 -23
- package/front_end/panels/issues/GenericIssueDetailsView.ts +4 -4
- package/front_end/panels/issues/HiddenIssuesRow.ts +7 -7
- package/front_end/panels/issues/IssueAggregator.ts +95 -95
- package/front_end/panels/issues/IssueKindView.ts +14 -14
- package/front_end/panels/issues/IssueView.ts +98 -98
- package/front_end/panels/issues/IssuesPane.ts +102 -102
- package/front_end/panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts +5 -5
- package/front_end/panels/issues/components/HideIssuesMenu.ts +10 -10
- package/front_end/panels/media/PlayerListView.ts +160 -97
- package/front_end/panels/media/PlayerMessagesView.ts +1 -0
- package/front_end/panels/media/playerListView.css +58 -0
- package/front_end/panels/network/NetworkLogView.ts +2 -6
- package/front_end/panels/network/NetworkWaterfallColumn.ts +2 -4
- package/front_end/panels/network/components/RequestTrustTokensView.ts +40 -40
- package/front_end/panels/network/components/WebBundleInfoView.ts +9 -9
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +92 -37
- package/front_end/panels/performance_monitor/performanceMonitor.css +32 -0
- package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +2 -2
- package/front_end/panels/search/SearchConfig.ts +0 -6
- package/front_end/panels/settings/KeybindsSettingsTab.ts +4 -0
- package/front_end/panels/settings/components/SyncSection.ts +14 -14
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +96 -96
- package/front_end/panels/sources/BreakpointEditDialog.ts +4 -3
- package/front_end/panels/sources/NavigatorView.ts +3 -9
- package/front_end/panels/sources/SourceMapNamesResolver.ts +3 -3
- package/front_end/panels/sources/SourcesPanel.ts +1 -3
- package/front_end/panels/sources/SourcesView.ts +0 -3
- package/front_end/panels/sources/TabbedEditorContainer.ts +0 -3
- package/front_end/panels/timeline/TimelineFlameChartView.ts +1 -1
- package/front_end/panels/timeline/TimelineLoader.ts +0 -3
- package/front_end/panels/timeline/TimelineTreeView.ts +1 -1
- package/front_end/panels/timeline/components/WebVitalsLane.ts +77 -76
- package/front_end/panels/timeline/components/WebVitalsTimeline.ts +133 -133
- package/front_end/panels/timeline/components/WebVitalsTooltip.ts +9 -9
- package/front_end/panels/webauthn/WebauthnPane.ts +203 -205
- package/front_end/third_party/codemirror.next/bundle.ts +3 -3
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js +2 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +10 -1
- package/front_end/third_party/codemirror.next/codemirror.next.js +2 -1
- package/front_end/third_party/codemirror.next/package.json +3 -3
- package/front_end/third_party/diff/DiffWrapper.ts +7 -0
- package/front_end/ui/components/adorners/Adorner.ts +2 -2
- package/front_end/ui/components/buttons/Button.ts +9 -9
- package/front_end/ui/components/data_grid/DataGrid.ts +64 -64
- package/front_end/ui/components/data_grid/DataGridController.ts +22 -22
- package/front_end/ui/components/data_grid/DataGridUtils.ts +3 -0
- package/front_end/ui/components/diff_view/DiffView.ts +6 -6
- package/front_end/ui/components/expandable_list/ExpandableList.ts +5 -5
- package/front_end/ui/components/icon_button/Icon.ts +4 -4
- package/front_end/ui/components/icon_button/IconButton.ts +4 -4
- package/front_end/ui/components/issue_counter/IssueCounter.ts +3 -3
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +11 -11
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +50 -50
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +6 -6
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +4 -4
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryNavigator.ts +12 -12
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.ts +11 -11
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +40 -39
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.ts +18 -18
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +6 -6
- package/front_end/ui/components/linkifier/LinkifierImpl.ts +4 -4
- package/front_end/ui/components/markdown_view/MarkdownImage.ts +5 -5
- package/front_end/ui/components/markdown_view/MarkdownLink.ts +2 -2
- package/front_end/ui/components/markdown_view/MarkdownView.ts +4 -4
- package/front_end/ui/components/panel_feedback/FeedbackButton.ts +2 -2
- package/front_end/ui/components/panel_feedback/PanelFeedback.ts +2 -2
- package/front_end/ui/components/panel_feedback/PreviewToggle.ts +4 -4
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +22 -22
- package/front_end/ui/components/report_view/ReportView.ts +16 -16
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +14 -14
- package/front_end/ui/components/settings/SettingCheckbox.ts +5 -5
- package/front_end/ui/components/survey_link/SurveyLink.ts +8 -8
- package/front_end/ui/components/text_editor/TextEditor.ts +9 -9
- package/front_end/ui/components/text_editor/cursor_tooltip.ts +7 -1
- package/front_end/ui/components/text_prompt/TextPrompt.ts +18 -18
- package/front_end/ui/components/tree_outline/TreeOutline.ts +69 -70
- package/front_end/ui/legacy/ContextFlavorListener.ts +0 -4
- package/front_end/ui/legacy/SearchableView.ts +13 -4
- package/front_end/ui/legacy/SuggestBox.ts +0 -3
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +6 -6
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +0 -3
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +1 -1
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +13 -12
- package/front_end/ui/legacy/components/source_frame/XMLView.ts +2 -2
- package/front_end/ui/legacy/themeColors.css +2 -0
- package/front_end/ui/legacy/theme_support/theme_support_impl.ts +34 -7
- package/package.json +1 -1
- package/scripts/eslint_rules/lib/use_private_class_members.js +41 -0
- package/scripts/eslint_rules/tests/use_private_class_members_test.js +62 -0
- package/scripts/migration/class-fields/migrate.js +2 -3
- package/scripts/migration/class-fields/migrate.sh +1 -3
- package/scripts/migration/class-fields/package.json +1 -1
- package/config/gni/all_devtools_files.gni +0 -255
- package/scripts/build/devtools_file_hashes.py +0 -82
- package/scripts/devtools_run/devtools_run_cli +0 -49
- package/scripts/devtools_run/package.json +0 -13
- package/scripts/unzip.py +0 -20
- package/scripts/visualize_deps/jquery_svg.html +0 -57
- package/scripts/visualize_deps/run_visualize.js +0 -119
|
@@ -31,53 +31,53 @@ export interface QueryContainerData {
|
|
|
31
31
|
export class QueryContainer extends HTMLElement {
|
|
32
32
|
static readonly litTagName = LitHtml.literal`devtools-query-container`;
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
35
|
+
#queryName?: string;
|
|
36
|
+
#container?: DOMNode;
|
|
37
|
+
#onContainerLinkClick?: (event: Event) => void;
|
|
38
|
+
#isContainerLinkHovered = false;
|
|
39
|
+
#queriedSizeDetails?: SDK.CSSContainerQuery.ContainerQueriedSizeDetails;
|
|
40
40
|
|
|
41
41
|
set data(data: QueryContainerData) {
|
|
42
|
-
this
|
|
43
|
-
this
|
|
44
|
-
this
|
|
45
|
-
this
|
|
42
|
+
this.#queryName = data.queryName;
|
|
43
|
+
this.#container = data.container;
|
|
44
|
+
this.#onContainerLinkClick = data.onContainerLinkClick;
|
|
45
|
+
this.#render();
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
connectedCallback(): void {
|
|
49
|
-
this
|
|
49
|
+
this.#shadow.adoptedStyleSheets = [queryContainerStyles];
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
updateContainerQueriedSizeDetails(details: SDK.CSSContainerQuery.ContainerQueriedSizeDetails): void {
|
|
53
|
-
this
|
|
54
|
-
this
|
|
53
|
+
this.#queriedSizeDetails = details;
|
|
54
|
+
this.#render();
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
this
|
|
59
|
-
this
|
|
57
|
+
async #onContainerLinkMouseEnter(): Promise<void> {
|
|
58
|
+
this.#container?.highlightNode('container-outline');
|
|
59
|
+
this.#isContainerLinkHovered = true;
|
|
60
60
|
this.dispatchEvent(new QueriedSizeRequestedEvent());
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
this
|
|
65
|
-
this
|
|
66
|
-
this
|
|
63
|
+
#onContainerLinkMouseLeave(): void {
|
|
64
|
+
this.#container?.clearHighlight();
|
|
65
|
+
this.#isContainerLinkHovered = false;
|
|
66
|
+
this.#render();
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
if (!this
|
|
69
|
+
#render(): void {
|
|
70
|
+
if (!this.#container) {
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
let idToDisplay, classesToDisplay;
|
|
75
|
-
if (!this
|
|
76
|
-
idToDisplay = this
|
|
77
|
-
classesToDisplay = this
|
|
75
|
+
if (!this.#queryName) {
|
|
76
|
+
idToDisplay = this.#container.getAttribute('id');
|
|
77
|
+
classesToDisplay = this.#container.getAttribute('class')?.split(/\s+/).filter(Boolean);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
const nodeTitle = this
|
|
80
|
+
const nodeTitle = this.#queryName || this.#container.nodeNameNicelyCased;
|
|
81
81
|
|
|
82
82
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
83
83
|
// clang-format off
|
|
@@ -87,9 +87,9 @@ export class QueryContainer extends HTMLElement {
|
|
|
87
87
|
<a href="#"
|
|
88
88
|
draggable=false
|
|
89
89
|
class="container-link"
|
|
90
|
-
@click=${this
|
|
91
|
-
@mouseenter=${this
|
|
92
|
-
@mouseleave=${this
|
|
90
|
+
@click=${this.#onContainerLinkClick}
|
|
91
|
+
@mouseenter=${this.#onContainerLinkMouseEnter}
|
|
92
|
+
@mouseleave=${this.#onContainerLinkMouseLeave}
|
|
93
93
|
><${NodeText.litTagName}
|
|
94
94
|
data-node-title=${nodeTitle}
|
|
95
95
|
.data=${{
|
|
@@ -97,39 +97,39 @@ export class QueryContainer extends HTMLElement {
|
|
|
97
97
|
nodeId: idToDisplay,
|
|
98
98
|
nodeClasses: classesToDisplay,
|
|
99
99
|
} as NodeTextData}></${NodeText.litTagName}></a>
|
|
100
|
-
${this
|
|
101
|
-
`, this
|
|
100
|
+
${this.#isContainerLinkHovered ? this.#renderQueriedSizeDetails() : LitHtml.nothing}
|
|
101
|
+
`, this.#shadow, {
|
|
102
102
|
host: this,
|
|
103
103
|
});
|
|
104
104
|
// clang-format on
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
if (!this
|
|
107
|
+
#renderQueriedSizeDetails(): LitHtml.TemplateResult|{} {
|
|
108
|
+
if (!this.#queriedSizeDetails || this.#queriedSizeDetails.queryAxis === QueryAxis.None) {
|
|
109
109
|
return LitHtml.nothing;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
const areBothAxesQueried = this
|
|
112
|
+
const areBothAxesQueried = this.#queriedSizeDetails.queryAxis === QueryAxis.Both;
|
|
113
113
|
|
|
114
114
|
const axisIconClasses = LitHtml.Directives.classMap({
|
|
115
115
|
'axis-icon': true,
|
|
116
116
|
'hidden': areBothAxesQueried,
|
|
117
|
-
'vertical': this
|
|
117
|
+
'vertical': this.#queriedSizeDetails.physicalAxis === PhysicalAxis.Vertical,
|
|
118
118
|
});
|
|
119
119
|
|
|
120
120
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
121
121
|
// clang-format off
|
|
122
122
|
return html`
|
|
123
123
|
<span class="queried-size-details">
|
|
124
|
-
(${this
|
|
124
|
+
(${this.#queriedSizeDetails.queryAxis}<${IconButton.Icon.Icon.litTagName}
|
|
125
125
|
class=${axisIconClasses} .data=${{
|
|
126
126
|
iconName: 'ic_dimension_single',
|
|
127
127
|
color: 'var(--color-text-primary)',
|
|
128
128
|
} as IconButton.Icon.IconData}></${IconButton.Icon.Icon.litTagName}>)
|
|
129
|
-
${areBothAxesQueried && this
|
|
130
|
-
${this
|
|
131
|
-
${areBothAxesQueried && this
|
|
132
|
-
${this
|
|
129
|
+
${areBothAxesQueried && this.#queriedSizeDetails.width ? 'width:' : LitHtml.nothing}
|
|
130
|
+
${this.#queriedSizeDetails.width || LitHtml.nothing}
|
|
131
|
+
${areBothAxesQueried && this.#queriedSizeDetails.height ? 'height:' : LitHtml.nothing}
|
|
132
|
+
${this.#queriedSizeDetails.height || LitHtml.nothing}
|
|
133
133
|
</span>
|
|
134
134
|
`;
|
|
135
135
|
// clang-format on
|
|
@@ -69,9 +69,9 @@ export class PropertyDeselectedEvent extends Event {
|
|
|
69
69
|
|
|
70
70
|
// eslint-disable-next-line rulesdir/check_component_naming
|
|
71
71
|
export class StylePropertyEditor extends HTMLElement {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
73
|
+
#authoredProperties: Map<string, string> = new Map();
|
|
74
|
+
#computedProperties: Map<string, string> = new Map();
|
|
75
75
|
protected readonly editableProperties: EditableProperty[] = [];
|
|
76
76
|
|
|
77
77
|
constructor() {
|
|
@@ -79,7 +79,7 @@ export class StylePropertyEditor extends HTMLElement {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
connectedCallback(): void {
|
|
82
|
-
this
|
|
82
|
+
this.#shadow.adoptedStyleSheets = [stylePropertyEditorStyles];
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
getEditableProperties(): EditableProperty[] {
|
|
@@ -87,28 +87,28 @@ export class StylePropertyEditor extends HTMLElement {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
set data(data: FlexEditorData) {
|
|
90
|
-
this
|
|
91
|
-
this
|
|
92
|
-
this
|
|
90
|
+
this.#authoredProperties = data.authoredProperties;
|
|
91
|
+
this.#computedProperties = data.computedProperties;
|
|
92
|
+
this.#render();
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
#render(): void {
|
|
96
96
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
97
97
|
// clang-format off
|
|
98
98
|
render(html`
|
|
99
99
|
<div class="container">
|
|
100
|
-
${this.editableProperties.map(prop => this
|
|
100
|
+
${this.editableProperties.map(prop => this.#renderProperty(prop))}
|
|
101
101
|
</div>
|
|
102
|
-
`, this
|
|
102
|
+
`, this.#shadow, {
|
|
103
103
|
host: this,
|
|
104
104
|
});
|
|
105
105
|
// clang-format on
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
const authoredValue = this
|
|
108
|
+
#renderProperty(prop: EditableProperty): LitHtml.TemplateResult {
|
|
109
|
+
const authoredValue = this.#authoredProperties.get(prop.propertyName);
|
|
110
110
|
const notAuthored = !authoredValue;
|
|
111
|
-
const shownValue = authoredValue || this
|
|
111
|
+
const shownValue = authoredValue || this.#computedProperties.get(prop.propertyName);
|
|
112
112
|
const classes = Directives.classMap({
|
|
113
113
|
'property-value': true,
|
|
114
114
|
'not-authored': notAuthored,
|
|
@@ -118,14 +118,14 @@ export class StylePropertyEditor extends HTMLElement {
|
|
|
118
118
|
<span class="property-name">${prop.propertyName}</span>: <span class=${classes}>${shownValue}</span>
|
|
119
119
|
</div>
|
|
120
120
|
<div class="buttons">
|
|
121
|
-
${prop.propertyValues.map(value => this
|
|
121
|
+
${prop.propertyValues.map(value => this.#renderButton(value, prop.propertyName, value === authoredValue))}
|
|
122
122
|
</div>
|
|
123
123
|
</div>`;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
#renderButton(propertyValue: string, propertyName: string, selected: boolean = false): LitHtml.TemplateResult {
|
|
127
127
|
const query = `${propertyName}: ${propertyValue}`;
|
|
128
|
-
const iconInfo = this.findIcon(query, this
|
|
128
|
+
const iconInfo = this.findIcon(query, this.#computedProperties);
|
|
129
129
|
if (!iconInfo) {
|
|
130
130
|
throw new Error(`Icon for ${query} is not found`);
|
|
131
131
|
}
|
|
@@ -137,14 +137,14 @@ export class StylePropertyEditor extends HTMLElement {
|
|
|
137
137
|
const values = {propertyName, propertyValue};
|
|
138
138
|
const title = selected ? i18nString(UIStrings.deselectButton, values) : i18nString(UIStrings.selectButton, values);
|
|
139
139
|
return html`<button title=${title} class=${classes} @click=${
|
|
140
|
-
(): void => this
|
|
140
|
+
(): void => this.#onButtonClick(propertyName, propertyValue, selected)}>
|
|
141
141
|
<${IconButton.Icon.Icon.litTagName} style=${transform} .data=${
|
|
142
142
|
{iconName: iconInfo.iconName, color: 'var(--icon-color)', width: '18px', height: '18px'} as
|
|
143
143
|
IconButton.Icon.IconWithName}></${IconButton.Icon.Icon.litTagName}>
|
|
144
144
|
</button>`;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
#onButtonClick(propertyName: string, propertyValue: string, selected: boolean): void {
|
|
148
148
|
if (selected) {
|
|
149
149
|
this.dispatchEvent(new PropertyDeselectedEvent(propertyName, propertyValue));
|
|
150
150
|
} else {
|
|
@@ -91,17 +91,17 @@ export class SizeInputElement extends HTMLElement {
|
|
|
91
91
|
placeholder=${this.#placeholder}
|
|
92
92
|
?disabled=${this.#disabled}
|
|
93
93
|
.value=${this.#size}
|
|
94
|
-
@change=${this
|
|
95
|
-
@keydown=${this
|
|
94
|
+
@change=${this.#fireSizeChange}
|
|
95
|
+
@keydown=${this.#handleModifierKeys} />
|
|
96
96
|
`,
|
|
97
97
|
this.#root, {host: this});
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
#fireSizeChange(event: Event): void {
|
|
101
101
|
this.dispatchEvent(new SizeChangedEvent(getInputValue(event)));
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
#handleModifierKeys(event: Event): void {
|
|
105
105
|
const modifiedValue = UILegacy.UIUtils.modifiedFloatNumber(getInputValue(event), event);
|
|
106
106
|
if (modifiedValue === null) {
|
|
107
107
|
return;
|
|
@@ -347,8 +347,9 @@ export function frameworkEventListeners(object: SDK.RemoteObject.RemoteObject):
|
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
+
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
350
351
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
351
|
-
function checkInternalHandler(handler: any): (() =>
|
|
352
|
+
function checkInternalHandler(handler: any): (() => void)|null {
|
|
352
353
|
if (handler && (typeof handler === 'function')) {
|
|
353
354
|
return handler;
|
|
354
355
|
}
|
|
@@ -32,7 +32,7 @@ const str_ = i18n.i18n.registerUIStrings('panels/issues/AffectedBlockedByRespons
|
|
|
32
32
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
33
33
|
|
|
34
34
|
export class AffectedBlockedByResponseView extends AffectedResourcesView {
|
|
35
|
-
|
|
35
|
+
#appendDetails(details: Iterable<Protocol.Audits.BlockedByResponseIssueDetails>): void {
|
|
36
36
|
const header = document.createElement('tr');
|
|
37
37
|
this.appendColumnTitle(header, i18nString(UIStrings.requestC));
|
|
38
38
|
this.appendColumnTitle(header, i18nString(UIStrings.parentFrame));
|
|
@@ -42,7 +42,7 @@ export class AffectedBlockedByResponseView extends AffectedResourcesView {
|
|
|
42
42
|
|
|
43
43
|
let count = 0;
|
|
44
44
|
for (const detail of details) {
|
|
45
|
-
this
|
|
45
|
+
this.#appendDetail(detail);
|
|
46
46
|
count++;
|
|
47
47
|
}
|
|
48
48
|
this.updateAffectedResourceCount(count);
|
|
@@ -52,7 +52,7 @@ export class AffectedBlockedByResponseView extends AffectedResourcesView {
|
|
|
52
52
|
return i18nString(UIStrings.nRequests, {n: count});
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
#appendDetail(details: Protocol.Audits.BlockedByResponseIssueDetails): void {
|
|
56
56
|
const element = document.createElement('tr');
|
|
57
57
|
element.classList.add('affected-resource-row');
|
|
58
58
|
|
|
@@ -83,6 +83,6 @@ export class AffectedBlockedByResponseView extends AffectedResourcesView {
|
|
|
83
83
|
|
|
84
84
|
update(): void {
|
|
85
85
|
this.clear();
|
|
86
|
-
this
|
|
86
|
+
this.#appendDetails(this.issue.getBlockedByResponseDetails());
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -45,8 +45,7 @@ export class AffectedCookiesView extends AffectedResourcesView {
|
|
|
45
45
|
return i18nString(UIStrings.nCookies, {n: count});
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
void {
|
|
48
|
+
#appendAffectedCookies(cookies: Iterable<{cookie: Protocol.Audits.AffectedCookie, hasRequest: boolean}>): void {
|
|
50
49
|
const header = document.createElement('tr');
|
|
51
50
|
this.appendColumnTitle(header, i18nString(UIStrings.name));
|
|
52
51
|
this.appendColumnTitle(
|
|
@@ -58,12 +57,12 @@ export class AffectedCookiesView extends AffectedResourcesView {
|
|
|
58
57
|
let count = 0;
|
|
59
58
|
for (const cookie of cookies) {
|
|
60
59
|
count++;
|
|
61
|
-
this
|
|
60
|
+
this.#appendAffectedCookie(cookie.cookie, cookie.hasRequest);
|
|
62
61
|
}
|
|
63
62
|
this.updateAffectedResourceCount(count);
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
|
|
65
|
+
#appendAffectedCookie(cookie: Protocol.Audits.AffectedCookie, hasAssociatedRequest: boolean): void {
|
|
67
66
|
const element = document.createElement('tr');
|
|
68
67
|
element.classList.add('affected-resource-cookie');
|
|
69
68
|
const name = document.createElement('td');
|
|
@@ -96,7 +95,7 @@ export class AffectedCookiesView extends AffectedResourcesView {
|
|
|
96
95
|
|
|
97
96
|
update(): void {
|
|
98
97
|
this.clear();
|
|
99
|
-
this
|
|
98
|
+
this.#appendAffectedCookies(this.issue.cookiesWithRequestIndicator());
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
101
|
|
|
@@ -57,7 +57,7 @@ const str_ = i18n.i18n.registerUIStrings('panels/issues/AffectedDirectivesView.t
|
|
|
57
57
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
58
58
|
|
|
59
59
|
export class AffectedDirectivesView extends AffectedResourcesView {
|
|
60
|
-
|
|
60
|
+
#appendStatus(element: Element, isReportOnly: boolean): void {
|
|
61
61
|
const status = document.createElement('td');
|
|
62
62
|
if (isReportOnly) {
|
|
63
63
|
status.classList.add('affected-resource-report-only-status');
|
|
@@ -73,20 +73,20 @@ export class AffectedDirectivesView extends AffectedResourcesView {
|
|
|
73
73
|
return i18nString(UIStrings.nDirectives, {n: count});
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
#appendViolatedDirective(element: Element, directive: string): void {
|
|
77
77
|
const violatedDirective = document.createElement('td');
|
|
78
78
|
violatedDirective.textContent = directive;
|
|
79
79
|
element.appendChild(violatedDirective);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
#appendBlockedURL(element: Element, url: string): void {
|
|
83
83
|
const info = document.createElement('td');
|
|
84
84
|
info.classList.add('affected-resource-directive-info');
|
|
85
85
|
info.textContent = url;
|
|
86
86
|
element.appendChild(info);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
#appendBlockedElement(
|
|
90
90
|
element: Element, nodeId: Protocol.DOM.BackendNodeId|undefined, model: SDK.IssuesModel.IssuesModel): void {
|
|
91
91
|
const elementsPanelLinkComponent = new ElementsComponents.ElementsPanelLink.ElementsPanelLink();
|
|
92
92
|
if (nodeId) {
|
|
@@ -126,7 +126,7 @@ export class AffectedDirectivesView extends AffectedResourcesView {
|
|
|
126
126
|
element.appendChild(violatingNode);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
#appendAffectedContentSecurityPolicyDetails(
|
|
130
130
|
cspIssues: Iterable<IssuesManager.ContentSecurityPolicyIssue.ContentSecurityPolicyIssue>): void {
|
|
131
131
|
const header = document.createElement('tr');
|
|
132
132
|
if (this.issue.code() === IssuesManager.ContentSecurityPolicyIssue.inlineViolationCode) {
|
|
@@ -158,12 +158,12 @@ export class AffectedDirectivesView extends AffectedResourcesView {
|
|
|
158
158
|
let count = 0;
|
|
159
159
|
for (const cspIssue of cspIssues) {
|
|
160
160
|
count++;
|
|
161
|
-
this
|
|
161
|
+
this.#appendAffectedContentSecurityPolicyDetail(cspIssue);
|
|
162
162
|
}
|
|
163
163
|
this.updateAffectedResourceCount(count);
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
#appendAffectedContentSecurityPolicyDetail(
|
|
167
167
|
cspIssue: IssuesManager.ContentSecurityPolicyIssue.ContentSecurityPolicyIssue): void {
|
|
168
168
|
const element = document.createElement('tr');
|
|
169
169
|
element.classList.add('affected-resource-directive');
|
|
@@ -173,27 +173,27 @@ export class AffectedDirectivesView extends AffectedResourcesView {
|
|
|
173
173
|
const model = cspIssue.model();
|
|
174
174
|
const maybeTarget = cspIssue.model()?.getTargetIfNotDisposed();
|
|
175
175
|
if (this.issue.code() === IssuesManager.ContentSecurityPolicyIssue.inlineViolationCode && model) {
|
|
176
|
-
this
|
|
177
|
-
this
|
|
176
|
+
this.#appendViolatedDirective(element, cspIssueDetails.violatedDirective);
|
|
177
|
+
this.#appendBlockedElement(element, cspIssueDetails.violatingNodeId, model);
|
|
178
178
|
this.appendSourceLocation(element, location, maybeTarget);
|
|
179
|
-
this
|
|
179
|
+
this.#appendStatus(element, cspIssueDetails.isReportOnly);
|
|
180
180
|
} else if (this.issue.code() === IssuesManager.ContentSecurityPolicyIssue.urlViolationCode) {
|
|
181
181
|
const url = cspIssueDetails.blockedURL ? cspIssueDetails.blockedURL : '';
|
|
182
|
-
this
|
|
183
|
-
this
|
|
184
|
-
this
|
|
182
|
+
this.#appendBlockedURL(element, url);
|
|
183
|
+
this.#appendStatus(element, cspIssueDetails.isReportOnly);
|
|
184
|
+
this.#appendViolatedDirective(element, cspIssueDetails.violatedDirective);
|
|
185
185
|
this.appendSourceLocation(element, location, maybeTarget);
|
|
186
186
|
} else if (this.issue.code() === IssuesManager.ContentSecurityPolicyIssue.evalViolationCode) {
|
|
187
187
|
this.appendSourceLocation(element, location, maybeTarget);
|
|
188
|
-
this
|
|
189
|
-
this
|
|
188
|
+
this.#appendViolatedDirective(element, cspIssueDetails.violatedDirective);
|
|
189
|
+
this.#appendStatus(element, cspIssueDetails.isReportOnly);
|
|
190
190
|
} else if (this.issue.code() === IssuesManager.ContentSecurityPolicyIssue.trustedTypesSinkViolationCode) {
|
|
191
191
|
this.appendSourceLocation(element, location, maybeTarget);
|
|
192
|
-
this
|
|
192
|
+
this.#appendStatus(element, cspIssueDetails.isReportOnly);
|
|
193
193
|
} else if (this.issue.code() === IssuesManager.ContentSecurityPolicyIssue.trustedTypesPolicyViolationCode) {
|
|
194
194
|
this.appendSourceLocation(element, location, maybeTarget);
|
|
195
|
-
this
|
|
196
|
-
this
|
|
195
|
+
this.#appendViolatedDirective(element, cspIssueDetails.violatedDirective);
|
|
196
|
+
this.#appendStatus(element, cspIssueDetails.isReportOnly);
|
|
197
197
|
} else {
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
@@ -203,6 +203,6 @@ export class AffectedDirectivesView extends AffectedResourcesView {
|
|
|
203
203
|
|
|
204
204
|
update(): void {
|
|
205
205
|
this.clear();
|
|
206
|
-
this
|
|
206
|
+
this.#appendAffectedContentSecurityPolicyDetails(this.issue.getCspIssues());
|
|
207
207
|
}
|
|
208
208
|
}
|
|
@@ -31,24 +31,24 @@ const str_ = i18n.i18n.registerUIStrings('panels/issues/AffectedDocumentsInQuirk
|
|
|
31
31
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
32
32
|
|
|
33
33
|
export class AffectedDocumentsInQuirksModeView extends AffectedElementsView {
|
|
34
|
-
|
|
34
|
+
#runningUpdatePromise: Promise<void> = Promise.resolve();
|
|
35
35
|
|
|
36
36
|
update(): void {
|
|
37
37
|
// Ensure that doUpdate is invoked atomically by serializing the update calls
|
|
38
38
|
// because it's not re-entrace safe.
|
|
39
|
-
this
|
|
39
|
+
this.#runningUpdatePromise = this.#runningUpdatePromise.then(this.#doUpdate.bind(this));
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
protected getResourceName(count: number): Platform.UIString.LocalizedString {
|
|
43
43
|
return i18nString(UIStrings.nDocuments, {n: count});
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
async #doUpdate(): Promise<void> {
|
|
47
47
|
this.clear();
|
|
48
|
-
await this
|
|
48
|
+
await this.#appendQuirksModeDocuments(this.issue.getQuirksModeIssues());
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
async #appendQuirksModeDocument(issue: IssuesManager.QuirksModeIssue.QuirksModeIssue): Promise<void> {
|
|
52
52
|
const row = document.createElement('tr');
|
|
53
53
|
row.classList.add('affected-resource-quirks-mode');
|
|
54
54
|
|
|
@@ -64,8 +64,7 @@ export class AffectedDocumentsInQuirksModeView extends AffectedElementsView {
|
|
|
64
64
|
this.affectedResources.appendChild(row);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
Promise<void> {
|
|
67
|
+
async #appendQuirksModeDocuments(issues: Iterable<IssuesManager.QuirksModeIssue.QuirksModeIssue>): Promise<void> {
|
|
69
68
|
const header = document.createElement('tr');
|
|
70
69
|
this.appendColumnTitle(header, i18nString(UIStrings.documentInTheDOMTree));
|
|
71
70
|
this.appendColumnTitle(header, i18nString(UIStrings.mode));
|
|
@@ -75,7 +74,7 @@ export class AffectedDocumentsInQuirksModeView extends AffectedElementsView {
|
|
|
75
74
|
let count = 0;
|
|
76
75
|
for (const issue of issues) {
|
|
77
76
|
count++;
|
|
78
|
-
await this
|
|
77
|
+
await this.#appendQuirksModeDocument(issue);
|
|
79
78
|
}
|
|
80
79
|
this.updateAffectedResourceCount(count);
|
|
81
80
|
}
|
|
@@ -17,10 +17,10 @@ const UIStrings = {
|
|
|
17
17
|
const str_ = i18n.i18n.registerUIStrings('panels/issues/AffectedElementsView.ts', UIStrings);
|
|
18
18
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
19
19
|
export class AffectedElementsView extends AffectedResourcesView {
|
|
20
|
-
|
|
20
|
+
async #appendAffectedElements(affectedElements: Iterable<IssuesManager.Issue.AffectedElement>): Promise<void> {
|
|
21
21
|
let count = 0;
|
|
22
22
|
for (const element of affectedElements) {
|
|
23
|
-
await this
|
|
23
|
+
await this.#appendAffectedElement(element);
|
|
24
24
|
count++;
|
|
25
25
|
}
|
|
26
26
|
this.updateAffectedResourceCount(count);
|
|
@@ -30,7 +30,7 @@ export class AffectedElementsView extends AffectedResourcesView {
|
|
|
30
30
|
return i18nString(UIStrings.nElements, {n: count});
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
async #appendAffectedElement(element: IssuesManager.Issue.AffectedElement): Promise<void> {
|
|
34
34
|
const cellElement = await this.createElementCell(element, this.issue.getCategory());
|
|
35
35
|
const rowElement = document.createElement('tr');
|
|
36
36
|
rowElement.appendChild(cellElement);
|
|
@@ -39,6 +39,6 @@ export class AffectedElementsView extends AffectedResourcesView {
|
|
|
39
39
|
|
|
40
40
|
update(): void {
|
|
41
41
|
this.clear();
|
|
42
|
-
this
|
|
42
|
+
this.#appendAffectedElements(this.issue.elements());
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -9,21 +9,20 @@ import type * as IssuesManager from '../../models/issues_manager/issues_manager.
|
|
|
9
9
|
import {AffectedElementsView} from './AffectedElementsView.js';
|
|
10
10
|
|
|
11
11
|
export class AffectedElementsWithLowContrastView extends AffectedElementsView {
|
|
12
|
-
|
|
12
|
+
#runningUpdatePromise: Promise<void> = Promise.resolve();
|
|
13
13
|
|
|
14
14
|
update(): void {
|
|
15
15
|
// Ensure that doUpdate is invoked atomically by serializing the update calls
|
|
16
16
|
// because it's not re-entrace safe.
|
|
17
|
-
this
|
|
17
|
+
this.#runningUpdatePromise = this.#runningUpdatePromise.then(this.#doUpdate.bind(this));
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
async #doUpdate(): Promise<void> {
|
|
21
21
|
this.clear();
|
|
22
|
-
await this
|
|
22
|
+
await this.#appendLowContrastElements(this.issue.getLowContrastIssues());
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
Promise<void> {
|
|
25
|
+
async #appendLowContrastElement(issue: IssuesManager.LowTextContrastIssue.LowTextContrastIssue): Promise<void> {
|
|
27
26
|
const row = document.createElement('tr');
|
|
28
27
|
row.classList.add('affected-resource-low-contrast');
|
|
29
28
|
|
|
@@ -41,7 +40,7 @@ export class AffectedElementsWithLowContrastView extends AffectedElementsView {
|
|
|
41
40
|
this.affectedResources.appendChild(row);
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
async #appendLowContrastElements(issues: Iterable<IssuesManager.LowTextContrastIssue.LowTextContrastIssue>):
|
|
45
44
|
Promise<void> {
|
|
46
45
|
const header = document.createElement('tr');
|
|
47
46
|
this.appendColumnTitle(header, i18nString(UIStrings.element));
|
|
@@ -55,7 +54,7 @@ export class AffectedElementsWithLowContrastView extends AffectedElementsView {
|
|
|
55
54
|
let count = 0;
|
|
56
55
|
for (const lowContrastIssue of issues) {
|
|
57
56
|
count++;
|
|
58
|
-
await this
|
|
57
|
+
await this.#appendLowContrastElement(lowContrastIssue);
|
|
59
58
|
}
|
|
60
59
|
this.updateAffectedResourceCount(count);
|
|
61
60
|
}
|
|
@@ -55,7 +55,7 @@ const str_ = i18n.i18n.registerUIStrings('panels/issues/AffectedHeavyAdView.ts',
|
|
|
55
55
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
56
56
|
|
|
57
57
|
export class AffectedHeavyAdView extends AffectedResourcesView {
|
|
58
|
-
|
|
58
|
+
#appendAffectedHeavyAds(heavyAds: Iterable<IssuesManager.HeavyAdIssue.HeavyAdIssue>): void {
|
|
59
59
|
const header = document.createElement('tr');
|
|
60
60
|
this.appendColumnTitle(header, i18nString(UIStrings.limitExceeded));
|
|
61
61
|
this.appendColumnTitle(header, i18nString(UIStrings.resolutionStatus));
|
|
@@ -65,7 +65,7 @@ export class AffectedHeavyAdView extends AffectedResourcesView {
|
|
|
65
65
|
|
|
66
66
|
let count = 0;
|
|
67
67
|
for (const heavyAd of heavyAds) {
|
|
68
|
-
this
|
|
68
|
+
this.#appendAffectedHeavyAd(heavyAd.details());
|
|
69
69
|
count++;
|
|
70
70
|
}
|
|
71
71
|
this.updateAffectedResourceCount(count);
|
|
@@ -75,7 +75,7 @@ export class AffectedHeavyAdView extends AffectedResourcesView {
|
|
|
75
75
|
return i18nString(UIStrings.nResources, {n: count});
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
#statusToString(status: Protocol.Audits.HeavyAdResolutionStatus): string {
|
|
79
79
|
switch (status) {
|
|
80
80
|
case Protocol.Audits.HeavyAdResolutionStatus.HeavyAdBlocked:
|
|
81
81
|
return i18nString(UIStrings.removed);
|
|
@@ -85,7 +85,7 @@ export class AffectedHeavyAdView extends AffectedResourcesView {
|
|
|
85
85
|
return '';
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
#limitToString(status: Protocol.Audits.HeavyAdReason): string {
|
|
89
89
|
switch (status) {
|
|
90
90
|
case Protocol.Audits.HeavyAdReason.CpuPeakLimit:
|
|
91
91
|
return i18nString(UIStrings.cpuPeakLimit);
|
|
@@ -97,18 +97,18 @@ export class AffectedHeavyAdView extends AffectedResourcesView {
|
|
|
97
97
|
return '';
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
#appendAffectedHeavyAd(heavyAd: Protocol.Audits.HeavyAdIssueDetails): void {
|
|
101
101
|
const element = document.createElement('tr');
|
|
102
102
|
element.classList.add('affected-resource-heavy-ad');
|
|
103
103
|
|
|
104
104
|
const reason = document.createElement('td');
|
|
105
105
|
reason.classList.add('affected-resource-heavy-ad-info');
|
|
106
|
-
reason.textContent = this
|
|
106
|
+
reason.textContent = this.#limitToString(heavyAd.reason);
|
|
107
107
|
element.appendChild(reason);
|
|
108
108
|
|
|
109
109
|
const status = document.createElement('td');
|
|
110
110
|
status.classList.add('affected-resource-heavy-ad-info');
|
|
111
|
-
status.textContent = this
|
|
111
|
+
status.textContent = this.#statusToString(heavyAd.resolution);
|
|
112
112
|
element.appendChild(status);
|
|
113
113
|
|
|
114
114
|
const frameId = heavyAd.frame.frameId;
|
|
@@ -120,6 +120,6 @@ export class AffectedHeavyAdView extends AffectedResourcesView {
|
|
|
120
120
|
|
|
121
121
|
update(): void {
|
|
122
122
|
this.clear();
|
|
123
|
-
this
|
|
123
|
+
this.#appendAffectedHeavyAds(this.issue.getHeavyAdIssues());
|
|
124
124
|
}
|
|
125
125
|
}
|