chrome-devtools-frontend 1.0.1548870 → 1.0.1549484

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 (188) hide show
  1. package/docs/contributing/settings-experiments-features.md +35 -0
  2. package/docs/styleguide/ux/patterns.md +27 -0
  3. package/eslint.config.mjs +1 -0
  4. package/front_end/Tests.js +2 -0
  5. package/front_end/core/host/InspectorFrontendHost.ts +26 -558
  6. package/front_end/core/host/InspectorFrontendHostAPI.ts +6 -3
  7. package/front_end/core/host/InspectorFrontendHostStub.ts +558 -0
  8. package/front_end/core/host/ResourceLoader.ts +9 -23
  9. package/front_end/core/host/UserMetrics.ts +4 -4
  10. package/front_end/core/root/DevToolsContext.ts +4 -0
  11. package/front_end/core/root/Runtime.ts +10 -0
  12. package/front_end/core/sdk/CSSMatchedStyles.ts +2 -2
  13. package/front_end/core/sdk/CSSModel.ts +24 -24
  14. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +11 -11
  15. package/front_end/core/sdk/CSSQuery.ts +1 -1
  16. package/front_end/core/sdk/CSSRule.ts +2 -2
  17. package/front_end/core/sdk/CSSStyleDeclaration.ts +1 -1
  18. package/front_end/core/sdk/CSSStyleSheetHeader.ts +1 -1
  19. package/front_end/core/sdk/DOMModel.ts +3 -0
  20. package/front_end/core/sdk/NetworkManager.ts +29 -31
  21. package/front_end/core/sdk/NetworkRequest.ts +4 -0
  22. package/front_end/core/sdk/OverlayModel.ts +2 -2
  23. package/front_end/core/sdk/PageResourceLoader.ts +63 -37
  24. package/front_end/core/sdk/SourceMap.ts +6 -0
  25. package/front_end/core/sdk/SourceMapCache.ts +21 -0
  26. package/front_end/core/sdk/SourceMapManager.ts +7 -6
  27. package/front_end/core/sdk/SourceMapScopesInfo.ts +6 -2
  28. package/front_end/core/sdk/TargetManager.ts +14 -2
  29. package/front_end/core/sdk/sdk-meta.ts +13 -0
  30. package/front_end/entrypoints/formatter_worker/FormatterActions.ts +1 -0
  31. package/front_end/entrypoints/formatter_worker/ScopeParser.ts +1 -1
  32. package/front_end/entrypoints/main/MainImpl.ts +13 -3
  33. package/front_end/foundation/Universe.ts +1 -1
  34. package/front_end/generated/Deprecation.ts +18 -4
  35. package/front_end/generated/InspectorBackendCommands.ts +33 -31
  36. package/front_end/generated/SupportedCSSProperties.js +41 -41
  37. package/front_end/generated/protocol-mapping.d.ts +12 -0
  38. package/front_end/generated/protocol-proxy-api.d.ts +11 -0
  39. package/front_end/generated/protocol.ts +70 -35
  40. package/front_end/models/ai_assistance/AiConversation.ts +5 -4
  41. package/front_end/models/ai_assistance/ChangeManager.ts +4 -4
  42. package/front_end/models/ai_assistance/ConversationHandler.ts +0 -15
  43. package/front_end/models/ai_assistance/agents/AiAgent.ts +9 -6
  44. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +135 -3
  45. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +24 -0
  46. package/front_end/models/bindings/CompilerScriptMapping.ts +43 -0
  47. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +19 -0
  48. package/front_end/models/bindings/ResourceMapping.ts +73 -0
  49. package/front_end/models/bindings/ResourceScriptMapping.ts +50 -0
  50. package/front_end/models/issues_manager/GenericIssue.ts +17 -0
  51. package/front_end/models/issues_manager/descriptions/genericNavigationEntryMarkedSkippable.md +7 -0
  52. package/front_end/models/javascript_metadata/NativeFunctions.js +7 -3
  53. package/front_end/models/source_map_scopes/FunctionCodeResolver.snapshot.txt +98 -0
  54. package/front_end/models/source_map_scopes/FunctionCodeResolver.ts +270 -0
  55. package/front_end/models/source_map_scopes/source_map_scopes.ts +2 -0
  56. package/front_end/models/workspace/UISourceCode.ts +51 -44
  57. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +76 -34
  58. package/front_end/panels/ai_assistance/aiAssistancePanel.css +1 -0
  59. package/front_end/panels/ai_assistance/components/ChatView.ts +23 -11
  60. package/front_end/panels/application/AppManifestView.ts +3 -2
  61. package/front_end/panels/application/FrameDetailsView.ts +5 -6
  62. package/front_end/panels/application/ServiceWorkersView.ts +2 -2
  63. package/front_end/panels/application/TrustTokensTreeElement.ts +2 -6
  64. package/front_end/panels/application/components/PermissionsPolicySection.ts +201 -157
  65. package/front_end/panels/application/components/ProtocolHandlersView.ts +117 -80
  66. package/front_end/panels/application/components/ServiceWorkerRouterView.ts +47 -41
  67. package/front_end/panels/application/components/StorageMetadataView.ts +31 -34
  68. package/front_end/panels/application/components/TrustTokensView.ts +76 -68
  69. package/front_end/panels/console/ConsoleView.ts +3 -2
  70. package/front_end/panels/console/ConsoleViewMessage.ts +6 -4
  71. package/front_end/panels/console/console-meta.ts +0 -13
  72. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +3 -1
  73. package/front_end/panels/elements/CSSRuleValidator.ts +7 -7
  74. package/front_end/panels/elements/CSSRuleValidatorHelper.ts +2 -2
  75. package/front_end/panels/elements/ElementsTreeElement.ts +16 -13
  76. package/front_end/panels/elements/ElementsTreeOutline.ts +2 -1
  77. package/front_end/panels/elements/LayoutPane.ts +12 -10
  78. package/front_end/panels/elements/StylePropertyTreeElement.ts +12 -12
  79. package/front_end/panels/elements/components/AdornerManager.ts +3 -3
  80. package/front_end/panels/elements/components/StylePropertyEditor.ts +6 -6
  81. package/front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts +27 -49
  82. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +15 -11
  83. package/front_end/panels/media/PlayerListView.ts +100 -73
  84. package/front_end/panels/media/playerListView.css +5 -0
  85. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +3 -3
  86. package/front_end/panels/network/RequestConditionsDrawer.ts +5 -5
  87. package/front_end/panels/network/components/DirectSocketConnectionView.ts +17 -0
  88. package/front_end/panels/network/resourceChunkView.css +4 -0
  89. package/front_end/panels/security/CookieControlsView.ts +1 -1
  90. package/front_end/panels/sensors/LocationsSettingsTab.ts +1 -1
  91. package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +1 -1
  92. package/front_end/panels/settings/KeybindsSettingsTab.ts +1 -1
  93. package/front_end/panels/settings/SettingsScreen.ts +6 -6
  94. package/front_end/panels/settings/WorkspaceSettingsTab.ts +1 -1
  95. package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +1 -1
  96. package/front_end/panels/snippets/SnippetsQuickOpen.ts +4 -2
  97. package/front_end/panels/sources/CSSPlugin.ts +1 -1
  98. package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +13 -5
  99. package/front_end/panels/sources/GoToLineQuickOpen.ts +4 -2
  100. package/front_end/panels/sources/NavigatorView.ts +2 -2
  101. package/front_end/panels/sources/OpenFileQuickOpen.ts +7 -8
  102. package/front_end/panels/sources/OutlineQuickOpen.ts +6 -3
  103. package/front_end/panels/sources/ProfilePlugin.ts +21 -12
  104. package/front_end/panels/sources/UISourceCodeFrame.ts +0 -1
  105. package/front_end/panels/sources/filteredUISourceCodeListProvider.css +41 -0
  106. package/front_end/panels/timeline/TimelinePanel.ts +17 -18
  107. package/front_end/panels/timeline/TimelineSelectorStatsView.ts +3 -3
  108. package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +2 -2
  109. package/front_end/panels/timeline/docs/flame_chart_migration.md +11 -16
  110. package/front_end/panels/utils/utils.ts +17 -3
  111. package/front_end/panels/whats_new/ReleaseNoteText.ts +10 -20
  112. package/front_end/panels/whats_new/resources/WNDT.md +8 -8
  113. package/front_end/third_party/chromium/README.chromium +1 -1
  114. package/front_end/third_party/puppeteer/third_party/mitt/README.chromium +1 -0
  115. package/front_end/third_party/puppeteer/third_party/parsel/README.chromium +1 -0
  116. package/front_end/third_party/puppeteer/third_party/rxjs/README.chromium +1 -0
  117. package/front_end/ui/components/adorners/Adorner.ts +1 -1
  118. package/front_end/ui/components/annotations/AnnotationRepository.ts +98 -0
  119. package/front_end/ui/components/annotations/AnnotationType.ts +10 -0
  120. package/front_end/ui/components/annotations/annotations.ts +6 -0
  121. package/front_end/ui/components/buttons/Button.ts +1 -1
  122. package/front_end/ui/components/buttons/FloatingButton.ts +1 -1
  123. package/front_end/ui/components/chrome_link/ChromeLink.ts +1 -1
  124. package/front_end/ui/components/dialogs/ButtonDialog.ts +1 -1
  125. package/front_end/ui/components/dialogs/Dialog.ts +1 -1
  126. package/front_end/ui/components/dialogs/ShortcutDialog.ts +1 -0
  127. package/front_end/ui/components/diff_view/DiffView.ts +1 -1
  128. package/front_end/ui/components/expandable_list/ExpandableList.ts +1 -1
  129. package/front_end/ui/components/highlighting/HighlightElement.ts +1 -0
  130. package/front_end/ui/components/highlighting/MarkupHighlight.ts +162 -0
  131. package/front_end/ui/components/highlighting/highlighting.ts +7 -0
  132. package/front_end/ui/components/icon_button/FileSourceIcon.ts +1 -1
  133. package/front_end/ui/components/icon_button/Icon.ts +4 -2
  134. package/front_end/ui/components/icon_button/IconButton.ts +1 -1
  135. package/front_end/ui/components/issue_counter/IssueCounter.ts +1 -1
  136. package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +1 -1
  137. package/front_end/ui/components/legacy_wrapper/LegacyWrapper.ts +1 -1
  138. package/front_end/ui/components/linkifier/LinkifierImpl.ts +1 -1
  139. package/front_end/ui/components/list/List.ts +184 -0
  140. package/front_end/ui/components/list/list.css +90 -0
  141. package/front_end/ui/components/{cards/cards.ts → list/lists.ts} +3 -3
  142. package/front_end/ui/components/markdown_view/CodeBlock.ts +1 -1
  143. package/front_end/ui/components/markdown_view/MarkdownImage.ts +1 -1
  144. package/front_end/ui/components/markdown_view/MarkdownLink.ts +1 -1
  145. package/front_end/ui/components/markdown_view/MarkdownView.ts +1 -1
  146. package/front_end/ui/components/menus/Menu.ts +1 -1
  147. package/front_end/ui/components/menus/SelectMenu.ts +1 -1
  148. package/front_end/ui/components/node_text/NodeText.ts +1 -1
  149. package/front_end/ui/components/panel_feedback/FeedbackButton.ts +1 -1
  150. package/front_end/ui/components/panel_feedback/PanelFeedback.ts +1 -1
  151. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +1 -1
  152. package/front_end/ui/components/panel_introduction_steps/PanelIntroductionSteps.ts +1 -1
  153. package/front_end/ui/components/report_view/ReportView.ts +1 -1
  154. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -1
  155. package/front_end/ui/components/settings/SettingCheckbox.ts +1 -1
  156. package/front_end/ui/components/settings/SettingDeprecationWarning.ts +1 -1
  157. package/front_end/ui/components/snackbars/Snackbar.ts +1 -1
  158. package/front_end/ui/components/spinners/Spinner.ts +1 -1
  159. package/front_end/ui/components/srgb_overlay/SrgbOverlay.ts +1 -1
  160. package/front_end/ui/components/suggestion_input/SuggestionInput.ts +1 -0
  161. package/front_end/ui/components/survey_link/SurveyLink.ts +1 -1
  162. package/front_end/ui/components/switch/SwitchImpl.ts +1 -1
  163. package/front_end/ui/components/text_editor/TextEditor.ts +1 -0
  164. package/front_end/ui/components/text_prompt/TextPrompt.ts +1 -1
  165. package/front_end/ui/components/tooltips/Tooltip.ts +1 -1
  166. package/front_end/ui/components/tree_outline/TreeOutline.ts +1 -1
  167. package/front_end/ui/kit/kit.ts +5 -0
  168. package/front_end/ui/legacy/TabbedPane.ts +98 -0
  169. package/front_end/ui/legacy/UIUtils.ts +0 -184
  170. package/front_end/ui/legacy/ViewManager.ts +23 -8
  171. package/front_end/ui/legacy/ViewRegistration.ts +21 -22
  172. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +5 -4
  173. package/front_end/ui/legacy/components/perf_ui/LineLevelProfile.ts +73 -35
  174. package/front_end/ui/legacy/components/perf_ui/LiveHeapProfile.ts +11 -2
  175. package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +12 -13
  176. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +7 -16
  177. package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +5 -6
  178. package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +18 -65
  179. package/front_end/ui/legacy/components/source_frame/JSONView.ts +2 -1
  180. package/front_end/ui/legacy/tabbedPane.css +10 -0
  181. package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
  182. package/inspector_overlay/README.md +3 -3
  183. package/mcp/HostBindings.ts +310 -0
  184. package/mcp/mcp.ts +17 -0
  185. package/mcp/tsconfig.json +6 -1
  186. package/package.json +26 -24
  187. /package/front_end/ui/{components → kit}/cards/Card.ts +0 -0
  188. /package/front_end/ui/{components → kit}/cards/card.css +0 -0
@@ -37,7 +37,7 @@ export interface LayoutProperties {
37
37
  isFlex: boolean;
38
38
  isGrid: boolean;
39
39
  isSubgrid: boolean;
40
- isMasonry: boolean;
40
+ isGridLanes: boolean;
41
41
  isContainer: boolean;
42
42
  hasScroll: boolean;
43
43
  }
@@ -52,8 +52,8 @@ export class CSSModel extends SDKModel<EventTypes> {
52
52
  readonly #styleLoader: ComputedStyleLoader;
53
53
  readonly #stylePollingThrottler = new Common.Throttler.Throttler(StylePollingInterval);
54
54
  readonly #styleSheetIdsForURL =
55
- new Map<Platform.DevToolsPath.UrlString, Map<string, Set<Protocol.CSS.StyleSheetId>>>();
56
- readonly #styleSheetIdToHeader = new Map<Protocol.CSS.StyleSheetId, CSSStyleSheetHeader>();
55
+ new Map<Platform.DevToolsPath.UrlString, Map<string, Set<Protocol.DOM.StyleSheetId>>>();
56
+ readonly #styleSheetIdToHeader = new Map<Protocol.DOM.StyleSheetId, CSSStyleSheetHeader>();
57
57
  #cachedMatchedCascadeNode: DOMNode|null = null;
58
58
  #cachedMatchedCascadePromise: Promise<CSSMatchedStyles|null>|null = null;
59
59
  #cssPropertyTracker: CSSPropertyTracker|null = null;
@@ -183,7 +183,7 @@ export class CSSModel extends SDKModel<EventTypes> {
183
183
  }
184
184
 
185
185
  async setStyleText(
186
- styleSheetId: Protocol.CSS.StyleSheetId, range: TextUtils.TextRange.TextRange, text: string,
186
+ styleSheetId: Protocol.DOM.StyleSheetId, range: TextUtils.TextRange.TextRange, text: string,
187
187
  majorChange: boolean): Promise<boolean> {
188
188
  try {
189
189
  await this.ensureOriginalStyleSheetText(styleSheetId);
@@ -204,7 +204,7 @@ export class CSSModel extends SDKModel<EventTypes> {
204
204
  }
205
205
  }
206
206
 
207
- async setSelectorText(styleSheetId: Protocol.CSS.StyleSheetId, range: TextUtils.TextRange.TextRange, text: string):
207
+ async setSelectorText(styleSheetId: Protocol.DOM.StyleSheetId, range: TextUtils.TextRange.TextRange, text: string):
208
208
  Promise<boolean> {
209
209
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.StyleRuleEdited);
210
210
 
@@ -226,7 +226,7 @@ export class CSSModel extends SDKModel<EventTypes> {
226
226
  }
227
227
 
228
228
  async setPropertyRulePropertyName(
229
- styleSheetId: Protocol.CSS.StyleSheetId, range: TextUtils.TextRange.TextRange, text: string): Promise<boolean> {
229
+ styleSheetId: Protocol.DOM.StyleSheetId, range: TextUtils.TextRange.TextRange, text: string): Promise<boolean> {
230
230
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.StyleRuleEdited);
231
231
 
232
232
  try {
@@ -247,7 +247,7 @@ export class CSSModel extends SDKModel<EventTypes> {
247
247
  }
248
248
  }
249
249
 
250
- async setKeyframeKey(styleSheetId: Protocol.CSS.StyleSheetId, range: TextUtils.TextRange.TextRange, text: string):
250
+ async setKeyframeKey(styleSheetId: Protocol.DOM.StyleSheetId, range: TextUtils.TextRange.TextRange, text: string):
251
251
  Promise<boolean> {
252
252
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.StyleRuleEdited);
253
253
 
@@ -367,7 +367,7 @@ export class CSSModel extends SDKModel<EventTypes> {
367
367
  return await CSSMatchedStyles.create(payload);
368
368
  }
369
369
 
370
- async getClassNames(styleSheetId: Protocol.CSS.StyleSheetId): Promise<string[]> {
370
+ async getClassNames(styleSheetId: Protocol.DOM.StyleSheetId): Promise<string[]> {
371
371
  const {classNames} = await this.agent.invoke_collectClassNames({styleSheetId});
372
372
  return classNames || [];
373
373
  }
@@ -392,7 +392,7 @@ export class CSSModel extends SDKModel<EventTypes> {
392
392
  (styles.get('grid-template-columns')?.startsWith('subgrid') ||
393
393
  styles.get('grid-template-rows')?.startsWith('subgrid'))) ??
394
394
  false;
395
- const isMasonry = display === 'masonry' || display === 'inline-masonry';
395
+ const isGridLanes = display === 'grid-lanes' || display === 'inline-grid-lanes';
396
396
  const containerType = styles.get('container-type');
397
397
  const isContainer = Boolean(containerType) && containerType !== '' && containerType !== 'normal';
398
398
  const hasScroll = Boolean(styles.get('scroll-snap-type')) && styles.get('scroll-snap-type') !== 'none';
@@ -401,7 +401,7 @@ export class CSSModel extends SDKModel<EventTypes> {
401
401
  isFlex,
402
402
  isGrid,
403
403
  isSubgrid,
404
- isMasonry,
404
+ isGridLanes,
405
405
  isContainer,
406
406
  hasScroll,
407
407
  };
@@ -502,7 +502,7 @@ export class CSSModel extends SDKModel<EventTypes> {
502
502
  }
503
503
 
504
504
  async setMediaText(
505
- styleSheetId: Protocol.CSS.StyleSheetId, range: TextUtils.TextRange.TextRange,
505
+ styleSheetId: Protocol.DOM.StyleSheetId, range: TextUtils.TextRange.TextRange,
506
506
  newMediaText: string): Promise<boolean> {
507
507
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.StyleRuleEdited);
508
508
 
@@ -524,7 +524,7 @@ export class CSSModel extends SDKModel<EventTypes> {
524
524
  }
525
525
 
526
526
  async setContainerQueryText(
527
- styleSheetId: Protocol.CSS.StyleSheetId, range: TextUtils.TextRange.TextRange,
527
+ styleSheetId: Protocol.DOM.StyleSheetId, range: TextUtils.TextRange.TextRange,
528
528
  newContainerQueryText: string): Promise<boolean> {
529
529
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.StyleRuleEdited);
530
530
 
@@ -547,7 +547,7 @@ export class CSSModel extends SDKModel<EventTypes> {
547
547
  }
548
548
 
549
549
  async setSupportsText(
550
- styleSheetId: Protocol.CSS.StyleSheetId, range: TextUtils.TextRange.TextRange,
550
+ styleSheetId: Protocol.DOM.StyleSheetId, range: TextUtils.TextRange.TextRange,
551
551
  newSupportsText: string): Promise<boolean> {
552
552
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.StyleRuleEdited);
553
553
 
@@ -569,7 +569,7 @@ export class CSSModel extends SDKModel<EventTypes> {
569
569
  }
570
570
 
571
571
  async setScopeText(
572
- styleSheetId: Protocol.CSS.StyleSheetId, range: TextUtils.TextRange.TextRange,
572
+ styleSheetId: Protocol.DOM.StyleSheetId, range: TextUtils.TextRange.TextRange,
573
573
  newScopeText: string): Promise<boolean> {
574
574
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.StyleRuleEdited);
575
575
 
@@ -590,7 +590,7 @@ export class CSSModel extends SDKModel<EventTypes> {
590
590
  }
591
591
  }
592
592
 
593
- async addRule(styleSheetId: Protocol.CSS.StyleSheetId, ruleText: string, ruleLocation: TextUtils.TextRange.TextRange):
593
+ async addRule(styleSheetId: Protocol.DOM.StyleSheetId, ruleText: string, ruleLocation: TextUtils.TextRange.TextRange):
594
594
  Promise<CSSStyleRule|null> {
595
595
  try {
596
596
  await this.ensureOriginalStyleSheetText(styleSheetId);
@@ -657,7 +657,7 @@ export class CSSModel extends SDKModel<EventTypes> {
657
657
  return this.#fontFaces.get(src);
658
658
  }
659
659
 
660
- styleSheetHeaderForId(id: Protocol.CSS.StyleSheetId): CSSStyleSheetHeader|null {
660
+ styleSheetHeaderForId(id: Protocol.DOM.StyleSheetId): CSSStyleSheetHeader|null {
661
661
  return this.#styleSheetIdToHeader.get(id) || null;
662
662
  }
663
663
 
@@ -665,11 +665,11 @@ export class CSSModel extends SDKModel<EventTypes> {
665
665
  return [...this.#styleSheetIdToHeader.values()];
666
666
  }
667
667
 
668
- fireStyleSheetChanged(styleSheetId: Protocol.CSS.StyleSheetId, edit?: Edit): void {
668
+ fireStyleSheetChanged(styleSheetId: Protocol.DOM.StyleSheetId, edit?: Edit): void {
669
669
  this.dispatchEventToListeners(Events.StyleSheetChanged, {styleSheetId, edit});
670
670
  }
671
671
 
672
- private ensureOriginalStyleSheetText(styleSheetId: Protocol.CSS.StyleSheetId): Promise<string|null> {
672
+ private ensureOriginalStyleSheetText(styleSheetId: Protocol.DOM.StyleSheetId): Promise<string|null> {
673
673
  const header = this.styleSheetHeaderForId(styleSheetId);
674
674
  if (!header) {
675
675
  return Promise.resolve(null);
@@ -732,7 +732,7 @@ export class CSSModel extends SDKModel<EventTypes> {
732
732
  this.dispatchEventToListeners(Events.StyleSheetAdded, styleSheetHeader);
733
733
  }
734
734
 
735
- styleSheetRemoved(id: Protocol.CSS.StyleSheetId): void {
735
+ styleSheetRemoved(id: Protocol.DOM.StyleSheetId): void {
736
736
  const header = this.#styleSheetIdToHeader.get(id);
737
737
  console.assert(Boolean(header));
738
738
  if (!header) {
@@ -760,7 +760,7 @@ export class CSSModel extends SDKModel<EventTypes> {
760
760
  this.dispatchEventToListeners(Events.StyleSheetRemoved, header);
761
761
  }
762
762
 
763
- getStyleSheetIdsForURL(url: Platform.DevToolsPath.UrlString): Protocol.CSS.StyleSheetId[] {
763
+ getStyleSheetIdsForURL(url: Platform.DevToolsPath.UrlString): Protocol.DOM.StyleSheetId[] {
764
764
  const frameIdToStyleSheetIds = this.#styleSheetIdsForURL.get(url);
765
765
  if (!frameIdToStyleSheetIds) {
766
766
  return [];
@@ -773,7 +773,7 @@ export class CSSModel extends SDKModel<EventTypes> {
773
773
  return result;
774
774
  }
775
775
 
776
- async setStyleSheetText(styleSheetId: Protocol.CSS.StyleSheetId, newText: string, majorChange: boolean):
776
+ async setStyleSheetText(styleSheetId: Protocol.DOM.StyleSheetId, newText: string, majorChange: boolean):
777
777
  Promise<string|null> {
778
778
  const header = this.#styleSheetIdToHeader.get(styleSheetId);
779
779
  if (!header) {
@@ -799,7 +799,7 @@ export class CSSModel extends SDKModel<EventTypes> {
799
799
  return null;
800
800
  }
801
801
 
802
- async getStyleSheetText(styleSheetId: Protocol.CSS.StyleSheetId): Promise<string|null> {
802
+ async getStyleSheetText(styleSheetId: Protocol.DOM.StyleSheetId): Promise<string|null> {
803
803
  const response = await this.agent.invoke_getStyleSheetText({styleSheetId});
804
804
  if (response.getError()) {
805
805
  return null;
@@ -953,7 +953,7 @@ export enum Events {
953
953
  }
954
954
 
955
955
  export interface StyleSheetChangedEvent {
956
- styleSheetId: Protocol.CSS.StyleSheetId;
956
+ styleSheetId: Protocol.DOM.StyleSheetId;
957
957
  edit?: Edit;
958
958
  }
959
959
 
@@ -999,7 +999,7 @@ export class Edit {
999
999
 
1000
1000
  export class CSSLocation {
1001
1001
  readonly #cssModel: CSSModel;
1002
- styleSheetId: Protocol.CSS.StyleSheetId;
1002
+ styleSheetId: Protocol.DOM.StyleSheetId;
1003
1003
  url: Platform.DevToolsPath.UrlString;
1004
1004
  lineNumber: number;
1005
1005
  columnNumber: number;
@@ -1075,25 +1075,25 @@ export class CustomFunctionMatcher extends matcherBase(CustomFunctionMatch) {
1075
1075
  export const enum LayoutType {
1076
1076
  FLEX = 'flex',
1077
1077
  GRID = 'grid',
1078
- MASONRY = 'masonry'
1078
+ GRID_LANES = 'grid-lanes',
1079
1079
  }
1080
1080
 
1081
- export class FlexGridMasonryMatch implements Match {
1081
+ export class FlexGridGridLanesMatch implements Match {
1082
1082
  constructor(readonly text: string, readonly node: CodeMirror.SyntaxNode, readonly layoutType: LayoutType) {
1083
1083
  }
1084
1084
  }
1085
1085
 
1086
1086
  // clang-format off
1087
- export class FlexGridMasonryMatcher extends matcherBase(FlexGridMasonryMatch) {
1087
+ export class FlexGridGridLanesMatcher extends matcherBase(FlexGridGridLanesMatch) {
1088
1088
  // clang-format on
1089
1089
  static readonly FLEX = ['flex', 'inline-flex', 'block flex', 'inline flex'];
1090
1090
  static readonly GRID = ['grid', 'inline-grid', 'block grid', 'inline grid'];
1091
- static readonly MASONRY = ['masonry', 'inline-masonry', 'block masonry', 'inline masonry'];
1091
+ static readonly GRID_LANES = ['grid-lanes', 'inline-grid-lanes', 'block grid-lanes', 'inline grid-lanes'];
1092
1092
  override accepts(propertyName: string): boolean {
1093
1093
  return propertyName === 'display';
1094
1094
  }
1095
1095
 
1096
- override matches(node: CodeMirror.SyntaxNode, matching: BottomUpTreeMatching): FlexGridMasonryMatch|null {
1096
+ override matches(node: CodeMirror.SyntaxNode, matching: BottomUpTreeMatching): FlexGridGridLanesMatch|null {
1097
1097
  if (node.name !== 'Declaration') {
1098
1098
  return null;
1099
1099
  }
@@ -1105,14 +1105,14 @@ export class FlexGridMasonryMatcher extends matcherBase(FlexGridMasonryMatch) {
1105
1105
  .map(node => matching.getComputedText(node).trim())
1106
1106
  .filter(value => value);
1107
1107
  const text = values.join(' ');
1108
- if (FlexGridMasonryMatcher.FLEX.includes(text)) {
1109
- return new FlexGridMasonryMatch(matching.ast.text(node), node, LayoutType.FLEX);
1108
+ if (FlexGridGridLanesMatcher.FLEX.includes(text)) {
1109
+ return new FlexGridGridLanesMatch(matching.ast.text(node), node, LayoutType.FLEX);
1110
1110
  }
1111
- if (FlexGridMasonryMatcher.GRID.includes(text)) {
1112
- return new FlexGridMasonryMatch(matching.ast.text(node), node, LayoutType.GRID);
1111
+ if (FlexGridGridLanesMatcher.GRID.includes(text)) {
1112
+ return new FlexGridGridLanesMatch(matching.ast.text(node), node, LayoutType.GRID);
1113
1113
  }
1114
- if (FlexGridMasonryMatcher.MASONRY.includes(text)) {
1115
- return new FlexGridMasonryMatch(matching.ast.text(node), node, LayoutType.MASONRY);
1114
+ if (FlexGridGridLanesMatcher.GRID_LANES.includes(text)) {
1115
+ return new FlexGridGridLanesMatch(matching.ast.text(node), node, LayoutType.GRID_LANES);
1116
1116
  }
1117
1117
  return null;
1118
1118
  }
@@ -14,7 +14,7 @@ type CSSQueryPayload =
14
14
  export abstract class CSSQuery {
15
15
  text = '';
16
16
  range?: TextUtils.TextRange.TextRange|null;
17
- styleSheetId?: Protocol.CSS.StyleSheetId;
17
+ styleSheetId?: Protocol.DOM.StyleSheetId;
18
18
  protected cssModel: CSSModel;
19
19
 
20
20
  constructor(cssModel: CSSModel) {
@@ -17,7 +17,7 @@ import type {CSSStyleSheetHeader} from './CSSStyleSheetHeader.js';
17
17
  import {CSSSupports} from './CSSSupports.js';
18
18
 
19
19
  function styleSheetHeaderForRule(
20
- cssModel: CSSModel, {styleSheetId}: {styleSheetId?: Protocol.CSS.StyleSheetId}): CSSStyleSheetHeader|null {
20
+ cssModel: CSSModel, {styleSheetId}: {styleSheetId?: Protocol.DOM.StyleSheetId}): CSSStyleSheetHeader|null {
21
21
  return styleSheetId && cssModel.styleSheetHeaderForId(styleSheetId) || null;
22
22
  }
23
23
 
@@ -143,7 +143,7 @@ export class CSSStyleRule extends CSSRule {
143
143
  selectors: [{text: selectorText, value: undefined}],
144
144
  },
145
145
  style: {
146
- styleSheetId: '0' as Protocol.CSS.StyleSheetId,
146
+ styleSheetId: '0' as Protocol.DOM.StyleSheetId,
147
147
  range: new TextUtils.TextRange.TextRange(0, 0, 0, 0),
148
148
  shorthandEntries: [],
149
149
  cssProperties: [],
@@ -15,7 +15,7 @@ export class CSSStyleDeclaration {
15
15
  readonly #cssModel: CSSModel;
16
16
  parentRule: CSSRule|null;
17
17
  #allProperties: CSSProperty[] = [];
18
- styleSheetId?: Protocol.CSS.StyleSheetId;
18
+ styleSheetId?: Protocol.DOM.StyleSheetId;
19
19
  range: TextUtils.TextRange.TextRange|null = null;
20
20
  cssText?: string;
21
21
  #shorthandValues = new Map<string, string>();
@@ -30,7 +30,7 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
30
30
 
31
31
  export class CSSStyleSheetHeader implements TextUtils.ContentProvider.ContentProvider, FrameAssociated {
32
32
  #cssModel: CSSModel;
33
- id: Protocol.CSS.StyleSheetId;
33
+ id: Protocol.DOM.StyleSheetId;
34
34
  frameId: Protocol.Page.FrameId;
35
35
  sourceURL: Platform.DevToolsPath.UrlString;
36
36
  hasSourceURL: boolean;
@@ -1800,6 +1800,9 @@ class DOMDispatcher implements ProtocolProxyApi.DOMDispatcher {
1800
1800
  constructor(domModel: DOMModel) {
1801
1801
  this.#domModel = domModel;
1802
1802
  }
1803
+ adoptedStyleSheetsModified(_params: Protocol.DOM.AdoptedStyleSheetsModifiedEvent): void {
1804
+ // TODO: implementation
1805
+ }
1803
1806
 
1804
1807
  documentUpdated(): void {
1805
1808
  this.#domModel.documentUpdated();
@@ -6,7 +6,6 @@ import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
6
6
  import * as Protocol from '../../generated/protocol.js';
7
7
  import * as TextUtils from '../../models/text_utils/text_utils.js';
8
8
  import * as Common from '../common/common.js';
9
- import * as Host from '../host/host.js';
10
9
  import * as i18n from '../i18n/i18n.js';
11
10
  import * as Platform from '../platform/platform.js';
12
11
  import * as Root from '../root/root.js';
@@ -1404,7 +1403,11 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
1404
1403
  sendBufferSize: event.options.sendBufferSize,
1405
1404
  receiveBufferSize: event.options.receiveBufferSize,
1406
1405
  dnsQueryType: event.options.dnsQueryType,
1407
- }
1406
+ multicastLoopback: event.options.multicastLoopback,
1407
+ multicastTimeToLive: event.options.multicastTimeToLive,
1408
+ multicastAllowAddressSharing: event.options.multicastAllowAddressSharing,
1409
+ },
1410
+ joinedMulticastGroups: new Set(),
1408
1411
  };
1409
1412
  networkRequest.setResourceType(Common.ResourceType.resourceTypes.DirectSocket);
1410
1413
  networkRequest.setIssueTime(event.timestamp, event.timestamp);
@@ -1502,10 +1505,28 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
1502
1505
  this.updateNetworkRequest(networkRequest);
1503
1506
  }
1504
1507
 
1505
- directUDPSocketJoinedMulticastGroup(_event: Protocol.Network.DirectUDPSocketJoinedMulticastGroupEvent): void {
1508
+ directUDPSocketJoinedMulticastGroup(event: Protocol.Network.DirectUDPSocketJoinedMulticastGroupEvent): void {
1509
+ const networkRequest = this.#requestsById.get(event.identifier);
1510
+ if (!networkRequest?.directSocketInfo) {
1511
+ return;
1512
+ }
1513
+ if (!networkRequest.directSocketInfo.joinedMulticastGroups) {
1514
+ networkRequest.directSocketInfo.joinedMulticastGroups = new Set();
1515
+ }
1516
+ if (!networkRequest.directSocketInfo.joinedMulticastGroups.has(event.IPAddress)) {
1517
+ networkRequest.directSocketInfo.joinedMulticastGroups.add(event.IPAddress);
1518
+ this.updateNetworkRequest(networkRequest);
1519
+ }
1506
1520
  }
1507
1521
 
1508
- directUDPSocketLeftMulticastGroup(_event: Protocol.Network.DirectUDPSocketLeftMulticastGroupEvent): void {
1522
+ directUDPSocketLeftMulticastGroup(event: Protocol.Network.DirectUDPSocketLeftMulticastGroupEvent): void {
1523
+ const networkRequest = this.#requestsById.get(event.identifier);
1524
+ if (!networkRequest?.directSocketInfo?.joinedMulticastGroups) {
1525
+ return;
1526
+ }
1527
+ if (networkRequest.directSocketInfo.joinedMulticastGroups.delete(event.IPAddress)) {
1528
+ this.updateNetworkRequest(networkRequest);
1529
+ }
1509
1530
  }
1510
1531
 
1511
1532
  trustTokenOperationDone(event: Protocol.Network.TrustTokenOperationDoneEvent): void {
@@ -1912,8 +1933,10 @@ export class RequestConditions extends Common.ObjectWrapper.ObjectWrapper<Reques
1912
1933
  promises.push(agent.invoke_overrideNetworkState({
1913
1934
  offline,
1914
1935
  latency: globalConditions?.latency ?? 0,
1915
- downloadThroughput: !globalConditions || globalConditions.download < 0 ? 0 : globalConditions.download,
1916
- uploadThroughput: !globalConditions || globalConditions.upload < 0 ? 0 : globalConditions.upload,
1936
+ downloadThroughput: globalConditions?.download ?? -1,
1937
+ uploadThroughput: globalConditions?.upload ?? -1,
1938
+ connectionType: globalConditions ? NetworkManager.connectionType(globalConditions) :
1939
+ Protocol.Network.ConnectionType.None,
1917
1940
  }));
1918
1941
  }
1919
1942
 
@@ -2307,31 +2330,6 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
2307
2330
  return certificate.tableNames;
2308
2331
  }
2309
2332
 
2310
- async loadResource(url: Platform.DevToolsPath.UrlString): Promise<{
2311
- success: boolean,
2312
- content: string,
2313
- errorDescription: Host.ResourceLoader.LoadErrorDescription,
2314
- }> {
2315
- const headers: Record<string, string> = {};
2316
-
2317
- const currentUserAgent = this.currentUserAgent();
2318
- if (currentUserAgent) {
2319
- headers['User-Agent'] = currentUserAgent;
2320
- }
2321
-
2322
- if (Common.Settings.Settings.instance().moduleSetting('cache-disabled').get()) {
2323
- headers['Cache-Control'] = 'no-cache';
2324
- }
2325
-
2326
- const allowRemoteFilePaths =
2327
- Common.Settings.Settings.instance().moduleSetting('network.enable-remote-file-loading').get();
2328
-
2329
- return await new Promise(
2330
- resolve => Host.ResourceLoader.load(url, headers, (success, _responseHeaders, content, errorDescription) => {
2331
- resolve({success, content, errorDescription});
2332
- }, allowRemoteFilePaths));
2333
- }
2334
-
2335
2333
  appliedRequestConditions(requestInternal: NetworkRequest): AppliedNetworkConditions|undefined {
2336
2334
  if (!requestInternal.appliedNetworkConditionsId) {
2337
2335
  return undefined;
@@ -2215,6 +2215,9 @@ export interface DirectSocketCreateOptions {
2215
2215
  sendBufferSize?: number;
2216
2216
  receiveBufferSize?: number;
2217
2217
  dnsQueryType?: Protocol.Network.DirectSocketDnsQueryType;
2218
+ multicastLoopback?: boolean;
2219
+ multicastTimeToLive?: number;
2220
+ multicastAllowAddressSharing?: boolean;
2218
2221
  }
2219
2222
 
2220
2223
  export interface DirectSocketOpenInfo {
@@ -2230,6 +2233,7 @@ export interface DirectSocketInfo {
2230
2233
  errorMessage?: string;
2231
2234
  createOptions: DirectSocketCreateOptions;
2232
2235
  openInfo?: DirectSocketOpenInfo;
2236
+ joinedMulticastGroups?: Set<string>;
2233
2237
  }
2234
2238
 
2235
2239
  export interface DirectSocketChunk {
@@ -784,7 +784,7 @@ export class OverlayModel extends SDKModel<EventTypes> implements ProtocolProxyA
784
784
  export class WindowControls {
785
785
  readonly #cssModel: CSSModel;
786
786
  #originalStylesheetText: string|undefined;
787
- #stylesheetId?: Protocol.CSS.StyleSheetId;
787
+ #stylesheetId?: Protocol.DOM.StyleSheetId;
788
788
  #currentUrl: Platform.DevToolsPath.UrlString|undefined;
789
789
 
790
790
  #config: Protocol.Overlay.WindowControlsOverlayConfig = {
@@ -874,7 +874,7 @@ export class WindowControls {
874
874
  return header?.sourceURL;
875
875
  }
876
876
 
877
- #fetchCurrentStyleSheet(cssSourceUrl: Platform.DevToolsPath.UrlString): Protocol.CSS.StyleSheetId|undefined {
877
+ #fetchCurrentStyleSheet(cssSourceUrl: Platform.DevToolsPath.UrlString): Protocol.DOM.StyleSheetId|undefined {
878
878
  const stylesheetIds = this.#cssModel.getStyleSheetIdsForURL(cssSourceUrl);
879
879
  return stylesheetIds.length > 0 ? stylesheetIds[0] : undefined;
880
880
  }
@@ -7,8 +7,8 @@ import * as Common from '../common/common.js';
7
7
  import * as Host from '../host/host.js';
8
8
  import * as i18n from '../i18n/i18n.js';
9
9
  import type * as Platform from '../platform/platform.js';
10
+ import * as Root from '../root/root.js';
10
11
 
11
- import {FrameManager} from './FrameManager.js';
12
12
  import {IOModel} from './IOModel.js';
13
13
  import {MultitargetNetworkManager, NetworkManager} from './NetworkManager.js';
14
14
  import {
@@ -68,7 +68,7 @@ export class ResourceKey {
68
68
  }
69
69
  }
70
70
 
71
- let pageResourceLoader: PageResourceLoader|null = null;
71
+ export type UserAgentProvider = Pick<MultitargetNetworkManager, 'currentUserAgent'>;
72
72
 
73
73
  interface LoadQueueEntry {
74
74
  resolve: () => void;
@@ -81,6 +81,9 @@ interface LoadQueueEntry {
81
81
  * resources were loaded, and whether there was a load error.
82
82
  */
83
83
  export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
84
+ readonly #targetManager: TargetManager;
85
+ readonly #settings: Common.Settings.Settings;
86
+ readonly #userAgentProvider: UserAgentProvider;
84
87
  #currentlyLoading = 0;
85
88
  #currentlyLoadingPerTarget = new Map<Protocol.Target.TargetID|'main', number>();
86
89
  readonly #maxConcurrentLoads: number;
@@ -92,41 +95,51 @@ export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<Event
92
95
  errorDescription: Host.ResourceLoader.LoadErrorDescription,
93
96
  }>)|null;
94
97
  constructor(
98
+ targetManager: TargetManager, settings: Common.Settings.Settings, userAgentProvider: UserAgentProvider,
95
99
  loadOverride: ((arg0: string) => Promise<{
96
100
  success: boolean,
97
101
  content: string,
98
102
  errorDescription: Host.ResourceLoader.LoadErrorDescription,
99
103
  }>)|null,
100
- maxConcurrentLoads: number) {
104
+ maxConcurrentLoads = 500) {
101
105
  super();
106
+ this.#targetManager = targetManager;
107
+ this.#settings = settings;
108
+ this.#userAgentProvider = userAgentProvider;
102
109
  this.#maxConcurrentLoads = maxConcurrentLoads;
103
- TargetManager.instance().addModelListener(
110
+ this.#targetManager.addModelListener(
104
111
  ResourceTreeModel, ResourceTreeModelEvents.PrimaryPageChanged, this.onPrimaryPageChanged, this);
105
112
  this.#loadOverride = loadOverride;
106
113
  }
107
114
 
108
- static instance({forceNew, loadOverride, maxConcurrentLoads}: {
115
+ static instance({forceNew, targetManager, settings, userAgentProvider, loadOverride, maxConcurrentLoads}: {
109
116
  forceNew: boolean,
110
117
  loadOverride: (null|((arg0: string) => Promise<{
111
118
  success: boolean,
112
119
  content: string,
113
120
  errorDescription: Host.ResourceLoader.LoadErrorDescription,
114
121
  }>)),
115
- maxConcurrentLoads: number,
122
+ targetManager?: TargetManager,
123
+ settings?: Common.Settings.Settings,
124
+ userAgentProvider?: UserAgentProvider,
125
+ maxConcurrentLoads?: number,
116
126
  } = {
117
127
  forceNew: false,
118
128
  loadOverride: null,
119
- maxConcurrentLoads: 500,
120
129
  }): PageResourceLoader {
121
- if (!pageResourceLoader || forceNew) {
122
- pageResourceLoader = new PageResourceLoader(loadOverride, maxConcurrentLoads);
130
+ if (forceNew) {
131
+ Root.DevToolsContext.globalInstance().set(
132
+ PageResourceLoader,
133
+ new PageResourceLoader(
134
+ targetManager ?? TargetManager.instance(), settings ?? Common.Settings.Settings.instance(),
135
+ userAgentProvider ?? MultitargetNetworkManager.instance(), loadOverride, maxConcurrentLoads));
123
136
  }
124
137
 
125
- return pageResourceLoader;
138
+ return Root.DevToolsContext.globalInstance().get(PageResourceLoader);
126
139
  }
127
140
 
128
141
  static removeInstance(): void {
129
- pageResourceLoader = null;
142
+ Root.DevToolsContext.globalInstance().delete(PageResourceLoader);
130
143
  }
131
144
 
132
145
  onPrimaryPageChanged(
@@ -159,7 +172,7 @@ export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<Event
159
172
 
160
173
  getScopedResourcesLoaded(): Map<string, PageResource> {
161
174
  return new Map([...this.#pageResources].filter(
162
- ([_, pageResource]) => TargetManager.instance().isInScope(pageResource.initiator.target) ||
175
+ ([_, pageResource]) => this.#targetManager.isInScope(pageResource.initiator.target) ||
163
176
  isExtensionInitiator(pageResource.initiator)));
164
177
  }
165
178
 
@@ -180,11 +193,10 @@ export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<Event
180
193
  loading: number,
181
194
  resources: number,
182
195
  } {
183
- const targetManager = TargetManager.instance();
184
196
  let loadingCount = 0;
185
197
  for (const [targetId, count] of this.#currentlyLoadingPerTarget) {
186
- const target = targetManager.targetById(targetId);
187
- if (targetManager.isInScope(target)) {
198
+ const target = this.#targetManager.targetById(targetId);
199
+ if (this.#targetManager.isInScope(target)) {
188
200
  loadingCount += count;
189
201
  }
190
202
  }
@@ -305,25 +317,15 @@ export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<Event
305
317
  return await this.#loadOverride(url);
306
318
  }
307
319
  const parsedURL = new Common.ParsedURL.ParsedURL(url);
308
- const eligibleForLoadFromTarget = getLoadThroughTargetSetting().get() && parsedURL && parsedURL.scheme !== 'file' &&
309
- parsedURL.scheme !== 'data' && parsedURL.scheme !== 'devtools';
320
+ const eligibleForLoadFromTarget = this.getLoadThroughTargetSetting().get() && parsedURL &&
321
+ parsedURL.scheme !== 'file' && parsedURL.scheme !== 'data' && parsedURL.scheme !== 'devtools' &&
322
+ initiator.target;
310
323
  Host.userMetrics.developerResourceScheme(this.getDeveloperResourceScheme(parsedURL));
311
324
  if (eligibleForLoadFromTarget) {
312
325
  try {
313
- if (initiator.target) {
314
- Host.userMetrics.developerResourceLoaded(
315
- Host.UserMetrics.DeveloperResourceLoaded.LOAD_THROUGH_PAGE_VIA_TARGET);
316
- const result = await this.loadFromTarget(initiator.target, initiator.frameId, url, isBinary);
317
- return result;
318
- }
319
- const frame = FrameManager.instance().getFrame(initiator.frameId);
320
- if (frame) {
321
- Host.userMetrics.developerResourceLoaded(
322
- Host.UserMetrics.DeveloperResourceLoaded.LOAD_THROUGH_PAGE_VIA_FRAME);
323
- const result =
324
- await this.loadFromTarget(frame.resourceTreeModel().target(), initiator.frameId, url, isBinary);
325
- return result;
326
- }
326
+ Host.userMetrics.developerResourceLoaded(Host.UserMetrics.DeveloperResourceLoaded.LOAD_THROUGH_PAGE_VIA_TARGET);
327
+ const result = await this.loadFromTarget(initiator.target, initiator.frameId, url, isBinary);
328
+ return result;
327
329
  } catch (e) {
328
330
  if (e instanceof Error) {
329
331
  Host.userMetrics.developerResourceLoaded(Host.UserMetrics.DeveloperResourceLoaded.LOAD_THROUGH_PAGE_FAILURE);
@@ -339,13 +341,13 @@ export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<Event
339
341
  }
340
342
  Host.userMetrics.developerResourceLoaded(Host.UserMetrics.DeveloperResourceLoaded.LOAD_THROUGH_PAGE_FALLBACK);
341
343
  } else {
342
- const code = getLoadThroughTargetSetting().get() ?
344
+ const code = this.getLoadThroughTargetSetting().get() ?
343
345
  Host.UserMetrics.DeveloperResourceLoaded.FALLBACK_PER_PROTOCOL :
344
346
  Host.UserMetrics.DeveloperResourceLoaded.FALLBACK_PER_OVERRIDE;
345
347
  Host.userMetrics.developerResourceLoaded(code);
346
348
  }
347
349
 
348
- const result = await MultitargetNetworkManager.instance().loadResource(url);
350
+ const result = await this.loadFromHostBindings(url);
349
351
  if (eligibleForLoadFromTarget && !result.success) {
350
352
  Host.userMetrics.developerResourceLoaded(Host.UserMetrics.DeveloperResourceLoaded.FALLBACK_FAILURE);
351
353
  }
@@ -395,7 +397,7 @@ export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<Event
395
397
  }> {
396
398
  const networkManager = (target.model(NetworkManager) as NetworkManager);
397
399
  const ioModel = (target.model(IOModel) as IOModel);
398
- const disableCache = Common.Settings.Settings.instance().moduleSetting('cache-disabled').get();
400
+ const disableCache = this.#settings.moduleSetting('cache-disabled').get();
399
401
  const resource = await networkManager.loadNetworkResource(frameId, url, {disableCache, includeCredentials: true});
400
402
  try {
401
403
  const content = resource.stream ?
@@ -420,10 +422,34 @@ export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<Event
420
422
  }
421
423
  }
422
424
  }
423
- }
424
425
 
425
- export function getLoadThroughTargetSetting(): Common.Settings.Setting<boolean> {
426
- return Common.Settings.Settings.instance().createSetting('load-through-target', true);
426
+ private async loadFromHostBindings(url: Platform.DevToolsPath.UrlString): Promise<{
427
+ success: boolean,
428
+ content: string,
429
+ errorDescription: Host.ResourceLoader.LoadErrorDescription,
430
+ }> {
431
+ const headers: Record<string, string> = {};
432
+
433
+ const currentUserAgent = this.#userAgentProvider.currentUserAgent();
434
+ if (currentUserAgent) {
435
+ headers['User-Agent'] = currentUserAgent;
436
+ }
437
+
438
+ if (this.#settings.moduleSetting('cache-disabled').get()) {
439
+ headers['Cache-Control'] = 'no-cache';
440
+ }
441
+
442
+ const allowRemoteFilePaths = this.#settings.moduleSetting('network.enable-remote-file-loading').get();
443
+
444
+ return await new Promise(
445
+ resolve => Host.ResourceLoader.load(url, headers, (success, _responseHeaders, content, errorDescription) => {
446
+ resolve({success, content, errorDescription});
447
+ }, allowRemoteFilePaths));
448
+ }
449
+
450
+ getLoadThroughTargetSetting(): Common.Settings.Setting<boolean> {
451
+ return this.#settings.createSetting('load-through-target', true);
452
+ }
427
453
  }
428
454
 
429
455
  export const enum Events {
@@ -779,6 +779,12 @@ export class SourceMap {
779
779
  return this.#scopesInfo?.findOriginalFunctionName(position) ?? null;
780
780
  }
781
781
 
782
+ findOriginalFunctionScope(position: ScopesCodec.Position):
783
+ {scope: ScopesCodec.OriginalScope, url?: Platform.DevToolsPath.UrlString}|null {
784
+ this.#ensureSourceMapProcessed();
785
+ return this.#scopesInfo?.findOriginalFunctionScope(position) ?? null;
786
+ }
787
+
782
788
  isOutlinedFrame(generatedLine: number, generatedColumn: number): boolean {
783
789
  this.#ensureSourceMapProcessed();
784
790
  return this.#scopesInfo?.isOutlinedFrame(generatedLine, generatedColumn) ?? false;