blob: 27814470e4ae2c5d3ee7f037db9a0c6d7bec24d6 [file] [log] [blame]
Wolfgang Beyer760462e2020-07-13 15:01:351// Copyright 2020 The Chromium Authors. All rights reserved.
2// 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';
Tim van der Lippe1bd5e212021-05-06 10:54:297import * as Bindings from '../../../models/bindings/bindings.js';
8import * as Common from '../../../core/common/common.js';
9import * as i18n from '../../../core/i18n/i18n.js';
10import * as Network from '../../network/network.js';
Jack Franklina75ae7c2021-05-11 13:22:5411import type * as Platform from '../../../core/platform/platform.js';
Tim van der Lippe1bd5e212021-05-06 10:54:2912import * as Root from '../../../core/root/root.js';
13import * as SDK from '../../../core/sdk/sdk.js'; // eslint-disable-line no-unused-vars
Paul Lewis01f49392021-05-10 13:54:2014import * as LitHtml from '../../../ui/lit-html/lit-html.js';
Kriti Sapra74915452021-05-13 11:57:3615import * as ReportView from '../../../ui/components/report_view/report_view.js';
16import * as IconButton from '../../../ui/components/icon_button/icon_button.js';
Tim van der Lippe1bd5e212021-05-06 10:54:2917import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
18import * as UI from '../../../ui/legacy/legacy.js';
19import * as Workspace from '../../../models/workspace/workspace.js';
20import * as Components from '../../../ui/legacy/components/utils/utils.js';
Tim van der Lippe229a54f2021-05-14 16:59:0521import * as Protocol from '../../../generated/protocol.js';
Wolfgang Beyer760462e2020-07-13 15:01:3522
Simon Zünd697fb0b2021-03-01 10:12:4223const UIStrings = {
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:0124 /**
25 *@description Section header in the Frame Details view
26 */
27 additionalInformation: 'Additional Information',
28 /**
29 *@description Explanation for why the additional information section is being shown
30 */
31 thisAdditionalDebugging:
32 'This additional (debugging) information is shown because the \'Protocol Monitor\' experiment is enabled.',
33 /**
34 *@description Label for subtitle of frame details view
35 */
36 frameId: 'Frame ID',
37 /**
38 *@description Name of a network resource type
39 */
40 document: 'Document',
41 /**
42 *@description Text for web URLs
43 */
44 url: 'URL',
45 /**
46 *@description Title for a link to the Sources panel
47 */
48 clickToRevealInSourcesPanel: 'Click to reveal in Sources panel',
49 /**
50 *@description Title for a link to the Network panel
51 */
52 clickToRevealInNetworkPanel: 'Click to reveal in Network panel',
53 /**
54 *@description Title for unreachable URL field
55 */
56 unreachableUrl: 'Unreachable URL',
57 /**
58 *@description Title for a link that applies a filter to the network panel
59 */
60 clickToRevealInNetworkPanelMight: 'Click to reveal in Network panel (might require page reload)',
61 /**
62 *@description Text for the origin of something
63 */
64 origin: 'Origin',
65 /**
66 *@description Related node label in Timeline UIUtils of the Performance panel
67 */
68 ownerElement: 'Owner Element',
69 /**
70 *@description Title for a link to the Elements panel
71 */
72 clickToRevealInElementsPanel: 'Click to reveal in Elements panel',
73 /**
74 *@description Title for ad frame type field
75 */
76 adStatus: 'Ad Status',
77 /**
78 *@description Description for ad frame type
79 */
80 thisFrameHasBeenIdentifiedAsThe: 'This frame has been identified as the root frame of an ad',
81 /**
82 *@description Value for ad frame type
83 */
84 root: 'root',
85 /**
86 *@description Description for ad frame type
87 */
Peter Marshall3d967382021-02-25 06:56:1888 thisFrameHasBeenIdentifiedAsTheA: 'This frame has been identified as a child frame of an ad',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:0189 /**
90 *@description Value for ad frame type
91 */
92 child: 'child',
93 /**
94 *@description Section header in the Frame Details view
95 */
96 securityIsolation: 'Security & Isolation',
97 /**
98 *@description Row title for in the Frame Details view
99 */
100 secureContext: 'Secure Context',
101 /**
102 *@description Text in Timeline indicating that input has happened recently
103 */
104 yes: 'Yes',
105 /**
106 *@description Text in Timeline indicating that input has not happened recently
107 */
108 no: 'No',
109 /**
110 *@description Row title for in the Frame Details view
111 */
112 crossoriginIsolated: 'Cross-Origin Isolated',
113 /**
114 *@description Explanatory text in the Frame Details view
115 */
116 localhostIsAlwaysASecureContext: 'Localhost is always a secure context',
117 /**
118 *@description Explanatory text in the Frame Details view
119 */
120 aFrameAncestorIsAnInsecure: 'A frame ancestor is an insecure context',
121 /**
122 *@description Explanatory text in the Frame Details view
123 */
124 theFramesSchemeIsInsecure: 'The frame\'s scheme is insecure',
125 /**
126 *@description Row title in the Frame Details view
127 */
128 crossoriginEmbedderPolicy: 'Cross-Origin Embedder Policy',
129 /**
130 *@description Row title in the Frame Details view
131 */
132 crossoriginOpenerPolicy: 'Cross-Origin Opener Policy',
133 /**
Peter Marshallec861882021-02-16 11:14:21134 *@description This label specifies the server endpoints to which the server is reporting errors
135 *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:01136 */
137 reportingTo: 'reporting to',
138 /**
139 *@description Section header in the Frame Details view
140 */
141 apiAvailability: 'API availability',
142 /**
143 *@description Explanatory text in the Frame Details view for the API availability section
144 */
145 availabilityOfCertainApisDepends: 'Availability of certain APIs depends on the document being cross-origin isolated.',
146 /**
147 *@description Description of the SharedArrayBuffer status
148 */
149 availableTransferable: 'available, transferable',
150 /**
151 *@description Description of the SharedArrayBuffer status
152 */
153 availableNotTransferable: 'available, not transferable',
154 /**
155 *@description Explanation for the SharedArrayBuffer availability status
156 */
157 unavailable: 'unavailable',
158 /**
159 *@description Tooltip for the SharedArrayBuffer availability status
160 */
161 sharedarraybufferConstructorIs:
162 'SharedArrayBuffer constructor is available and SABs can be transferred via postMessage',
163 /**
164 *@description Tooltip for the SharedArrayBuffer availability status
165 */
166 sharedarraybufferConstructorIsAvailable:
167 'SharedArrayBuffer constructor is available but SABs cannot be transferred via postMessage',
168 /**
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01169 *@description Explanation for the SharedArrayBuffer availability status
170 */
Sigurd Schneider2a450252021-05-04 07:13:15171 willRequireCrossoriginIsolated: '⚠️ will require cross-origin isolated context in the future',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01172 /**
173 *@description Explanation for the SharedArrayBuffer availability status
174 */
175 requiresCrossoriginIsolated: 'requires cross-origin isolated context',
176 /**
Sigurd Schneiderf7e58be2021-05-14 14:41:52177 *@description Explanation for the SharedArrayBuffer availability status in case the transfer of a SAB requires the
178 * permission policy `cross-origin-isolated` to be enabled (e.g. because the message refers to the situation in an iframe).
179 */
180 transferRequiresCrossoriginIsolatedPermission:
181 '`SharedArrayBuffer` transfer requires enabling the permission policy:',
Sigurd Schneider2a450252021-05-04 07:13:15182 /**
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01183 *@description Explanation for the Measure Memory availability status
184 */
185 available: 'available',
186 /**
187 *@description Tooltip for the Measure Memory availability status
188 */
189 thePerformanceAPI: 'The performance.measureUserAgentSpecificMemory() API is available',
190 /**
191 *@description Tooltip for the Measure Memory availability status
192 */
193 thePerformancemeasureuseragentspecificmemory: 'The performance.measureUserAgentSpecificMemory() API is not available',
194 /**
195 *@description Entry in the API availability section of the frame details view
196 */
197 measureMemory: 'Measure Memory',
198 /**
199 *@description Text that is usually a hyperlink to more documentation
200 */
201 learnMore: 'Learn more',
Wolfgang Beyer19093942021-03-15 15:00:34202 /**
Wolfgang Beyer40834922021-05-10 08:34:22203 *@description Label for a stack trace. If a frame is created programmatically (i.e. via JavaScript), there is a
204 * 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:34205 */
206 creationStackTrace: 'Frame Creation Stack Trace',
207 /**
208 *@description Tooltip for 'Frame Creation Stack Trace' explaining that the stack
209 *trace shows where in the code the frame has been created programmatically
210 */
211 creationStackTraceExplanation: 'This frame was created programmatically. The stack trace shows where this happened.',
Wolfgang Beyer4751c1c2021-03-24 15:32:35212 /**
213 *@description Label for a button. When clicked more details (for the content this button refers to) will be shown.
214 */
215 showDetails: 'Show details',
216 /**
217 *@description Label for a button. When clicked some details (for the content this button refers to) will be hidden.
218 */
219 hideDetails: 'Hide details',
220 /**
Wolfgang Beyer4751c1c2021-03-24 15:32:35221 *@description Label for a list of features which are allowed according to the current Permissions policy
222 *(a mechanism that allows developers to enable/disable browser features and APIs (e.g. camera, geolocation, autoplay))
223 */
224 allowedFeatures: 'Allowed Features',
225 /**
226 *@description Label for a list of features which are disabled according to the current Permissions policy
227 *(a mechanism that allows developers to enable/disable browser features and APIs (e.g. camera, geolocation, autoplay))
228 */
229 disabledFeatures: 'Disabled Features',
230 /**
231 *@description Tooltip text for a link to a specific request's headers in the Network panel.
232 */
233 clickToShowHeader: 'Click to reveal the request whose "`Permissions-Policy`" HTTP header disables this feature.',
234 /**
Wolfgang Beyer40834922021-05-10 08:34:22235 *@description Tooltip text for a link to a specific iframe in the Elements panel (Iframes can be nested, the link goes
236 * to the outer-most iframe which blocks a certain feature).
Wolfgang Beyer4751c1c2021-03-24 15:32:35237 */
238 clickToShowIframe: 'Click to reveal the top-most iframe which does not allow this feature in the elements panel.',
239 /**
240 *@description Text describing that a specific feature is blocked by not being included in the iframe's "allow" attribute.
241 */
242 disabledByIframe: 'missing in iframe "`allow`" attribute',
243 /**
244 *@description Text describing that a specific feature is blocked by a Permissions Policy specified in a request header.
245 */
246 disabledByHeader: 'disabled by "`Permissions-Policy`" header',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01247};
Tim van der Lippe1bd5e212021-05-06 10:54:29248const str_ = i18n.i18n.registerUIStrings('panels/application/components/FrameDetailsView.ts', UIStrings);
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01249const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
Sigurd Schneider1e5ad282020-07-17 11:52:08250export class FrameDetailsView extends UI.ThrottledWidget.ThrottledWidget {
Wolfgang Beyer92395c92021-02-02 10:43:23251 private readonly reportView = new FrameDetailsReportView();
Wolfgang Beyere5d1a9f2021-02-05 09:42:43252 private readonly frame: SDK.ResourceTreeModel.ResourceTreeFrame;
Wolfgang Beyer92395c92021-02-02 10:43:23253
Wolfgang Beyer309863f2021-01-21 09:01:21254 constructor(frame: SDK.ResourceTreeModel.ResourceTreeFrame) {
Wolfgang Beyer760462e2020-07-13 15:01:35255 super();
Wolfgang Beyere5d1a9f2021-02-05 09:42:43256 this.frame = frame;
257 this.contentElement.classList.add('overflow-auto');
Wolfgang Beyer92395c92021-02-02 10:43:23258 this.contentElement.appendChild(this.reportView);
Sigurd Schneider1e5ad282020-07-17 11:52:08259 this.update();
260 }
261
Wolfgang Beyer309863f2021-01-21 09:01:21262 async doUpdate(): Promise<void> {
Wolfgang Beyere5d1a9f2021-02-05 09:42:43263 this.reportView.data = {frame: this.frame};
Sigurd Schneidereabef962020-11-05 10:51:49264 }
Wolfgang Beyer760462e2020-07-13 15:01:35265}
Wolfgang Beyer3b4747f2020-08-12 07:30:46266
Wolfgang Beyer92395c92021-02-02 10:43:23267export interface FrameDetailsReportViewData {
268 frame: SDK.ResourceTreeModel.ResourceTreeFrame;
269}
270
271export class FrameDetailsReportView extends HTMLElement {
272 private readonly shadow = this.attachShadow({mode: 'open'});
273 private frame?: SDK.ResourceTreeModel.ResourceTreeFrame;
Wolfgang Beyere5d1a9f2021-02-05 09:42:43274 private protocolMonitorExperimentEnabled = false;
Wolfgang Beyer4751c1c2021-03-24 15:32:35275 private showPermissionsDisallowedDetails = false;
Wolfgang Beyere5d1a9f2021-02-05 09:42:43276
277 connectedCallback(): void {
278 this.protocolMonitorExperimentEnabled = Root.Runtime.experiments.isEnabled('protocolMonitor');
279 }
Wolfgang Beyer92395c92021-02-02 10:43:23280
281 set data(data: FrameDetailsReportViewData) {
282 this.frame = data.frame;
283 this.render();
284 }
285
286 private async render(): Promise<void> {
287 if (!this.frame) {
288 return;
289 }
290
291 // Disabled until https://crbug.com/1079231 is fixed.
292 // clang-format off
293 LitHtml.render(LitHtml.html`
Wolfgang Beyer1525b1f2021-02-02 14:12:30294 <style>
295 .text-ellipsis {
296 overflow: hidden;
297 text-overflow: ellipsis;
298 white-space: nowrap;
299 }
300
301 button ~ .text-ellipsis {
302 padding-left: 2px;
303 }
304
Wolfgang Beyer19093942021-03-15 15:00:34305 .link,
306 .devtools-link {
Wolfgang Beyer1525b1f2021-02-02 14:12:30307 color: var(--color-link);
308 text-decoration: underline;
309 cursor: pointer;
310 padding: 2px 0; /* adjust focus ring size */
311 }
312
313 button.link {
314 border: none;
315 background: none;
316 font-family: inherit;
317 font-size: inherit;
318 }
319
Wolfgang Beyerabfc8472021-02-04 11:29:50320 .inline-comment {
321 padding-left: 1ex;
322 white-space: pre-line;
323 }
324
325 .inline-comment::before {
326 content: "(";
327 }
328
329 .inline-comment::after {
330 content: ")";
331 }
332
333 .inline-name {
334 color: var(--color-text-secondary);
335 padding-left: 2ex;
336 user-select: none;
337 white-space: pre-line;
338 }
339
340 .inline-name::after {
341 content: ':\u00a0';
342 }
343
Wolfgang Beyer1525b1f2021-02-02 14:12:30344 .inline-items {
345 display: flex;
346 }
Wolfgang Beyer4751c1c2021-03-24 15:32:35347
348 .span-cols {
349 grid-column-start: span 2;
350 margin: 0 0 8px 30px;
351 line-height: 28px;
352 }
353
354 .policies-list {
355 padding-top: 3px;
356 }
Wolfgang Beyer1525b1f2021-02-02 14:12:30357 </style>
Kriti Sapra74915452021-05-13 11:57:36358 <${ReportView.ReportView.Report.litTagName} .data=${{reportTitle: this.frame.displayName()} as ReportView.ReportView.ReportData}>
Wolfgang Beyere5d1a9f2021-02-05 09:42:43359 ${this.renderDocumentSection()}
360 ${this.renderIsolationSection()}
361 ${this.renderApiAvailabilitySection()}
Sigurd Schneider173154c2021-02-18 14:18:38362 ${LitHtml.Directives.until(this.renderPermissionPolicy(), LitHtml.nothing)}
Wolfgang Beyere5d1a9f2021-02-05 09:42:43363 ${this.protocolMonitorExperimentEnabled ? this.renderAdditionalInfoSection() : LitHtml.nothing}
Kriti Sapra74915452021-05-13 11:57:36364 </${ReportView.ReportView.Report.litTagName}>
Wolfgang Beyer92395c92021-02-02 10:43:23365 `, this.shadow);
366 // clang-format on
367 }
Wolfgang Beyer1525b1f2021-02-02 14:12:30368
Sigurd Schneider173154c2021-02-18 14:18:38369 private async renderPermissionPolicy(): Promise<LitHtml.TemplateResult|{}> {
Wolfgang Beyer4751c1c2021-03-24 15:32:35370 const policies = await (this.frame && this.frame.getPermissionsPolicyState());
371 if (!policies) {
Sigurd Schneider173154c2021-02-18 14:18:38372 return LitHtml.nothing;
373 }
Wolfgang Beyer4751c1c2021-03-24 15:32:35374
375 const toggleShowPermissionsDisallowedDetails = (): void => {
376 this.showPermissionsDisallowedDetails = !this.showPermissionsDisallowedDetails;
377 this.render();
378 };
379
380 const renderAllowed = (): LitHtml.TemplateResult|{} => {
381 const allowed = policies.filter(p => p.allowed).map(p => p.feature).sort();
382 if (!allowed.length) {
383 return LitHtml.nothing;
384 }
385 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36386 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.allowedFeatures)}</${
387 ReportView.ReportView.ReportKey.litTagName}>
388 <${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer4751c1c2021-03-24 15:32:35389 ${allowed.join(', ')}
Kriti Sapra74915452021-05-13 11:57:36390 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer4751c1c2021-03-24 15:32:35391 `;
392 };
393
394 const renderDisallowed = async(): Promise<LitHtml.TemplateResult|{}> => {
395 const disallowed = policies.filter(p => !p.allowed).sort((a, b) => a.feature.localeCompare(b.feature));
396 if (!disallowed.length) {
397 return LitHtml.nothing;
398 }
399 if (!this.showPermissionsDisallowedDetails) {
400 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36401 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.disabledFeatures)}</${
402 ReportView.ReportView.ReportKey.litTagName}>
403 <${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer4751c1c2021-03-24 15:32:35404 ${disallowed.map(p => p.feature).join(', ')}
405 <button class="link" @click=${(): void => toggleShowPermissionsDisallowedDetails()}>
406 ${i18nString(UIStrings.showDetails)}
407 </button>
Kriti Sapra74915452021-05-13 11:57:36408 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer4751c1c2021-03-24 15:32:35409 `;
410 }
411
412 const frameManager = SDK.FrameManager.FrameManager.instance();
413 const featureRows = await Promise.all(disallowed.map(async policy => {
414 const frame = policy.locator ? frameManager.getFrame(policy.locator.frameId) : null;
415 const blockReason = policy.locator?.blockReason;
416 const linkTargetDOMNode = await (
417 blockReason === Protocol.Page.PermissionsPolicyBlockReason.IframeAttribute && frame &&
418 frame.getOwnerDOMNodeOrDocument());
419 const resource = frame && frame.resourceForURL(frame.url);
420 const linkTargetRequest =
421 blockReason === Protocol.Page.PermissionsPolicyBlockReason.Header && resource && resource.request;
422 const blockReasonText = blockReason === Protocol.Page.PermissionsPolicyBlockReason.IframeAttribute ?
423 i18nString(UIStrings.disabledByIframe) :
424 blockReason === Protocol.Page.PermissionsPolicyBlockReason.Header ? i18nString(UIStrings.disabledByHeader) :
425 '';
Wolfgang Beyer89cc8732021-04-07 13:45:56426 const revealHeader = async(): Promise<void> => {
427 if (!linkTargetRequest) {
428 return;
429 }
430 const headerName =
431 linkTargetRequest.responseHeaderValue('permissions-policy') ? 'permissions-policy' : 'feature-policy';
432 const requestLocation = Network.NetworkSearchScope.UIRequestLocation.responseHeaderMatch(
433 linkTargetRequest,
434 {name: headerName, value: ''},
435 );
436 // TODO(crbug.com/1196676) Refactor to use Common.Revealer
437 await Network.NetworkPanel.RequestLocationRevealer.instance().reveal(requestLocation);
438 };
439
Wolfgang Beyer4751c1c2021-03-24 15:32:35440 return LitHtml.html`
441 <div class="permissions-row">
442 <div>
Kriti Sapra74915452021-05-13 11:57:36443 <${IconButton.Icon.Icon.litTagName} class="allowed-icon"
Tim van der Lippe151b7972021-04-13 10:53:42444 .data=${{color: '', iconName: 'error_icon', width: '14px'} as IconButton.Icon.IconData}>
Kriti Sapra74915452021-05-13 11:57:36445 </${IconButton.Icon.Icon.litTagName}>
Wolfgang Beyer4751c1c2021-03-24 15:32:35446 </div>
447 <div class="feature-name text-ellipsis">
448 ${policy.feature}
449 </div>
450 <div class="block-reason">${blockReasonText}</div>
451 <div>
452 ${
453 linkTargetDOMNode ? this.renderIconLink(
454 'elements_panel_icon',
455 i18nString(UIStrings.clickToShowIframe),
456 (): Promise<void> => Common.Revealer.reveal(linkTargetDOMNode),
457 ) :
458 LitHtml.nothing}
Wolfgang Beyer89cc8732021-04-07 13:45:56459 ${
Wolfgang Beyer4751c1c2021-03-24 15:32:35460 linkTargetRequest ? this.renderIconLink(
461 'network_panel_icon',
462 i18nString(UIStrings.clickToShowHeader),
Wolfgang Beyer89cc8732021-04-07 13:45:56463 revealHeader,
Wolfgang Beyer4751c1c2021-03-24 15:32:35464 ) :
465 LitHtml.nothing}
466 </div>
467 </div>
468 `;
469 }));
470
471 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36472 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.disabledFeatures)}</${
473 ReportView.ReportView.ReportKey.litTagName}>
474 <${ReportView.ReportView.ReportValue.litTagName} class="policies-list">
Wolfgang Beyer4751c1c2021-03-24 15:32:35475 <style>
476 .permissions-row {
477 display: flex;
478 line-height: 22px;
479 }
480
481 .permissions-row div {
482 padding-right: 5px;
483 }
484
485 .feature-name {
486 width: 135px;
487 }
488
489 .allowed-icon {
490 padding: 2.5px 0;
491 }
492
493 .block-reason {
494 width: 215px;
495 }
496 </style>
497 ${featureRows}
498 <div class="permissions-row">
499 <button class="link" @click=${(): void => toggleShowPermissionsDisallowedDetails()}>
500 ${i18nString(UIStrings.hideDetails)}
501 </button>
502 </div>
Kriti Sapra74915452021-05-13 11:57:36503 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer4751c1c2021-03-24 15:32:35504 `;
505 };
506
507 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36508 <${ReportView.ReportView.ReportSectionHeader.litTagName}>${i18n.i18n.lockedString('Permissions Policy')}</${
509 ReportView.ReportView.ReportSectionHeader.litTagName}>
Wolfgang Beyer4751c1c2021-03-24 15:32:35510 ${renderAllowed()}
511 ${LitHtml.Directives.until(renderDisallowed(), LitHtml.nothing)}
Kriti Sapra74915452021-05-13 11:57:36512 <${ReportView.ReportView.ReportSectionDivider.litTagName}></${
513 ReportView.ReportView.ReportSectionDivider.litTagName}>
Sigurd Schneider173154c2021-02-18 14:18:38514 `;
515 }
516
Wolfgang Beyer1525b1f2021-02-02 14:12:30517 private renderDocumentSection(): LitHtml.TemplateResult|{} {
518 if (!this.frame) {
519 return LitHtml.nothing;
520 }
521
522 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36523 <${ReportView.ReportView.ReportSectionHeader.litTagName}>${i18nString(UIStrings.document)}</${
524 ReportView.ReportView.ReportSectionHeader.litTagName}>
525 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.url)}</${
526 ReportView.ReportView.ReportKey.litTagName}>
527 <${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer1525b1f2021-02-02 14:12:30528 <div class="inline-items">
529 ${this.maybeRenderSourcesLinkForURL()}
530 ${this.maybeRenderNetworkLinkForURL()}
531 <div class="text-ellipsis" title=${this.frame.url}>${this.frame.url}</div>
532 </div>
Kriti Sapra74915452021-05-13 11:57:36533 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer1525b1f2021-02-02 14:12:30534 ${this.maybeRenderUnreachableURL()}
535 ${this.maybeRenderOrigin()}
536 ${LitHtml.Directives.until(this.renderOwnerElement(), LitHtml.nothing)}
Wolfgang Beyer19093942021-03-15 15:00:34537 ${this.maybeRenderCreationStacktrace()}
Wolfgang Beyer1525b1f2021-02-02 14:12:30538 ${this.maybeRenderAdStatus()}
Kriti Sapra74915452021-05-13 11:57:36539 <${ReportView.ReportView.ReportSectionDivider.litTagName}></${
540 ReportView.ReportView.ReportSectionDivider.litTagName}>
Wolfgang Beyer1525b1f2021-02-02 14:12:30541 `;
542 }
543
544 private maybeRenderSourcesLinkForURL(): LitHtml.TemplateResult|{} {
545 if (!this.frame || this.frame.unreachableUrl()) {
546 return LitHtml.nothing;
547 }
548 const sourceCode = this.uiSourceCodeForFrame(this.frame);
549 return this.renderIconLink(
550 'sources_panel_icon',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01551 i18nString(UIStrings.clickToRevealInSourcesPanel),
Wolfgang Beyer1525b1f2021-02-02 14:12:30552 (): Promise<void> => Common.Revealer.reveal(sourceCode),
553 );
554 }
555
556 private maybeRenderNetworkLinkForURL(): LitHtml.TemplateResult|{} {
557 if (this.frame) {
558 const resource = this.frame.resourceForURL(this.frame.url);
559 if (resource && resource.request) {
560 const request = resource.request;
561 return this.renderIconLink(
562 'network_panel_icon',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01563 i18nString(UIStrings.clickToRevealInNetworkPanel),
Wolfgang Beyer1525b1f2021-02-02 14:12:30564 (): Promise<void> =>
565 Network.NetworkPanel.NetworkPanel.selectAndShowRequest(request, Network.NetworkItemView.Tabs.Headers),
566 );
567 }
568 }
569 return LitHtml.nothing;
570 }
571
572 private renderIconLink(
573 iconName: string, title: Platform.UIString.LocalizedString,
574 clickHandler: (() => void)|(() => Promise<void>)): LitHtml.TemplateResult {
575 // Disabled until https://crbug.com/1079231 is fixed.
576 // clang-format off
577 return LitHtml.html`
578 <button class="link" role="link" tabindex=0 @click=${clickHandler} title=${title}>
Kriti Sapra74915452021-05-13 11:57:36579 <${IconButton.Icon.Icon.litTagName} .data=${{
Wolfgang Beyer1525b1f2021-02-02 14:12:30580 iconName: iconName,
581 color: 'var(--color-primary)',
582 width: '16px',
583 height: '16px',
Tim van der Lippe151b7972021-04-13 10:53:42584 } as IconButton.Icon.IconData}>
Tim van der Lippe0005b802021-06-03 10:47:59585 </${IconButton.Icon.Icon.litTagName}>
Wolfgang Beyer1525b1f2021-02-02 14:12:30586 </button>
587 `;
588 // clang-format on
589 }
590
591 private uiSourceCodeForFrame(frame: SDK.ResourceTreeModel.ResourceTreeFrame): Workspace.UISourceCode.UISourceCode
592 |null {
593 for (const project of Workspace.Workspace.WorkspaceImpl.instance().projects()) {
594 const projectTarget = Bindings.NetworkProject.NetworkProject.getTargetForProject(project);
595 if (projectTarget && projectTarget === frame.resourceTreeModel().target()) {
596 const uiSourceCode = project.uiSourceCodeForURL(frame.url);
597 if (uiSourceCode) {
598 return uiSourceCode;
599 }
600 }
601 }
602 return null;
603 }
604
605 private maybeRenderUnreachableURL(): LitHtml.TemplateResult|{} {
606 if (!this.frame || !this.frame.unreachableUrl()) {
607 return LitHtml.nothing;
608 }
609 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36610 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.unreachableUrl)}</${
611 ReportView.ReportView.ReportKey.litTagName}>
612 <${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer1525b1f2021-02-02 14:12:30613 <div class="inline-items">
614 ${this.renderNetworkLinkForUnreachableURL()}
615 <div class="text-ellipsis" title=${this.frame.unreachableUrl()}>${this.frame.unreachableUrl()}</div>
616 </div>
Kriti Sapra74915452021-05-13 11:57:36617 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer1525b1f2021-02-02 14:12:30618 `;
619 }
620
621 private renderNetworkLinkForUnreachableURL(): LitHtml.TemplateResult|{} {
622 if (this.frame) {
623 const unreachableUrl = Common.ParsedURL.ParsedURL.fromString(this.frame.unreachableUrl());
624 if (unreachableUrl) {
625 return this.renderIconLink(
626 'network_panel_icon',
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01627 i18nString(UIStrings.clickToRevealInNetworkPanelMight),
Wolfgang Beyer1525b1f2021-02-02 14:12:30628 ():
629 void => {
630 Network.NetworkPanel.NetworkPanel.revealAndFilter([
631 {
Jan Schefflerd6c1d402021-02-26 16:56:38632 // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
633 // @ts-expect-error
Wolfgang Beyer1525b1f2021-02-02 14:12:30634 filterType: 'domain',
635 filterValue: unreachableUrl.domain(),
636 },
637 {
638 filterType: null,
639 filterValue: unreachableUrl.path,
640 },
641 ]);
642 },
643 );
644 }
645 }
646 return LitHtml.nothing;
647 }
648
649 private maybeRenderOrigin(): LitHtml.TemplateResult|{} {
650 if (this.frame && this.frame.securityOrigin && this.frame.securityOrigin !== '://') {
651 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36652 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.origin)}</${
653 ReportView.ReportView.ReportKey.litTagName}>
654 <${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer1525b1f2021-02-02 14:12:30655 <div class="text-ellipsis" title=${this.frame.securityOrigin}>${this.frame.securityOrigin}</div>
Kriti Sapra74915452021-05-13 11:57:36656 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer1525b1f2021-02-02 14:12:30657 `;
658 }
659 return LitHtml.nothing;
660 }
661
662 private async renderOwnerElement(): Promise<LitHtml.TemplateResult|{}> {
663 if (this.frame) {
Wolfgang Beyerf0d985e2021-02-05 12:56:52664 const linkTargetDOMNode = await this.frame.getOwnerDOMNodeOrDocument();
665 if (linkTargetDOMNode) {
666 // Disabled until https://crbug.com/1079231 is fixed.
667 // clang-format off
668 return LitHtml.html`
669 <style>
Wolfgang Beyerddf051e2021-02-09 08:33:01670 .button-icon-with-text {
Wolfgang Beyerf0d985e2021-02-05 12:56:52671 vertical-align: sub;
672 }
Wolfgang Beyer09b0e8e2021-02-09 13:39:48673
674 .without-min-width {
675 min-width: auto;
676 }
Wolfgang Beyerf0d985e2021-02-05 12:56:52677 </style>
Kriti Sapra74915452021-05-13 11:57:36678 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.ownerElement)}</${ReportView.ReportView.ReportKey.litTagName}>
679 <${ReportView.ReportView.ReportValue.litTagName} class="without-min-width">
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01680 <button class="link" role="link" tabindex=0 title=${i18nString(UIStrings.clickToRevealInElementsPanel)}
Wolfgang Beyerf0d985e2021-02-05 12:56:52681 @mouseenter=${(): Promise<void>|undefined => this.frame?.highlight()}
682 @mouseleave=${(): void => SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight()}
683 @click=${(): Promise<void> => Common.Revealer.reveal(linkTargetDOMNode)}
684 >
Kriti Sapra74915452021-05-13 11:57:36685 <${IconButton.Icon.Icon.litTagName} class="button-icon-with-text" .data=${{
Wolfgang Beyerf0d985e2021-02-05 12:56:52686 iconName: 'elements_panel_icon',
687 color: 'var(--color-primary)',
688 width: '16px',
689 height: '16px',
Kriti Sapra74915452021-05-13 11:57:36690 } as IconButton.Icon.IconData}></${IconButton.Icon.Icon.litTagName}>
Jack Franklin5ba6ec62021-04-30 07:36:20691 &lt;${linkTargetDOMNode.nodeName().toLocaleLowerCase()}&gt;
Wolfgang Beyer09b0e8e2021-02-09 13:39:48692 </button>
Kriti Sapra74915452021-05-13 11:57:36693 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyerf0d985e2021-02-05 12:56:52694 `;
695 // clang-format on
Wolfgang Beyer1525b1f2021-02-02 14:12:30696 }
697 }
698 return LitHtml.nothing;
699 }
700
Wolfgang Beyer19093942021-03-15 15:00:34701 private maybeRenderCreationStacktrace(): LitHtml.TemplateResult|{} {
Wolfgang Beyera20485a2021-04-21 07:22:19702 const creationStackTraceData = this.frame?.getCreationStackTraceData();
703 if (creationStackTraceData && creationStackTraceData.creationStackTrace) {
Wolfgang Beyera036d0c2021-03-19 09:09:33704 // Disabled until https://crbug.com/1079231 is fixed.
705 // clang-format off
Wolfgang Beyer19093942021-03-15 15:00:34706 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36707 <${ReportView.ReportView.ReportKey.litTagName} title=${i18nString(UIStrings.creationStackTraceExplanation)}>${
708 i18nString(UIStrings.creationStackTrace)}</${ReportView.ReportView.ReportKey.litTagName}>
709 <${ReportView.ReportView.ReportValue.litTagName}>
710 <${StackTrace.litTagName} .data=${{
Wolfgang Beyera036d0c2021-03-19 09:09:33711 frame: this.frame,
712 buildStackTraceRows: Components.JSPresentationUtils.buildStackTraceRows,
713 } as StackTraceData}>
Kriti Sapra74915452021-05-13 11:57:36714 </${StackTrace.litTagName}>
715 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer19093942021-03-15 15:00:34716 `;
Wolfgang Beyera036d0c2021-03-19 09:09:33717 // clang-format on
Wolfgang Beyer19093942021-03-15 15:00:34718 }
719 return LitHtml.nothing;
720 }
721
Wolfgang Beyer1525b1f2021-02-02 14:12:30722 private maybeRenderAdStatus(): LitHtml.TemplateResult|{} {
723 if (this.frame) {
724 if (this.frame.adFrameType() === Protocol.Page.AdFrameType.Root) {
725 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36726 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.adStatus)}</${
727 ReportView.ReportView.ReportKey.litTagName}>
728 <${ReportView.ReportView.ReportValue.litTagName} title=${
729 i18nString(UIStrings.thisFrameHasBeenIdentifiedAsThe)}>${i18nString(UIStrings.root)}</${
730 ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer1525b1f2021-02-02 14:12:30731 `;
732 }
733 if (this.frame.adFrameType() === Protocol.Page.AdFrameType.Child) {
734 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36735 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.adStatus)}</${
736 ReportView.ReportView.ReportKey.litTagName}>
737 <${ReportView.ReportView.ReportValue.litTagName} title=${
738 i18nString(UIStrings.thisFrameHasBeenIdentifiedAsTheA)}>${i18nString(UIStrings.child)}</${
739 ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer1525b1f2021-02-02 14:12:30740 `;
741 }
742 }
743 return LitHtml.nothing;
744 }
Wolfgang Beyerabfc8472021-02-04 11:29:50745
746 private renderIsolationSection(): LitHtml.TemplateResult|{} {
747 if (!this.frame) {
748 return LitHtml.nothing;
749 }
750 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36751 <${ReportView.ReportView.ReportSectionHeader.litTagName}>${i18nString(UIStrings.securityIsolation)}</${
752 ReportView.ReportView.ReportSectionHeader.litTagName}>
753 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.secureContext)}</${
754 ReportView.ReportView.ReportKey.litTagName}>
755 <${ReportView.ReportView.ReportValue.litTagName}>
Tim van der Lippe0005b802021-06-03 10:47:59756 ${this.frame.isSecureContext() ? i18nString(UIStrings.yes) : i18nString(UIStrings.no)}\xA0${
757 this.maybeRenderSecureContextExplanation()}
Kriti Sapra74915452021-05-13 11:57:36758 </${ReportView.ReportView.ReportValue.litTagName}>
759 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.crossoriginIsolated)}</${
760 ReportView.ReportView.ReportKey.litTagName}>
761 <${ReportView.ReportView.ReportValue.litTagName}>
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01762 ${this.frame.isCrossOriginIsolated() ? i18nString(UIStrings.yes) : i18nString(UIStrings.no)}
Kriti Sapra74915452021-05-13 11:57:36763 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyerabfc8472021-02-04 11:29:50764 ${LitHtml.Directives.until(this.maybeRenderCoopCoepStatus(), LitHtml.nothing)}
Kriti Sapra74915452021-05-13 11:57:36765 <${ReportView.ReportView.ReportSectionDivider.litTagName}></${
766 ReportView.ReportView.ReportSectionDivider.litTagName}>
Wolfgang Beyerabfc8472021-02-04 11:29:50767 `;
768 }
769
770 private maybeRenderSecureContextExplanation(): LitHtml.TemplateResult|{} {
771 const explanation = this.getSecureContextExplanation();
772 if (explanation) {
Tim van der Lippe0005b802021-06-03 10:47:59773 return LitHtml.html`<span class="inline-comment">${explanation}</span>`;
Wolfgang Beyerabfc8472021-02-04 11:29:50774 }
775 return LitHtml.nothing;
776 }
777
778 private getSecureContextExplanation(): Platform.UIString.LocalizedString|null {
779 switch (this.frame?.getSecureContextType()) {
780 case Protocol.Page.SecureContextType.Secure:
781 return null;
782 case Protocol.Page.SecureContextType.SecureLocalhost:
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01783 return i18nString(UIStrings.localhostIsAlwaysASecureContext);
Wolfgang Beyerabfc8472021-02-04 11:29:50784 case Protocol.Page.SecureContextType.InsecureAncestor:
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01785 return i18nString(UIStrings.aFrameAncestorIsAnInsecure);
Wolfgang Beyerabfc8472021-02-04 11:29:50786 case Protocol.Page.SecureContextType.InsecureScheme:
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01787 return i18nString(UIStrings.theFramesSchemeIsInsecure);
Wolfgang Beyerabfc8472021-02-04 11:29:50788 }
789 return null;
790 }
791
792 private async maybeRenderCoopCoepStatus(): Promise<LitHtml.TemplateResult|{}> {
793 if (this.frame) {
794 const model = this.frame.resourceTreeModel().target().model(SDK.NetworkManager.NetworkManager);
795 const info = model && await model.getSecurityIsolationStatus(this.frame.id);
796 if (info) {
797 return LitHtml.html`
798 ${
799 this.maybeRenderCrossOriginStatus(
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01800 info.coep, i18nString(UIStrings.crossoriginEmbedderPolicy),
801 Protocol.Network.CrossOriginEmbedderPolicyValue.None)}
Wolfgang Beyerabfc8472021-02-04 11:29:50802 ${
803 this.maybeRenderCrossOriginStatus(
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01804 info.coop, i18nString(UIStrings.crossoriginOpenerPolicy),
805 Protocol.Network.CrossOriginOpenerPolicyValue.UnsafeNone)}
Wolfgang Beyerabfc8472021-02-04 11:29:50806 `;
807 }
808 }
809 return LitHtml.nothing;
810 }
811
812 private maybeRenderCrossOriginStatus(
813 info: Protocol.Network.CrossOriginEmbedderPolicyStatus|Protocol.Network.CrossOriginOpenerPolicyStatus|undefined,
814 policyName: string,
815 noneValue: Protocol.Network.CrossOriginEmbedderPolicyValue|
816 Protocol.Network.CrossOriginOpenerPolicyValue): LitHtml.TemplateResult|{} {
817 if (!info) {
818 return LitHtml.nothing;
819 }
820 const isEnabled = info.value !== noneValue;
821 const isReportOnly = (!isEnabled && info.reportOnlyValue !== noneValue);
822 const endpoint = isEnabled ? info.reportingEndpoint : info.reportOnlyReportingEndpoint;
823 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36824 <${ReportView.ReportView.ReportKey.litTagName}>${policyName}</${ReportView.ReportView.ReportKey.litTagName}>
825 <${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyerabfc8472021-02-04 11:29:50826 ${isEnabled ? info.value : info.reportOnlyValue}
827 ${isReportOnly ? LitHtml.html`<span class="inline-comment">report-only</span>` : LitHtml.nothing}
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01828 ${
829 endpoint ? LitHtml.html`<span class="inline-name">${i18nString(UIStrings.reportingTo)}</span>${endpoint}` :
830 LitHtml.nothing}
Kriti Sapra74915452021-05-13 11:57:36831 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyerabfc8472021-02-04 11:29:50832 `;
833 }
Wolfgang Beyer6a6efe62021-02-04 15:56:21834
835 private renderApiAvailabilitySection(): LitHtml.TemplateResult|{} {
836 if (!this.frame) {
837 return LitHtml.nothing;
838 }
839
840 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36841 <${ReportView.ReportView.ReportSectionHeader.litTagName}>${i18nString(UIStrings.apiAvailability)}</${
842 ReportView.ReportView.ReportSectionHeader.litTagName}>
Wolfgang Beyer6a6efe62021-02-04 15:56:21843 <div class="span-cols">
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01844 ${i18nString(UIStrings.availabilityOfCertainApisDepends)}
Wolfgang Beyer4751c1c2021-03-24 15:32:35845 <x-link href="https://web.dev/why-coop-coep/" class="link">${i18nString(UIStrings.learnMore)}</x-link>
Wolfgang Beyer6a6efe62021-02-04 15:56:21846 </div>
847 ${this.renderSharedArrayBufferAvailability()}
848 ${this.renderMeasureMemoryAvailability()}
Kriti Sapra74915452021-05-13 11:57:36849 <${ReportView.ReportView.ReportSectionDivider.litTagName}></${
850 ReportView.ReportView.ReportSectionDivider.litTagName}>
Wolfgang Beyer6a6efe62021-02-04 15:56:21851 `;
852 }
853
854 private renderSharedArrayBufferAvailability(): LitHtml.TemplateResult|{} {
855 if (this.frame) {
856 const features = this.frame.getGatedAPIFeatures();
857 if (features) {
858 const sabAvailable = features.includes(Protocol.Page.GatedAPIFeatures.SharedArrayBuffers);
859 const sabTransferAvailable =
860 sabAvailable && features.includes(Protocol.Page.GatedAPIFeatures.SharedArrayBuffersTransferAllowed);
861 const availabilityText = sabTransferAvailable ?
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01862 i18nString(UIStrings.availableTransferable) :
863 (sabAvailable ? i18nString(UIStrings.availableNotTransferable) : i18nString(UIStrings.unavailable));
Wolfgang Beyer6a6efe62021-02-04 15:56:21864 const tooltipText = sabTransferAvailable ?
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01865 i18nString(UIStrings.sharedarraybufferConstructorIs) :
866 (sabAvailable ? i18nString(UIStrings.sharedarraybufferConstructorIsAvailable) : '');
Wolfgang Beyer6a6efe62021-02-04 15:56:21867
Sigurd Schneider2a450252021-05-04 07:13:15868 function renderHint(frame: SDK.ResourceTreeModel.ResourceTreeFrame): LitHtml.TemplateResult|{} {
869 switch (frame.getCrossOriginIsolatedContextType()) {
870 case Protocol.Page.CrossOriginIsolatedContextType.Isolated:
871 return LitHtml.nothing;
872 case Protocol.Page.CrossOriginIsolatedContextType.NotIsolated:
873 if (sabAvailable) {
874 return LitHtml.html`<span class="inline-comment">${
875 i18nString(UIStrings.willRequireCrossoriginIsolated)}</span>`;
876 }
877 return LitHtml.html`<span class="inline-comment">${
878 i18nString(UIStrings.requiresCrossoriginIsolated)}</span>`;
879 case Protocol.Page.CrossOriginIsolatedContextType.NotIsolatedFeatureDisabled:
880 if (!sabTransferAvailable) {
881 return LitHtml.html`<span class="inline-comment">${
882 i18nString(
883 UIStrings
884 .transferRequiresCrossoriginIsolatedPermission)} <code>cross-origin-isolated</code></span>`;
885 }
886 break;
887 }
888 return LitHtml.nothing;
889 }
890
Peter Marshall0e1cd822021-02-24 10:52:42891 // SharedArrayBuffer is an API name, so we don't translate it.
Wolfgang Beyer6a6efe62021-02-04 15:56:21892 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36893 <${ReportView.ReportView.ReportKey.litTagName}>SharedArrayBuffers</${
894 ReportView.ReportView.ReportKey.litTagName}>
895 <${ReportView.ReportView.ReportValue.litTagName} title=${tooltipText}>
Wolfgang Beyer6a6efe62021-02-04 15:56:21896 ${availabilityText}
Sigurd Schneider2a450252021-05-04 07:13:15897 ${renderHint(this.frame)}
Kriti Sapra74915452021-05-13 11:57:36898 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer6a6efe62021-02-04 15:56:21899 `;
Wolfgang Beyer6a6efe62021-02-04 15:56:21900 }
901 }
902 return LitHtml.nothing;
903 }
904
905 private renderMeasureMemoryAvailability(): LitHtml.TemplateResult|{} {
906 if (this.frame) {
907 const measureMemoryAvailable = this.frame.isCrossOriginIsolated();
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01908 const availabilityText =
909 measureMemoryAvailable ? i18nString(UIStrings.available) : i18nString(UIStrings.unavailable);
910 const tooltipText = measureMemoryAvailable ? i18nString(UIStrings.thePerformanceAPI) :
911 i18nString(UIStrings.thePerformancemeasureuseragentspecificmemory);
Wolfgang Beyer6a6efe62021-02-04 15:56:21912 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36913 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.measureMemory)}</${
914 ReportView.ReportView.ReportKey.litTagName}>
915 <${ReportView.ReportView.ReportValue.litTagName}>
Tim van der Lippe0005b802021-06-03 10:47:59916 <span title=${tooltipText}>${
917 availabilityText}</span>\xA0<x-link class="link" href="https://web.dev/monitor-total-page-memory-usage/">${
Wolfgang Beyer09b0e8e2021-02-09 13:39:48918 i18nString(UIStrings.learnMore)}</x-link>
Kriti Sapra74915452021-05-13 11:57:36919 </${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyer6a6efe62021-02-04 15:56:21920 `;
921 }
922 return LitHtml.nothing;
923 }
Wolfgang Beyere5d1a9f2021-02-05 09:42:43924
925 private renderAdditionalInfoSection(): LitHtml.TemplateResult|{} {
926 if (!this.frame) {
927 return LitHtml.nothing;
928 }
929
930 return LitHtml.html`
Kriti Sapra74915452021-05-13 11:57:36931 <${ReportView.ReportView.ReportSectionHeader.litTagName}
Vidal Guillermo Diazleal Ortega0a997bb2021-02-09 04:33:01932 title=${i18nString(UIStrings.thisAdditionalDebugging)}
Kriti Sapra74915452021-05-13 11:57:36933 >${i18nString(UIStrings.additionalInformation)}</${ReportView.ReportView.ReportSectionHeader.litTagName}>
934 <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.frameId)}</${
935 ReportView.ReportView.ReportKey.litTagName}>
936 <${ReportView.ReportView.ReportValue.litTagName}>
Wolfgang Beyere5d1a9f2021-02-05 09:42:43937 <div class="text-ellipsis" title=${this.frame.id}>${this.frame.id}</div>
Kriti Sapra74915452021-05-13 11:57:36938 </${ReportView.ReportView.ReportValue.litTagName}>
939 <${ReportView.ReportView.ReportSectionDivider.litTagName}></${
940 ReportView.ReportView.ReportSectionDivider.litTagName}>
Wolfgang Beyere5d1a9f2021-02-05 09:42:43941 `;
942 }
Wolfgang Beyer92395c92021-02-02 10:43:23943}
944
Kriti Sapra34df98d2021-05-06 10:15:42945ComponentHelpers.CustomElements.defineComponent('devtools-resources-frame-details-view', FrameDetailsReportView);
Wolfgang Beyer92395c92021-02-02 10:43:23946
947declare global {
948 // eslint-disable-next-line @typescript-eslint/no-unused-vars
949 interface HTMLElementTagNameMap {
950 'devtools-resources-frame-details-view': FrameDetailsReportView;
951 }
952}