chrome-devtools-frontend 1.0.1696904 → 1.0.1697595

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/.geminiignore +0 -1
  2. package/eslint.config.mjs +4 -1
  3. package/front_end/core/common/Base64.ts +14 -4
  4. package/front_end/core/common/Color.ts +5 -2
  5. package/front_end/core/common/Gzip.ts +1 -1
  6. package/front_end/core/common/Object.ts +0 -1
  7. package/front_end/core/host/InspectorFrontendHostAPI.ts +16 -3
  8. package/front_end/core/host/InspectorFrontendHostStub.ts +3 -2
  9. package/front_end/core/host/ResourceLoader.ts +1 -2
  10. package/front_end/core/platform/api/HostRuntime.ts +15 -0
  11. package/front_end/core/platform/browser/HostRuntime.ts +70 -0
  12. package/front_end/core/platform/node/HostRuntime.ts +17 -3
  13. package/front_end/core/root/Runtime.ts +5 -0
  14. package/front_end/core/sdk/CSSStyleSheetHeader.ts +2 -2
  15. package/front_end/core/sdk/ConsoleModel.ts +3 -3
  16. package/front_end/core/sdk/DOMModel.ts +13 -0
  17. package/front_end/core/sdk/DebuggerModel.ts +6 -0
  18. package/front_end/core/sdk/NetworkRequest.ts +19 -19
  19. package/front_end/core/sdk/RuntimeModel.ts +5 -0
  20. package/front_end/core/sdk/Script.ts +2 -2
  21. package/front_end/core/sdk/ServerTiming.ts +6 -6
  22. package/front_end/core/sdk/SourceMap.ts +112 -14
  23. package/front_end/core/sdk/SourceMapRangeMappings.ts +43 -0
  24. package/front_end/core/sdk/SourceMapScopeChainEntry.ts +24 -16
  25. package/front_end/core/sdk/SourceMapScopesInfo.ts +95 -11
  26. package/front_end/core/sdk/sdk.ts +2 -0
  27. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +1 -1
  28. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +6 -6
  29. package/front_end/entrypoints/main/MainImpl.ts +1 -1
  30. package/front_end/foundation/Universe.ts +8 -0
  31. package/front_end/generated/InspectorBackendCommands.ts +3 -0
  32. package/front_end/generated/protocol-mapping.d.ts +19 -0
  33. package/front_end/generated/protocol-proxy-api.d.ts +15 -0
  34. package/front_end/generated/protocol.ts +35 -0
  35. package/front_end/models/ai_assistance/AiAgent2.ts +20 -18
  36. package/front_end/models/ai_assistance/AiConversation.ts +38 -12
  37. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +9 -2
  38. package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +2 -2
  39. package/front_end/models/ai_assistance/agents/StylingAgent.ts +13 -4
  40. package/front_end/models/ai_assistance/contexts/DOMNodeContext.ts +4 -4
  41. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +5 -5
  42. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +6 -6
  43. package/front_end/models/ai_assistance/tools/CookieUtils.ts +10 -8
  44. package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +1 -1
  45. package/front_end/models/ai_assistance/tools/GetElementAccessibilityDetails.ts +1 -3
  46. package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +9 -8
  47. package/front_end/models/ai_assistance/tools/GetSourceContent.ts +5 -6
  48. package/front_end/models/ai_assistance/tools/GetStorageValues.ts +6 -25
  49. package/front_end/models/ai_assistance/tools/GetStyles.ts +1 -3
  50. package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +7 -6
  51. package/front_end/models/ai_assistance/tools/ListPageOrigins.ts +8 -5
  52. package/front_end/models/ai_assistance/tools/ListSources.ts +8 -10
  53. package/front_end/models/ai_assistance/tools/ListStorageKeys.ts +6 -25
  54. package/front_end/models/ai_assistance/tools/README.md +5 -3
  55. package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +1 -2
  56. package/front_end/models/ai_assistance/tools/Tool.ts +52 -14
  57. package/front_end/models/bindings/FileUtils.ts +18 -40
  58. package/front_end/models/bindings/TempFile.ts +5 -12
  59. package/front_end/models/change_tracker/ChangeTracker.ts +89 -0
  60. package/front_end/models/change_tracker/change_tracker.ts +9 -0
  61. package/front_end/models/crux-manager/CrUXManager.ts +8 -5
  62. package/front_end/models/emulation/DeviceModeModel.ts +44 -93
  63. package/front_end/models/heap_snapshot/HeapSnapshotProxy.ts +1 -1
  64. package/front_end/models/issues_manager/CookieIssue.ts +1 -1
  65. package/front_end/models/issues_manager/DeprecationIssue.ts +2 -2
  66. package/front_end/models/issues_manager/MarkdownIssueDescription.ts +2 -2
  67. package/front_end/models/live-metrics/LiveMetrics.ts +2 -3
  68. package/front_end/models/persistence/IsolatedFileSystem.ts +16 -23
  69. package/front_end/models/trace/ModelImpl.ts +0 -6
  70. package/front_end/models/trace/Processor.ts +4 -7
  71. package/front_end/models/trace/helpers/Timing.ts +2 -1
  72. package/front_end/models/trace/insights/DuplicatedJavaScript.ts +1 -1
  73. package/front_end/models/trace/insights/INPBreakdown.ts +1 -1
  74. package/front_end/models/trace/insights/ImageDelivery.ts +3 -3
  75. package/front_end/models/trace/insights/LCPDiscovery.ts +2 -2
  76. package/front_end/models/trace/insights/NetworkDependencyTree.ts +3 -3
  77. package/front_end/models/trace/insights/Viewport.ts +1 -1
  78. package/front_end/models/trace/types/Overlays.ts +14 -3
  79. package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingView.ts +67 -19
  80. package/front_end/panels/accessibility/AccessibilityNodeView.ts +2 -2
  81. package/front_end/panels/accessibility/AccessibilitySubPane.ts +0 -1
  82. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +1 -1
  83. package/front_end/panels/ai_assistance/components/ChatInput.ts +1 -1
  84. package/front_end/panels/ai_assistance/components/ChatMessage.ts +1 -1
  85. package/front_end/panels/application/AppManifestView.ts +9 -11
  86. package/front_end/panels/application/ApplicationPanelSidebar.ts +9 -9
  87. package/front_end/panels/application/BackgroundServiceView.ts +1 -1
  88. package/front_end/panels/application/DOMStorageItemsView.ts +1 -1
  89. package/front_end/panels/application/DeviceBoundSessionsView.ts +2 -2
  90. package/front_end/panels/application/FrameDetailsView.ts +5 -5
  91. package/front_end/panels/application/IndexedDBViews.ts +3 -3
  92. package/front_end/panels/application/KeyValueStorageItemsView.ts +0 -1
  93. package/front_end/panels/application/ReportingApiView.ts +1 -1
  94. package/front_end/panels/application/ServiceWorkerCacheTreeElement.ts +1 -1
  95. package/front_end/panels/application/ServiceWorkersView.ts +1 -1
  96. package/front_end/panels/application/StorageBucketsTreeElement.ts +1 -1
  97. package/front_end/panels/application/WebMCPView.ts +1 -1
  98. package/front_end/panels/application/components/AdsView.ts +2 -2
  99. package/front_end/panels/application/components/BackForwardCacheStrings.ts +116 -117
  100. package/front_end/panels/application/components/BackForwardCacheView.ts +7 -7
  101. package/front_end/panels/application/components/BounceTrackingMitigationsView.ts +2 -2
  102. package/front_end/panels/application/components/PermissionsPolicySection.ts +2 -2
  103. package/front_end/panels/application/components/ProtocolHandlersView.ts +1 -1
  104. package/front_end/panels/application/components/ReportsGrid.ts +1 -1
  105. package/front_end/panels/application/components/StorageMetadataView.ts +1 -1
  106. package/front_end/panels/application/components/TrustTokensView.ts +3 -3
  107. package/front_end/panels/application/preloading/PreloadingView.ts +20 -22
  108. package/front_end/panels/application/preloading/components/MismatchedPreloadingGrid.ts +9 -9
  109. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +31 -33
  110. package/front_end/panels/application/preloading/components/PreloadingDisabledInfobar.ts +23 -23
  111. package/front_end/panels/application/preloading/components/PreloadingGrid.ts +4 -4
  112. package/front_end/panels/application/preloading/components/PreloadingString.ts +161 -161
  113. package/front_end/panels/application/preloading/components/RuleSetDetailsView.ts +2 -6
  114. package/front_end/panels/application/preloading/components/RuleSetGrid.ts +8 -8
  115. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +32 -32
  116. package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +1 -1
  117. package/front_end/panels/changes/ChangesView.ts +1 -1
  118. package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +1 -1
  119. package/front_end/panels/common/GdpSignUpDialog.ts +2 -3
  120. package/front_end/panels/console/ConsoleInsightTeaser.ts +1 -1
  121. package/front_end/panels/console/ConsolePinPane.ts +0 -1
  122. package/front_end/panels/console/ConsoleView.ts +2 -3
  123. package/front_end/panels/console/ConsoleViewMessage.ts +2 -3
  124. package/front_end/panels/coverage/CoverageListView.ts +6 -6
  125. package/front_end/panels/coverage/CoverageView.ts +7 -7
  126. package/front_end/panels/elements/CSSRuleValidator.ts +10 -10
  127. package/front_end/panels/elements/DOMTreeContextMenu.ts +16 -23
  128. package/front_end/panels/elements/ElementsPanel.ts +3 -3
  129. package/front_end/panels/elements/ElementsTreeElement.ts +287 -60
  130. package/front_end/panels/elements/ElementsTreeOutline.ts +273 -42
  131. package/front_end/panels/elements/LayoutPane.ts +1 -1
  132. package/front_end/panels/elements/StylePropertyTreeElement.ts +2 -2
  133. package/front_end/panels/elements/StylesSidebarPane.ts +3 -3
  134. package/front_end/panels/event_listeners/EventListenersView.ts +0 -1
  135. package/front_end/panels/explain/components/ConsoleInsight.ts +4 -4
  136. package/front_end/panels/issues/AffectedPartitioningBlobURLView.ts +3 -3
  137. package/front_end/panels/issues/IssuesPane.ts +1 -1
  138. package/front_end/panels/layer_viewer/Layers3DView.ts +3 -3
  139. package/front_end/panels/lighthouse/LighthouseController.ts +4 -4
  140. package/front_end/panels/lighthouse/LighthouseStatusView.ts +9 -9
  141. package/front_end/panels/lighthouse/LighthouseTimespanView.ts +1 -1
  142. package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorController.ts +1 -1
  143. package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorPane.ts +1 -1
  144. package/front_end/panels/media/MainView.ts +2 -2
  145. package/front_end/panels/mobile_throttling/CalibrationController.ts +1 -1
  146. package/front_end/panels/mobile_throttling/NetworkPanelIndicator.ts +1 -1
  147. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +3 -3
  148. package/front_end/panels/network/NetworkConfigView.ts +26 -16
  149. package/front_end/panels/network/NetworkItemView.ts +1 -1
  150. package/front_end/panels/network/NetworkLogView.ts +4 -5
  151. package/front_end/panels/network/NetworkPanel.ts +138 -53
  152. package/front_end/panels/network/RequestConditionsDrawer.ts +3 -3
  153. package/front_end/panels/network/RequestCookiesView.ts +2 -2
  154. package/front_end/panels/network/RequestHeadersView.ts +65 -32
  155. package/front_end/panels/network/RequestPayloadView.ts +0 -2
  156. package/front_end/panels/network/RequestTimingView.ts +1 -1
  157. package/front_end/panels/network/ResourceChunkView.ts +1 -1
  158. package/front_end/panels/network/components/HeaderSectionRow.ts +2 -2
  159. package/front_end/panels/network/components/RequestHeaderSection.ts +1 -1
  160. package/front_end/panels/network/components/RequestHeadersView.css +7 -1
  161. package/front_end/panels/network/components/RequestTrustTokensView.ts +7 -7
  162. package/front_end/panels/network/components/ResponseHeaderSection.ts +3 -4
  163. package/front_end/panels/network/forward/BackendLinking.ts +49 -0
  164. package/front_end/panels/network/forward/forward.ts +2 -0
  165. package/front_end/panels/network/network-meta.ts +1 -1
  166. package/front_end/panels/profiler/HeapDetachedElementsView.ts +1 -1
  167. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +10 -10
  168. package/front_end/panels/profiler/HeapSnapshotView.ts +1 -1
  169. package/front_end/panels/profiler/IsolateSelector.ts +4 -4
  170. package/front_end/panels/profiler/ModuleUIStrings.ts +1 -1
  171. package/front_end/panels/profiler/ProfilesPanel.ts +2 -3
  172. package/front_end/panels/recorder/RecorderPanel.ts +1 -1
  173. package/front_end/panels/search/SearchView.ts +6 -6
  174. package/front_end/panels/security/SecurityModel.ts +4 -4
  175. package/front_end/panels/security/SecurityPanel.ts +88 -60
  176. package/front_end/panels/security/SecurityPanelSidebar.ts +103 -234
  177. package/front_end/panels/security/security.ts +0 -4
  178. package/front_end/panels/security/sidebar.css +9 -10
  179. package/front_end/panels/settings/AISettingsTab.ts +9 -9
  180. package/front_end/panels/settings/BackendLinkingSettingsTab.ts +303 -0
  181. package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +1 -1
  182. package/front_end/panels/settings/KeybindsSettingsTab.ts +2 -2
  183. package/front_end/panels/settings/SettingsScreen.ts +156 -109
  184. package/front_end/panels/settings/WorkspaceSettingsTab.ts +1 -1
  185. package/front_end/panels/settings/backendLinkingSettingsTab.css +78 -0
  186. package/front_end/panels/settings/components/SyncSection.ts +3 -3
  187. package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +13 -13
  188. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +2 -2
  189. package/front_end/panels/settings/settings-meta.ts +25 -0
  190. package/front_end/panels/settings/settings.ts +2 -0
  191. package/front_end/panels/snippets/SnippetsQuickOpen.ts +1 -1
  192. package/front_end/panels/sources/CSSPlugin.ts +2 -2
  193. package/front_end/panels/sources/DebuggerPlugin.ts +4 -4
  194. package/front_end/panels/sources/NavigatorView.ts +3 -3
  195. package/front_end/panels/sources/OutlineQuickOpen.ts +1 -1
  196. package/front_end/panels/sources/PersistenceActions.ts +2 -2
  197. package/front_end/panels/sources/SourcesNavigator.ts +5 -5
  198. package/front_end/panels/sources/TabbedEditorContainer.ts +1 -1
  199. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +0 -1
  200. package/front_end/panels/sources/components/HeadersView.ts +1 -1
  201. package/front_end/panels/timeline/README.md +3 -2
  202. package/front_end/panels/timeline/TimelineFlameChartView.ts +23 -2
  203. package/front_end/panels/timeline/TimelineUIUtils.ts +0 -1
  204. package/front_end/panels/timeline/components/ExportTraceOptions.ts +2 -2
  205. package/front_end/panels/timeline/components/FieldSettingsDialog.ts +4 -4
  206. package/front_end/panels/timeline/components/IgnoreListSetting.ts +1 -1
  207. package/front_end/panels/timeline/components/LiveMetricsView.ts +7 -7
  208. package/front_end/panels/timeline/components/MetricCard.ts +3 -3
  209. package/front_end/panels/timeline/components/MetricCompareStrings.ts +12 -14
  210. package/front_end/panels/timeline/components/OriginMap.ts +3 -3
  211. package/front_end/panels/timeline/components/SidebarAnnotationsTab.ts +4 -4
  212. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +70 -4
  213. package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +1 -1
  214. package/front_end/panels/timeline/overlays/components/TimespanBreakdownOverlay.ts +3 -1
  215. package/front_end/panels/timeline/timelineFlameChartView.css +47 -0
  216. package/front_end/panels/web_audio/WebAudioView.ts +1 -1
  217. package/front_end/panels/webauthn/WebauthnPane.ts +1 -1
  218. package/front_end/panels/whats_new/ReleaseNoteText.ts +8 -8
  219. package/front_end/panels/whats_new/resources/WNDT.md +6 -6
  220. package/front_end/third_party/chromium/README.chromium +1 -1
  221. package/front_end/third_party/puppeteer/README.chromium +2 -2
  222. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +6 -0
  223. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +5 -8
  224. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Coverage.d.ts +6 -0
  225. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Coverage.d.ts.map +1 -1
  226. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Coverage.js.map +1 -1
  227. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.d.ts.map +1 -1
  228. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.js +1 -5
  229. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.js.map +1 -1
  230. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
  231. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
  232. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js.map +1 -1
  233. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
  234. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
  235. package/front_end/third_party/puppeteer/package/lib/types.d.ts +6 -0
  236. package/front_end/third_party/puppeteer/package/package.json +2 -2
  237. package/front_end/third_party/puppeteer/package/src/cdp/Coverage.ts +6 -0
  238. package/front_end/third_party/puppeteer/package/src/cdp/ScreenRecording.ts +3 -7
  239. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  240. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  241. package/front_end/third_party/web-vitals/README.chromium +2 -2
  242. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +8 -5
  243. package/front_end/third_party/web-vitals/package/package.json +1 -1
  244. package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +8 -4
  245. package/front_end/third_party/web-vitals/rebuild.sh +2 -2
  246. package/front_end/ui/components/panel_feedback/PanelFeedback.ts +2 -2
  247. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +1 -1
  248. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -1
  249. package/front_end/ui/components/text_editor/AiCodeCompletionTeaser.ts +4 -4
  250. package/front_end/ui/components/text_editor/AiCodeGenerationTeaser.ts +3 -3
  251. package/front_end/ui/legacy/ContextMenu.ts +19 -0
  252. package/front_end/ui/legacy/RemoteDebuggingTerminatedScreen.ts +2 -2
  253. package/front_end/ui/legacy/SoftContextMenu.ts +6 -0
  254. package/front_end/ui/legacy/TargetCrashedScreen.ts +2 -2
  255. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +1 -1
  256. package/front_end/ui/legacy/components/inline_editor/PositionAreaEditor.ts +1 -1
  257. package/front_end/ui/legacy/components/perf_ui/FilmStripView.ts +1 -1
  258. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +69 -31
  259. package/front_end/ui/visual_logging/KnownContextValues.ts +4 -0
  260. package/package.json +9 -5
  261. package/front_end/panels/security/OriginTreeElement.ts +0 -59
  262. package/front_end/panels/security/SecurityPanelSidebarTreeElement.ts +0 -30
package/.geminiignore CHANGED
@@ -2,5 +2,4 @@ node_modules/
2
2
  /third_party/
3
3
  front_end/core/i18n/locales/*.json
4
4
  front_end/third_party/lighthouse/locales/*.json
5
- front_end/third_party/puppeteer/package/lib/cjs/
6
5
  front_end/panels/timeline/fixtures/traces/
package/eslint.config.mjs CHANGED
@@ -265,7 +265,8 @@ export default defineConfig([
265
265
  'error',
266
266
  {
267
267
  selector: 'ExportDefaultDeclaration',
268
- message: 'Default exports are not allowed. Use named exports instead.',
268
+ message:
269
+ 'Default exports are not allowed. Use named exports instead.',
269
270
  },
270
271
  ],
271
272
  /**
@@ -948,6 +949,8 @@ export default defineConfig([
948
949
  'eslint.config.mjs',
949
950
  '**/*/rollup.config.mjs',
950
951
  '**/*.rollup.js',
952
+ '**/*/karma.conf.ts',
953
+ '**/*/karma.conf.in.js',
951
954
  ],
952
955
  rules: {
953
956
  // The config operate on the default export
@@ -32,14 +32,24 @@ export function decode(input: string): Uint8Array<ArrayBuffer> {
32
32
  return bytes;
33
33
  }
34
34
 
35
+ export type BlobPart = ArrayBufferLike|Uint8Array|Blob|string;
36
+
35
37
  /**
36
38
  * Note: if input can be very large (larger than the max string size), callers should
37
39
  * expect this to throw an error.
38
40
  */
39
41
  export async function encode(input: BlobPart): Promise<string> {
42
+ const maybeFileReader = (globalThis as Record<string, unknown>)['FileReader'] as (new () => {
43
+ onerror: (() => void) | null,
44
+ onload: (() => void) | null,
45
+ result: string | ArrayBuffer | null,
46
+ readAsDataURL(blob: Blob): void,
47
+ }) |
48
+ undefined;
49
+
40
50
  // Node.js environment (for foundation unit tests)
41
- if (typeof FileReader === 'undefined') {
42
- const blob = new Blob([input]);
51
+ if (!maybeFileReader) {
52
+ const blob = new Blob([input as unknown as (ArrayBuffer | Blob | string)]);
43
53
  const arrayBuffer = await blob.arrayBuffer();
44
54
  // Use globalThis.Buffer to avoid TypeScript errors if Node types are not included.
45
55
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -48,7 +58,7 @@ export async function encode(input: BlobPart): Promise<string> {
48
58
 
49
59
  // Browser environment
50
60
  return await new Promise((resolve, reject) => {
51
- const reader = new FileReader();
61
+ const reader = new maybeFileReader();
52
62
  reader.onerror = () => reject(new Error('failed to convert to base64: internal error'));
53
63
  reader.onload = () => {
54
64
  // The input was too large to encode as a string. The caller should anticipate
@@ -71,6 +81,6 @@ export async function encode(input: BlobPart): Promise<string> {
71
81
  resolve(base64);
72
82
  };
73
83
 
74
- reader.readAsDataURL(new Blob([input]));
84
+ reader.readAsDataURL(new Blob([input as unknown as (ArrayBuffer | Blob | string)]));
75
85
  });
76
86
  }
@@ -613,12 +613,15 @@ export function findFgColorForContrastAPCA(fgColor: Legacy, bgColor: Legacy, req
613
613
  const fgIsLighter = fgLuminance >= bgLuminance;
614
614
  const desiredLuminance = desiredLuminanceAPCA(bgLuminance, requiredContrast, fgIsLighter);
615
615
 
616
+ const meetsRequiredContrast = (candidate: Legacy): boolean =>
617
+ Math.round(Math.abs(contrastRatioAPCA(candidate.rgba(), bgColor.rgba()))) >= requiredContrast;
618
+
616
619
  const saturationComponentIndex = 1;
617
620
  const valueComponentIndex = 2;
618
621
 
619
622
  if (approachColorValue(candidateHSVA, valueComponentIndex, desiredLuminance, candidateLuminance)) {
620
623
  const candidate = Legacy.fromHSVA(candidateHSVA);
621
- if (Math.abs(contrastRatioAPCA(bgColor.rgba(), candidate.rgba())) >= requiredContrast) {
624
+ if (meetsRequiredContrast(candidate)) {
622
625
  return candidate;
623
626
  }
624
627
  }
@@ -626,7 +629,7 @@ export function findFgColorForContrastAPCA(fgColor: Legacy, bgColor: Legacy, req
626
629
  candidateHSVA[valueComponentIndex] = 1;
627
630
  if (approachColorValue(candidateHSVA, saturationComponentIndex, desiredLuminance, candidateLuminance)) {
628
631
  const candidate = Legacy.fromHSVA(candidateHSVA);
629
- if (Math.abs(contrastRatioAPCA(bgColor.rgba(), candidate.rgba())) >= requiredContrast) {
632
+ if (meetsRequiredContrast(candidate)) {
630
633
  return candidate;
631
634
  }
632
635
  }
@@ -19,7 +19,7 @@ export async function arrayBufferToString(ab: ArrayBufferLike): Promise<string>
19
19
  if (isGzip(ab)) {
20
20
  return await decompress(ab);
21
21
  }
22
- const str = new TextDecoder('utf-8').decode(ab);
22
+ const str = new TextDecoder('utf-8').decode(new Uint8Array(ab));
23
23
  return str;
24
24
  }
25
25
 
@@ -128,7 +128,6 @@ export function eventMixin<
128
128
  Events,
129
129
  Base extends Platform.Constructor.Constructor<EventMixinBase>,
130
130
  >(base: Base): EventMixin<Events, Base> {
131
- console.assert((base as unknown) !== HTMLElement);
132
131
  return class EventHandling extends base implements EventTarget<Events> {
133
132
  // Note that the weird name is due to TSC disallowing private/protected fields in
134
133
  // anonmous exported classes. We use a `__` prefix to prevent clashes with `base`.
@@ -6,6 +6,11 @@ import type * as Platform from '../../core/platform/platform.js';
6
6
  import type * as Common from '../common/common.js';
7
7
  import type * as Root from '../root/root.js';
8
8
 
9
+ declare global {
10
+ // eslint-disable-next-line @typescript-eslint/naming-convention
11
+ var InspectorFrontendHost: InspectorFrontendHostAPI;
12
+ }
13
+
9
14
  /**
10
15
  * This values should match the one getting called from Chromium
11
16
  */
@@ -227,6 +232,14 @@ export interface FunctionCallEvent {
227
232
  * Please note that the "dispatch" side can't be type-checked as the dispatch is
228
233
  * done dynamically.
229
234
  **/
235
+ export interface DevicesDiscoveryConfig {
236
+ discoverUsbDevices: boolean;
237
+ portForwardingEnabled: boolean;
238
+ portForwardingConfig: Record<string, string>;
239
+ networkDiscoveryEnabled: boolean;
240
+ networkDiscoveryConfig: string[];
241
+ }
242
+
230
243
  export interface EventTypes {
231
244
  [Events.AppendedToURL]: Platform.DevToolsPath.RawPathString|Platform.DevToolsPath.UrlString;
232
245
  [Events.CanceledSaveURL]: Platform.DevToolsPath.UrlString;
@@ -234,7 +247,7 @@ export interface EventTypes {
234
247
  [Events.ContextMenuCleared]: void;
235
248
  [Events.ContextMenuItemSelected]: number;
236
249
  [Events.DeviceCountUpdated]: number;
237
- [Events.DevicesDiscoveryConfigChanged]: Adb.Config;
250
+ [Events.DevicesDiscoveryConfigChanged]: DevicesDiscoveryConfig;
238
251
  [Events.DevicesPortForwardingStatusChanged]: void;
239
252
  [Events.DevicesUpdated]: void;
240
253
  [Events.DispatchMessage]: string;
@@ -399,7 +412,7 @@ export interface InspectorFrontendHostAPI {
399
412
 
400
413
  sendMessageToBackend(message: string): void;
401
414
 
402
- setDevicesDiscoveryConfig(config: Adb.Config): void;
415
+ setDevicesDiscoveryConfig(config: DevicesDiscoveryConfig): void;
403
416
 
404
417
  setDevicesUpdatesEnabled(enabled: boolean): void;
405
418
 
@@ -423,7 +436,7 @@ export interface InspectorFrontendHostAPI {
423
436
 
424
437
  resetZoom(): void;
425
438
 
426
- showContextMenuAtPoint(x: number, y: number, items: ContextMenuDescriptor[], document: Document): void;
439
+ showContextMenuAtPoint(x: number, y: number, items: ContextMenuDescriptor[], document: object): void;
427
440
 
428
441
  reattach(callback: () => void): void;
429
442
 
@@ -14,6 +14,7 @@ import {
14
14
  type ChangeEvent,
15
15
  type ClickEvent,
16
16
  type ContextMenuDescriptor,
17
+ type DevicesDiscoveryConfig,
17
18
  type DispatchHttpRequestRequest,
18
19
  type DispatchHttpRequestResult,
19
20
  type DoAidaConversationResult,
@@ -460,7 +461,7 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
460
461
  setOpenNewWindowForPopups(_value: boolean): void {
461
462
  }
462
463
 
463
- setDevicesDiscoveryConfig(_config: Adb.Config): void {
464
+ setDevicesDiscoveryConfig(_config: DevicesDiscoveryConfig): void {
464
465
  }
465
466
 
466
467
  setDevicesUpdatesEnabled(_enabled: boolean): void {
@@ -472,7 +473,7 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
472
473
  openNodeFrontend(): void {
473
474
  }
474
475
 
475
- showContextMenuAtPoint(_x: number, _y: number, _items: ContextMenuDescriptor[], _document: Document): void {
476
+ showContextMenuAtPoint(_x: number, _y: number, _items: ContextMenuDescriptor[], _document: object): void {
476
477
  throw new Error('Soft context menu should be used');
477
478
  }
478
479
 
@@ -7,7 +7,6 @@
7
7
  import * as Common from '../common/common.js';
8
8
  import * as i18n from '../i18n/i18n.js';
9
9
 
10
- import {InspectorFrontendHostInstance} from './InspectorFrontendHost.js';
11
10
  import type {LoadNetworkResourceResult} from './InspectorFrontendHostAPI.js';
12
11
 
13
12
  const UIStrings = {
@@ -248,7 +247,7 @@ export const loadAsStream = function(
248
247
  rawHeaders.push(key + ': ' + headers[key]);
249
248
  }
250
249
  }
251
- InspectorFrontendHostInstance.loadNetworkResource(url, rawHeaders.join('\r\n'), streamId, finishedCallback);
250
+ globalThis.InspectorFrontendHost.loadNetworkResource(url, rawHeaders.join('\r\n'), streamId, finishedCallback);
252
251
 
253
252
  function finishedCallback(response: LoadNetworkResourceResult): void {
254
253
  if (callback) {
@@ -2,6 +2,17 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
+ export interface ScreenshotOptions {
6
+ base64Png: string;
7
+ fileName: string;
8
+ clip?: {
9
+ screenRectWidth: number,
10
+ screenRectHeight: number,
11
+ visiblePageRectLeft: number,
12
+ visiblePageRectTop: number,
13
+ };
14
+ }
15
+
5
16
  /**
6
17
  * Provides abstractions for host features that require different implementations depending
7
18
  * on whether DevTools runs in the browser or Node.js
@@ -12,6 +23,10 @@ export interface HostRuntime {
12
23
  getOnLine(): boolean;
13
24
  getUserAgent(): string;
14
25
  getLocalStorage(): Storage|undefined;
26
+ getDevicePixelRatio(): number;
27
+ saveScreenshot(options: ScreenshotOptions): Promise<void>;
28
+ revokeLastScreenshotUrl(): void;
29
+ loadTextFile(url: URL): Promise<string>;
15
30
  }
16
31
 
17
32
  /**
@@ -69,6 +69,67 @@ class WebWorker implements Api.HostRuntime.Worker {
69
69
  }
70
70
  }
71
71
 
72
+ let lastScreenshotBlobUrl: string|null = null;
73
+
74
+ function revokeLastScreenshotUrl(): void {
75
+ if (lastScreenshotBlobUrl) {
76
+ URL.revokeObjectURL(lastScreenshotBlobUrl);
77
+ lastScreenshotBlobUrl = null;
78
+ }
79
+ }
80
+
81
+ async function saveScreenshot(options: Api.HostRuntime.ScreenshotOptions): Promise<void> {
82
+ const pageImage = new Image();
83
+ await new Promise<void>((resolve, reject) => {
84
+ pageImage.onload = () => resolve();
85
+ pageImage.onerror = () => reject(new Error('Failed to load image for screenshot'));
86
+ pageImage.src = 'data:image/png;base64,' + options.base64Png;
87
+ });
88
+
89
+ let canvas: OffscreenCanvas;
90
+ if (options.clip) {
91
+ const scale = pageImage.naturalWidth / options.clip.screenRectWidth;
92
+ const screenRectWidth = options.clip.screenRectWidth * scale;
93
+ const screenRectHeight = options.clip.screenRectHeight * scale;
94
+ const contentLeft = options.clip.visiblePageRectLeft * scale;
95
+ const contentTop = options.clip.visiblePageRectTop * scale;
96
+
97
+ canvas = new OffscreenCanvas(
98
+ Math.floor(screenRectWidth),
99
+ // Cap the height to not hit the GPU limit.
100
+ // https://crbug.com/1260828
101
+ Math.min(1 << 14, Math.floor(screenRectHeight)),
102
+ );
103
+ const ctx = canvas.getContext('2d', {willReadFrequently: true});
104
+ if (!ctx) {
105
+ throw new Error('Could not get 2d context from canvas.');
106
+ }
107
+ ctx.imageSmoothingEnabled = false;
108
+ ctx.drawImage(pageImage, Math.floor(contentLeft), Math.floor(contentTop));
109
+ } else {
110
+ canvas = new OffscreenCanvas(
111
+ pageImage.naturalWidth,
112
+ Math.min(1 << 14, Math.floor(pageImage.naturalHeight)),
113
+ );
114
+ const ctx = canvas.getContext('2d', {willReadFrequently: true});
115
+ if (!ctx) {
116
+ throw new Error('Could not get 2d context for base64 screenshot.');
117
+ }
118
+ ctx.imageSmoothingEnabled = false;
119
+ ctx.drawImage(pageImage, 0, 0);
120
+ }
121
+
122
+ revokeLastScreenshotUrl();
123
+ /* eslint-disable-next-line @devtools/no-imperative-dom-api */
124
+ const link = document.createElement('a');
125
+ link.download = options.fileName + '.png';
126
+ const blob = await canvas.convertToBlob({type: 'image/png'});
127
+ const blobUrl = URL.createObjectURL(blob);
128
+ lastScreenshotBlobUrl = blobUrl;
129
+ link.href = blobUrl;
130
+ link.click();
131
+ }
132
+
72
133
  export const HOST_RUNTIME: Api.HostRuntime.HostRuntime = {
73
134
  createWorker(url: string): Api.HostRuntime.Worker {
74
135
  return new WebWorker(url);
@@ -84,4 +145,13 @@ export const HOST_RUNTIME: Api.HostRuntime.HostRuntime = {
84
145
  undefined {
85
146
  return 'localStorage' in globalThis ? globalThis.localStorage : undefined;
86
147
  },
148
+ getDevicePixelRatio(): number {
149
+ return window.devicePixelRatio;
150
+ },
151
+ saveScreenshot,
152
+ revokeLastScreenshotUrl,
153
+ async loadTextFile(url: URL): Promise<string> {
154
+ const response = await fetch(url);
155
+ return await response.text();
156
+ },
87
157
  };
@@ -2,6 +2,8 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
+ import * as Fs from 'node:fs';
6
+ import * as Url from 'node:url';
5
7
  import * as WorkerThreads from 'node:worker_threads';
6
8
 
7
9
  import type * as Api from '../api/api.js';
@@ -19,14 +21,16 @@ class NodeWorkerScope implements Api.HostRuntime.WorkerScope {
19
21
  }
20
22
 
21
23
  class NodeWorker implements Api.HostRuntime.Worker {
24
+ readonly #worker: WorkerThreads.Worker;
22
25
  readonly #workerPromise: Promise<WorkerThreads.Worker>;
23
26
  #disposed = false;
24
27
  #rejectWorkerPromise?: (error: Error) => void;
25
28
 
26
29
  constructor(url: string) {
27
- this.#workerPromise = new Promise((resolve, reject) => {
30
+ const worker = new WorkerThreads.Worker(new URL(url));
31
+ this.#worker = worker;
32
+ this.#workerPromise = new Promise<WorkerThreads.Worker>((resolve, reject) => {
28
33
  this.#rejectWorkerPromise = reject;
29
- const worker = new WorkerThreads.Worker(new URL(url));
30
34
  worker.once('message', (message: unknown) => {
31
35
  if (message === 'workerReady') {
32
36
  resolve(worker);
@@ -34,6 +38,8 @@ class NodeWorker implements Api.HostRuntime.Worker {
34
38
  });
35
39
  worker.on('error', reject);
36
40
  });
41
+ // Prevent unhandled promise rejections if the worker is terminated early.
42
+ this.#workerPromise.catch(() => {});
37
43
  }
38
44
 
39
45
  postMessage(message: unknown, transfer?: Api.HostRuntime.WorkerTransferable[]): void {
@@ -46,7 +52,7 @@ class NodeWorker implements Api.HostRuntime.Worker {
46
52
 
47
53
  dispose(): void {
48
54
  this.#disposed = true;
49
- void this.#workerPromise.then(worker => worker.terminate());
55
+ void this.#worker.terminate();
50
56
  }
51
57
 
52
58
  terminate(immediately?: boolean): void {
@@ -92,4 +98,12 @@ export const HOST_RUNTIME: Api.HostRuntime.HostRuntime = {
92
98
  undefined {
93
99
  return undefined;
94
100
  },
101
+ getDevicePixelRatio(): number {
102
+ return 1;
103
+ },
104
+ async saveScreenshot(_options: Api.HostRuntime.ScreenshotOptions): Promise<void>{},
105
+ revokeLastScreenshotUrl(): void{},
106
+ async loadTextFile(url: URL): Promise<string> {
107
+ return await Fs.promises.readFile(Url.fileURLToPath(url), 'utf-8');
108
+ },
95
109
  };
@@ -545,6 +545,10 @@ interface DevToolsMobileSafeAreaEmulation {
545
545
  enabled: boolean;
546
546
  }
547
547
 
548
+ interface DevToolsNetworkBackendLinking {
549
+ enabled: boolean;
550
+ }
551
+
548
552
  /**
549
553
  * The host configuration that we expect from the DevTools back-end.
550
554
  *
@@ -602,6 +606,7 @@ export type HostConfig = Platform.TypeScriptUtilities.RecursivePartial<{
602
606
  devToolsAriaLiveRecording: DevToolsAriaLiveRecording,
603
607
  devToolsInstrumentationBreakpoints: DevToolsInstrumentationBreakpoints,
604
608
  devToolsMobileSafeAreaEmulation: DevToolsMobileSafeAreaEmulation,
609
+ devToolsNetworkBackendLinking: DevToolsNetworkBackendLinking,
605
610
  extensionsOnChromeUrls: ExtensionsOnChromeUrls,
606
611
  devToolsComments: HostConfigDevToolsComments,
607
612
  }>;
@@ -19,11 +19,11 @@ const UIStrings = {
19
19
  /**
20
20
  * @description Error message for when a CSS file can't be loaded.
21
21
  */
22
- couldNotFindTheOriginalStyle: 'Could not find the original style sheet.',
22
+ couldNotFindTheOriginalStyle: 'Could not find the original style sheet',
23
23
  /**
24
24
  * @description Error message to display when a source CSS file could not be retrieved.
25
25
  */
26
- couldNotRetrieveSourceStyles: 'Could not retrieve source styles.',
26
+ couldNotRetrieveSourceStyles: 'Could not retrieve source styles',
27
27
  } as const;
28
28
  const str_ = i18n.i18n.registerUIStrings('core/sdk/CSSStyleSheetHeader.ts', UIStrings);
29
29
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -56,16 +56,16 @@ const UIStrings = {
56
56
  * @description Text shown in the console when a performance profile (with the given name) was started.
57
57
  * @example {title} PH1
58
58
  */
59
- profileSStarted: 'Profile \'\'{PH1}\'\' started.',
59
+ profileSStarted: 'Profile \'\'{PH1}\'\' started',
60
60
  /**
61
61
  * @description Text shown in the console when a performance profile (with the given name) was stopped.
62
62
  * @example {name} PH1
63
63
  */
64
- profileSFinished: 'Profile \'\'{PH1}\'\' finished.',
64
+ profileSFinished: 'Profile \'\'{PH1}\'\' finished',
65
65
  /**
66
66
  * @description Error message shown in the console after the user tries to save a JavaScript value to a temporary variable.
67
67
  */
68
- failedToSaveToTempVariable: 'Failed to save to temp variable.',
68
+ failedToSaveToTempVariable: 'Failed to save to temp variable',
69
69
  } as const;
70
70
 
71
71
  const str_ = i18n.i18n.registerUIStrings('core/sdk/ConsoleModel.ts', UIStrings);
@@ -1427,6 +1427,19 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
1427
1427
  return this.domModel().nodeForId(response.nodeId);
1428
1428
  }
1429
1429
 
1430
+ async getImplicitAnchorCandidates(): Promise<DeferredDOMNode[]> {
1431
+ const response = await this.#agent.invoke_getImplicitAnchorCandidates({
1432
+ nodeId: this.id,
1433
+ });
1434
+
1435
+ if (response.getError() || !response.backendNodeIds) {
1436
+ return [];
1437
+ }
1438
+
1439
+ const target = this.domModel().target();
1440
+ return response.backendNodeIds.map(backendNodeId => new DeferredDOMNode(target, backendNodeId));
1441
+ }
1442
+
1430
1443
  async takeSnapshot(ownerDocumentSnapshot?: DOMDocument): Promise<DOMNode> {
1431
1444
  const snapshot = (this instanceof DOMDocument) ? new DOMDocumentSnapshot(this.domModel(), {
1432
1445
  nodeId: this.id,
@@ -1331,6 +1331,7 @@ export class CallFrame {
1331
1331
  generatePreview: options.generatePreview,
1332
1332
  throwOnSideEffect: options.throwOnSideEffect,
1333
1333
  timeout: options.timeout,
1334
+ scopeNumber: options.scopeNumber,
1334
1335
  });
1335
1336
  const error = response.getError();
1336
1337
  if (error) {
@@ -1407,6 +1408,11 @@ export class Scope implements ScopeChainEntry {
1407
1408
  return this.#callFrame;
1408
1409
  }
1409
1410
 
1411
+ /** The index of this scope in {@link CallFrame.scopeChain}, usable as an `evaluateOnCallFrame` `scopeNumber`. */
1412
+ ordinal(): number {
1413
+ return this.#ordinal;
1414
+ }
1415
+
1410
1416
  type(): string {
1411
1417
  return this.#type;
1412
1418
  }
@@ -30,15 +30,15 @@ const UIStrings = {
30
30
  /**
31
31
  * @description Tooltip to explain why a cookie was blocked.
32
32
  */
33
- secureOnly: 'This cookie was blocked because it had the "`Secure`" attribute and the connection was not secure.',
33
+ secureOnly: 'This cookie was blocked because it had the "`Secure`" attribute and the connection was not secure',
34
34
  /**
35
35
  * @description Tooltip to explain why a cookie was blocked.
36
36
  */
37
- notOnPath: 'This cookie was blocked because its path was not an exact match for or a superdirectory of the request URL’s path.',
37
+ notOnPath: 'This cookie was blocked because its path was not an exact match for or a superdirectory of the request URL’s path',
38
38
  /**
39
39
  * @description Tooltip to explain why a cookie was blocked.
40
40
  */
41
- domainMismatch: 'This cookie was blocked because neither did the request URL’s domain exactly match the cookie’s domain, nor was the request URL’s domain a subdomain of the cookie’s Domain attribute value.',
41
+ domainMismatch: 'This cookie was blocked because neither did the request URL’s domain exactly match the cookie’s domain, nor was the request URL’s domain a subdomain of the cookie’s Domain attribute value',
42
42
  /**
43
43
  * @description Tooltip to explain why a cookie was blocked.
44
44
  */
@@ -46,7 +46,7 @@ const UIStrings = {
46
46
  /**
47
47
  * @description Tooltip to explain why a cookie was blocked.
48
48
  */
49
- sameSiteLax: 'This cookie was blocked because it had the "`SameSite=Lax`" attribute and the request was made from a different site and was not initiated by a top-level navigation.',
49
+ sameSiteLax: 'This cookie was blocked because it had the "`SameSite=Lax`" attribute and the request was made from a different site and was not initiated by a top-level navigation',
50
50
  /**
51
51
  * @description Tooltip to explain why a cookie was blocked.
52
52
  */
@@ -58,7 +58,7 @@ const UIStrings = {
58
58
  /**
59
59
  * @description Tooltip to explain why a cookie was blocked.
60
60
  */
61
- userPreferences: 'This cookie was blocked due to user preferences.',
61
+ userPreferences: 'This cookie was blocked due to user preferences',
62
62
  /**
63
63
  * @description Tooltip to explain why a cookie was blocked.
64
64
  */
@@ -66,7 +66,7 @@ const UIStrings = {
66
66
  /**
67
67
  * @description Tooltip to explain why a cookie was blocked.
68
68
  */
69
- unknownError: 'An unknown error was encountered when trying to send this cookie.',
69
+ unknownError: 'An unknown error was encountered when trying to send this cookie',
70
70
  /**
71
71
  * @description Tooltip to explain why a cookie was blocked due to exceeding the maximum size.
72
72
  */
@@ -74,7 +74,7 @@ const UIStrings = {
74
74
  /**
75
75
  * @description Tooltip to explain why an attempt to set a cookie via `Set-Cookie` HTTP header on a request's response was blocked.
76
76
  */
77
- thisSetcookieWasBlockedDueToUser: 'This attempt to set a cookie via a "`Set-Cookie`" header was blocked due to user preferences.',
77
+ thisSetcookieWasBlockedDueToUser: 'This attempt to set a cookie via a "`Set-Cookie`" header was blocked due to user preferences',
78
78
  /**
79
79
  * @description Tooltip to explain why an attempt to set a cookie via `Set-Cookie` HTTP header on a request's response was blocked.
80
80
  */
@@ -82,28 +82,28 @@ const UIStrings = {
82
82
  /**
83
83
  * @description Tooltip to explain why an attempt to set a cookie via `Set-Cookie` HTTP header on a request's response was blocked.
84
84
  */
85
- thisSetcookieHadInvalidSyntax: 'This "`Set-Cookie`" header had invalid syntax.',
85
+ thisSetcookieHadInvalidSyntax: 'This "`Set-Cookie`" header had invalid syntax',
86
86
  /**
87
87
  * @description Tooltip to explain why a cookie was blocked.
88
88
  */
89
- thisSetcookieHadADisallowedCharacter: 'This "`Set-Cookie`" header contained a disallowed character (a forbidden ASCII control character, or the tab character if it appears in the middle of the cookie name, value, an attribute name, or an attribute value).',
89
+ thisSetcookieHadADisallowedCharacter: 'This "`Set-Cookie`" header contained a disallowed character (a forbidden ASCII control character, or the tab character if it appears in the middle of the cookie name, value, an attribute name, or an attribute value)',
90
90
  /**
91
91
  * @description Tooltip to explain why a cookie was blocked.
92
92
  */
93
- theSchemeOfThisConnectionIsNot: 'The scheme of this connection is not allowed to store cookies.',
93
+ theSchemeOfThisConnectionIsNot: 'The scheme of this connection is not allowed to store cookies',
94
94
  /**
95
95
  * @description Tooltip to explain why a cookie was blocked.
96
96
  */
97
- anUnknownErrorWasEncounteredWhenTrying: 'An unknown error was encountered when trying to store this cookie.',
97
+ anUnknownErrorWasEncounteredWhenTrying: 'An unknown error was encountered when trying to store this cookie',
98
98
  /**
99
99
  * @description Tooltip to explain why an attempt to set a cookie via a `Set-Cookie` HTTP header on a request's response was blocked.
100
100
  */
101
- blockedReasonSecureOnly: 'This attempt to set a cookie via a "`Set-Cookie`" header was blocked because it had the "`Secure`" attribute but was not received over a secure connection.',
101
+ blockedReasonSecureOnly: 'This attempt to set a cookie via a "`Set-Cookie`" header was blocked because it had the "`Secure`" attribute but was not received over a secure connection',
102
102
  /**
103
103
  * @description Tooltip to explain why an attempt to set a cookie via a `Set-Cookie` HTTP header on a request's response was blocked.
104
104
  * @example {SameSite=Strict} PH1
105
105
  */
106
- blockedReasonSameSiteStrictLax: 'This attempt to set a cookie via a "`Set-Cookie`" header was blocked because it had the "{PH1}" attribute but came from a cross-site response which was not the response to a top-level navigation.',
106
+ blockedReasonSameSiteStrictLax: 'This attempt to set a cookie via a "`Set-Cookie`" header was blocked because it had the "{PH1}" attribute but came from a cross-site response which was not the response to a top-level navigation',
107
107
  /**
108
108
  * @description Tooltip to explain why an attempt to set a cookie via a `Set-Cookie` HTTP header on a request's response was blocked.
109
109
  */
@@ -111,19 +111,19 @@ const UIStrings = {
111
111
  /**
112
112
  * @description Tooltip to explain why an attempt to set a cookie via a `Set-Cookie` HTTP header on a request's response was blocked.
113
113
  */
114
- blockedReasonSameSiteNoneInsecure: 'This attempt to set a cookie via a "`Set-Cookie`" header was blocked because it had the "`SameSite=None`" attribute but did not have the "`Secure`" attribute, which is required in order to use "`SameSite=None`".',
114
+ blockedReasonSameSiteNoneInsecure: 'This attempt to set a cookie via a "`Set-Cookie`" header was blocked because it had the "`SameSite=None`" attribute but did not have the "`Secure`" attribute, which is required in order to use "`SameSite=None`"',
115
115
  /**
116
116
  * @description Tooltip to explain why an attempt to set a cookie via a `Set-Cookie` HTTP header on a request's response was blocked.
117
117
  */
118
- blockedReasonOverwriteSecure: 'This attempt to set a cookie via a "`Set-Cookie`" header was blocked because it was not sent over a secure connection and would have overwritten a cookie with the "`Secure`" attribute.',
118
+ blockedReasonOverwriteSecure: 'This attempt to set a cookie via a "`Set-Cookie`" header was blocked because it was not sent over a secure connection and would have overwritten a cookie with the "`Secure`" attribute',
119
119
  /**
120
120
  * @description Tooltip to explain why an attempt to set a cookie via a `Set-Cookie` HTTP header on a request's response was blocked.
121
121
  */
122
- blockedReasonInvalidDomain: 'This attempt to set a cookie via a "`Set-Cookie`" header was blocked because its "`Domain`" attribute was invalid with regards to the current host URL.',
122
+ blockedReasonInvalidDomain: 'This attempt to set a cookie via a "`Set-Cookie`" header was blocked because its "`Domain`" attribute was invalid with regards to the current host URL',
123
123
  /**
124
124
  * @description Tooltip to explain why an attempt to set a cookie via a `Set-Cookie` HTTP header on a request's response was blocked.
125
125
  */
126
- blockedReasonInvalidPrefix: 'This attempt to set a cookie via a "`Set-Cookie`" header was blocked because it used the "`__Secure-`" or "`__Host-`" prefix in its name and broke the additional rules applied to cookies with these prefixes as defined in `https://tools.ietf.org/html/draft-west-cookie-prefixes-05`.',
126
+ blockedReasonInvalidPrefix: 'This attempt to set a cookie via a "`Set-Cookie`" header was blocked because it used the "`__Secure-`" or "`__Host-`" prefix in its name and broke the additional rules applied to cookies with these prefixes as defined in `https://tools.ietf.org/html/draft-west-cookie-prefixes-05`',
127
127
  /**
128
128
  * @description Tooltip to explain why a cookie was blocked when the size of the #name plus the size of the value exceeds the max size.
129
129
  */
@@ -136,7 +136,7 @@ const UIStrings = {
136
136
  /**
137
137
  * @description Tooltip to explain why the cookie should have been blocked by third-party cookie phaseout but is exempted.
138
138
  */
139
- exemptionReasonUserSetting: 'This cookie is allowed by user preference.',
139
+ exemptionReasonUserSetting: 'This cookie is allowed by user preference',
140
140
  /**
141
141
  * @description Tooltip to explain why the cookie should have been blocked by third-party cookie phaseout but is exempted.
142
142
  */
@@ -152,7 +152,7 @@ const UIStrings = {
152
152
  /**
153
153
  * @description Tooltip to explain why the cookie should have been blocked by third-party cookie phaseout but is exempted.
154
154
  */
155
- exemptionReasonScheme: 'This cookie is allowed by the top-level URL scheme.',
155
+ exemptionReasonScheme: 'This cookie is allowed by the top-level URL scheme',
156
156
  } as const;
157
157
  // clang-format on
158
158
 
@@ -718,6 +718,11 @@ export interface EvaluationOptions {
718
718
  replMode?: boolean;
719
719
  allowUnsafeEvalBlockedByCSP?: boolean;
720
720
  contextId?: number;
721
+ /**
722
+ * Index into `CallFrame.scopeChain()` denoting the scope in which the expression is evaluated.
723
+ * Defaults to 0, i.e. the inner-most scope. Only honored by `CallFrame.evaluate`.
724
+ */
725
+ scopeNumber?: number;
721
726
  }
722
727
 
723
728
  export interface CallFunctionOptions {
@@ -50,11 +50,11 @@ const UIStrings = {
50
50
  /**
51
51
  * @description Error message for when a script can't be loaded because it was removed or deleted.
52
52
  */
53
- scriptRemovedOrDeleted: 'Script removed or deleted.',
53
+ scriptRemovedOrDeleted: 'Script removed or deleted',
54
54
  /**
55
55
  * @description Error message when failing to load a script source text.
56
56
  */
57
- unableToFetchScriptSource: 'Unable to fetch script source.',
57
+ unableToFetchScriptSource: 'Unable to fetch script source',
58
58
  } as const;
59
59
  const str_ = i18n.i18n.registerUIStrings('core/sdk/Script.ts', UIStrings);
60
60
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);