blob: 1853c2c1bba7c3de7c01bf1c6ca8e9ac79edc5e1 [file] [log] [blame]
Danil Somsikov4ba8f352021-06-09 12:27:221// Copyright 2021 The Chromium Authors. All rights reserved.
Wolfgang Beyer760462e2020-07-13 15:01:352// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Wolfgang Beyer19093942021-03-15 15:00:345import type {StackTraceData} from './StackTrace.js';
Kriti Sapra74915452021-05-13 11:57:366import {StackTrace} from './StackTrace.js';
Wolfgang Beyerffae99f2021-07-08 08:46:537import type {PermissionsPolicySectionData} from './PermissionsPolicySection.js';
8import {PermissionsPolicySection, renderIconLink} from './PermissionsPolicySection.js';
Tim van der Lippe1bd5e212021-05-06 10:54:299import * as Bindings from '../../../models/bindings/bindings.js';
10import * as Common from '../../../core/common/common.js';
11import * as i18n from '../../../core/i18n/i18n.js';
Sigurd Schneider2e36ec62021-06-11 06:14:2712import * as NetworkForward from '../../../panels/network/forward/forward.js';
Jack Franklina75ae7c2021-05-11 13:22:5413import type * as Platform from '../../../core/platform/platform.js';
Tim van der Lippe1bd5e212021-05-06 10:54:2914import * as Root from '../../../core/root/root.js';
Tim van der Lippec2cbf322021-07-26 14:35:3315import * as SDK from '../../../core/sdk/sdk.js';
Paul Lewis01f49392021-05-10 13:54:2016import * as LitHtml from '../../../ui/lit-html/lit-html.js';
Sigurd Schneidercc9a02e2021-06-16 06:20:3317import * as ExpandableList from '../../../ui/components/expandable_list/expandable_list.js';
Kriti Sapra74915452021-05-13 11:57:3618import * as ReportView from '../../../ui/components/report_view/report_view.js';
19import * as IconButton from '../../../ui/components/icon_button/icon_button.js';
Tim van der Lippe1bd5e212021-05-06 10:54:2920import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
21import * as UI from '../../../ui/legacy/legacy.js';
22import * as Workspace from '../../../models/workspace/workspace.js';
23import * as Components from '../../../ui/legacy/components/utils/utils.js';
Tim van der Lippe229a54f2021-05-14 16:59:0524import * as Protocol from '../../../generated/protocol.js';
Charlie Hu2086be52021-07-02 16:12:1225import type {OriginTrialTreeViewData} from './OriginTrialTreeView.js';
26import {OriginTrialTreeView} from './OriginTrialTreeView.js';
Wolfgang Beyerffae99f2021-07-08 08:46:5327import * as Coordinator from '../../../ui/components/render_coordinator/render_coordinator.js';
Wolfgang Beyer760462e2020-07-13 15:01:3528
Kriti Sapra9db87f52021-07-14 12:51:1229import frameDetailsReportViewStyles from './frameDetailsReportView.css.js';
30
Simon Zünd697fb0b2021-03-01 10:12:4231const UIStrings = {
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:0132 /**
33 *@description Section header in the Frame Details view
34 */
35 additionalInformation: 'Additional Information',
36 /**
37 *@description Explanation for why the additional information section is being shown
38 */
39 thisAdditionalDebugging:
40 'This additional (debugging) information is shown because the \'Protocol Monitor\' experiment is enabled.',
41 /**
42 *@description Label for subtitle of frame details view
43 */
44 frameId: 'Frame ID',
45 /**
46 *@description Name of a network resource type
47 */
48 document: 'Document',
49 /**
Wolfgang Beyer5e451ff2021-12-08 16:44:3550 *@description A web URL (for a lot of languages this does not need to be translated, please translate only where necessary)
51 */
52 url: 'URL',
53 /**
54 /**
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:0155 *@description Title for a link to the Sources panel
56 */
57 clickToRevealInSourcesPanel: 'Click to reveal in Sources panel',
58 /**
59 *@description Title for a link to the Network panel
60 */
61 clickToRevealInNetworkPanel: 'Click to reveal in Network panel',
62 /**
63 *@description Title for unreachable URL field
64 */
65 unreachableUrl: 'Unreachable URL',
66 /**
67 *@description Title for a link that applies a filter to the network panel
68 */
69 clickToRevealInNetworkPanelMight: 'Click to reveal in Network panel (might require page reload)',
70 /**
Wolfgang Beyer5e451ff2021-12-08 16:44:3571 *@description The origin of a URL (https://web.dev/same-site-same-origin/#origin)
72 *(for a lot of languages this does not need to be translated, please translate only where necessary)
73 */
74 origin: 'Origin',
75 /**
76 /**
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:0177 *@description Related node label in Timeline UIUtils of the Performance panel
78 */
79 ownerElement: 'Owner Element',
80 /**
81 *@description Title for a link to the Elements panel
82 */
83 clickToRevealInElementsPanel: 'Click to reveal in Elements panel',
84 /**
85 *@description Title for ad frame type field
86 */
87 adStatus: 'Ad Status',
88 /**
89 *@description Description for ad frame type
90 */
Sigurd Schneidercc9a02e2021-06-16 06:20:3391 rootDescription: 'This frame has been identified as the root frame of an ad',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:0192 /**
93 *@description Value for ad frame type
94 */
95 root: 'root',
96 /**
97 *@description Description for ad frame type
98 */
Sigurd Schneidercc9a02e2021-06-16 06:20:3399 childDescription: 'This frame has been identified as a child frame of an ad',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01100 /**
101 *@description Value for ad frame type
102 */
103 child: 'child',
104 /**
105 *@description Section header in the Frame Details view
106 */
107 securityIsolation: 'Security & Isolation',
108 /**
109 *@description Row title for in the Frame Details view
110 */
111 secureContext: 'Secure Context',
112 /**
113 *@description Text in Timeline indicating that input has happened recently
114 */
115 yes: 'Yes',
116 /**
117 *@description Text in Timeline indicating that input has not happened recently
118 */
119 no: 'No',
120 /**
Wolfgang Beyer5e451ff2021-12-08 16:44:35121 *@description Label for whether a frame is cross-origin isolated
122 *(https://developer.chrome.com/docs/extensions/mv3/cross-origin-isolation/)
123 *(for a lot of languages this does not need to be translated, please translate only where necessary)
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01124 */
Wolfgang Beyer5e451ff2021-12-08 16:44:35125 crossoriginIsolated: 'Cross-Origin Isolated',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01126 /**
127 *@description Explanatory text in the Frame Details view
128 */
Wolfgang Beyerdbf211e2021-11-23 10:23:54129 localhostIsAlwaysASecureContext: '`Localhost` is always a secure context',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01130 /**
131 *@description Explanatory text in the Frame Details view
132 */
133 aFrameAncestorIsAnInsecure: 'A frame ancestor is an insecure context',
134 /**
135 *@description Explanatory text in the Frame Details view
136 */
137 theFramesSchemeIsInsecure: 'The frame\'s scheme is insecure',
138 /**
Peter Marshallec861882021-02-16 11:14:21139 *@description This label specifies the server endpoints to which the server is reporting errors
140 *and warnings through the Report-to API. Following this label will be the URL of the server.
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01141 */
142 reportingTo: 'reporting to',
143 /**
144 *@description Section header in the Frame Details view
145 */
146 apiAvailability: 'API availability',
147 /**
Wolfgang Beyer5e451ff2021-12-08 16:44:35148 *@description Explanation of why cross-origin isolation is important
149 *(https://web.dev/why-coop-coep/)
150 *(for a lot of languages 'cross-origin isolation' does not need to be translated, please translate only where necessary)
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01151 */
Wolfgang Beyer5e451ff2021-12-08 16:44:35152 availabilityOfCertainApisDepends: 'Availability of certain APIs depends on the document being cross-origin isolated.',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01153 /**
154 *@description Description of the SharedArrayBuffer status
155 */
156 availableTransferable: 'available, transferable',
157 /**
158 *@description Description of the SharedArrayBuffer status
159 */
160 availableNotTransferable: 'available, not transferable',
161 /**
162 *@description Explanation for the SharedArrayBuffer availability status
163 */
164 unavailable: 'unavailable',
165 /**
166 *@description Tooltip for the SharedArrayBuffer availability status
167 */
168 sharedarraybufferConstructorIs:
Wolfgang Beyerdbf211e2021-11-23 10:23:54169 '`SharedArrayBuffer` constructor is available and `SABs` can be transferred via `postMessage`',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01170 /**
171 *@description Tooltip for the SharedArrayBuffer availability status
172 */
173 sharedarraybufferConstructorIsAvailable:
Wolfgang Beyerdbf211e2021-11-23 10:23:54174 '`SharedArrayBuffer` constructor is available but `SABs` cannot be transferred via `postMessage`',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01175 /**
Wolfgang Beyer5e451ff2021-12-08 16:44:35176 *@description Explanation why SharedArrayBuffer will not be available in the future
177 *(https://developer.chrome.com/docs/extensions/mv3/cross-origin-isolation/)
178 *(for a lot of languages 'cross-origin isolation' does not need to be translated, please translate only where necessary)
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01179 */
Wolfgang Beyer5e451ff2021-12-08 16:44:35180 willRequireCrossoriginIsolated: '⚠️ will require cross-origin isolated context in the future',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01181 /**
Wolfgang Beyer5e451ff2021-12-08 16:44:35182 *@description Explanation why SharedArrayBuffer is not available
183 *(https://developer.chrome.com/docs/extensions/mv3/cross-origin-isolation/)
184 *(for a lot of languages 'cross-origin isolation' does not need to be translated, please translate only where necessary).
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01185 */
Wolfgang Beyer5e451ff2021-12-08 16:44:35186 requiresCrossoriginIsolated: 'requires cross-origin isolated context',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01187 /**
Sigurd Schneiderf7e58be2021-05-14 14:41:52188 *@description Explanation for the SharedArrayBuffer availability status in case the transfer of a SAB requires the
189 * permission policy `cross-origin-isolated` to be enabled (e.g. because the message refers to the situation in an iframe).
190 */
191 transferRequiresCrossoriginIsolatedPermission:
192 '`SharedArrayBuffer` transfer requires enabling the permission policy:',
Sigurd Schneider2a450252021-05-04 07:13:15193 /**
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01194 *@description Explanation for the Measure Memory availability status
195 */
196 available: 'available',
197 /**
198 *@description Tooltip for the Measure Memory availability status
199 */
Wolfgang Beyerdbf211e2021-11-23 10:23:54200 thePerformanceAPI: 'The `performance.measureUserAgentSpecificMemory()` API is available',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01201 /**
202 *@description Tooltip for the Measure Memory availability status
203 */
Wolfgang Beyerdbf211e2021-11-23 10:23:54204 thePerformancemeasureuseragentspecificmemory:
205 'The `performance.measureUserAgentSpecificMemory()` API is not available',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01206 /**
207 *@description Entry in the API availability section of the frame details view
208 */
209 measureMemory: 'Measure Memory',
210 /**
211 *@description Text that is usually a hyperlink to more documentation
212 */
213 learnMore: 'Learn more',
Wolfgang Beyer19093942021-03-15 15:00:34214 /**
Wolfgang Beyer40834922021-05-10 08:34:22215 *@description Label for a stack trace. If a frame is created programmatically (i.e. via JavaScript), there is a
216 * stack trace for the line of code which caused the creation of the iframe. This is the stack trace we are showing here.
Wolfgang Beyer19093942021-03-15 15:00:34217 */
Wolfgang Beyerdbf211e2021-11-23 10:23:54218 creationStackTrace: 'Frame Creation `Stack Trace`',
Wolfgang Beyer19093942021-03-15 15:00:34219 /**
220 *@description Tooltip for 'Frame Creation Stack Trace' explaining that the stack
221 *trace shows where in the code the frame has been created programmatically
222 */
Wolfgang Beyerdbf211e2021-11-23 10:23:54223 creationStackTraceExplanation:
224 'This frame was created programmatically. The `stack trace` shows where this happened.',
Wolfgang Beyer4751c1c2021-03-24 15:32:35225 /**
Sigurd Schneidercc9a02e2021-06-16 06:20:33226 *@description Text descripting why a frame has been indentified as an advertisement.
227 */
228 parentIsAdExplanation: 'This frame is considered an ad frame because its parent frame is an ad frame.',
229 /**
230 *@description Text descripting why a frame has been indentified as an advertisement.
231 */
232 matchedBlockingRuleExplanation:
233 'This frame is considered an ad frame because its current (or previous) main document is an ad resource.',
234 /**
235 *@description Text descripting why a frame has been indentified as an advertisement.
236 */
237 createdByAdScriptExplanation:
Wolfgang Beyerdbf211e2021-11-23 10:23:54238 'There was an ad script in the `(async) stack` when this frame was created. Examining the creation `stack trace` of this frame might provide more insight.',
Wolfgang Beyer1a432c42022-01-20 09:30:14239 /**
240 *@description Label for a button which when clicked causes some information to be refreshed/updated.
241 */
242 refresh: 'Refresh',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01243};
Tim van der Lippe1bd5e212021-05-06 10:54:29244const str_ = i18n.i18n.registerUIStrings('panels/application/components/FrameDetailsView.ts', UIStrings);
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01245const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
Sigurd Schneider1e5ad282020-07-17 11:52:08246export class FrameDetailsView extends UI.ThrottledWidget.ThrottledWidget {
Tim van der Lippec3f835a2021-12-15 13:28:32247 readonly #reportView = new FrameDetailsReportView();
248 readonly #frame: SDK.ResourceTreeModel.ResourceTreeFrame;
Wolfgang Beyer92395c92021-02-02 10:43:23249
Wolfgang Beyer309863f2021-01-21 09:01:21250 constructor(frame: SDK.ResourceTreeModel.ResourceTreeFrame) {
Wolfgang Beyer760462e2020-07-13 15:01:35251 super();
Tim van der Lippec3f835a2021-12-15 13:28:32252 this.#frame = frame;
Wolfgang Beyere5d1a9f2021-02-05 09:42:43253 this.contentElement.classList.add('overflow-auto');
Tim van der Lippec3f835a2021-12-15 13:28:32254 this.contentElement.appendChild(this.#reportView);
Sigurd Schneider1e5ad282020-07-17 11:52:08255 this.update();
256 }
257
Wolfgang Beyer309863f2021-01-21 09:01:21258 async doUpdate(): Promise<void> {
Tim van der Lippec3f835a2021-12-15 13:28:32259 this.#reportView.data = {frame: this.#frame};
Sigurd Schneidereabef962020-11-05 10:51:49260 }
Wolfgang Beyer760462e2020-07-13 15:01:35261}
Wolfgang Beyer3b4747f2020-08-12 07:30:46262
Wolfgang Beyerffae99f2021-07-08 08:46:53263const coordinator = Coordinator.RenderCoordinator.RenderCoordinator.instance();
264
Wolfgang Beyer92395c92021-02-02 10:43:23265export interface FrameDetailsReportViewData {
266 frame: SDK.ResourceTreeModel.ResourceTreeFrame;
267}
268
269export class FrameDetailsReportView extends HTMLElement {
Jack Franklinaf799b32021-07-01 08:37:18270 static readonly litTagName = LitHtml.literal`devtools-resources-frame-details-view`;
Tim van der Lippec3f835a2021-12-15 13:28:32271 readonly #shadow = this.attachShadow({mode: 'open'});
272 #frame?: SDK.ResourceTreeModel.ResourceTreeFrame;
273 #protocolMonitorExperimentEnabled = false;
274 #permissionsPolicies: Promise<Protocol.Page.PermissionsPolicyFeatureState[]|null>|null = null;
275 #permissionsPolicySectionData: PermissionsPolicySectionData = {policies: [], showDetails: false};
276 #originTrialTreeView: OriginTrialTreeView = new OriginTrialTreeView();
Wolfgang Beyere5d1a9f2021-02-05 09:42:43277
278 connectedCallback(): void {
Tim van der Lippec3f835a2021-12-15 13:28:32279 this.#protocolMonitorExperimentEnabled = Root.Runtime.experiments.isEnabled('protocolMonitor');
280 this.#shadow.adoptedStyleSheets = [frameDetailsReportViewStyles];
Wolfgang Beyere5d1a9f2021-02-05 09:42:43281 }
Wolfgang Beyer92395c92021-02-02 10:43:23282
283 set data(data: FrameDetailsReportViewData) {
Tim van der Lippec3f835a2021-12-15 13:28:32284 this.#frame = data.frame;
285 if (!this.#permissionsPolicies && this.#frame) {
286 this.#permissionsPolicies = this.#frame.getPermissionsPolicyState();
Wolfgang Beyerffae99f2021-07-08 08:46:53287 }
Tim van der Lippe2d9a95c2022-01-04 15:18:03288 void this.#render();
Wolfgang Beyer92395c92021-02-02 10:43:23289 }
290
Tim van der Lippec3f835a2021-12-15 13:28:32291 async #render(): Promise<void> {
Wolfgang Beyerffae99f2021-07-08 08:46:53292 await coordinator.write('FrameDetailsView render', () => {
Tim van der Lippec3f835a2021-12-15 13:28:32293 if (!this.#frame) {
Wolfgang Beyerffae99f2021-07-08 08:46:53294 return;
295 }
Wolfgang Beyer92395c92021-02-02 10:43:23296
Wolfgang Beyerffae99f2021-07-08 08:46:53297 // Disabled until https://crbug.com/1079231 is fixed.
298 // clang-format off
Wolfgang Beyerffae99f2021-07-08 08:46:53299 LitHtml.render(LitHtml.html`
Tim van der Lippec3f835a2021-12-15 13:28:32300 <${ReportView.ReportView.Report.litTagName} .data=${{reportTitle: this.#frame.displayName()} as ReportView.ReportView.ReportData}>
301 ${this.#renderDocumentSection()}
302 ${this.#renderIsolationSection()}
303 ${this.#renderApiAvailabilitySection()}
304 ${this.#renderOriginTrial()}
305 ${LitHtml.Directives.until(this.#permissionsPolicies?.then(policies => {
306 this.#permissionsPolicySectionData.policies = policies || [];
Wolfgang Beyerffae99f2021-07-08 08:46:53307 return LitHtml.html`
308 <${PermissionsPolicySection.litTagName}
Tim van der Lippec3f835a2021-12-15 13:28:32309 .data=${this.#permissionsPolicySectionData as PermissionsPolicySectionData}
Wolfgang Beyerffae99f2021-07-08 08:46:53310 >
311 </${PermissionsPolicySection.litTagName}>
312 `;
313 }), LitHtml.nothing)}
Tim van der Lippec3f835a2021-12-15 13:28:32314 ${this.#protocolMonitorExperimentEnabled ? this.#renderAdditionalInfoSection() : LitHtml.nothing}
Wolfgang Beyerffae99f2021-07-08 08:46:53315 </${ReportView.ReportView.Report.litTagName}>
Tim van der Lippec3f835a2021-12-15 13:28:32316 `, this.#shadow, {host: this});
Wolfgang Beyerffae99f2021-07-08 08:46:53317 // clang-format on
318 });
Wolfgang Beyer92395c92021-02-02 10:43:23319 }
Wolfgang Beyer1525b1f2021-02-02 14:12:30320
Jack Franklind7508302022-05-09 14:22:21321 #renderOriginTrial(): LitHtml.LitTemplate {
Tim van der Lippec3f835a2021-12-15 13:28:32322 if (!this.#frame) {
Charlie Hu2086be52021-07-02 16:12:12323 return LitHtml.nothing;
324 }
Charlie Hu6c295cf2021-08-10 15:38:48325
Tim van der Lippec3f835a2021-12-15 13:28:32326 this.#originTrialTreeView.classList.add('span-cols');
Charlie Hu6c295cf2021-08-10 15:38:48327
Tim van der Lippec3f835a2021-12-15 13:28:32328 const frame = this.#frame;
Charlie Hu6c295cf2021-08-10 15:38:48329 const refreshOriginTrials: () => void = () => {
Tim van der Lippe2d9a95c2022-01-04 15:18:03330 void frame.getOriginTrials().then(trials => {
Tim van der Lippec3f835a2021-12-15 13:28:32331 this.#originTrialTreeView.data = {trials} as OriginTrialTreeViewData;
Charlie Hu6c295cf2021-08-10 15:38:48332 });
333 };
334 refreshOriginTrials();
335
Charlie Hu2086be52021-07-02 16:12:12336 return LitHtml.html`
Charlie Hu6c295cf2021-08-10 15:38:48337 <${ReportView.ReportView.ReportSectionHeader.litTagName}>
Wolfgang Beyerdbf211e2021-11-23 10:23:54338 ${i18n.i18n.lockedString('Origin Trials')}
Jack Franklina31102b2021-12-03 15:01:22339 <${IconButton.IconButton.IconButton.litTagName} class="inline-button" .data=${{
Charlie Hu6c295cf2021-08-10 15:38:48340 clickHandler: refreshOriginTrials,
341 groups: [
342 {
343 iconName: 'refresh_12x12_icon',
Wolfgang Beyer1a432c42022-01-20 09:30:14344 text: i18nString(UIStrings.refresh),
Wolfgang Beyer6bdafac2022-01-24 09:24:43345 iconColor: 'var(--color-text-primary)',
Charlie Hu6c295cf2021-08-10 15:38:48346 } as IconButton.IconButton.IconWithTextData,
347 ],
Jack Franklina31102b2021-12-03 15:01:22348 } as IconButton.IconButton.IconButtonData}>
Charlie Hu6c295cf2021-08-10 15:38:48349 </${IconButton.IconButton.IconButton.litTagName}>
Charlie Hu2086be52021-07-02 16:12:12350 </${ReportView.ReportView.ReportSectionHeader.litTagName}>
Tim van der Lippec3f835a2021-12-15 13:28:32351 ${this.#originTrialTreeView}
Charlie Hu2086be52021-07-02 16:12:12352 <${ReportView.ReportView.ReportSectionDivider.litTagName}></${
353 ReportView.ReportView.ReportSectionDivider.litTagName}>
354 `;
355 }
356
Jack Franklind7508302022-05-09 14:22:21357 #renderDocumentSection(): LitHtml.LitTemplate {
Tim van der Lippec3f835a2021-12-15 13:28:32358 if (!this.#frame) {
Wolfgang Beyer1525b1f2021-02-02 14:12:30359 return LitHtml.nothing;
360 }
361
362 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36363 <${ReportView.ReportView.ReportSectionHeader.litTagName}>${i18nString(UIStrings.document)}</${
364 ReportView.ReportView.ReportSectionHeader.litTagName}>
Wolfgang Beyer5e451ff2021-12-08 16:44:35365 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.url)}</${
Kriti Sapra74915452021-05-13 11:57:36366 ReportView.ReportView.ReportKey.litTagName}>
367 <${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer1525b1f2021-02-02 14:12:30368 <div class="inline-items">
Tim van der Lippec3f835a2021-12-15 13:28:32369 ${this.#maybeRenderSourcesLinkForURL()}
370 ${this.#maybeRenderNetworkLinkForURL()}
371 <div class="text-ellipsis" title=${this.#frame.url}>${this.#frame.url}</div>
Wolfgang Beyer1525b1f2021-02-02 14:12:30372 </div>
Kriti Sapra74915452021-05-13 11:57:36373 </${ReportView.ReportView.ReportValue.litTagName}>
Tim van der Lippec3f835a2021-12-15 13:28:32374 ${this.#maybeRenderUnreachableURL()}
375 ${this.#maybeRenderOrigin()}
376 ${LitHtml.Directives.until(this.#renderOwnerElement(), LitHtml.nothing)}
377 ${this.#maybeRenderCreationStacktrace()}
378 ${this.#maybeRenderAdStatus()}
Kriti Sapra74915452021-05-13 11:57:36379 <${ReportView.ReportView.ReportSectionDivider.litTagName}></${
380 ReportView.ReportView.ReportSectionDivider.litTagName}>
Wolfgang Beyer1525b1f2021-02-02 14:12:30381 `;
382 }
383
Jack Franklind7508302022-05-09 14:22:21384 #maybeRenderSourcesLinkForURL(): LitHtml.LitTemplate {
Tim van der Lippec3f835a2021-12-15 13:28:32385 if (!this.#frame || this.#frame.unreachableUrl()) {
Wolfgang Beyer1525b1f2021-02-02 14:12:30386 return LitHtml.nothing;
387 }
Tim van der Lippec3f835a2021-12-15 13:28:32388 const sourceCode = this.#uiSourceCodeForFrame(this.#frame);
Wolfgang Beyerffae99f2021-07-08 08:46:53389 return renderIconLink(
Wolfgang Beyer1525b1f2021-02-02 14:12:30390 'sources_panel_icon',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01391 i18nString(UIStrings.clickToRevealInSourcesPanel),
Wolfgang Beyer1525b1f2021-02-02 14:12:30392 (): Promise<void> => Common.Revealer.reveal(sourceCode),
393 );
394 }
395
Jack Franklind7508302022-05-09 14:22:21396 #maybeRenderNetworkLinkForURL(): LitHtml.LitTemplate {
Tim van der Lippec3f835a2021-12-15 13:28:32397 if (this.#frame) {
398 const resource = this.#frame.resourceForURL(this.#frame.url);
Wolfgang Beyer1525b1f2021-02-02 14:12:30399 if (resource && resource.request) {
400 const request = resource.request;
Wolfgang Beyerffae99f2021-07-08 08:46:53401 return renderIconLink(
Sigurd Schneider14d3e9f2021-06-14 08:29:01402 'network_panel_icon', i18nString(UIStrings.clickToRevealInNetworkPanel), (): Promise<void> => {
403 const requestLocation = NetworkForward.UIRequestLocation.UIRequestLocation.tab(
404 request, NetworkForward.UIRequestLocation.UIRequestTabs.Headers);
405 return Common.Revealer.reveal(requestLocation);
406 });
Wolfgang Beyer1525b1f2021-02-02 14:12:30407 }
408 }
409 return LitHtml.nothing;
410 }
411
Tim van der Lippec3f835a2021-12-15 13:28:32412 #uiSourceCodeForFrame(frame: SDK.ResourceTreeModel.ResourceTreeFrame): Workspace.UISourceCode.UISourceCode|null {
Wolfgang Beyer1525b1f2021-02-02 14:12:30413 for (const project of Workspace.Workspace.WorkspaceImpl.instance().projects()) {
414 const projectTarget = Bindings.NetworkProject.NetworkProject.getTargetForProject(project);
415 if (projectTarget && projectTarget === frame.resourceTreeModel().target()) {
416 const uiSourceCode = project.uiSourceCodeForURL(frame.url);
417 if (uiSourceCode) {
418 return uiSourceCode;
419 }
420 }
421 }
422 return null;
423 }
424
Jack Franklind7508302022-05-09 14:22:21425 #maybeRenderUnreachableURL(): LitHtml.LitTemplate {
Tim van der Lippec3f835a2021-12-15 13:28:32426 if (!this.#frame || !this.#frame.unreachableUrl()) {
Wolfgang Beyer1525b1f2021-02-02 14:12:30427 return LitHtml.nothing;
428 }
429 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36430 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.unreachableUrl)}</${
431 ReportView.ReportView.ReportKey.litTagName}>
432 <${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer1525b1f2021-02-02 14:12:30433 <div class="inline-items">
Tim van der Lippec3f835a2021-12-15 13:28:32434 ${this.#renderNetworkLinkForUnreachableURL()}
435 <div class="text-ellipsis" title=${this.#frame.unreachableUrl()}>${this.#frame.unreachableUrl()}</div>
Wolfgang Beyer1525b1f2021-02-02 14:12:30436 </div>
Kriti Sapra74915452021-05-13 11:57:36437 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer1525b1f2021-02-02 14:12:30438 `;
439 }
440
Jack Franklind7508302022-05-09 14:22:21441 #renderNetworkLinkForUnreachableURL(): LitHtml.LitTemplate {
Tim van der Lippec3f835a2021-12-15 13:28:32442 if (this.#frame) {
443 const unreachableUrl = Common.ParsedURL.ParsedURL.fromString(this.#frame.unreachableUrl());
Wolfgang Beyer1525b1f2021-02-02 14:12:30444 if (unreachableUrl) {
Wolfgang Beyerffae99f2021-07-08 08:46:53445 return renderIconLink(
Wolfgang Beyer1525b1f2021-02-02 14:12:30446 'network_panel_icon',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01447 i18nString(UIStrings.clickToRevealInNetworkPanelMight),
Wolfgang Beyer1525b1f2021-02-02 14:12:30448 ():
449 void => {
Tim van der Lippe2d9a95c2022-01-04 15:18:03450 void Common.Revealer.reveal(NetworkForward.UIFilter.UIRequestFilter.filters([
Wolfgang Beyer1525b1f2021-02-02 14:12:30451 {
Sigurd Schneider30722582021-06-16 06:54:16452 filterType: NetworkForward.UIFilter.FilterType.Domain,
Wolfgang Beyer1525b1f2021-02-02 14:12:30453 filterValue: unreachableUrl.domain(),
454 },
455 {
456 filterType: null,
457 filterValue: unreachableUrl.path,
458 },
Sigurd Schneider30722582021-06-16 06:54:16459 ]));
Wolfgang Beyer1525b1f2021-02-02 14:12:30460 },
461 );
462 }
463 }
464 return LitHtml.nothing;
465 }
466
Jack Franklind7508302022-05-09 14:22:21467 #maybeRenderOrigin(): LitHtml.LitTemplate {
Tim van der Lippec3f835a2021-12-15 13:28:32468 if (this.#frame && this.#frame.securityOrigin && this.#frame.securityOrigin !== '://') {
Wolfgang Beyer1525b1f2021-02-02 14:12:30469 return LitHtml.html`
Wolfgang Beyer5e451ff2021-12-08 16:44:35470 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.origin)}</${
Kriti Sapra74915452021-05-13 11:57:36471 ReportView.ReportView.ReportKey.litTagName}>
472 <${ReportView.ReportView.ReportValue.litTagName}>
Tim van der Lippec3f835a2021-12-15 13:28:32473 <div class="text-ellipsis" title=${this.#frame.securityOrigin}>${this.#frame.securityOrigin}</div>
Kriti Sapra74915452021-05-13 11:57:36474 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer1525b1f2021-02-02 14:12:30475 `;
476 }
477 return LitHtml.nothing;
478 }
479
Jack Franklind7508302022-05-09 14:22:21480 async #renderOwnerElement(): Promise<LitHtml.LitTemplate> {
Tim van der Lippec3f835a2021-12-15 13:28:32481 if (this.#frame) {
482 const linkTargetDOMNode = await this.#frame.getOwnerDOMNodeOrDocument();
Wolfgang Beyerf0d985e2021-02-05 12:56:52483 if (linkTargetDOMNode) {
484 // Disabled until https://crbug.com/1079231 is fixed.
485 // clang-format off
Wolfgang Beyerf0d985e2021-02-05 12:56:52486 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36487 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.ownerElement)}</${ReportView.ReportView.ReportKey.litTagName}>
488 <${ReportView.ReportView.ReportValue.litTagName} class="without-min-width">
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01489 <button class="link" role="link" tabindex=0 title=${i18nString(UIStrings.clickToRevealInElementsPanel)}
Tim van der Lippec3f835a2021-12-15 13:28:32490 @mouseenter=${(): Promise<void>|undefined => this.#frame?.highlight()}
Wolfgang Beyerf0d985e2021-02-05 12:56:52491 @mouseleave=${(): void => SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight()}
492 @click=${(): Promise<void> => Common.Revealer.reveal(linkTargetDOMNode)}
493 >
Kriti Sapra74915452021-05-13 11:57:36494 <${IconButton.Icon.Icon.litTagName} class="button-icon-with-text" .data=${{
Wolfgang Beyerf0d985e2021-02-05 12:56:52495 iconName: 'elements_panel_icon',
496 color: 'var(--color-primary)',
497 width: '16px',
498 height: '16px',
Kriti Sapra74915452021-05-13 11:57:36499 } as IconButton.Icon.IconData}></${IconButton.Icon.Icon.litTagName}>
Jack Franklin5ba6ec62021-04-30 07:36:20500 &lt;${linkTargetDOMNode.nodeName().toLocaleLowerCase()}&gt;
Wolfgang Beyer09b0e8e2021-02-09 13:39:48501 </button>
Kriti Sapra74915452021-05-13 11:57:36502 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyerf0d985e2021-02-05 12:56:52503 `;
504 // clang-format on
Wolfgang Beyer1525b1f2021-02-02 14:12:30505 }
506 }
507 return LitHtml.nothing;
508 }
509
Jack Franklind7508302022-05-09 14:22:21510 #maybeRenderCreationStacktrace(): LitHtml.LitTemplate {
Tim van der Lippec3f835a2021-12-15 13:28:32511 const creationStackTraceData = this.#frame?.getCreationStackTraceData();
Wolfgang Beyera20485a2021-04-21 07:22:19512 if (creationStackTraceData && creationStackTraceData.creationStackTrace) {
Wolfgang Beyera036d0c2021-03-19 09:09:33513 // Disabled until https://crbug.com/1079231 is fixed.
514 // clang-format off
Wolfgang Beyer19093942021-03-15 15:00:34515 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36516 <${ReportView.ReportView.ReportKey.litTagName} title=${i18nString(UIStrings.creationStackTraceExplanation)}>${
517 i18nString(UIStrings.creationStackTrace)}</${ReportView.ReportView.ReportKey.litTagName}>
518 <${ReportView.ReportView.ReportValue.litTagName}>
519 <${StackTrace.litTagName} .data=${{
Tim van der Lippec3f835a2021-12-15 13:28:32520 frame: this.#frame,
Wolfgang Beyera036d0c2021-03-19 09:09:33521 buildStackTraceRows: Components.JSPresentationUtils.buildStackTraceRows,
522 } as StackTraceData}>
Kriti Sapra74915452021-05-13 11:57:36523 </${StackTrace.litTagName}>
524 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer19093942021-03-15 15:00:34525 `;
Wolfgang Beyera036d0c2021-03-19 09:09:33526 // clang-format on
Wolfgang Beyer19093942021-03-15 15:00:34527 }
528 return LitHtml.nothing;
529 }
530
Tim van der Lippec3f835a2021-12-15 13:28:32531 #getAdFrameTypeStrings(type: Protocol.Page.AdFrameType.Child|Protocol.Page.AdFrameType.Root):
Sigurd Schneidercc9a02e2021-06-16 06:20:33532 {value: Platform.UIString.LocalizedString, description: Platform.UIString.LocalizedString} {
533 switch (type) {
534 case Protocol.Page.AdFrameType.Child:
535 return {value: i18nString(UIStrings.child), description: i18nString(UIStrings.childDescription)};
536 case Protocol.Page.AdFrameType.Root:
537 return {value: i18nString(UIStrings.root), description: i18nString(UIStrings.rootDescription)};
Wolfgang Beyer1525b1f2021-02-02 14:12:30538 }
Sigurd Schneidercc9a02e2021-06-16 06:20:33539 }
540
Tim van der Lippec3f835a2021-12-15 13:28:32541 #getAdFrameExplanationString(explanation: Protocol.Page.AdFrameExplanation): Platform.UIString.LocalizedString {
Sigurd Schneidercc9a02e2021-06-16 06:20:33542 switch (explanation) {
543 case Protocol.Page.AdFrameExplanation.CreatedByAdScript:
544 return i18nString(UIStrings.createdByAdScriptExplanation);
545 case Protocol.Page.AdFrameExplanation.MatchedBlockingRule:
546 return i18nString(UIStrings.matchedBlockingRuleExplanation);
547 case Protocol.Page.AdFrameExplanation.ParentIsAd:
548 return i18nString(UIStrings.parentIsAdExplanation);
549 }
550 }
551
Jack Franklind7508302022-05-09 14:22:21552 #maybeRenderAdStatus(): LitHtml.LitTemplate {
Tim van der Lippec3f835a2021-12-15 13:28:32553 if (!this.#frame) {
Sigurd Schneidercc9a02e2021-06-16 06:20:33554 return LitHtml.nothing;
555 }
Tim van der Lippec3f835a2021-12-15 13:28:32556 const adFrameType = this.#frame.adFrameType();
Sigurd Schneidercc9a02e2021-06-16 06:20:33557 if (adFrameType === Protocol.Page.AdFrameType.None) {
558 return LitHtml.nothing;
559 }
Tim van der Lippec3f835a2021-12-15 13:28:32560 const typeStrings = this.#getAdFrameTypeStrings(adFrameType);
Jack Franklina31102b2021-12-03 15:01:22561 const rows = [LitHtml.html`<div title=${typeStrings.description}>${typeStrings.value}</div>`];
Tim van der Lippec3f835a2021-12-15 13:28:32562 for (const explanation of this.#frame.adFrameStatus()?.explanations || []) {
563 rows.push(LitHtml.html`<div>${this.#getAdFrameExplanationString(explanation)}</div>`);
Sigurd Schneidercc9a02e2021-06-16 06:20:33564 }
565 return LitHtml.html`
566 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.adStatus)}</${
567 ReportView.ReportView.ReportKey.litTagName}>
568 <${ReportView.ReportView.ReportValue.litTagName}>
569 <${ExpandableList.ExpandableList.ExpandableList.litTagName} .data=${
570 {rows} as ExpandableList.ExpandableList.ExpandableListData}></${
571 ExpandableList.ExpandableList.ExpandableList.litTagName}></${ReportView.ReportView.ReportValue.litTagName}>
572 `;
Wolfgang Beyer1525b1f2021-02-02 14:12:30573 }
Wolfgang Beyerabfc8472021-02-04 11:29:50574
Jack Franklind7508302022-05-09 14:22:21575 #renderIsolationSection(): LitHtml.LitTemplate {
Tim van der Lippec3f835a2021-12-15 13:28:32576 if (!this.#frame) {
Wolfgang Beyerabfc8472021-02-04 11:29:50577 return LitHtml.nothing;
578 }
579 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36580 <${ReportView.ReportView.ReportSectionHeader.litTagName}>${i18nString(UIStrings.securityIsolation)}</${
581 ReportView.ReportView.ReportSectionHeader.litTagName}>
582 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.secureContext)}</${
583 ReportView.ReportView.ReportKey.litTagName}>
584 <${ReportView.ReportView.ReportValue.litTagName}>
Tim van der Lippec3f835a2021-12-15 13:28:32585 ${this.#frame.isSecureContext() ? i18nString(UIStrings.yes) : i18nString(UIStrings.no)}\xA0${
586 this.#maybeRenderSecureContextExplanation()}
Kriti Sapra74915452021-05-13 11:57:36587 </${ReportView.ReportView.ReportValue.litTagName}>
588 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.crossoriginIsolated)}</${
589 ReportView.ReportView.ReportKey.litTagName}>
590 <${ReportView.ReportView.ReportValue.litTagName}>
Tim van der Lippec3f835a2021-12-15 13:28:32591 ${this.#frame.isCrossOriginIsolated() ? i18nString(UIStrings.yes) : i18nString(UIStrings.no)}
Kriti Sapra74915452021-05-13 11:57:36592 </${ReportView.ReportView.ReportValue.litTagName}>
Tim van der Lippec3f835a2021-12-15 13:28:32593 ${LitHtml.Directives.until(this.#maybeRenderCoopCoepStatus(), LitHtml.nothing)}
Kriti Sapra74915452021-05-13 11:57:36594 <${ReportView.ReportView.ReportSectionDivider.litTagName}></${
595 ReportView.ReportView.ReportSectionDivider.litTagName}>
Wolfgang Beyerabfc8472021-02-04 11:29:50596 `;
597 }
598
Jack Franklind7508302022-05-09 14:22:21599 #maybeRenderSecureContextExplanation(): LitHtml.LitTemplate {
Tim van der Lippec3f835a2021-12-15 13:28:32600 const explanation = this.#getSecureContextExplanation();
Wolfgang Beyerabfc8472021-02-04 11:29:50601 if (explanation) {
Tim van der Lippe0005b802021-06-03 10:47:59602 return LitHtml.html`<span class="inline-comment">${explanation}</span>`;
Wolfgang Beyerabfc8472021-02-04 11:29:50603 }
604 return LitHtml.nothing;
605 }
606
Tim van der Lippec3f835a2021-12-15 13:28:32607 #getSecureContextExplanation(): Platform.UIString.LocalizedString|null {
608 switch (this.#frame?.getSecureContextType()) {
Wolfgang Beyerabfc8472021-02-04 11:29:50609 case Protocol.Page.SecureContextType.Secure:
610 return null;
611 case Protocol.Page.SecureContextType.SecureLocalhost:
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01612 return i18nString(UIStrings.localhostIsAlwaysASecureContext);
Wolfgang Beyerabfc8472021-02-04 11:29:50613 case Protocol.Page.SecureContextType.InsecureAncestor:
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01614 return i18nString(UIStrings.aFrameAncestorIsAnInsecure);
Wolfgang Beyerabfc8472021-02-04 11:29:50615 case Protocol.Page.SecureContextType.InsecureScheme:
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01616 return i18nString(UIStrings.theFramesSchemeIsInsecure);
Wolfgang Beyerabfc8472021-02-04 11:29:50617 }
618 return null;
619 }
620
Jack Franklind7508302022-05-09 14:22:21621 async #maybeRenderCoopCoepStatus(): Promise<LitHtml.LitTemplate> {
Tim van der Lippec3f835a2021-12-15 13:28:32622 if (this.#frame) {
623 const model = this.#frame.resourceTreeModel().target().model(SDK.NetworkManager.NetworkManager);
624 const info = model && await model.getSecurityIsolationStatus(this.#frame.id);
Wolfgang Beyerabfc8472021-02-04 11:29:50625 if (info) {
626 return LitHtml.html`
627 ${
Tim van der Lippec3f835a2021-12-15 13:28:32628 this.#maybeRenderCrossOriginStatus(
Wolfgang Beyerdbf211e2021-11-23 10:23:54629 info.coep, i18n.i18n.lockedString('Cross-Origin Embedder Policy (COEP)'),
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01630 Protocol.Network.CrossOriginEmbedderPolicyValue.None)}
Wolfgang Beyerabfc8472021-02-04 11:29:50631 ${
Tim van der Lippec3f835a2021-12-15 13:28:32632 this.#maybeRenderCrossOriginStatus(
Wolfgang Beyerdbf211e2021-11-23 10:23:54633 info.coop, i18n.i18n.lockedString('Cross-Origin Opener Policy (COOP)'),
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01634 Protocol.Network.CrossOriginOpenerPolicyValue.UnsafeNone)}
Wolfgang Beyerabfc8472021-02-04 11:29:50635 `;
636 }
637 }
638 return LitHtml.nothing;
639 }
640
Tim van der Lippec3f835a2021-12-15 13:28:32641 #maybeRenderCrossOriginStatus(
Wolfgang Beyerabfc8472021-02-04 11:29:50642 info: Protocol.Network.CrossOriginEmbedderPolicyStatus|Protocol.Network.CrossOriginOpenerPolicyStatus|undefined,
643 policyName: string,
644 noneValue: Protocol.Network.CrossOriginEmbedderPolicyValue|
Jack Franklind7508302022-05-09 14:22:21645 Protocol.Network.CrossOriginOpenerPolicyValue): LitHtml.LitTemplate {
Wolfgang Beyerabfc8472021-02-04 11:29:50646 if (!info) {
647 return LitHtml.nothing;
648 }
649 const isEnabled = info.value !== noneValue;
650 const isReportOnly = (!isEnabled && info.reportOnlyValue !== noneValue);
651 const endpoint = isEnabled ? info.reportingEndpoint : info.reportOnlyReportingEndpoint;
652 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36653 <${ReportView.ReportView.ReportKey.litTagName}>${policyName}</${ReportView.ReportView.ReportKey.litTagName}>
654 <${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyerabfc8472021-02-04 11:29:50655 ${isEnabled ? info.value : info.reportOnlyValue}
656 ${isReportOnly ? LitHtml.html`<span class="inline-comment">report-only</span>` : LitHtml.nothing}
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01657 ${
658 endpoint ? LitHtml.html`<span class="inline-name">${i18nString(UIStrings.reportingTo)}</span>${endpoint}` :
659 LitHtml.nothing}
Kriti Sapra74915452021-05-13 11:57:36660 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyerabfc8472021-02-04 11:29:50661 `;
662 }
Wolfgang Beyer6a6efe62021-02-04 15:56:21663
Jack Franklind7508302022-05-09 14:22:21664 #renderApiAvailabilitySection(): LitHtml.LitTemplate {
Tim van der Lippec3f835a2021-12-15 13:28:32665 if (!this.#frame) {
Wolfgang Beyer6a6efe62021-02-04 15:56:21666 return LitHtml.nothing;
667 }
668
669 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36670 <${ReportView.ReportView.ReportSectionHeader.litTagName}>${i18nString(UIStrings.apiAvailability)}</${
671 ReportView.ReportView.ReportSectionHeader.litTagName}>
Wolfgang Beyer6a6efe62021-02-04 15:56:21672 <div class="span-cols">
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01673 ${i18nString(UIStrings.availabilityOfCertainApisDepends)}
Wolfgang Beyer4751c1c2021-03-24 15:32:35674 <x-link href="https://web.dev/why-coop-coep/" class="link">${i18nString(UIStrings.learnMore)}</x-link>
Wolfgang Beyer6a6efe62021-02-04 15:56:21675 </div>
Tim van der Lippec3f835a2021-12-15 13:28:32676 ${this.#renderSharedArrayBufferAvailability()}
677 ${this.#renderMeasureMemoryAvailability()}
Kriti Sapra74915452021-05-13 11:57:36678 <${ReportView.ReportView.ReportSectionDivider.litTagName}></${
679 ReportView.ReportView.ReportSectionDivider.litTagName}>
Wolfgang Beyer6a6efe62021-02-04 15:56:21680 `;
681 }
682
Jack Franklind7508302022-05-09 14:22:21683 #renderSharedArrayBufferAvailability(): LitHtml.LitTemplate {
Tim van der Lippec3f835a2021-12-15 13:28:32684 if (this.#frame) {
685 const features = this.#frame.getGatedAPIFeatures();
Wolfgang Beyer6a6efe62021-02-04 15:56:21686 if (features) {
687 const sabAvailable = features.includes(Protocol.Page.GatedAPIFeatures.SharedArrayBuffers);
688 const sabTransferAvailable =
689 sabAvailable && features.includes(Protocol.Page.GatedAPIFeatures.SharedArrayBuffersTransferAllowed);
690 const availabilityText = sabTransferAvailable ?
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01691 i18nString(UIStrings.availableTransferable) :
692 (sabAvailable ? i18nString(UIStrings.availableNotTransferable) : i18nString(UIStrings.unavailable));
Wolfgang Beyer6a6efe62021-02-04 15:56:21693 const tooltipText = sabTransferAvailable ?
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01694 i18nString(UIStrings.sharedarraybufferConstructorIs) :
695 (sabAvailable ? i18nString(UIStrings.sharedarraybufferConstructorIsAvailable) : '');
Wolfgang Beyer6a6efe62021-02-04 15:56:21696
Jack Franklind7508302022-05-09 14:22:21697 function renderHint(frame: SDK.ResourceTreeModel.ResourceTreeFrame): LitHtml.LitTemplate {
Sigurd Schneider2a450252021-05-04 07:13:15698 switch (frame.getCrossOriginIsolatedContextType()) {
699 case Protocol.Page.CrossOriginIsolatedContextType.Isolated:
700 return LitHtml.nothing;
701 case Protocol.Page.CrossOriginIsolatedContextType.NotIsolated:
702 if (sabAvailable) {
703 return LitHtml.html`<span class="inline-comment">${
704 i18nString(UIStrings.willRequireCrossoriginIsolated)}</span>`;
705 }
706 return LitHtml.html`<span class="inline-comment">${
707 i18nString(UIStrings.requiresCrossoriginIsolated)}</span>`;
708 case Protocol.Page.CrossOriginIsolatedContextType.NotIsolatedFeatureDisabled:
709 if (!sabTransferAvailable) {
710 return LitHtml.html`<span class="inline-comment">${
711 i18nString(
712 UIStrings
713 .transferRequiresCrossoriginIsolatedPermission)} <code>cross-origin-isolated</code></span>`;
714 }
715 break;
716 }
717 return LitHtml.nothing;
718 }
719
Peter Marshall0e1cd822021-02-24 10:52:42720 // SharedArrayBuffer is an API name, so we don't translate it.
Wolfgang Beyer6a6efe62021-02-04 15:56:21721 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36722 <${ReportView.ReportView.ReportKey.litTagName}>SharedArrayBuffers</${
723 ReportView.ReportView.ReportKey.litTagName}>
724 <${ReportView.ReportView.ReportValue.litTagName} title=${tooltipText}>
Tim van der Lippec3f835a2021-12-15 13:28:32725 ${availabilityText}\xA0${renderHint(this.#frame)}
Kriti Sapra74915452021-05-13 11:57:36726 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer6a6efe62021-02-04 15:56:21727 `;
Wolfgang Beyer6a6efe62021-02-04 15:56:21728 }
729 }
730 return LitHtml.nothing;
731 }
732
Jack Franklind7508302022-05-09 14:22:21733 #renderMeasureMemoryAvailability(): LitHtml.LitTemplate {
Tim van der Lippec3f835a2021-12-15 13:28:32734 if (this.#frame) {
735 const measureMemoryAvailable = this.#frame.isCrossOriginIsolated();
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01736 const availabilityText =
737 measureMemoryAvailable ? i18nString(UIStrings.available) : i18nString(UIStrings.unavailable);
738 const tooltipText = measureMemoryAvailable ? i18nString(UIStrings.thePerformanceAPI) :
739 i18nString(UIStrings.thePerformancemeasureuseragentspecificmemory);
Wolfgang Beyer6a6efe62021-02-04 15:56:21740 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36741 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.measureMemory)}</${
742 ReportView.ReportView.ReportKey.litTagName}>
743 <${ReportView.ReportView.ReportValue.litTagName}>
Tim van der Lippe0005b802021-06-03 10:47:59744 <span title=${tooltipText}>${
745 availabilityText}</span>\xA0<x-link class="link" href="https://web.dev/monitor-total-page-memory-usage/">${
Wolfgang Beyer09b0e8e2021-02-09 13:39:48746 i18nString(UIStrings.learnMore)}</x-link>
Kriti Sapra74915452021-05-13 11:57:36747 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer6a6efe62021-02-04 15:56:21748 `;
749 }
750 return LitHtml.nothing;
751 }
Wolfgang Beyere5d1a9f2021-02-05 09:42:43752
Jack Franklind7508302022-05-09 14:22:21753 #renderAdditionalInfoSection(): LitHtml.LitTemplate {
Tim van der Lippec3f835a2021-12-15 13:28:32754 if (!this.#frame) {
Wolfgang Beyere5d1a9f2021-02-05 09:42:43755 return LitHtml.nothing;
756 }
757
758 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36759 <${ReportView.ReportView.ReportSectionHeader.litTagName}
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01760 title=${i18nString(UIStrings.thisAdditionalDebugging)}
Kriti Sapra74915452021-05-13 11:57:36761 >${i18nString(UIStrings.additionalInformation)}</${ReportView.ReportView.ReportSectionHeader.litTagName}>
762 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.frameId)}</${
763 ReportView.ReportView.ReportKey.litTagName}>
764 <${ReportView.ReportView.ReportValue.litTagName}>
Tim van der Lippec3f835a2021-12-15 13:28:32765 <div class="text-ellipsis" title=${this.#frame.id}>${this.#frame.id}</div>
Kriti Sapra74915452021-05-13 11:57:36766 </${ReportView.ReportView.ReportValue.litTagName}>
767 <${ReportView.ReportView.ReportSectionDivider.litTagName}></${
768 ReportView.ReportView.ReportSectionDivider.litTagName}>
Wolfgang Beyere5d1a9f2021-02-05 09:42:43769 `;
770 }
Wolfgang Beyer92395c92021-02-02 10:43:23771}
772
Kriti Sapra34df98d2021-05-06 10:15:42773ComponentHelpers.CustomElements.defineComponent('devtools-resources-frame-details-view', FrameDetailsReportView);
Wolfgang Beyer92395c92021-02-02 10:43:23774
775declare global {
776 // eslint-disable-next-line @typescript-eslint/no-unused-vars
777 interface HTMLElementTagNameMap {
778 'devtools-resources-frame-details-view': FrameDetailsReportView;
779 }
780}