chrome-devtools-frontend 1.0.1536371 → 1.0.1537268
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/front_end/core/host/AidaClient.ts +64 -5
- package/front_end/core/host/DispatchHttpRequestClient.ts +62 -0
- package/front_end/core/host/GdpClient.ts +8 -57
- package/front_end/core/host/host.ts +2 -0
- package/front_end/core/protocol_client/CDPConnection.ts +10 -8
- package/front_end/core/protocol_client/InspectorBackend.ts +36 -42
- package/front_end/core/sdk/EnhancedTracesParser.ts +20 -5
- package/front_end/core/sdk/RehydratingConnection.ts +112 -4
- package/front_end/core/sdk/RehydratingObject.ts +8 -0
- package/front_end/core/sdk/TraceObject.ts +5 -1
- package/front_end/models/javascript_metadata/NativeFunctions.js +1 -1
- package/front_end/models/trace/types/File.ts +9 -0
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +5 -9
- package/front_end/panels/ai_assistance/components/ChatView.ts +58 -70
- package/front_end/panels/application/BackForwardCacheTreeElement.ts +2 -6
- package/front_end/panels/application/components/BackForwardCacheView.ts +74 -69
- package/front_end/panels/application/components/FrameDetailsView.ts +8 -11
- package/front_end/panels/application/components/OriginTrialTreeView.ts +65 -69
- package/front_end/panels/application/components/backForwardCacheView.css +4 -0
- package/front_end/panels/application/components/badge.css +1 -1
- package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +44 -53
- package/front_end/panels/recorder/RecorderController.ts +1 -2
- package/front_end/panels/recorder/components/CreateRecordingView.ts +153 -129
- package/front_end/panels/settings/AISettingsTab.ts +162 -171
- package/front_end/panels/settings/SettingsScreen.ts +3 -7
- package/front_end/panels/settings/aiSettingsTab.css +151 -148
- package/front_end/panels/settings/settings-meta.ts +1 -2
- package/front_end/panels/sources/AddSourceMapURLDialog.ts +23 -26
- package/front_end/panels/timeline/TimelinePanel.ts +60 -11
- package/front_end/panels/timeline/components/ExportTraceOptions.ts +33 -34
- package/front_end/third_party/chromium/README.chromium +2 -2
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts +9 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BrowserContext.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts +13 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.js +5 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js +3 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Realm.d.ts +1 -12
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Realm.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.d.ts +6 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js +6 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.d.ts +2 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js +3 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/disposable.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/disposable.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/disposable.js +3 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/disposable.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/util.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/util.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/util.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/util.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +28 -3
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +21 -10
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts +9 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BrowserContext.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts +13 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.js +5 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js +3 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Realm.d.ts +1 -12
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Realm.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.d.ts +6 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js +6 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.d.ts +2 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js +3 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/disposable.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/disposable.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/disposable.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/disposable.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/util.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/util.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/util.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/util.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +28 -3
- package/front_end/third_party/puppeteer/package/package.json +2 -2
- package/front_end/third_party/puppeteer/package/src/api/Browser.ts +13 -1
- package/front_end/third_party/puppeteer/package/src/api/BrowserContext.ts +7 -2
- package/front_end/third_party/puppeteer/package/src/api/Page.ts +14 -1
- package/front_end/third_party/puppeteer/package/src/bidi/BrowserContext.ts +8 -5
- package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +5 -2
- package/front_end/third_party/puppeteer/package/src/cdp/Accessibility.ts +8 -0
- package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +11 -2
- package/front_end/third_party/puppeteer/package/src/cdp/BrowserContext.ts +3 -2
- package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +5 -5
- package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/util/disposable.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/util/util.ts +1 -0
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +280 -0
- package/front_end/ui/components/text_editor/text_editor.ts +1 -0
- package/front_end/ui/components/tooltips/Tooltip.ts +1 -1
- package/front_end/ui/legacy/Dialog.ts +0 -1
- package/front_end/ui/legacy/SettingsUI.ts +0 -14
- package/front_end/ui/legacy/XLink.ts +0 -3
- package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +9 -0
- package/front_end/ui/legacy/components/utils/Linkifier.ts +9 -3
- package/front_end/ui/visual_logging/KnownContextValues.ts +1 -1
- package/mcp/mcp.ts +5 -0
- package/package.json +1 -1
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatterBounds.snapshot.txt +0 -4
- package/front_end/ui/components/docs/breadcrumbs_perf/initial-breadcrumb-perf.html +0 -20
- package/front_end/ui/components/docs/breadcrumbs_perf/initial-breadcrumb-perf.ts +0 -25
- package/front_end/ui/components/docs/breadcrumbs_perf/nested-breadcrumbs-perf.html +0 -20
- package/front_end/ui/components/docs/breadcrumbs_perf/nested-breadcrumbs-perf.ts +0 -36
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright 2021 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/chrome_link/chrome_link.js';
|
|
7
6
|
import '../../../ui/components/expandable_list/expandable_list.js';
|
|
@@ -15,19 +14,16 @@ import * as SDK from '../../../core/sdk/sdk.js';
|
|
|
15
14
|
import * as Protocol from '../../../generated/protocol.js';
|
|
16
15
|
import * as Buttons from '../../../ui/components/buttons/buttons.js';
|
|
17
16
|
import type * as ExpandableList from '../../../ui/components/expandable_list/expandable_list.js';
|
|
18
|
-
import * as LegacyWrapper from '../../../ui/components/legacy_wrapper/legacy_wrapper.js';
|
|
19
|
-
import * as RenderCoordinator from '../../../ui/components/render_coordinator/render_coordinator.js';
|
|
20
17
|
import type * as ReportView from '../../../ui/components/report_view/report_view.js';
|
|
21
18
|
import type * as TreeOutline from '../../../ui/components/tree_outline/tree_outline.js';
|
|
22
19
|
import * as Components from '../../../ui/legacy/components/utils/utils.js';
|
|
23
|
-
import * as
|
|
20
|
+
import * as UI from '../../../ui/legacy/legacy.js';
|
|
21
|
+
import {html, type LitTemplate, nothing, render, type TemplateResult} from '../../../ui/lit/lit.js';
|
|
24
22
|
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
|
|
25
23
|
|
|
26
24
|
import {NotRestoredReasonDescription} from './BackForwardCacheStrings.js';
|
|
27
25
|
import backForwardCacheViewStyles from './backForwardCacheView.css.js';
|
|
28
26
|
|
|
29
|
-
const {html} = Lit;
|
|
30
|
-
|
|
31
27
|
const UIStrings = {
|
|
32
28
|
/**
|
|
33
29
|
* @description Title text in back/forward cache view of the Application panel
|
|
@@ -66,6 +62,10 @@ const UIStrings = {
|
|
|
66
62
|
* page eligible for back/forward cache.
|
|
67
63
|
*/
|
|
68
64
|
pageSupportNeeded: 'Actionable',
|
|
65
|
+
/**
|
|
66
|
+
* @description Label for the completion of the back/forward cache test
|
|
67
|
+
*/
|
|
68
|
+
testCompleted: 'Back/forward cache test completed.',
|
|
69
69
|
/**
|
|
70
70
|
* @description Explanation for actionable items which prevent the page from being eligible
|
|
71
71
|
* for back/forward cache.
|
|
@@ -158,7 +158,7 @@ function renderMainFrameInformation(
|
|
|
158
158
|
frame: SDK.ResourceTreeModel.ResourceTreeFrame|null,
|
|
159
159
|
frameTreeData: {node: FrameTreeNodeData, frameCount: number, issueCount: number}|undefined,
|
|
160
160
|
reasonToFramesMap: Map<Protocol.Page.BackForwardCacheNotRestoredReason, string[]>, screenStatus: ScreenStatusType,
|
|
161
|
-
navigateAwayAndBack: () => Promise<void>):
|
|
161
|
+
navigateAwayAndBack: () => Promise<void>): TemplateResult {
|
|
162
162
|
if (!frame) {
|
|
163
163
|
// clang-format of
|
|
164
164
|
return html`
|
|
@@ -208,19 +208,19 @@ function renderMainFrameInformation(
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
function maybeRenderFrameTree(
|
|
211
|
-
frameTreeData: {node: FrameTreeNodeData, frameCount: number, issueCount: number}|undefined):
|
|
211
|
+
frameTreeData: {node: FrameTreeNodeData, frameCount: number, issueCount: number}|undefined): LitTemplate {
|
|
212
212
|
if (!frameTreeData || (frameTreeData.frameCount === 0 && frameTreeData.issueCount === 0)) {
|
|
213
|
-
return
|
|
213
|
+
return nothing;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
function treeNodeRenderer(node: TreeOutline.TreeOutlineUtils.TreeNode<FrameTreeNodeData>):
|
|
216
|
+
function treeNodeRenderer(node: TreeOutline.TreeOutlineUtils.TreeNode<FrameTreeNodeData>): TemplateResult {
|
|
217
217
|
// clang-format off
|
|
218
218
|
return html`
|
|
219
219
|
<div class="text-ellipsis">
|
|
220
220
|
${node.treeNodeData.iconName ? html`
|
|
221
221
|
<devtools-icon class="inline-icon extra-large" .name=${node.treeNodeData.iconName} style="margin-bottom: -3px;">
|
|
222
222
|
</devtools-icon>
|
|
223
|
-
` :
|
|
223
|
+
` : nothing}
|
|
224
224
|
${node.treeNodeData.text}
|
|
225
225
|
</div>`;
|
|
226
226
|
// clang-format on
|
|
@@ -274,12 +274,12 @@ function buildFrameTree(data: FrameTreeNodeData): TreeOutline.TreeOutlineUtils.T
|
|
|
274
274
|
return node;
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
function renderBackForwardCacheStatus(status: boolean|undefined):
|
|
277
|
+
function renderBackForwardCacheStatus(status: boolean|undefined): TemplateResult {
|
|
278
278
|
switch (status) {
|
|
279
279
|
case true:
|
|
280
280
|
// clang-format off
|
|
281
281
|
return html`
|
|
282
|
-
<devtools-report-section>
|
|
282
|
+
<devtools-report-section class="cache-status-section" tabindex="-1">
|
|
283
283
|
<div class="status extra-large">
|
|
284
284
|
<devtools-icon class="inline-icon extra-large" name="check-circle" style="color: var(--icon-checkmark-green);">
|
|
285
285
|
</devtools-icon>
|
|
@@ -290,7 +290,7 @@ function renderBackForwardCacheStatus(status: boolean|undefined): Lit.TemplateRe
|
|
|
290
290
|
case false:
|
|
291
291
|
// clang-format off
|
|
292
292
|
return html`
|
|
293
|
-
<devtools-report-section>
|
|
293
|
+
<devtools-report-section class="cache-status-section" tabindex="-1">
|
|
294
294
|
<div class="status">
|
|
295
295
|
<devtools-icon class="inline-icon extra-large" name="clear">
|
|
296
296
|
</devtools-icon>
|
|
@@ -301,7 +301,7 @@ function renderBackForwardCacheStatus(status: boolean|undefined): Lit.TemplateRe
|
|
|
301
301
|
}
|
|
302
302
|
// clang-format off
|
|
303
303
|
return html`
|
|
304
|
-
<devtools-report-section>
|
|
304
|
+
<devtools-report-section class="cache-status-section" tabindex="-1">
|
|
305
305
|
${i18nString(UIStrings.unknown)}
|
|
306
306
|
</devtools-report-section>`;
|
|
307
307
|
// clang-format on
|
|
@@ -310,9 +310,9 @@ function renderBackForwardCacheStatus(status: boolean|undefined): Lit.TemplateRe
|
|
|
310
310
|
function maybeRenderExplanations(
|
|
311
311
|
explanations: Protocol.Page.BackForwardCacheNotRestoredExplanation[],
|
|
312
312
|
explanationTree: Protocol.Page.BackForwardCacheNotRestoredExplanationTree|undefined,
|
|
313
|
-
reasonToFramesMap: Map<Protocol.Page.BackForwardCacheNotRestoredReason, string[]>):
|
|
313
|
+
reasonToFramesMap: Map<Protocol.Page.BackForwardCacheNotRestoredReason, string[]>): LitTemplate {
|
|
314
314
|
if (explanations.length === 0) {
|
|
315
|
-
return
|
|
315
|
+
return nothing;
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
const pageSupportNeeded = explanations.filter(
|
|
@@ -334,7 +334,7 @@ function maybeRenderExplanations(
|
|
|
334
334
|
function renderExplanations(
|
|
335
335
|
category: Platform.UIString.LocalizedString, explainerText: Platform.UIString.LocalizedString,
|
|
336
336
|
explanations: Protocol.Page.BackForwardCacheNotRestoredExplanation[],
|
|
337
|
-
reasonToFramesMap: Map<Protocol.Page.BackForwardCacheNotRestoredReason, string[]>):
|
|
337
|
+
reasonToFramesMap: Map<Protocol.Page.BackForwardCacheNotRestoredReason, string[]>): TemplateResult {
|
|
338
338
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
339
339
|
// clang-format off
|
|
340
340
|
return html`
|
|
@@ -347,11 +347,11 @@ function renderExplanations(
|
|
|
347
347
|
</div>
|
|
348
348
|
</devtools-report-section-header>
|
|
349
349
|
${explanations.map(explanation => renderReason(explanation, reasonToFramesMap.get(explanation.reason)))}
|
|
350
|
-
` :
|
|
350
|
+
` : nothing}`;
|
|
351
351
|
// clang-format on
|
|
352
352
|
}
|
|
353
353
|
|
|
354
|
-
function maybeRenderReasonContext(explanation: Protocol.Page.BackForwardCacheNotRestoredExplanation):
|
|
354
|
+
function maybeRenderReasonContext(explanation: Protocol.Page.BackForwardCacheNotRestoredExplanation): LitTemplate {
|
|
355
355
|
if (explanation.reason ===
|
|
356
356
|
Protocol.Page.BackForwardCacheNotRestoredReason.EmbedderExtensionSentMessageToCachedFrame &&
|
|
357
357
|
explanation.context) {
|
|
@@ -361,12 +361,12 @@ function maybeRenderReasonContext(explanation: Protocol.Page.BackForwardCacheNot
|
|
|
361
361
|
<devtools-chrome-link .href=${link}>${explanation.context}</devtools-chrome-link>`;
|
|
362
362
|
// clang-format on
|
|
363
363
|
}
|
|
364
|
-
return
|
|
364
|
+
return nothing;
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
-
function renderFramesPerReason(frames: string[]|undefined):
|
|
367
|
+
function renderFramesPerReason(frames: string[]|undefined): LitTemplate {
|
|
368
368
|
if (frames === undefined || frames.length === 0) {
|
|
369
|
-
return
|
|
369
|
+
return nothing;
|
|
370
370
|
}
|
|
371
371
|
const rows = [html`<div>${i18nString(UIStrings.framesPerIssue, {n: frames.length})}</div>`];
|
|
372
372
|
rows.push(...frames.map(url => html`<div class="text-ellipsis" title=${url}
|
|
@@ -383,8 +383,7 @@ function renderFramesPerReason(frames: string[]|undefined): Lit.LitTemplate {
|
|
|
383
383
|
`;
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
-
function maybeRenderDeepLinkToUnload(explanation: Protocol.Page.BackForwardCacheNotRestoredExplanation):
|
|
387
|
-
Lit.LitTemplate {
|
|
386
|
+
function maybeRenderDeepLinkToUnload(explanation: Protocol.Page.BackForwardCacheNotRestoredExplanation): LitTemplate {
|
|
388
387
|
if (explanation.reason === Protocol.Page.BackForwardCacheNotRestoredReason.UnloadHandlerExistsInMainFrame ||
|
|
389
388
|
explanation.reason === Protocol.Page.BackForwardCacheNotRestoredReason.UnloadHandlerExistsInSubFrame) {
|
|
390
389
|
return html`
|
|
@@ -395,13 +394,12 @@ function maybeRenderDeepLinkToUnload(explanation: Protocol.Page.BackForwardCache
|
|
|
395
394
|
${i18nString(UIStrings.neverUseUnload)}
|
|
396
395
|
</x-link>`;
|
|
397
396
|
}
|
|
398
|
-
return
|
|
397
|
+
return nothing;
|
|
399
398
|
}
|
|
400
399
|
|
|
401
|
-
function maybeRenderJavaScriptDetails(details: Protocol.Page.BackForwardCacheBlockingDetails[]|undefined):
|
|
402
|
-
Lit.LitTemplate {
|
|
400
|
+
function maybeRenderJavaScriptDetails(details: Protocol.Page.BackForwardCacheBlockingDetails[]|undefined): LitTemplate {
|
|
403
401
|
if (details === undefined || details.length === 0) {
|
|
404
|
-
return
|
|
402
|
+
return nothing;
|
|
405
403
|
}
|
|
406
404
|
const maxLengthForDisplayedURLs = 50;
|
|
407
405
|
const linkifier = new Components.Linkifier.Linkifier(maxLengthForDisplayedURLs);
|
|
@@ -423,7 +421,7 @@ function maybeRenderJavaScriptDetails(details: Protocol.Page.BackForwardCacheBlo
|
|
|
423
421
|
}
|
|
424
422
|
|
|
425
423
|
function renderReason(
|
|
426
|
-
explanation: Protocol.Page.BackForwardCacheNotRestoredExplanation, frames: string[]|undefined):
|
|
424
|
+
explanation: Protocol.Page.BackForwardCacheNotRestoredExplanation, frames: string[]|undefined): TemplateResult {
|
|
427
425
|
// clang-format off
|
|
428
426
|
return html`
|
|
429
427
|
<devtools-report-section>
|
|
@@ -438,7 +436,7 @@ function renderReason(
|
|
|
438
436
|
${maybeRenderDeepLinkToUnload(explanation)}
|
|
439
437
|
${maybeRenderReasonContext(explanation)}
|
|
440
438
|
</div>` :
|
|
441
|
-
|
|
439
|
+
nothing}
|
|
442
440
|
</devtools-report-section>
|
|
443
441
|
<div class="gray-text">
|
|
444
442
|
${explanation.reason}
|
|
@@ -448,36 +446,44 @@ function renderReason(
|
|
|
448
446
|
// clang-format on
|
|
449
447
|
}
|
|
450
448
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
449
|
+
interface ViewInput {
|
|
450
|
+
frame: SDK.ResourceTreeModel.ResourceTreeFrame|null;
|
|
451
|
+
frameTreeData: {node: FrameTreeNodeData, frameCount: number, issueCount: number}|undefined;
|
|
452
|
+
reasonToFramesMap: Map<Protocol.Page.BackForwardCacheNotRestoredReason, string[]>;
|
|
453
|
+
screenStatus: ScreenStatusType;
|
|
454
|
+
navigateAwayAndBack: () => Promise<void>;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
type View = (input: ViewInput, output: undefined, target: HTMLElement) => void;
|
|
458
|
+
|
|
459
|
+
const DEFAULT_VIEW: View = (input, output, target) => {
|
|
456
460
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
457
461
|
// clang-format off
|
|
458
|
-
|
|
462
|
+
render(html`
|
|
459
463
|
<style>${backForwardCacheViewStyles}</style>
|
|
460
464
|
<devtools-report .data=${
|
|
461
465
|
{reportTitle: i18nString(UIStrings.backForwardCacheTitle)} as ReportView.ReportView.ReportData
|
|
462
466
|
} jslog=${VisualLogging.pane('back-forward-cache')}>
|
|
463
467
|
|
|
464
|
-
${renderMainFrameInformation(frame, frameTreeData, reasonToFramesMap, screenStatus, navigateAwayAndBack)}
|
|
468
|
+
${renderMainFrameInformation(input.frame, input.frameTreeData, input.reasonToFramesMap, input.screenStatus, input.navigateAwayAndBack)}
|
|
465
469
|
</devtools-report>
|
|
466
470
|
`, target);
|
|
467
471
|
// clang-format on
|
|
468
|
-
}
|
|
472
|
+
};
|
|
469
473
|
|
|
470
|
-
export class BackForwardCacheView extends
|
|
471
|
-
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
474
|
+
export class BackForwardCacheView extends UI.Widget.Widget {
|
|
472
475
|
#screenStatus = ScreenStatusType.RESULT;
|
|
473
476
|
#historyIndex = 0;
|
|
477
|
+
#view: View;
|
|
474
478
|
|
|
475
|
-
constructor() {
|
|
476
|
-
super();
|
|
479
|
+
constructor(view = DEFAULT_VIEW) {
|
|
480
|
+
super({useShadowDom: true});
|
|
481
|
+
this.#view = view;
|
|
477
482
|
this.#getMainResourceTreeModel()?.addEventListener(
|
|
478
|
-
SDK.ResourceTreeModel.Events.PrimaryPageChanged, this.
|
|
483
|
+
SDK.ResourceTreeModel.Events.PrimaryPageChanged, this.requestUpdate, this);
|
|
479
484
|
this.#getMainResourceTreeModel()?.addEventListener(
|
|
480
|
-
SDK.ResourceTreeModel.Events.BackForwardCacheDetailsUpdated, this.
|
|
485
|
+
SDK.ResourceTreeModel.Events.BackForwardCacheDetailsUpdated, this.requestUpdate, this);
|
|
486
|
+
this.requestUpdate();
|
|
481
487
|
}
|
|
482
488
|
|
|
483
489
|
#getMainResourceTreeModel(): SDK.ResourceTreeModel.ResourceTreeModel|null {
|
|
@@ -488,21 +494,21 @@ export class BackForwardCacheView extends LegacyWrapper.LegacyWrapper.WrappableC
|
|
|
488
494
|
#getMainFrame(): SDK.ResourceTreeModel.ResourceTreeFrame|null {
|
|
489
495
|
return this.#getMainResourceTreeModel()?.mainFrame || null;
|
|
490
496
|
}
|
|
491
|
-
connectedCallback(): void {
|
|
492
|
-
this.parentElement?.classList.add('overflow-auto');
|
|
493
|
-
}
|
|
494
497
|
|
|
495
|
-
override async
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
498
|
+
override async performUpdate(): Promise<void> {
|
|
499
|
+
const reasonToFramesMap = new Map<Protocol.Page.BackForwardCacheNotRestoredReason, string[]>();
|
|
500
|
+
const explanationTree = this.#getMainFrame()?.backForwardCacheDetails?.explanationsTree;
|
|
501
|
+
if (explanationTree) {
|
|
502
|
+
this.#buildReasonToFramesMap(explanationTree, {blankCount: 1}, reasonToFramesMap);
|
|
503
|
+
}
|
|
504
|
+
const viewInput: ViewInput = {
|
|
505
|
+
frame: this.#getMainFrame(),
|
|
506
|
+
frameTreeData: this.#buildFrameTreeDataRecursive(explanationTree, {blankCount: 1}),
|
|
507
|
+
reasonToFramesMap,
|
|
508
|
+
screenStatus: this.#screenStatus,
|
|
509
|
+
navigateAwayAndBack: this.#navigateAwayAndBack.bind(this),
|
|
510
|
+
};
|
|
511
|
+
this.#view(viewInput, undefined, this.contentElement);
|
|
506
512
|
}
|
|
507
513
|
|
|
508
514
|
#renderBackForwardCacheTestResult(): void {
|
|
@@ -510,7 +516,14 @@ export class BackForwardCacheView extends LegacyWrapper.LegacyWrapper.WrappableC
|
|
|
510
516
|
SDK.ResourceTreeModel.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated,
|
|
511
517
|
this.#renderBackForwardCacheTestResult, this);
|
|
512
518
|
this.#screenStatus = ScreenStatusType.RESULT;
|
|
513
|
-
|
|
519
|
+
this.requestUpdate();
|
|
520
|
+
void this.updateComplete.then(() => {
|
|
521
|
+
UI.ARIAUtils.LiveAnnouncer.alert(i18nString(UIStrings.testCompleted));
|
|
522
|
+
const resultsSection = this.contentElement?.querySelector('.cache-status-section') as HTMLElement;
|
|
523
|
+
if (resultsSection) {
|
|
524
|
+
resultsSection.focus();
|
|
525
|
+
}
|
|
526
|
+
});
|
|
514
527
|
}
|
|
515
528
|
|
|
516
529
|
async #onNavigatedAway(): Promise<void> {
|
|
@@ -552,7 +565,7 @@ export class BackForwardCacheView extends LegacyWrapper.LegacyWrapper.WrappableC
|
|
|
552
565
|
}
|
|
553
566
|
this.#historyIndex = historyResults.currentIndex;
|
|
554
567
|
this.#screenStatus = ScreenStatusType.RUNNING;
|
|
555
|
-
|
|
568
|
+
this.requestUpdate();
|
|
556
569
|
|
|
557
570
|
// This event listener is removed inside of onNavigatedAway().
|
|
558
571
|
SDK.TargetManager.TargetManager.instance().addModelListener(
|
|
@@ -643,11 +656,3 @@ interface FrameTreeNodeData {
|
|
|
643
656
|
iconName?: string;
|
|
644
657
|
children?: FrameTreeNodeData[];
|
|
645
658
|
}
|
|
646
|
-
|
|
647
|
-
customElements.define('devtools-resources-back-forward-cache-view', BackForwardCacheView);
|
|
648
|
-
|
|
649
|
-
declare global {
|
|
650
|
-
interface HTMLElementTagNameMap {
|
|
651
|
-
'devtools-resources-back-forward-cache-view': BackForwardCacheView;
|
|
652
|
-
}
|
|
653
|
-
}
|
|
@@ -23,6 +23,7 @@ import * as LegacyWrapper from '../../../ui/components/legacy_wrapper/legacy_wra
|
|
|
23
23
|
import * as RenderCoordinator from '../../../ui/components/render_coordinator/render_coordinator.js';
|
|
24
24
|
import type * as ReportView from '../../../ui/components/report_view/report_view.js';
|
|
25
25
|
import * as Components from '../../../ui/legacy/components/utils/utils.js';
|
|
26
|
+
import * as UI from '../../../ui/legacy/legacy.js';
|
|
26
27
|
import * as Lit from '../../../ui/lit/lit.js';
|
|
27
28
|
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
|
|
28
29
|
|
|
@@ -35,6 +36,7 @@ import {
|
|
|
35
36
|
import type {StackTraceData} from './StackTrace.js';
|
|
36
37
|
|
|
37
38
|
const {html} = Lit;
|
|
39
|
+
const {widgetConfig} = UI.Widget;
|
|
38
40
|
|
|
39
41
|
const UIStrings = {
|
|
40
42
|
/**
|
|
@@ -283,7 +285,6 @@ export class FrameDetailsReportView extends LegacyWrapper.LegacyWrapper.Wrappabl
|
|
|
283
285
|
#protocolMonitorExperimentEnabled = false;
|
|
284
286
|
#permissionsPolicies: Promise<Protocol.Page.PermissionsPolicyFeatureState[]|null>|null = null;
|
|
285
287
|
#permissionsPolicySectionData: PermissionsPolicySectionData = {policies: [], showDetails: false};
|
|
286
|
-
#originTrialTreeView: OriginTrialTreeView = new OriginTrialTreeView();
|
|
287
288
|
#linkifier = new Components.Linkifier.Linkifier();
|
|
288
289
|
#adScriptAncestry: Protocol.Page.AdScriptAncestry|null = null;
|
|
289
290
|
|
|
@@ -317,7 +318,7 @@ export class FrameDetailsReportView extends LegacyWrapper.LegacyWrapper.Wrappabl
|
|
|
317
318
|
if (!this.#permissionsPolicies && this.#frame) {
|
|
318
319
|
this.#permissionsPolicies = this.#frame.getPermissionsPolicyState();
|
|
319
320
|
}
|
|
320
|
-
await RenderCoordinator.write('FrameDetailsView render', () => {
|
|
321
|
+
await RenderCoordinator.write('FrameDetailsView render', async () => {
|
|
321
322
|
if (!this.#frame) {
|
|
322
323
|
return;
|
|
323
324
|
}
|
|
@@ -331,7 +332,7 @@ export class FrameDetailsReportView extends LegacyWrapper.LegacyWrapper.Wrappabl
|
|
|
331
332
|
${this.#renderDocumentSection()}
|
|
332
333
|
${this.#renderIsolationSection()}
|
|
333
334
|
${this.#renderApiAvailabilitySection()}
|
|
334
|
-
${this.#renderOriginTrial()}
|
|
335
|
+
${await this.#renderOriginTrial()}
|
|
335
336
|
${Lit.Directives.until(this.#permissionsPolicies?.then(policies => {
|
|
336
337
|
this.#permissionsPolicySectionData.policies = policies || [];
|
|
337
338
|
return html`
|
|
@@ -348,17 +349,12 @@ export class FrameDetailsReportView extends LegacyWrapper.LegacyWrapper.Wrappabl
|
|
|
348
349
|
});
|
|
349
350
|
}
|
|
350
351
|
|
|
351
|
-
#renderOriginTrial(): Lit.LitTemplate {
|
|
352
|
+
async #renderOriginTrial(): Promise<Lit.LitTemplate> {
|
|
352
353
|
if (!this.#frame) {
|
|
353
354
|
return Lit.nothing;
|
|
354
355
|
}
|
|
355
356
|
|
|
356
|
-
this.#
|
|
357
|
-
|
|
358
|
-
void this.#frame.getOriginTrials().then(trials => {
|
|
359
|
-
this.#originTrialTreeView.data = {trials};
|
|
360
|
-
});
|
|
361
|
-
|
|
357
|
+
const data = {trials: await this.#frame.getOriginTrials()};
|
|
362
358
|
// clang-format off
|
|
363
359
|
return html`
|
|
364
360
|
<devtools-report-section-header>
|
|
@@ -373,7 +369,8 @@ export class FrameDetailsReportView extends LegacyWrapper.LegacyWrapper.Wrappabl
|
|
|
373
369
|
</x-link>
|
|
374
370
|
</span>
|
|
375
371
|
</devtools-report-section>
|
|
376
|
-
|
|
372
|
+
<devtools-widget class="span-cols" .widgetConfig=${widgetConfig(OriginTrialTreeView, {data})}>
|
|
373
|
+
</devtools-widget>
|
|
377
374
|
<devtools-report-divider></devtools-report-divider>`;
|
|
378
375
|
// clang-format on
|
|
379
376
|
}
|
|
@@ -11,6 +11,7 @@ import * as i18n from '../../../core/i18n/i18n.js';
|
|
|
11
11
|
import * as Protocol from '../../../generated/protocol.js';
|
|
12
12
|
import * as Adorners from '../../../ui/components/adorners/adorners.js';
|
|
13
13
|
import type * as TreeOutline from '../../../ui/components/tree_outline/tree_outline.js';
|
|
14
|
+
import * as UI from '../../../ui/legacy/legacy.js';
|
|
14
15
|
import * as Lit from '../../../ui/lit/lit.js';
|
|
15
16
|
|
|
16
17
|
import badgeStyles from './badge.css.js';
|
|
@@ -79,34 +80,18 @@ export interface BadgeData {
|
|
|
79
80
|
style: 'error'|'success'|'secondary';
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
adornerContent.textContent = data.badgeContent;
|
|
93
|
-
this.#adorner.data = {
|
|
94
|
-
name: 'badge',
|
|
95
|
-
content: adornerContent,
|
|
96
|
-
};
|
|
97
|
-
this.#adorner.classList.add(`badge-${data.style}`);
|
|
98
|
-
|
|
99
|
-
Lit.render(
|
|
100
|
-
html`
|
|
101
|
-
<style>${badgeStyles}</style>
|
|
102
|
-
${this.#adorner}
|
|
103
|
-
`,
|
|
104
|
-
this.#shadow, {host: this});
|
|
105
|
-
}
|
|
83
|
+
function createBadge(data: BadgeData): Adorners.Adorner.Adorner {
|
|
84
|
+
const adorner = new Adorners.Adorner.Adorner();
|
|
85
|
+
const adornerContent = document.createElement('span');
|
|
86
|
+
adornerContent.textContent = data.badgeContent;
|
|
87
|
+
adorner.data = {
|
|
88
|
+
name: 'badge',
|
|
89
|
+
content: adornerContent,
|
|
90
|
+
};
|
|
91
|
+
adorner.classList.add(`badge-${data.style}`);
|
|
92
|
+
return adorner;
|
|
106
93
|
}
|
|
107
94
|
|
|
108
|
-
customElements.define('devtools-resources-origin-trial-tree-view-badge', Badge);
|
|
109
|
-
|
|
110
95
|
type TreeNode<DataType> = TreeOutline.TreeOutlineUtils.TreeNode<DataType>;
|
|
111
96
|
|
|
112
97
|
/**
|
|
@@ -127,19 +112,18 @@ function constructOriginTrialTree(originTrial: Protocol.Page.OriginTrial): TreeN
|
|
|
127
112
|
constructTokenDetailsNodes(originTrial.tokensWithStatus[0]),
|
|
128
113
|
renderer: (node: TreeNode<OriginTrialTreeNodeData>) => {
|
|
129
114
|
const trial = node.treeNodeData as Protocol.Page.OriginTrial;
|
|
130
|
-
const tokenCountBadge =
|
|
131
|
-
<devtools-resources-origin-trial-tree-view-badge .data=${{
|
|
115
|
+
const tokenCountBadge = createBadge({
|
|
132
116
|
badgeContent: i18nString(UIStrings.tokens, {PH1: trial.tokensWithStatus.length}),
|
|
133
117
|
style: 'secondary',
|
|
134
|
-
}
|
|
135
|
-
`;
|
|
118
|
+
});
|
|
136
119
|
|
|
137
120
|
return html`
|
|
138
121
|
${trial.trialName}
|
|
139
|
-
<
|
|
122
|
+
<style>${badgeStyles}</style>
|
|
123
|
+
${createBadge({
|
|
140
124
|
badgeContent: trial.status,
|
|
141
125
|
style: trial.status === Protocol.Page.OriginTrialStatus.Enabled ? 'success' : 'error',
|
|
142
|
-
}
|
|
126
|
+
})}
|
|
143
127
|
${trial.tokensWithStatus.length > 1 ? tokenCountBadge : Lit.nothing}
|
|
144
128
|
`;
|
|
145
129
|
},
|
|
@@ -153,12 +137,10 @@ function constructTokenNode(token: Protocol.Page.OriginTrialTokenWithStatus): Tr
|
|
|
153
137
|
children: async () => constructTokenDetailsNodes(token),
|
|
154
138
|
renderer: (node: TreeNode<OriginTrialTreeNodeData>, state: {isExpanded: boolean}) => {
|
|
155
139
|
const tokenStatus = node.treeNodeData as string;
|
|
156
|
-
const statusBadge =
|
|
157
|
-
<devtools-resources-origin-trial-tree-view-badge .data=${{
|
|
140
|
+
const statusBadge = createBadge({
|
|
158
141
|
badgeContent: tokenStatus,
|
|
159
142
|
style: tokenStatus === Protocol.Page.OriginTrialTokenStatus.Success ? 'success' : 'error',
|
|
160
|
-
}
|
|
161
|
-
`;
|
|
143
|
+
});
|
|
162
144
|
// Only display token status for convenience when the node is not expanded.
|
|
163
145
|
return html`${i18nString(UIStrings.token)} ${state.isExpanded ? Lit.nothing : statusBadge}`;
|
|
164
146
|
},
|
|
@@ -290,10 +272,11 @@ export class OriginTrialTokenRows extends HTMLElement {
|
|
|
290
272
|
{
|
|
291
273
|
name: i18nString(UIStrings.status),
|
|
292
274
|
value: html`
|
|
293
|
-
<
|
|
275
|
+
<style>${badgeStyles}</style>
|
|
276
|
+
${createBadge({
|
|
294
277
|
badgeContent: this.#tokenWithStatus.status,
|
|
295
278
|
style: this.#tokenWithStatus.status === Protocol.Page.OriginTrialTokenStatus.Success ? 'success' : 'error',
|
|
296
|
-
}
|
|
279
|
+
})}`,
|
|
297
280
|
},
|
|
298
281
|
...this.#parsedTokenDetails,
|
|
299
282
|
];
|
|
@@ -307,7 +290,9 @@ export class OriginTrialTokenRows extends HTMLElement {
|
|
|
307
290
|
|
|
308
291
|
Lit.render(
|
|
309
292
|
html`
|
|
310
|
-
<style
|
|
293
|
+
<style>
|
|
294
|
+
${originTrialTokenRowsStyles}
|
|
295
|
+
</style>
|
|
311
296
|
<div class="content">
|
|
312
297
|
${tokenDetailRows}
|
|
313
298
|
</div>
|
|
@@ -322,45 +307,56 @@ export interface OriginTrialTreeViewData {
|
|
|
322
307
|
trials: Protocol.Page.OriginTrial[];
|
|
323
308
|
}
|
|
324
309
|
|
|
325
|
-
|
|
326
|
-
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
310
|
+
type View = (input: OriginTrialTreeViewData, output: undefined, target: HTMLElement) => void;
|
|
327
311
|
|
|
328
|
-
|
|
329
|
-
|
|
312
|
+
const DEFAULT_VIEW: View = (input, _output, target) => {
|
|
313
|
+
if (!input.trials.length) {
|
|
314
|
+
// clang-format off
|
|
315
|
+
Lit.render(html`
|
|
316
|
+
<style>${originTrialTreeViewStyles}</style>
|
|
317
|
+
<span class="status-badge">
|
|
318
|
+
<devtools-icon class="medium" name="clear"></devtools-icon>
|
|
319
|
+
<span>${i18nString(UIStrings.noTrialTokens)}</span>
|
|
320
|
+
</span>`, target);
|
|
321
|
+
// clang-format on
|
|
322
|
+
return;
|
|
330
323
|
}
|
|
331
324
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
<
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
325
|
+
// clang-format off
|
|
326
|
+
Lit.render(html`
|
|
327
|
+
<style>
|
|
328
|
+
${originTrialTreeViewStyles}
|
|
329
|
+
</style>
|
|
330
|
+
<devtools-tree-outline .data=${{
|
|
331
|
+
tree: input.trials.map(constructOriginTrialTree),
|
|
332
|
+
defaultRenderer,
|
|
333
|
+
} as TreeOutline.TreeOutline.TreeOutlineData < OriginTrialTreeNodeData >}>
|
|
334
|
+
</devtools-tree-outline>
|
|
335
|
+
`, target);
|
|
336
|
+
// clang-format on
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
export class OriginTrialTreeView extends UI.Widget.Widget {
|
|
340
|
+
#data: OriginTrialTreeViewData = {trials: []};
|
|
341
|
+
#view: View;
|
|
342
|
+
|
|
343
|
+
constructor(element?: HTMLElement, view: View = DEFAULT_VIEW) {
|
|
344
|
+
super(element, {useShadowDom: true});
|
|
345
|
+
this.#view = view;
|
|
346
|
+
}
|
|
344
347
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
<devtools-tree-outline .data=${{
|
|
349
|
-
tree: trials.map(constructOriginTrialTree),
|
|
350
|
-
defaultRenderer,
|
|
351
|
-
} as TreeOutline.TreeOutline.TreeOutlineData < OriginTrialTreeNodeData >}>
|
|
352
|
-
</devtools-tree-outline>
|
|
353
|
-
`,
|
|
354
|
-
this.#shadow, {host: this});
|
|
348
|
+
set data(data: OriginTrialTreeViewData) {
|
|
349
|
+
this.#data = data;
|
|
350
|
+
this.requestUpdate();
|
|
355
351
|
}
|
|
356
|
-
}
|
|
357
352
|
|
|
358
|
-
|
|
353
|
+
override performUpdate(): void {
|
|
354
|
+
this.#view(this.#data, undefined, this.contentElement);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
359
357
|
|
|
360
358
|
declare global {
|
|
361
359
|
interface HTMLElementTagNameMap {
|
|
362
|
-
'devtools-resources-origin-trial-tree-view': OriginTrialTreeView;
|
|
363
360
|
'devtools-resources-origin-trial-token-rows': OriginTrialTokenRows;
|
|
364
|
-
'devtools-resources-origin-trial-tree-view-badge': Badge;
|
|
365
361
|
}
|
|
366
362
|
}
|