Danil Somsikov | 4ba8f35 | 2021-06-09 12:27:22 | [diff] [blame] | 1 | // Copyright 2021 The Chromium Authors. All rights reserved. |
Wolfgang Beyer | 760462e | 2020-07-13 15:01:35 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Jack Franklin | 3a80260 | 2022-07-13 08:39:42 | [diff] [blame] | 5 | import {StackTrace, type StackTraceData} from './StackTrace.js'; |
| 6 | |
| 7 | import { |
| 8 | PermissionsPolicySection, |
| 9 | renderIconLink, |
| 10 | type PermissionsPolicySectionData, |
| 11 | } from './PermissionsPolicySection.js'; |
Tim van der Lippe | 1bd5e21 | 2021-05-06 10:54:29 | [diff] [blame] | 12 | import * as Bindings from '../../../models/bindings/bindings.js'; |
| 13 | import * as Common from '../../../core/common/common.js'; |
| 14 | import * as i18n from '../../../core/i18n/i18n.js'; |
Sigurd Schneider | 2e36ec6 | 2021-06-11 06:14:27 | [diff] [blame] | 15 | import * as NetworkForward from '../../../panels/network/forward/forward.js'; |
Danil Somsikov | c48b2b1 | 2022-06-24 15:03:03 | [diff] [blame] | 16 | import * as Platform from '../../../core/platform/platform.js'; |
Tim van der Lippe | 1bd5e21 | 2021-05-06 10:54:29 | [diff] [blame] | 17 | import * as Root from '../../../core/root/root.js'; |
Tim van der Lippe | c2cbf32 | 2021-07-26 14:35:33 | [diff] [blame] | 18 | import * as SDK from '../../../core/sdk/sdk.js'; |
Paul Lewis | 01f4939 | 2021-05-10 13:54:20 | [diff] [blame] | 19 | import * as LitHtml from '../../../ui/lit-html/lit-html.js'; |
Sigurd Schneider | cc9a02e | 2021-06-16 06:20:33 | [diff] [blame] | 20 | import * as ExpandableList from '../../../ui/components/expandable_list/expandable_list.js'; |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 21 | import * as ReportView from '../../../ui/components/report_view/report_view.js'; |
| 22 | import * as IconButton from '../../../ui/components/icon_button/icon_button.js'; |
Tim van der Lippe | 1bd5e21 | 2021-05-06 10:54:29 | [diff] [blame] | 23 | import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js'; |
Danil Somsikov | 5875b3b | 2023-05-17 21:41:36 | [diff] [blame] | 24 | import * as LegacyWrapper from '../../../ui/components/legacy_wrapper/legacy_wrapper.js'; |
Tim van der Lippe | 1bd5e21 | 2021-05-06 10:54:29 | [diff] [blame] | 25 | import * as Workspace from '../../../models/workspace/workspace.js'; |
| 26 | import * as Components from '../../../ui/legacy/components/utils/utils.js'; |
Tim van der Lippe | 229a54f | 2021-05-14 16:59:05 | [diff] [blame] | 27 | import * as Protocol from '../../../generated/protocol.js'; |
Jack Franklin | 3a80260 | 2022-07-13 08:39:42 | [diff] [blame] | 28 | |
| 29 | import {OriginTrialTreeView, type OriginTrialTreeViewData} from './OriginTrialTreeView.js'; |
Wolfgang Beyer | ffae99f | 2021-07-08 08:46:53 | [diff] [blame] | 30 | import * as Coordinator from '../../../ui/components/render_coordinator/render_coordinator.js'; |
Wolfgang Beyer | 760462e | 2020-07-13 15:01:35 | [diff] [blame] | 31 | |
Kriti Sapra | 9db87f5 | 2021-07-14 12:51:12 | [diff] [blame] | 32 | import frameDetailsReportViewStyles from './frameDetailsReportView.css.js'; |
Robert Lin | 449f933 | 2022-07-06 14:05:45 | [diff] [blame] | 33 | import {Prerender2ReasonDescription} from './Prerender2.js'; |
Kriti Sapra | 9db87f5 | 2021-07-14 12:51:12 | [diff] [blame] | 34 | |
Simon Zünd | 697fb0b | 2021-03-01 10:12:42 | [diff] [blame] | 35 | const UIStrings = { |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 36 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 37 | *@description Section header in the Frame Details view |
| 38 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 39 | additionalInformation: 'Additional Information', |
| 40 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 41 | *@description Explanation for why the additional information section is being shown |
| 42 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 43 | thisAdditionalDebugging: |
| 44 | 'This additional (debugging) information is shown because the \'Protocol Monitor\' experiment is enabled.', |
| 45 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 46 | *@description Label for subtitle of frame details view |
| 47 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 48 | frameId: 'Frame ID', |
| 49 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 50 | *@description Name of a network resource type |
| 51 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 52 | document: 'Document', |
| 53 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 54 | *@description A web URL (for a lot of languages this does not need to be translated, please translate only where necessary) |
| 55 | */ |
Wolfgang Beyer | 5e451ff | 2021-12-08 16:44:35 | [diff] [blame] | 56 | url: 'URL', |
| 57 | /** |
| 58 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 59 | *@description Title for a link to the Sources panel |
| 60 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 61 | clickToRevealInSourcesPanel: 'Click to reveal in Sources panel', |
| 62 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 63 | *@description Title for a link to the Network panel |
| 64 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 65 | clickToRevealInNetworkPanel: 'Click to reveal in Network panel', |
| 66 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 67 | *@description Title for unreachable URL field |
| 68 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 69 | unreachableUrl: 'Unreachable URL', |
| 70 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 71 | *@description Title for a link that applies a filter to the network panel |
| 72 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 73 | clickToRevealInNetworkPanelMight: 'Click to reveal in Network panel (might require page reload)', |
| 74 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 75 | *@description The origin of a URL (https://web.dev/same-site-same-origin/#origin) |
| 76 | *(for a lot of languages this does not need to be translated, please translate only where necessary) |
| 77 | */ |
Wolfgang Beyer | 5e451ff | 2021-12-08 16:44:35 | [diff] [blame] | 78 | origin: 'Origin', |
| 79 | /** |
| 80 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 81 | *@description Related node label in Timeline UIUtils of the Performance panel |
| 82 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 83 | ownerElement: 'Owner Element', |
| 84 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 85 | *@description Title for a link to the Elements panel |
| 86 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 87 | clickToRevealInElementsPanel: 'Click to reveal in Elements panel', |
| 88 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 89 | *@description Title for ad frame type field |
| 90 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 91 | adStatus: 'Ad Status', |
| 92 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 93 | *@description Description for ad frame type |
| 94 | */ |
Sigurd Schneider | cc9a02e | 2021-06-16 06:20:33 | [diff] [blame] | 95 | rootDescription: 'This frame has been identified as the root frame of an ad', |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 96 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 97 | *@description Value for ad frame type |
| 98 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 99 | root: 'root', |
| 100 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 101 | *@description Description for ad frame type |
| 102 | */ |
Sigurd Schneider | cc9a02e | 2021-06-16 06:20:33 | [diff] [blame] | 103 | childDescription: 'This frame has been identified as a child frame of an ad', |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 104 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 105 | *@description Value for ad frame type |
| 106 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 107 | child: 'child', |
| 108 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 109 | *@description Section header in the Frame Details view |
| 110 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 111 | securityIsolation: 'Security & Isolation', |
| 112 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 113 | *@description Row title for in the Frame Details view |
| 114 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 115 | secureContext: 'Secure Context', |
| 116 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 117 | *@description Text in Timeline indicating that input has happened recently |
| 118 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 119 | yes: 'Yes', |
| 120 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 121 | *@description Text in Timeline indicating that input has not happened recently |
| 122 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 123 | no: 'No', |
| 124 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 125 | *@description Label for whether a frame is cross-origin isolated |
| 126 | *(https://developer.chrome.com/docs/extensions/mv3/cross-origin-isolation/) |
| 127 | *(for a lot of languages this does not need to be translated, please translate only where necessary) |
| 128 | */ |
Wolfgang Beyer | 5e451ff | 2021-12-08 16:44:35 | [diff] [blame] | 129 | crossoriginIsolated: 'Cross-Origin Isolated', |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 130 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 131 | *@description Explanatory text in the Frame Details view |
| 132 | */ |
Wolfgang Beyer | dbf211e | 2021-11-23 10:23:54 | [diff] [blame] | 133 | localhostIsAlwaysASecureContext: '`Localhost` is always a secure context', |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 134 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 135 | *@description Explanatory text in the Frame Details view |
| 136 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 137 | aFrameAncestorIsAnInsecure: 'A frame ancestor is an insecure context', |
| 138 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 139 | *@description Explanatory text in the Frame Details view |
| 140 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 141 | theFramesSchemeIsInsecure: 'The frame\'s scheme is insecure', |
| 142 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 143 | *@description This label specifies the server endpoints to which the server is reporting errors |
| 144 | *and warnings through the Report-to API. Following this label will be the URL of the server. |
| 145 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 146 | reportingTo: 'reporting to', |
| 147 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 148 | *@description Section header in the Frame Details view |
| 149 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 150 | apiAvailability: 'API availability', |
| 151 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 152 | *@description Explanation of why cross-origin isolation is important |
| 153 | *(https://web.dev/why-coop-coep/) |
| 154 | *(for a lot of languages 'cross-origin isolation' does not need to be translated, please translate only where necessary) |
| 155 | */ |
Wolfgang Beyer | 5e451ff | 2021-12-08 16:44:35 | [diff] [blame] | 156 | availabilityOfCertainApisDepends: 'Availability of certain APIs depends on the document being cross-origin isolated.', |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 157 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 158 | *@description Description of the SharedArrayBuffer status |
| 159 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 160 | availableTransferable: 'available, transferable', |
| 161 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 162 | *@description Description of the SharedArrayBuffer status |
| 163 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 164 | availableNotTransferable: 'available, not transferable', |
| 165 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 166 | *@description Explanation for the SharedArrayBuffer availability status |
| 167 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 168 | unavailable: 'unavailable', |
| 169 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 170 | *@description Tooltip for the SharedArrayBuffer availability status |
| 171 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 172 | sharedarraybufferConstructorIs: |
Wolfgang Beyer | dbf211e | 2021-11-23 10:23:54 | [diff] [blame] | 173 | '`SharedArrayBuffer` constructor is available and `SABs` can be transferred via `postMessage`', |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 174 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 175 | *@description Tooltip for the SharedArrayBuffer availability status |
| 176 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 177 | sharedarraybufferConstructorIsAvailable: |
Wolfgang Beyer | dbf211e | 2021-11-23 10:23:54 | [diff] [blame] | 178 | '`SharedArrayBuffer` constructor is available but `SABs` cannot be transferred via `postMessage`', |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 179 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 180 | *@description Explanation why SharedArrayBuffer will not be available in the future |
| 181 | *(https://developer.chrome.com/docs/extensions/mv3/cross-origin-isolation/) |
| 182 | *(for a lot of languages 'cross-origin isolation' does not need to be translated, please translate only where necessary) |
| 183 | */ |
Wolfgang Beyer | 5e451ff | 2021-12-08 16:44:35 | [diff] [blame] | 184 | willRequireCrossoriginIsolated: '⚠️ will require cross-origin isolated context in the future', |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 185 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 186 | *@description Explanation why SharedArrayBuffer is not available |
| 187 | *(https://developer.chrome.com/docs/extensions/mv3/cross-origin-isolation/) |
| 188 | *(for a lot of languages 'cross-origin isolation' does not need to be translated, please translate only where necessary). |
| 189 | */ |
Wolfgang Beyer | 5e451ff | 2021-12-08 16:44:35 | [diff] [blame] | 190 | requiresCrossoriginIsolated: 'requires cross-origin isolated context', |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 191 | /** |
Sigurd Schneider | f7e58be | 2021-05-14 14:41:52 | [diff] [blame] | 192 | *@description Explanation for the SharedArrayBuffer availability status in case the transfer of a SAB requires the |
| 193 | * permission policy `cross-origin-isolated` to be enabled (e.g. because the message refers to the situation in an iframe). |
| 194 | */ |
| 195 | transferRequiresCrossoriginIsolatedPermission: |
| 196 | '`SharedArrayBuffer` transfer requires enabling the permission policy:', |
Sigurd Schneider | 2a45025 | 2021-05-04 07:13:15 | [diff] [blame] | 197 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 198 | *@description Explanation for the Measure Memory availability status |
| 199 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 200 | available: 'available', |
| 201 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 202 | *@description Tooltip for the Measure Memory availability status |
| 203 | */ |
Wolfgang Beyer | dbf211e | 2021-11-23 10:23:54 | [diff] [blame] | 204 | thePerformanceAPI: 'The `performance.measureUserAgentSpecificMemory()` API is available', |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 205 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 206 | *@description Tooltip for the Measure Memory availability status |
| 207 | */ |
Wolfgang Beyer | dbf211e | 2021-11-23 10:23:54 | [diff] [blame] | 208 | thePerformancemeasureuseragentspecificmemory: |
| 209 | 'The `performance.measureUserAgentSpecificMemory()` API is not available', |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 210 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 211 | *@description Entry in the API availability section of the frame details view |
| 212 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 213 | measureMemory: 'Measure Memory', |
| 214 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 215 | *@description Text that is usually a hyperlink to more documentation |
| 216 | */ |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 217 | learnMore: 'Learn more', |
Wolfgang Beyer | 1909394 | 2021-03-15 15:00:34 | [diff] [blame] | 218 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 219 | *@description Label for a stack trace. If a frame is created programmatically (i.e. via JavaScript), there is a |
| 220 | * stack trace for the line of code which caused the creation of the iframe. This is the stack trace we are showing here. |
| 221 | */ |
Wolfgang Beyer | dbf211e | 2021-11-23 10:23:54 | [diff] [blame] | 222 | creationStackTrace: 'Frame Creation `Stack Trace`', |
Wolfgang Beyer | 1909394 | 2021-03-15 15:00:34 | [diff] [blame] | 223 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 224 | *@description Tooltip for 'Frame Creation Stack Trace' explaining that the stack |
| 225 | *trace shows where in the code the frame has been created programmatically |
| 226 | */ |
Wolfgang Beyer | dbf211e | 2021-11-23 10:23:54 | [diff] [blame] | 227 | creationStackTraceExplanation: |
| 228 | 'This frame was created programmatically. The `stack trace` shows where this happened.', |
Wolfgang Beyer | 4751c1c | 2021-03-24 15:32:35 | [diff] [blame] | 229 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 230 | *@description Text descripting why a frame has been indentified as an advertisement. |
| 231 | */ |
Sigurd Schneider | cc9a02e | 2021-06-16 06:20:33 | [diff] [blame] | 232 | parentIsAdExplanation: 'This frame is considered an ad frame because its parent frame is an ad frame.', |
| 233 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 234 | *@description Text descripting why a frame has been indentified as an advertisement. |
| 235 | */ |
Sigurd Schneider | cc9a02e | 2021-06-16 06:20:33 | [diff] [blame] | 236 | matchedBlockingRuleExplanation: |
| 237 | 'This frame is considered an ad frame because its current (or previous) main document is an ad resource.', |
| 238 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 239 | *@description Text descripting why a frame has been indentified as an advertisement. |
| 240 | */ |
Sigurd Schneider | cc9a02e | 2021-06-16 06:20:33 | [diff] [blame] | 241 | createdByAdScriptExplanation: |
Wolfgang Beyer | dbf211e | 2021-11-23 10:23:54 | [diff] [blame] | 242 | '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 Beyer | 1a432c4 | 2022-01-20 09:30:14 | [diff] [blame] | 243 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 244 | *@description Label for a button which when clicked causes some information to be refreshed/updated. |
| 245 | */ |
Wolfgang Beyer | 1a432c4 | 2022-01-20 09:30:14 | [diff] [blame] | 246 | refresh: 'Refresh', |
Danil Somsikov | 325f218 | 2022-05-16 09:40:39 | [diff] [blame] | 247 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 248 | *@description Label for section of frame details view |
| 249 | */ |
Danil Somsikov | 325f218 | 2022-05-16 09:40:39 | [diff] [blame] | 250 | prerendering: 'Prerendering', |
| 251 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 252 | *@description Label for subtitle of frame details view |
| 253 | */ |
Danil Somsikov | 325f218 | 2022-05-16 09:40:39 | [diff] [blame] | 254 | prerenderingStatus: 'Prerendering Status', |
Danil Somsikov | c48b2b1 | 2022-06-24 15:03:03 | [diff] [blame] | 255 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 256 | *@description Label for a link to an ad script, which created the current iframe. |
| 257 | */ |
Danil Somsikov | c48b2b1 | 2022-06-24 15:03:03 | [diff] [blame] | 258 | creatorAdScript: 'Creator Ad Script', |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 259 | }; |
Tim van der Lippe | 1bd5e21 | 2021-05-06 10:54:29 | [diff] [blame] | 260 | const str_ = i18n.i18n.registerUIStrings('panels/application/components/FrameDetailsView.ts', UIStrings); |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 261 | const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_); |
Wolfgang Beyer | 3b4747f | 2020-08-12 07:30:46 | [diff] [blame] | 262 | |
Wolfgang Beyer | ffae99f | 2021-07-08 08:46:53 | [diff] [blame] | 263 | const coordinator = Coordinator.RenderCoordinator.RenderCoordinator.instance(); |
| 264 | |
Wolfgang Beyer | 92395c9 | 2021-02-02 10:43:23 | [diff] [blame] | 265 | export interface FrameDetailsReportViewData { |
| 266 | frame: SDK.ResourceTreeModel.ResourceTreeFrame; |
Danil Somsikov | c48b2b1 | 2022-06-24 15:03:03 | [diff] [blame] | 267 | target?: SDK.Target.Target; |
Robert Lin | 48a925e | 2022-11-02 11:55:56 | [diff] [blame] | 268 | prerenderedUrl?: string; |
Alex Rudenko | b8b4860 | 2022-10-17 12:59:58 | [diff] [blame] | 269 | adScriptId: Protocol.Page.AdScriptId|null; |
Wolfgang Beyer | 92395c9 | 2021-02-02 10:43:23 | [diff] [blame] | 270 | } |
| 271 | |
Danil Somsikov | 091da10 | 2023-06-09 21:56:03 | [diff] [blame] | 272 | export class FrameDetailsReportView extends LegacyWrapper.LegacyWrapper.WrappableComponent { |
Jack Franklin | af799b3 | 2021-07-01 08:37:18 | [diff] [blame] | 273 | static readonly litTagName = LitHtml.literal`devtools-resources-frame-details-view`; |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 274 | readonly #shadow = this.attachShadow({mode: 'open'}); |
| 275 | #frame?: SDK.ResourceTreeModel.ResourceTreeFrame; |
Danil Somsikov | c48b2b1 | 2022-06-24 15:03:03 | [diff] [blame] | 276 | #target?: SDK.Target.Target; |
Robert Lin | 48a925e | 2022-11-02 11:55:56 | [diff] [blame] | 277 | #prerenderedUrl?: string; |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 278 | #protocolMonitorExperimentEnabled = false; |
| 279 | #permissionsPolicies: Promise<Protocol.Page.PermissionsPolicyFeatureState[]|null>|null = null; |
| 280 | #permissionsPolicySectionData: PermissionsPolicySectionData = {policies: [], showDetails: false}; |
| 281 | #originTrialTreeView: OriginTrialTreeView = new OriginTrialTreeView(); |
Danil Somsikov | c48b2b1 | 2022-06-24 15:03:03 | [diff] [blame] | 282 | #linkifier = new Components.Linkifier.Linkifier(); |
Alex Rudenko | b8b4860 | 2022-10-17 12:59:58 | [diff] [blame] | 283 | #adScriptId: Protocol.Page.AdScriptId|null = null; |
Wolfgang Beyer | e5d1a9f | 2021-02-05 09:42:43 | [diff] [blame] | 284 | |
Danil Somsikov | 5875b3b | 2023-05-17 21:41:36 | [diff] [blame] | 285 | constructor(frame: SDK.ResourceTreeModel.ResourceTreeFrame) { |
| 286 | super(); |
| 287 | this.#frame = frame; |
| 288 | this.#prerenderedUrl = ''; |
Danil Somsikov | 5875b3b | 2023-05-17 21:41:36 | [diff] [blame] | 289 | |
| 290 | SDK.TargetManager.TargetManager.instance().addModelListener( |
| 291 | SDK.ChildTargetManager.ChildTargetManager, SDK.ChildTargetManager.Events.TargetInfoChanged, this.targetChanged, |
| 292 | this); |
| 293 | frame.resourceTreeModel().addEventListener( |
Danil Somsikov | 091da10 | 2023-06-09 21:56:03 | [diff] [blame] | 294 | SDK.ResourceTreeModel.Events.PrerenderingStatusUpdated, this.render, this); |
| 295 | void this.render(); |
Danil Somsikov | 5875b3b | 2023-05-17 21:41:36 | [diff] [blame] | 296 | } |
| 297 | |
| 298 | targetChanged(event: Common.EventTarget.EventTargetEvent<Protocol.Target.TargetInfo>): void { |
| 299 | const targetInfo = event.data; |
| 300 | if (targetInfo.subtype === 'prerender') { |
| 301 | this.#prerenderedUrl = targetInfo.url; |
Danil Somsikov | 091da10 | 2023-06-09 21:56:03 | [diff] [blame] | 302 | void this.render(); |
Danil Somsikov | 5875b3b | 2023-05-17 21:41:36 | [diff] [blame] | 303 | } |
| 304 | } |
| 305 | |
Wolfgang Beyer | e5d1a9f | 2021-02-05 09:42:43 | [diff] [blame] | 306 | connectedCallback(): void { |
Danil Somsikov | 2d619e1 | 2023-07-10 10:13:52 | [diff] [blame^] | 307 | this.parentElement?.classList.add('overflow-auto'); |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 308 | this.#protocolMonitorExperimentEnabled = Root.Runtime.experiments.isEnabled('protocolMonitor'); |
| 309 | this.#shadow.adoptedStyleSheets = [frameDetailsReportViewStyles]; |
Wolfgang Beyer | e5d1a9f | 2021-02-05 09:42:43 | [diff] [blame] | 310 | } |
Wolfgang Beyer | 92395c9 | 2021-02-02 10:43:23 | [diff] [blame] | 311 | |
Danil Somsikov | 5875b3b | 2023-05-17 21:41:36 | [diff] [blame] | 312 | override async render(): Promise<void> { |
| 313 | this.#adScriptId = (await this.#frame?.parentFrame()?.getAdScriptId(this.#frame?.id)) || null; |
| 314 | const debuggerModel = this.#adScriptId?.debuggerId ? |
| 315 | await SDK.DebuggerModel.DebuggerModel.modelForDebuggerId(this.#adScriptId?.debuggerId) : |
| 316 | null; |
| 317 | this.#target = debuggerModel?.target(); |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 318 | if (!this.#permissionsPolicies && this.#frame) { |
| 319 | this.#permissionsPolicies = this.#frame.getPermissionsPolicyState(); |
Wolfgang Beyer | ffae99f | 2021-07-08 08:46:53 | [diff] [blame] | 320 | } |
Wolfgang Beyer | ffae99f | 2021-07-08 08:46:53 | [diff] [blame] | 321 | await coordinator.write('FrameDetailsView render', () => { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 322 | if (!this.#frame) { |
Wolfgang Beyer | ffae99f | 2021-07-08 08:46:53 | [diff] [blame] | 323 | return; |
| 324 | } |
Wolfgang Beyer | 92395c9 | 2021-02-02 10:43:23 | [diff] [blame] | 325 | |
Wolfgang Beyer | ffae99f | 2021-07-08 08:46:53 | [diff] [blame] | 326 | // Disabled until https://crbug.com/1079231 is fixed. |
| 327 | // clang-format off |
Wolfgang Beyer | ffae99f | 2021-07-08 08:46:53 | [diff] [blame] | 328 | LitHtml.render(LitHtml.html` |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 329 | <${ReportView.ReportView.Report.litTagName} .data=${{reportTitle: this.#frame.displayName()} as ReportView.ReportView.ReportData}> |
| 330 | ${this.#renderDocumentSection()} |
| 331 | ${this.#renderIsolationSection()} |
| 332 | ${this.#renderApiAvailabilitySection()} |
| 333 | ${this.#renderOriginTrial()} |
| 334 | ${LitHtml.Directives.until(this.#permissionsPolicies?.then(policies => { |
| 335 | this.#permissionsPolicySectionData.policies = policies || []; |
Wolfgang Beyer | ffae99f | 2021-07-08 08:46:53 | [diff] [blame] | 336 | return LitHtml.html` |
| 337 | <${PermissionsPolicySection.litTagName} |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 338 | .data=${this.#permissionsPolicySectionData as PermissionsPolicySectionData} |
Wolfgang Beyer | ffae99f | 2021-07-08 08:46:53 | [diff] [blame] | 339 | > |
| 340 | </${PermissionsPolicySection.litTagName}> |
| 341 | `; |
| 342 | }), LitHtml.nothing)} |
Danil Somsikov | 325f218 | 2022-05-16 09:40:39 | [diff] [blame] | 343 | ${this.#renderPrerenderingSection()} |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 344 | ${this.#protocolMonitorExperimentEnabled ? this.#renderAdditionalInfoSection() : LitHtml.nothing} |
Wolfgang Beyer | ffae99f | 2021-07-08 08:46:53 | [diff] [blame] | 345 | </${ReportView.ReportView.Report.litTagName}> |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 346 | `, this.#shadow, {host: this}); |
Wolfgang Beyer | ffae99f | 2021-07-08 08:46:53 | [diff] [blame] | 347 | // clang-format on |
| 348 | }); |
Wolfgang Beyer | 92395c9 | 2021-02-02 10:43:23 | [diff] [blame] | 349 | } |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 350 | |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 351 | #renderOriginTrial(): LitHtml.LitTemplate { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 352 | if (!this.#frame) { |
Charlie Hu | 2086be5 | 2021-07-02 16:12:12 | [diff] [blame] | 353 | return LitHtml.nothing; |
| 354 | } |
Charlie Hu | 6c295cf | 2021-08-10 15:38:48 | [diff] [blame] | 355 | |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 356 | this.#originTrialTreeView.classList.add('span-cols'); |
Charlie Hu | 6c295cf | 2021-08-10 15:38:48 | [diff] [blame] | 357 | |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 358 | const frame = this.#frame; |
Charlie Hu | 6c295cf | 2021-08-10 15:38:48 | [diff] [blame] | 359 | const refreshOriginTrials: () => void = () => { |
Tim van der Lippe | 2d9a95c | 2022-01-04 15:18:03 | [diff] [blame] | 360 | void frame.getOriginTrials().then(trials => { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 361 | this.#originTrialTreeView.data = {trials} as OriginTrialTreeViewData; |
Charlie Hu | 6c295cf | 2021-08-10 15:38:48 | [diff] [blame] | 362 | }); |
| 363 | }; |
| 364 | refreshOriginTrials(); |
| 365 | |
Charlie Hu | 2086be5 | 2021-07-02 16:12:12 | [diff] [blame] | 366 | return LitHtml.html` |
Charlie Hu | 6c295cf | 2021-08-10 15:38:48 | [diff] [blame] | 367 | <${ReportView.ReportView.ReportSectionHeader.litTagName}> |
Wolfgang Beyer | dbf211e | 2021-11-23 10:23:54 | [diff] [blame] | 368 | ${i18n.i18n.lockedString('Origin Trials')} |
Jack Franklin | a31102b | 2021-12-03 15:01:22 | [diff] [blame] | 369 | <${IconButton.IconButton.IconButton.litTagName} class="inline-button" .data=${{ |
Charlie Hu | 6c295cf | 2021-08-10 15:38:48 | [diff] [blame] | 370 | clickHandler: refreshOriginTrials, |
| 371 | groups: [ |
| 372 | { |
Wolfgang Beyer | b670394 | 2023-04-04 11:53:43 | [diff] [blame] | 373 | iconName: 'refresh', |
Wolfgang Beyer | 1a432c4 | 2022-01-20 09:30:14 | [diff] [blame] | 374 | text: i18nString(UIStrings.refresh), |
Wolfgang Beyer | b670394 | 2023-04-04 11:53:43 | [diff] [blame] | 375 | iconColor: 'var(--icon-default-hover)', |
| 376 | iconWidth: '14px', |
| 377 | iconHeight: '14px', |
Charlie Hu | 6c295cf | 2021-08-10 15:38:48 | [diff] [blame] | 378 | } as IconButton.IconButton.IconWithTextData, |
| 379 | ], |
Jack Franklin | a31102b | 2021-12-03 15:01:22 | [diff] [blame] | 380 | } as IconButton.IconButton.IconButtonData}> |
Charlie Hu | 6c295cf | 2021-08-10 15:38:48 | [diff] [blame] | 381 | </${IconButton.IconButton.IconButton.litTagName}> |
Charlie Hu | 2086be5 | 2021-07-02 16:12:12 | [diff] [blame] | 382 | </${ReportView.ReportView.ReportSectionHeader.litTagName}> |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 383 | ${this.#originTrialTreeView} |
Charlie Hu | 2086be5 | 2021-07-02 16:12:12 | [diff] [blame] | 384 | <${ReportView.ReportView.ReportSectionDivider.litTagName}></${ |
| 385 | ReportView.ReportView.ReportSectionDivider.litTagName}> |
| 386 | `; |
| 387 | } |
| 388 | |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 389 | #renderDocumentSection(): LitHtml.LitTemplate { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 390 | if (!this.#frame) { |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 391 | return LitHtml.nothing; |
| 392 | } |
| 393 | |
| 394 | return LitHtml.html` |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 395 | <${ReportView.ReportView.ReportSectionHeader.litTagName}>${i18nString(UIStrings.document)}</${ |
| 396 | ReportView.ReportView.ReportSectionHeader.litTagName}> |
Wolfgang Beyer | 5e451ff | 2021-12-08 16:44:35 | [diff] [blame] | 397 | <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.url)}</${ |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 398 | ReportView.ReportView.ReportKey.litTagName}> |
| 399 | <${ReportView.ReportView.ReportValue.litTagName}> |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 400 | <div class="inline-items"> |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 401 | ${this.#maybeRenderSourcesLinkForURL()} |
| 402 | ${this.#maybeRenderNetworkLinkForURL()} |
| 403 | <div class="text-ellipsis" title=${this.#frame.url}>${this.#frame.url}</div> |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 404 | </div> |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 405 | </${ReportView.ReportView.ReportValue.litTagName}> |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 406 | ${this.#maybeRenderUnreachableURL()} |
| 407 | ${this.#maybeRenderOrigin()} |
| 408 | ${LitHtml.Directives.until(this.#renderOwnerElement(), LitHtml.nothing)} |
| 409 | ${this.#maybeRenderCreationStacktrace()} |
| 410 | ${this.#maybeRenderAdStatus()} |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 411 | <${ReportView.ReportView.ReportSectionDivider.litTagName}></${ |
| 412 | ReportView.ReportView.ReportSectionDivider.litTagName}> |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 413 | `; |
| 414 | } |
| 415 | |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 416 | #maybeRenderSourcesLinkForURL(): LitHtml.LitTemplate { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 417 | if (!this.#frame || this.#frame.unreachableUrl()) { |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 418 | return LitHtml.nothing; |
| 419 | } |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 420 | const sourceCode = this.#uiSourceCodeForFrame(this.#frame); |
Wolfgang Beyer | ffae99f | 2021-07-08 08:46:53 | [diff] [blame] | 421 | return renderIconLink( |
Wolfgang Beyer | f64d63e | 2023-04-04 14:47:38 | [diff] [blame] | 422 | 'breakpoint-circle', |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 423 | i18nString(UIStrings.clickToRevealInSourcesPanel), |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 424 | (): Promise<void> => Common.Revealer.reveal(sourceCode), |
| 425 | ); |
| 426 | } |
| 427 | |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 428 | #maybeRenderNetworkLinkForURL(): LitHtml.LitTemplate { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 429 | if (this.#frame) { |
| 430 | const resource = this.#frame.resourceForURL(this.#frame.url); |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 431 | if (resource && resource.request) { |
| 432 | const request = resource.request; |
Wolfgang Beyer | ffae99f | 2021-07-08 08:46:53 | [diff] [blame] | 433 | return renderIconLink( |
Wolfgang Beyer | f64d63e | 2023-04-04 14:47:38 | [diff] [blame] | 434 | 'arrow-up-down-circle', i18nString(UIStrings.clickToRevealInNetworkPanel), (): Promise<void> => { |
Wolfgang Beyer | 705d89f | 2023-02-24 15:12:34 | [diff] [blame] | 435 | const headersTab = Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.HEADER_OVERRIDES) ? |
| 436 | NetworkForward.UIRequestLocation.UIRequestTabs.HeadersComponent : |
| 437 | NetworkForward.UIRequestLocation.UIRequestTabs.Headers; |
| 438 | const requestLocation = NetworkForward.UIRequestLocation.UIRequestLocation.tab(request, headersTab); |
Sigurd Schneider | 14d3e9f | 2021-06-14 08:29:01 | [diff] [blame] | 439 | return Common.Revealer.reveal(requestLocation); |
| 440 | }); |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 441 | } |
| 442 | } |
| 443 | return LitHtml.nothing; |
| 444 | } |
| 445 | |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 446 | #uiSourceCodeForFrame(frame: SDK.ResourceTreeModel.ResourceTreeFrame): Workspace.UISourceCode.UISourceCode|null { |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 447 | for (const project of Workspace.Workspace.WorkspaceImpl.instance().projects()) { |
| 448 | const projectTarget = Bindings.NetworkProject.NetworkProject.getTargetForProject(project); |
| 449 | if (projectTarget && projectTarget === frame.resourceTreeModel().target()) { |
| 450 | const uiSourceCode = project.uiSourceCodeForURL(frame.url); |
| 451 | if (uiSourceCode) { |
| 452 | return uiSourceCode; |
| 453 | } |
| 454 | } |
| 455 | } |
| 456 | return null; |
| 457 | } |
| 458 | |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 459 | #maybeRenderUnreachableURL(): LitHtml.LitTemplate { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 460 | if (!this.#frame || !this.#frame.unreachableUrl()) { |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 461 | return LitHtml.nothing; |
| 462 | } |
| 463 | return LitHtml.html` |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 464 | <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.unreachableUrl)}</${ |
| 465 | ReportView.ReportView.ReportKey.litTagName}> |
| 466 | <${ReportView.ReportView.ReportValue.litTagName}> |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 467 | <div class="inline-items"> |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 468 | ${this.#renderNetworkLinkForUnreachableURL()} |
| 469 | <div class="text-ellipsis" title=${this.#frame.unreachableUrl()}>${this.#frame.unreachableUrl()}</div> |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 470 | </div> |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 471 | </${ReportView.ReportView.ReportValue.litTagName}> |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 472 | `; |
| 473 | } |
| 474 | |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 475 | #renderNetworkLinkForUnreachableURL(): LitHtml.LitTemplate { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 476 | if (this.#frame) { |
| 477 | const unreachableUrl = Common.ParsedURL.ParsedURL.fromString(this.#frame.unreachableUrl()); |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 478 | if (unreachableUrl) { |
Wolfgang Beyer | ffae99f | 2021-07-08 08:46:53 | [diff] [blame] | 479 | return renderIconLink( |
Wolfgang Beyer | f64d63e | 2023-04-04 14:47:38 | [diff] [blame] | 480 | 'arrow-up-down-circle', |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 481 | i18nString(UIStrings.clickToRevealInNetworkPanelMight), |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 482 | (): |
| 483 | void => { |
Tim van der Lippe | 2d9a95c | 2022-01-04 15:18:03 | [diff] [blame] | 484 | void Common.Revealer.reveal(NetworkForward.UIFilter.UIRequestFilter.filters([ |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 485 | { |
Sigurd Schneider | 3072258 | 2021-06-16 06:54:16 | [diff] [blame] | 486 | filterType: NetworkForward.UIFilter.FilterType.Domain, |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 487 | filterValue: unreachableUrl.domain(), |
| 488 | }, |
| 489 | { |
| 490 | filterType: null, |
| 491 | filterValue: unreachableUrl.path, |
| 492 | }, |
Sigurd Schneider | 3072258 | 2021-06-16 06:54:16 | [diff] [blame] | 493 | ])); |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 494 | }, |
| 495 | ); |
| 496 | } |
| 497 | } |
| 498 | return LitHtml.nothing; |
| 499 | } |
| 500 | |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 501 | #maybeRenderOrigin(): LitHtml.LitTemplate { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 502 | if (this.#frame && this.#frame.securityOrigin && this.#frame.securityOrigin !== '://') { |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 503 | return LitHtml.html` |
Wolfgang Beyer | 5e451ff | 2021-12-08 16:44:35 | [diff] [blame] | 504 | <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.origin)}</${ |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 505 | ReportView.ReportView.ReportKey.litTagName}> |
| 506 | <${ReportView.ReportView.ReportValue.litTagName}> |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 507 | <div class="text-ellipsis" title=${this.#frame.securityOrigin}>${this.#frame.securityOrigin}</div> |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 508 | </${ReportView.ReportView.ReportValue.litTagName}> |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 509 | `; |
| 510 | } |
| 511 | return LitHtml.nothing; |
| 512 | } |
| 513 | |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 514 | async #renderOwnerElement(): Promise<LitHtml.LitTemplate> { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 515 | if (this.#frame) { |
| 516 | const linkTargetDOMNode = await this.#frame.getOwnerDOMNodeOrDocument(); |
Wolfgang Beyer | f0d985e | 2021-02-05 12:56:52 | [diff] [blame] | 517 | if (linkTargetDOMNode) { |
| 518 | // Disabled until https://crbug.com/1079231 is fixed. |
| 519 | // clang-format off |
Wolfgang Beyer | f0d985e | 2021-02-05 12:56:52 | [diff] [blame] | 520 | return LitHtml.html` |
Wolfgang Beyer | f64d63e | 2023-04-04 14:47:38 | [diff] [blame] | 521 | <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.ownerElement)}</${ReportView.ReportView.ReportKey.litTagName}> |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 522 | <${ReportView.ReportView.ReportValue.litTagName} class="without-min-width"> |
Wolfgang Beyer | f64d63e | 2023-04-04 14:47:38 | [diff] [blame] | 523 | <div class="inline-items"> |
| 524 | <button class="link" role="link" tabindex=0 |
| 525 | @mouseenter=${(): Promise<void>|undefined => this.#frame?.highlight()} |
| 526 | @mouseleave=${(): void => SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight()} |
| 527 | @click=${(): Promise<void> => Common.Revealer.reveal(linkTargetDOMNode)} |
| 528 | title=${i18nString(UIStrings.clickToRevealInElementsPanel)} |
| 529 | > |
| 530 | <${IconButton.Icon.Icon.litTagName} .data=${{ |
| 531 | iconName: 'code-circle', |
| 532 | color: 'var(--icon-link)', |
Kateryna Prokopenko | b6c6177 | 2023-04-26 12:43:12 | [diff] [blame] | 533 | width: '16px', |
| 534 | height: '16px', |
Wolfgang Beyer | f64d63e | 2023-04-04 14:47:38 | [diff] [blame] | 535 | } as IconButton.Icon.IconData}> |
| 536 | </${IconButton.Icon.Icon.litTagName}> |
| 537 | </button> |
| 538 | <button class="link text-link" role="link" tabindex=0 title=${i18nString(UIStrings.clickToRevealInElementsPanel)} |
| 539 | @mouseenter=${(): Promise<void>|undefined => this.#frame?.highlight()} |
| 540 | @mouseleave=${(): void => SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight()} |
| 541 | @click=${(): Promise<void> => Common.Revealer.reveal(linkTargetDOMNode)} |
| 542 | > |
| 543 | <${linkTargetDOMNode.nodeName().toLocaleLowerCase()}> |
| 544 | </button> |
| 545 | </div> |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 546 | </${ReportView.ReportView.ReportValue.litTagName}> |
Wolfgang Beyer | f0d985e | 2021-02-05 12:56:52 | [diff] [blame] | 547 | `; |
| 548 | // clang-format on |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 549 | } |
| 550 | } |
| 551 | return LitHtml.nothing; |
| 552 | } |
| 553 | |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 554 | #maybeRenderCreationStacktrace(): LitHtml.LitTemplate { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 555 | const creationStackTraceData = this.#frame?.getCreationStackTraceData(); |
Wolfgang Beyer | a20485a | 2021-04-21 07:22:19 | [diff] [blame] | 556 | if (creationStackTraceData && creationStackTraceData.creationStackTrace) { |
Wolfgang Beyer | a036d0c | 2021-03-19 09:09:33 | [diff] [blame] | 557 | // Disabled until https://crbug.com/1079231 is fixed. |
| 558 | // clang-format off |
Wolfgang Beyer | 1909394 | 2021-03-15 15:00:34 | [diff] [blame] | 559 | return LitHtml.html` |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 560 | <${ReportView.ReportView.ReportKey.litTagName} title=${i18nString(UIStrings.creationStackTraceExplanation)}>${ |
| 561 | i18nString(UIStrings.creationStackTrace)}</${ReportView.ReportView.ReportKey.litTagName}> |
| 562 | <${ReportView.ReportView.ReportValue.litTagName}> |
| 563 | <${StackTrace.litTagName} .data=${{ |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 564 | frame: this.#frame, |
Wolfgang Beyer | a036d0c | 2021-03-19 09:09:33 | [diff] [blame] | 565 | buildStackTraceRows: Components.JSPresentationUtils.buildStackTraceRows, |
| 566 | } as StackTraceData}> |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 567 | </${StackTrace.litTagName}> |
| 568 | </${ReportView.ReportView.ReportValue.litTagName}> |
Wolfgang Beyer | 1909394 | 2021-03-15 15:00:34 | [diff] [blame] | 569 | `; |
Wolfgang Beyer | a036d0c | 2021-03-19 09:09:33 | [diff] [blame] | 570 | // clang-format on |
Wolfgang Beyer | 1909394 | 2021-03-15 15:00:34 | [diff] [blame] | 571 | } |
| 572 | return LitHtml.nothing; |
| 573 | } |
| 574 | |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 575 | #getAdFrameTypeStrings(type: Protocol.Page.AdFrameType.Child|Protocol.Page.AdFrameType.Root): |
Sigurd Schneider | cc9a02e | 2021-06-16 06:20:33 | [diff] [blame] | 576 | {value: Platform.UIString.LocalizedString, description: Platform.UIString.LocalizedString} { |
| 577 | switch (type) { |
| 578 | case Protocol.Page.AdFrameType.Child: |
| 579 | return {value: i18nString(UIStrings.child), description: i18nString(UIStrings.childDescription)}; |
| 580 | case Protocol.Page.AdFrameType.Root: |
| 581 | return {value: i18nString(UIStrings.root), description: i18nString(UIStrings.rootDescription)}; |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 582 | } |
Sigurd Schneider | cc9a02e | 2021-06-16 06:20:33 | [diff] [blame] | 583 | } |
| 584 | |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 585 | #getAdFrameExplanationString(explanation: Protocol.Page.AdFrameExplanation): Platform.UIString.LocalizedString { |
Sigurd Schneider | cc9a02e | 2021-06-16 06:20:33 | [diff] [blame] | 586 | switch (explanation) { |
| 587 | case Protocol.Page.AdFrameExplanation.CreatedByAdScript: |
| 588 | return i18nString(UIStrings.createdByAdScriptExplanation); |
| 589 | case Protocol.Page.AdFrameExplanation.MatchedBlockingRule: |
| 590 | return i18nString(UIStrings.matchedBlockingRuleExplanation); |
| 591 | case Protocol.Page.AdFrameExplanation.ParentIsAd: |
| 592 | return i18nString(UIStrings.parentIsAdExplanation); |
| 593 | } |
| 594 | } |
| 595 | |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 596 | #maybeRenderAdStatus(): LitHtml.LitTemplate { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 597 | if (!this.#frame) { |
Sigurd Schneider | cc9a02e | 2021-06-16 06:20:33 | [diff] [blame] | 598 | return LitHtml.nothing; |
| 599 | } |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 600 | const adFrameType = this.#frame.adFrameType(); |
Sigurd Schneider | cc9a02e | 2021-06-16 06:20:33 | [diff] [blame] | 601 | if (adFrameType === Protocol.Page.AdFrameType.None) { |
| 602 | return LitHtml.nothing; |
| 603 | } |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 604 | const typeStrings = this.#getAdFrameTypeStrings(adFrameType); |
Jack Franklin | a31102b | 2021-12-03 15:01:22 | [diff] [blame] | 605 | const rows = [LitHtml.html`<div title=${typeStrings.description}>${typeStrings.value}</div>`]; |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 606 | for (const explanation of this.#frame.adFrameStatus()?.explanations || []) { |
| 607 | rows.push(LitHtml.html`<div>${this.#getAdFrameExplanationString(explanation)}</div>`); |
Sigurd Schneider | cc9a02e | 2021-06-16 06:20:33 | [diff] [blame] | 608 | } |
Danil Somsikov | c48b2b1 | 2022-06-24 15:03:03 | [diff] [blame] | 609 | |
Alex Rudenko | b8b4860 | 2022-10-17 12:59:58 | [diff] [blame] | 610 | const adScriptLinkElement = this.#target ? this.#linkifier.linkifyScriptLocation( |
| 611 | this.#target, this.#adScriptId?.scriptId || null, |
| 612 | Platform.DevToolsPath.EmptyUrlString, undefined, undefined) : |
| 613 | null; |
Danil Somsikov | c48b2b1 | 2022-06-24 15:03:03 | [diff] [blame] | 614 | |
| 615 | // Disabled until https://crbug.com/1079231 is fixed. |
| 616 | // clang-format off |
Sigurd Schneider | cc9a02e | 2021-06-16 06:20:33 | [diff] [blame] | 617 | return LitHtml.html` |
| 618 | <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.adStatus)}</${ |
| 619 | ReportView.ReportView.ReportKey.litTagName}> |
| 620 | <${ReportView.ReportView.ReportValue.litTagName}> |
Danil Somsikov | c48b2b1 | 2022-06-24 15:03:03 | [diff] [blame] | 621 | <${ExpandableList.ExpandableList.ExpandableList.litTagName} .data=${ |
| 622 | {rows} as ExpandableList.ExpandableList.ExpandableListData}></${ |
Sigurd Schneider | cc9a02e | 2021-06-16 06:20:33 | [diff] [blame] | 623 | ExpandableList.ExpandableList.ExpandableList.litTagName}></${ReportView.ReportView.ReportValue.litTagName}> |
Danil Somsikov | c48b2b1 | 2022-06-24 15:03:03 | [diff] [blame] | 624 | ${this.#target ? LitHtml.html` |
| 625 | <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.creatorAdScript)}</${ |
| 626 | ReportView.ReportView.ReportKey.litTagName}> |
| 627 | <${ReportView.ReportView.ReportValue.litTagName} class="ad-script-link">${adScriptLinkElement}</${ |
| 628 | ReportView.ReportView.ReportValue.litTagName}> |
| 629 | ` : LitHtml.nothing} |
| 630 | `; |
| 631 | // clang-format on |
Wolfgang Beyer | 1525b1f | 2021-02-02 14:12:30 | [diff] [blame] | 632 | } |
Wolfgang Beyer | abfc847 | 2021-02-04 11:29:50 | [diff] [blame] | 633 | |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 634 | #renderIsolationSection(): LitHtml.LitTemplate { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 635 | if (!this.#frame) { |
Wolfgang Beyer | abfc847 | 2021-02-04 11:29:50 | [diff] [blame] | 636 | return LitHtml.nothing; |
| 637 | } |
| 638 | return LitHtml.html` |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 639 | <${ReportView.ReportView.ReportSectionHeader.litTagName}>${i18nString(UIStrings.securityIsolation)}</${ |
| 640 | ReportView.ReportView.ReportSectionHeader.litTagName}> |
| 641 | <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.secureContext)}</${ |
| 642 | ReportView.ReportView.ReportKey.litTagName}> |
| 643 | <${ReportView.ReportView.ReportValue.litTagName}> |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 644 | ${this.#frame.isSecureContext() ? i18nString(UIStrings.yes) : i18nString(UIStrings.no)}\xA0${ |
| 645 | this.#maybeRenderSecureContextExplanation()} |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 646 | </${ReportView.ReportView.ReportValue.litTagName}> |
| 647 | <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.crossoriginIsolated)}</${ |
| 648 | ReportView.ReportView.ReportKey.litTagName}> |
| 649 | <${ReportView.ReportView.ReportValue.litTagName}> |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 650 | ${this.#frame.isCrossOriginIsolated() ? i18nString(UIStrings.yes) : i18nString(UIStrings.no)} |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 651 | </${ReportView.ReportView.ReportValue.litTagName}> |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 652 | ${LitHtml.Directives.until(this.#maybeRenderCoopCoepStatus(), LitHtml.nothing)} |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 653 | <${ReportView.ReportView.ReportSectionDivider.litTagName}></${ |
| 654 | ReportView.ReportView.ReportSectionDivider.litTagName}> |
Wolfgang Beyer | abfc847 | 2021-02-04 11:29:50 | [diff] [blame] | 655 | `; |
| 656 | } |
| 657 | |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 658 | #maybeRenderSecureContextExplanation(): LitHtml.LitTemplate { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 659 | const explanation = this.#getSecureContextExplanation(); |
Wolfgang Beyer | abfc847 | 2021-02-04 11:29:50 | [diff] [blame] | 660 | if (explanation) { |
Tim van der Lippe | 0005b80 | 2021-06-03 10:47:59 | [diff] [blame] | 661 | return LitHtml.html`<span class="inline-comment">${explanation}</span>`; |
Wolfgang Beyer | abfc847 | 2021-02-04 11:29:50 | [diff] [blame] | 662 | } |
| 663 | return LitHtml.nothing; |
| 664 | } |
| 665 | |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 666 | #getSecureContextExplanation(): Platform.UIString.LocalizedString|null { |
| 667 | switch (this.#frame?.getSecureContextType()) { |
Wolfgang Beyer | abfc847 | 2021-02-04 11:29:50 | [diff] [blame] | 668 | case Protocol.Page.SecureContextType.Secure: |
| 669 | return null; |
| 670 | case Protocol.Page.SecureContextType.SecureLocalhost: |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 671 | return i18nString(UIStrings.localhostIsAlwaysASecureContext); |
Wolfgang Beyer | abfc847 | 2021-02-04 11:29:50 | [diff] [blame] | 672 | case Protocol.Page.SecureContextType.InsecureAncestor: |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 673 | return i18nString(UIStrings.aFrameAncestorIsAnInsecure); |
Wolfgang Beyer | abfc847 | 2021-02-04 11:29:50 | [diff] [blame] | 674 | case Protocol.Page.SecureContextType.InsecureScheme: |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 675 | return i18nString(UIStrings.theFramesSchemeIsInsecure); |
Wolfgang Beyer | abfc847 | 2021-02-04 11:29:50 | [diff] [blame] | 676 | } |
| 677 | return null; |
| 678 | } |
| 679 | |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 680 | async #maybeRenderCoopCoepStatus(): Promise<LitHtml.LitTemplate> { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 681 | if (this.#frame) { |
| 682 | const model = this.#frame.resourceTreeModel().target().model(SDK.NetworkManager.NetworkManager); |
| 683 | const info = model && await model.getSecurityIsolationStatus(this.#frame.id); |
Wolfgang Beyer | abfc847 | 2021-02-04 11:29:50 | [diff] [blame] | 684 | if (info) { |
| 685 | return LitHtml.html` |
| 686 | ${ |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 687 | this.#maybeRenderCrossOriginStatus( |
Wolfgang Beyer | dbf211e | 2021-11-23 10:23:54 | [diff] [blame] | 688 | info.coep, i18n.i18n.lockedString('Cross-Origin Embedder Policy (COEP)'), |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 689 | Protocol.Network.CrossOriginEmbedderPolicyValue.None)} |
Wolfgang Beyer | abfc847 | 2021-02-04 11:29:50 | [diff] [blame] | 690 | ${ |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 691 | this.#maybeRenderCrossOriginStatus( |
Wolfgang Beyer | dbf211e | 2021-11-23 10:23:54 | [diff] [blame] | 692 | info.coop, i18n.i18n.lockedString('Cross-Origin Opener Policy (COOP)'), |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 693 | Protocol.Network.CrossOriginOpenerPolicyValue.UnsafeNone)} |
Wolfgang Beyer | abfc847 | 2021-02-04 11:29:50 | [diff] [blame] | 694 | `; |
| 695 | } |
| 696 | } |
| 697 | return LitHtml.nothing; |
| 698 | } |
| 699 | |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 700 | #maybeRenderCrossOriginStatus( |
Wolfgang Beyer | abfc847 | 2021-02-04 11:29:50 | [diff] [blame] | 701 | info: Protocol.Network.CrossOriginEmbedderPolicyStatus|Protocol.Network.CrossOriginOpenerPolicyStatus|undefined, |
| 702 | policyName: string, |
| 703 | noneValue: Protocol.Network.CrossOriginEmbedderPolicyValue| |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 704 | Protocol.Network.CrossOriginOpenerPolicyValue): LitHtml.LitTemplate { |
Wolfgang Beyer | abfc847 | 2021-02-04 11:29:50 | [diff] [blame] | 705 | if (!info) { |
| 706 | return LitHtml.nothing; |
| 707 | } |
| 708 | const isEnabled = info.value !== noneValue; |
| 709 | const isReportOnly = (!isEnabled && info.reportOnlyValue !== noneValue); |
| 710 | const endpoint = isEnabled ? info.reportingEndpoint : info.reportOnlyReportingEndpoint; |
| 711 | return LitHtml.html` |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 712 | <${ReportView.ReportView.ReportKey.litTagName}>${policyName}</${ReportView.ReportView.ReportKey.litTagName}> |
| 713 | <${ReportView.ReportView.ReportValue.litTagName}> |
Wolfgang Beyer | abfc847 | 2021-02-04 11:29:50 | [diff] [blame] | 714 | ${isEnabled ? info.value : info.reportOnlyValue} |
| 715 | ${isReportOnly ? LitHtml.html`<span class="inline-comment">report-only</span>` : LitHtml.nothing} |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 716 | ${ |
| 717 | endpoint ? LitHtml.html`<span class="inline-name">${i18nString(UIStrings.reportingTo)}</span>${endpoint}` : |
| 718 | LitHtml.nothing} |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 719 | </${ReportView.ReportView.ReportValue.litTagName}> |
Wolfgang Beyer | abfc847 | 2021-02-04 11:29:50 | [diff] [blame] | 720 | `; |
| 721 | } |
Wolfgang Beyer | 6a6efe6 | 2021-02-04 15:56:21 | [diff] [blame] | 722 | |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 723 | #renderApiAvailabilitySection(): LitHtml.LitTemplate { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 724 | if (!this.#frame) { |
Wolfgang Beyer | 6a6efe6 | 2021-02-04 15:56:21 | [diff] [blame] | 725 | return LitHtml.nothing; |
| 726 | } |
| 727 | |
| 728 | return LitHtml.html` |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 729 | <${ReportView.ReportView.ReportSectionHeader.litTagName}>${i18nString(UIStrings.apiAvailability)}</${ |
| 730 | ReportView.ReportView.ReportSectionHeader.litTagName}> |
Wolfgang Beyer | 6a6efe6 | 2021-02-04 15:56:21 | [diff] [blame] | 731 | <div class="span-cols"> |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 732 | ${i18nString(UIStrings.availabilityOfCertainApisDepends)} |
Wolfgang Beyer | 4751c1c | 2021-03-24 15:32:35 | [diff] [blame] | 733 | <x-link href="https://web.dev/why-coop-coep/" class="link">${i18nString(UIStrings.learnMore)}</x-link> |
Wolfgang Beyer | 6a6efe6 | 2021-02-04 15:56:21 | [diff] [blame] | 734 | </div> |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 735 | ${this.#renderSharedArrayBufferAvailability()} |
| 736 | ${this.#renderMeasureMemoryAvailability()} |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 737 | <${ReportView.ReportView.ReportSectionDivider.litTagName}></${ |
| 738 | ReportView.ReportView.ReportSectionDivider.litTagName}> |
Wolfgang Beyer | 6a6efe6 | 2021-02-04 15:56:21 | [diff] [blame] | 739 | `; |
| 740 | } |
| 741 | |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 742 | #renderSharedArrayBufferAvailability(): LitHtml.LitTemplate { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 743 | if (this.#frame) { |
| 744 | const features = this.#frame.getGatedAPIFeatures(); |
Wolfgang Beyer | 6a6efe6 | 2021-02-04 15:56:21 | [diff] [blame] | 745 | if (features) { |
| 746 | const sabAvailable = features.includes(Protocol.Page.GatedAPIFeatures.SharedArrayBuffers); |
| 747 | const sabTransferAvailable = |
| 748 | sabAvailable && features.includes(Protocol.Page.GatedAPIFeatures.SharedArrayBuffersTransferAllowed); |
| 749 | const availabilityText = sabTransferAvailable ? |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 750 | i18nString(UIStrings.availableTransferable) : |
| 751 | (sabAvailable ? i18nString(UIStrings.availableNotTransferable) : i18nString(UIStrings.unavailable)); |
Wolfgang Beyer | 6a6efe6 | 2021-02-04 15:56:21 | [diff] [blame] | 752 | const tooltipText = sabTransferAvailable ? |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 753 | i18nString(UIStrings.sharedarraybufferConstructorIs) : |
| 754 | (sabAvailable ? i18nString(UIStrings.sharedarraybufferConstructorIsAvailable) : ''); |
Wolfgang Beyer | 6a6efe6 | 2021-02-04 15:56:21 | [diff] [blame] | 755 | |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 756 | function renderHint(frame: SDK.ResourceTreeModel.ResourceTreeFrame): LitHtml.LitTemplate { |
Sigurd Schneider | 2a45025 | 2021-05-04 07:13:15 | [diff] [blame] | 757 | switch (frame.getCrossOriginIsolatedContextType()) { |
| 758 | case Protocol.Page.CrossOriginIsolatedContextType.Isolated: |
| 759 | return LitHtml.nothing; |
| 760 | case Protocol.Page.CrossOriginIsolatedContextType.NotIsolated: |
| 761 | if (sabAvailable) { |
| 762 | return LitHtml.html`<span class="inline-comment">${ |
| 763 | i18nString(UIStrings.willRequireCrossoriginIsolated)}</span>`; |
| 764 | } |
| 765 | return LitHtml.html`<span class="inline-comment">${ |
| 766 | i18nString(UIStrings.requiresCrossoriginIsolated)}</span>`; |
| 767 | case Protocol.Page.CrossOriginIsolatedContextType.NotIsolatedFeatureDisabled: |
| 768 | if (!sabTransferAvailable) { |
| 769 | return LitHtml.html`<span class="inline-comment">${ |
| 770 | i18nString( |
| 771 | UIStrings |
| 772 | .transferRequiresCrossoriginIsolatedPermission)} <code>cross-origin-isolated</code></span>`; |
| 773 | } |
| 774 | break; |
| 775 | } |
| 776 | return LitHtml.nothing; |
| 777 | } |
| 778 | |
Peter Marshall | 0e1cd82 | 2021-02-24 10:52:42 | [diff] [blame] | 779 | // SharedArrayBuffer is an API name, so we don't translate it. |
Wolfgang Beyer | 6a6efe6 | 2021-02-04 15:56:21 | [diff] [blame] | 780 | return LitHtml.html` |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 781 | <${ReportView.ReportView.ReportKey.litTagName}>SharedArrayBuffers</${ |
| 782 | ReportView.ReportView.ReportKey.litTagName}> |
| 783 | <${ReportView.ReportView.ReportValue.litTagName} title=${tooltipText}> |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 784 | ${availabilityText}\xA0${renderHint(this.#frame)} |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 785 | </${ReportView.ReportView.ReportValue.litTagName}> |
Wolfgang Beyer | 6a6efe6 | 2021-02-04 15:56:21 | [diff] [blame] | 786 | `; |
Wolfgang Beyer | 6a6efe6 | 2021-02-04 15:56:21 | [diff] [blame] | 787 | } |
| 788 | } |
| 789 | return LitHtml.nothing; |
| 790 | } |
| 791 | |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 792 | #renderMeasureMemoryAvailability(): LitHtml.LitTemplate { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 793 | if (this.#frame) { |
| 794 | const measureMemoryAvailable = this.#frame.isCrossOriginIsolated(); |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 795 | const availabilityText = |
| 796 | measureMemoryAvailable ? i18nString(UIStrings.available) : i18nString(UIStrings.unavailable); |
| 797 | const tooltipText = measureMemoryAvailable ? i18nString(UIStrings.thePerformanceAPI) : |
| 798 | i18nString(UIStrings.thePerformancemeasureuseragentspecificmemory); |
Wolfgang Beyer | 6a6efe6 | 2021-02-04 15:56:21 | [diff] [blame] | 799 | return LitHtml.html` |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 800 | <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.measureMemory)}</${ |
| 801 | ReportView.ReportView.ReportKey.litTagName}> |
| 802 | <${ReportView.ReportView.ReportValue.litTagName}> |
Tim van der Lippe | 0005b80 | 2021-06-03 10:47:59 | [diff] [blame] | 803 | <span title=${tooltipText}>${ |
| 804 | availabilityText}</span>\xA0<x-link class="link" href="https://web.dev/monitor-total-page-memory-usage/">${ |
Wolfgang Beyer | 09b0e8e | 2021-02-09 13:39:48 | [diff] [blame] | 805 | i18nString(UIStrings.learnMore)}</x-link> |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 806 | </${ReportView.ReportView.ReportValue.litTagName}> |
Wolfgang Beyer | 6a6efe6 | 2021-02-04 15:56:21 | [diff] [blame] | 807 | `; |
| 808 | } |
| 809 | return LitHtml.nothing; |
| 810 | } |
Wolfgang Beyer | e5d1a9f | 2021-02-05 09:42:43 | [diff] [blame] | 811 | |
Danil Somsikov | 325f218 | 2022-05-16 09:40:39 | [diff] [blame] | 812 | #renderPrerenderingSection(): LitHtml.LitTemplate { |
Robert Lin | 48a925e | 2022-11-02 11:55:56 | [diff] [blame] | 813 | if (this.#prerenderedUrl && this.#prerenderedUrl !== '') { |
| 814 | const status = Prerender2ReasonDescription['PrerenderingOngoing'].name() + ' ' + this.#prerenderedUrl; |
| 815 | return LitHtml.html` |
| 816 | <${ReportView.ReportView.ReportSectionHeader.litTagName}> |
| 817 | ${i18nString(UIStrings.prerendering)}</${ReportView.ReportView.ReportSectionHeader.litTagName}> |
| 818 | <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.prerenderingStatus)}</${ |
| 819 | ReportView.ReportView.ReportKey.litTagName}> |
| 820 | <${ReportView.ReportView.ReportValue.litTagName}> |
| 821 | <div class="text-ellipsis" title=${status}>${status}</div> |
| 822 | </${ReportView.ReportView.ReportValue.litTagName}> |
| 823 | <${ReportView.ReportView.ReportSectionDivider.litTagName}></${ |
| 824 | ReportView.ReportView.ReportSectionDivider.litTagName}>`; |
| 825 | } |
| 826 | |
Danil Somsikov | 325f218 | 2022-05-16 09:40:39 | [diff] [blame] | 827 | if (!this.#frame || !this.#frame.prerenderFinalStatus) { |
| 828 | return LitHtml.nothing; |
| 829 | } |
Robert Lin | 48a925e | 2022-11-02 11:55:56 | [diff] [blame] | 830 | |
Robert Lin | 449f933 | 2022-07-06 14:05:45 | [diff] [blame] | 831 | const finalStatus = Prerender2ReasonDescription[this.#frame.prerenderFinalStatus].name(); |
Robert Lin | d77df7d | 2022-10-03 01:34:49 | [diff] [blame] | 832 | |
| 833 | if (this.#frame.prerenderDisallowedApiMethod) { |
| 834 | const detailSection = Prerender2ReasonDescription['DisallowedApiMethod'].name(); |
| 835 | return LitHtml.html` |
| 836 | <${ReportView.ReportView.ReportSectionHeader.litTagName}> |
| 837 | ${i18nString(UIStrings.prerendering)}</${ReportView.ReportView.ReportSectionHeader.litTagName}> |
| 838 | <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.prerenderingStatus)}</${ |
| 839 | ReportView.ReportView.ReportKey.litTagName}> |
| 840 | <${ReportView.ReportView.ReportValue.litTagName}> |
| 841 | <div class="text-ellipsis" title=${finalStatus}>${finalStatus}</div> |
| 842 | </${ReportView.ReportView.ReportValue.litTagName}> |
| 843 | <${ReportView.ReportView.ReportKey.litTagName}>${detailSection}</${ReportView.ReportView.ReportKey.litTagName}> |
| 844 | <${ReportView.ReportView.ReportValue.litTagName}> |
| 845 | <div class="text-ellipsis" title=${this.#frame.prerenderDisallowedApiMethod}> |
| 846 | ${this.#frame.prerenderDisallowedApiMethod} |
| 847 | </div> |
| 848 | </${ReportView.ReportView.ReportValue.litTagName}> |
| 849 | <${ReportView.ReportView.ReportSectionDivider.litTagName}></${ |
| 850 | ReportView.ReportView.ReportSectionDivider.litTagName}>`; |
| 851 | } |
Danil Somsikov | 325f218 | 2022-05-16 09:40:39 | [diff] [blame] | 852 | return LitHtml.html` |
| 853 | <${ReportView.ReportView.ReportSectionHeader.litTagName}> |
| 854 | ${i18nString(UIStrings.prerendering)}</${ReportView.ReportView.ReportSectionHeader.litTagName}> |
| 855 | <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.prerenderingStatus)}</${ |
| 856 | ReportView.ReportView.ReportKey.litTagName}> |
| 857 | <${ReportView.ReportView.ReportValue.litTagName}> |
Robert Lin | 449f933 | 2022-07-06 14:05:45 | [diff] [blame] | 858 | <div class="text-ellipsis" title=${finalStatus}>${finalStatus}</div> |
Danil Somsikov | 325f218 | 2022-05-16 09:40:39 | [diff] [blame] | 859 | </${ReportView.ReportView.ReportValue.litTagName}> |
| 860 | <${ReportView.ReportView.ReportSectionDivider.litTagName}></${ |
| 861 | ReportView.ReportView.ReportSectionDivider.litTagName}>`; |
| 862 | } |
| 863 | |
Jack Franklin | d750830 | 2022-05-09 14:22:21 | [diff] [blame] | 864 | #renderAdditionalInfoSection(): LitHtml.LitTemplate { |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 865 | if (!this.#frame) { |
Wolfgang Beyer | e5d1a9f | 2021-02-05 09:42:43 | [diff] [blame] | 866 | return LitHtml.nothing; |
| 867 | } |
| 868 | |
| 869 | return LitHtml.html` |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 870 | <${ReportView.ReportView.ReportSectionHeader.litTagName} |
Vidal Guillermo Diazleal Ortega | 0a997bb | 2021-02-09 04:33:01 | [diff] [blame] | 871 | title=${i18nString(UIStrings.thisAdditionalDebugging)} |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 872 | >${i18nString(UIStrings.additionalInformation)}</${ReportView.ReportView.ReportSectionHeader.litTagName}> |
| 873 | <${ReportView.ReportView.ReportKey.litTagName}>${i18nString(UIStrings.frameId)}</${ |
| 874 | ReportView.ReportView.ReportKey.litTagName}> |
| 875 | <${ReportView.ReportView.ReportValue.litTagName}> |
Tim van der Lippe | c3f835a | 2021-12-15 13:28:32 | [diff] [blame] | 876 | <div class="text-ellipsis" title=${this.#frame.id}>${this.#frame.id}</div> |
Kriti Sapra | 7491545 | 2021-05-13 11:57:36 | [diff] [blame] | 877 | </${ReportView.ReportView.ReportValue.litTagName}> |
| 878 | <${ReportView.ReportView.ReportSectionDivider.litTagName}></${ |
| 879 | ReportView.ReportView.ReportSectionDivider.litTagName}> |
Wolfgang Beyer | e5d1a9f | 2021-02-05 09:42:43 | [diff] [blame] | 880 | `; |
| 881 | } |
Wolfgang Beyer | 92395c9 | 2021-02-02 10:43:23 | [diff] [blame] | 882 | } |
| 883 | |
Kriti Sapra | 34df98d | 2021-05-06 10:15:42 | [diff] [blame] | 884 | ComponentHelpers.CustomElements.defineComponent('devtools-resources-frame-details-view', FrameDetailsReportView); |
Wolfgang Beyer | 92395c9 | 2021-02-02 10:43:23 | [diff] [blame] | 885 | |
| 886 | declare global { |
| 887 | // eslint-disable-next-line @typescript-eslint/no-unused-vars |
| 888 | interface HTMLElementTagNameMap { |
| 889 | 'devtools-resources-frame-details-view': FrameDetailsReportView; |
| 890 | } |
| 891 | } |