devtools-tracing 1.1.0 → 1.2.0

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 (528) hide show
  1. package/.claude/settings.local.json +14 -0
  2. package/dist/index.d.ts +4 -0
  3. package/dist/index.js +28854 -0
  4. package/package.json +10 -8
  5. package/generate.ts +0 -649
  6. package/index.ts +0 -17
  7. package/lib/extension-api/ExtensionAPI.d.ts +0 -357
  8. package/lib/front_end/core/common/App.ts +0 -7
  9. package/lib/front_end/core/common/AppProvider.ts +0 -32
  10. package/lib/front_end/core/common/Base64.ts +0 -47
  11. package/lib/front_end/core/common/CharacterIdMap.ts +0 -30
  12. package/lib/front_end/core/common/Color.ts +0 -2506
  13. package/lib/front_end/core/common/ColorConverter.ts +0 -402
  14. package/lib/front_end/core/common/ColorUtils.ts +0 -252
  15. package/lib/front_end/core/common/Console.ts +0 -114
  16. package/lib/front_end/core/common/Debouncer.ts +0 -15
  17. package/lib/front_end/core/common/EventTarget.ts +0 -52
  18. package/lib/front_end/core/common/Gzip.ts +0 -74
  19. package/lib/front_end/core/common/JavaScriptMetaData.ts +0 -29
  20. package/lib/front_end/core/common/Lazy.ts +0 -31
  21. package/lib/front_end/core/common/Linkifier.ts +0 -55
  22. package/lib/front_end/core/common/MapWithDefault.ts +0 -26
  23. package/lib/front_end/core/common/Mutex.ts +0 -55
  24. package/lib/front_end/core/common/Object.ts +0 -145
  25. package/lib/front_end/core/common/ParsedURL.ts +0 -554
  26. package/lib/front_end/core/common/Progress.ts +0 -180
  27. package/lib/front_end/core/common/QueryParamHandler.ts +0 -7
  28. package/lib/front_end/core/common/ResolverBase.ts +0 -85
  29. package/lib/front_end/core/common/ResourceType.ts +0 -588
  30. package/lib/front_end/core/common/ReturnToPanel.ts +0 -17
  31. package/lib/front_end/core/common/Revealer.ts +0 -192
  32. package/lib/front_end/core/common/Runnable.ts +0 -41
  33. package/lib/front_end/core/common/SegmentedRange.ts +0 -87
  34. package/lib/front_end/core/common/SettingRegistration.ts +0 -339
  35. package/lib/front_end/core/common/Settings.ts +0 -1497
  36. package/lib/front_end/core/common/SimpleHistoryManager.ts +0 -124
  37. package/lib/front_end/core/common/StringOutputStream.ts +0 -26
  38. package/lib/front_end/core/common/TextDictionary.ts +0 -48
  39. package/lib/front_end/core/common/Throttler.ts +0 -99
  40. package/lib/front_end/core/common/Trie.ts +0 -152
  41. package/lib/front_end/core/common/Worker.ts +0 -60
  42. package/lib/front_end/core/common/common.ts +0 -81
  43. package/lib/front_end/core/host/AidaClient.ts +0 -733
  44. package/lib/front_end/core/host/GdpClient.ts +0 -316
  45. package/lib/front_end/core/host/InspectorFrontendHost.ts +0 -648
  46. package/lib/front_end/core/host/InspectorFrontendHostAPI.ts +0 -551
  47. package/lib/front_end/core/host/Platform.ts +0 -76
  48. package/lib/front_end/core/host/ResourceLoader.ts +0 -282
  49. package/lib/front_end/core/host/UserMetrics.ts +0 -1230
  50. package/lib/front_end/core/host/host.ts +0 -23
  51. package/lib/front_end/core/i18n/ByteUtilities.ts +0 -82
  52. package/lib/front_end/core/i18n/DevToolsLocale.ts +0 -87
  53. package/lib/front_end/core/i18n/NumberFormatter.ts +0 -82
  54. package/lib/front_end/core/i18n/i18n.ts +0 -17
  55. package/lib/front_end/core/i18n/i18nImpl.ts +0 -204
  56. package/lib/front_end/core/i18n/i18nTypes.ts +0 -10
  57. package/lib/front_end/core/i18n/locales.js +0 -14
  58. package/lib/front_end/core/i18n/time-utilities.ts +0 -174
  59. package/lib/front_end/core/platform/ArrayUtilities.ts +0 -271
  60. package/lib/front_end/core/platform/Brand.ts +0 -23
  61. package/lib/front_end/core/platform/Constructor.ts +0 -10
  62. package/lib/front_end/core/platform/DOMUtilities.ts +0 -138
  63. package/lib/front_end/core/platform/DateUtilities.ts +0 -15
  64. package/lib/front_end/core/platform/DevToolsPath.ts +0 -53
  65. package/lib/front_end/core/platform/KeyboardUtilities.ts +0 -38
  66. package/lib/front_end/core/platform/MapUtilities.ts +0 -95
  67. package/lib/front_end/core/platform/MimeType.ts +0 -175
  68. package/lib/front_end/core/platform/NumberUtilities.ts +0 -80
  69. package/lib/front_end/core/platform/StringUtilities.ts +0 -588
  70. package/lib/front_end/core/platform/Timing.ts +0 -17
  71. package/lib/front_end/core/platform/TypedArrayUtilities.ts +0 -189
  72. package/lib/front_end/core/platform/TypescriptUtilities.ts +0 -86
  73. package/lib/front_end/core/platform/UIString.ts +0 -39
  74. package/lib/front_end/core/platform/UserVisibleError.ts +0 -28
  75. package/lib/front_end/core/platform/platform.ts +0 -45
  76. package/lib/front_end/core/protocol_client/ConnectionTransport.ts +0 -26
  77. package/lib/front_end/core/protocol_client/InspectorBackend.ts +0 -1050
  78. package/lib/front_end/core/protocol_client/NodeURL.ts +0 -42
  79. package/lib/front_end/core/protocol_client/protocol_client.ts +0 -13
  80. package/lib/front_end/core/root/Runtime.ts +0 -609
  81. package/lib/front_end/core/root/root.ts +0 -6
  82. package/lib/front_end/core/sdk/AccessibilityModel.ts +0 -353
  83. package/lib/front_end/core/sdk/AnimationModel.ts +0 -1041
  84. package/lib/front_end/core/sdk/AutofillModel.ts +0 -184
  85. package/lib/front_end/core/sdk/CPUProfilerModel.ts +0 -148
  86. package/lib/front_end/core/sdk/CPUThrottlingManager.ts +0 -282
  87. package/lib/front_end/core/sdk/CSSContainerQuery.ts +0 -139
  88. package/lib/front_end/core/sdk/CSSFontFace.ts +0 -40
  89. package/lib/front_end/core/sdk/CSSLayer.ts +0 -30
  90. package/lib/front_end/core/sdk/CSSMatchedStyles.ts +0 -1646
  91. package/lib/front_end/core/sdk/CSSMedia.ts +0 -121
  92. package/lib/front_end/core/sdk/CSSMetadata.ts +0 -1647
  93. package/lib/front_end/core/sdk/CSSModel.ts +0 -1128
  94. package/lib/front_end/core/sdk/CSSProperty.ts +0 -384
  95. package/lib/front_end/core/sdk/CSSPropertyParser.ts +0 -681
  96. package/lib/front_end/core/sdk/CSSPropertyParserMatchers.ts +0 -1395
  97. package/lib/front_end/core/sdk/CSSQuery.ts +0 -72
  98. package/lib/front_end/core/sdk/CSSRule.ts +0 -465
  99. package/lib/front_end/core/sdk/CSSScope.ts +0 -30
  100. package/lib/front_end/core/sdk/CSSStartingStyle.ts +0 -29
  101. package/lib/front_end/core/sdk/CSSStyleDeclaration.ts +0 -313
  102. package/lib/front_end/core/sdk/CSSStyleSheetHeader.ts +0 -196
  103. package/lib/front_end/core/sdk/CSSSupports.ts +0 -33
  104. package/lib/front_end/core/sdk/CategorizedBreakpoint.ts +0 -64
  105. package/lib/front_end/core/sdk/ChildTargetManager.ts +0 -314
  106. package/lib/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +0 -62
  107. package/lib/front_end/core/sdk/Connections.ts +0 -293
  108. package/lib/front_end/core/sdk/ConsoleModel.ts +0 -808
  109. package/lib/front_end/core/sdk/ConsoleModelTypes.ts +0 -15
  110. package/lib/front_end/core/sdk/Cookie.ts +0 -319
  111. package/lib/front_end/core/sdk/CookieModel.ts +0 -239
  112. package/lib/front_end/core/sdk/CookieParser.ts +0 -185
  113. package/lib/front_end/core/sdk/DOMDebuggerModel.ts +0 -787
  114. package/lib/front_end/core/sdk/DOMModel.ts +0 -1961
  115. package/lib/front_end/core/sdk/DebuggerModel.ts +0 -1605
  116. package/lib/front_end/core/sdk/EmulationModel.ts +0 -648
  117. package/lib/front_end/core/sdk/EnhancedTracesParser.ts +0 -515
  118. package/lib/front_end/core/sdk/EventBreakpointsModel.ts +0 -183
  119. package/lib/front_end/core/sdk/FrameAssociated.ts +0 -11
  120. package/lib/front_end/core/sdk/FrameManager.ts +0 -259
  121. package/lib/front_end/core/sdk/HeapProfilerModel.ts +0 -225
  122. package/lib/front_end/core/sdk/HttpReasonPhraseStrings.ts +0 -77
  123. package/lib/front_end/core/sdk/IOModel.ts +0 -91
  124. package/lib/front_end/core/sdk/IsolateManager.ts +0 -257
  125. package/lib/front_end/core/sdk/IssuesModel.ts +0 -70
  126. package/lib/front_end/core/sdk/LayerTreeBase.ts +0 -169
  127. package/lib/front_end/core/sdk/LogModel.ts +0 -56
  128. package/lib/front_end/core/sdk/NetworkManager.ts +0 -2823
  129. package/lib/front_end/core/sdk/NetworkRequest.ts +0 -2253
  130. package/lib/front_end/core/sdk/OverlayColorGenerator.ts +0 -52
  131. package/lib/front_end/core/sdk/OverlayModel.ts +0 -1011
  132. package/lib/front_end/core/sdk/OverlayPersistentHighlighter.ts +0 -522
  133. package/lib/front_end/core/sdk/PageLoad.ts +0 -35
  134. package/lib/front_end/core/sdk/PageResourceLoader.ts +0 -435
  135. package/lib/front_end/core/sdk/PaintProfiler.ts +0 -110
  136. package/lib/front_end/core/sdk/PerformanceMetricsModel.ts +0 -84
  137. package/lib/front_end/core/sdk/PreloadingModel.ts +0 -863
  138. package/lib/front_end/core/sdk/RehydratingConnection.ts +0 -386
  139. package/lib/front_end/core/sdk/RehydratingObject.ts +0 -66
  140. package/lib/front_end/core/sdk/RemoteObject.ts +0 -1160
  141. package/lib/front_end/core/sdk/Resource.ts +0 -232
  142. package/lib/front_end/core/sdk/ResourceTreeModel.ts +0 -1160
  143. package/lib/front_end/core/sdk/RuntimeModel.ts +0 -732
  144. package/lib/front_end/core/sdk/SDKModel.ts +0 -65
  145. package/lib/front_end/core/sdk/ScopeTreeCache.ts +0 -45
  146. package/lib/front_end/core/sdk/ScreenCaptureModel.ts +0 -255
  147. package/lib/front_end/core/sdk/Script.ts +0 -534
  148. package/lib/front_end/core/sdk/SecurityOriginManager.ts +0 -76
  149. package/lib/front_end/core/sdk/ServerSentEvents.ts +0 -80
  150. package/lib/front_end/core/sdk/ServerSentEventsProtocol.ts +0 -122
  151. package/lib/front_end/core/sdk/ServerTiming.ts +0 -260
  152. package/lib/front_end/core/sdk/ServiceWorkerCacheModel.ts +0 -377
  153. package/lib/front_end/core/sdk/ServiceWorkerManager.ts +0 -605
  154. package/lib/front_end/core/sdk/SourceMap.ts +0 -867
  155. package/lib/front_end/core/sdk/SourceMapCache.ts +0 -54
  156. package/lib/front_end/core/sdk/SourceMapFunctionRanges.ts +0 -156
  157. package/lib/front_end/core/sdk/SourceMapManager.ts +0 -239
  158. package/lib/front_end/core/sdk/SourceMapScopeChainEntry.ts +0 -189
  159. package/lib/front_end/core/sdk/SourceMapScopesInfo.ts +0 -508
  160. package/lib/front_end/core/sdk/StorageBucketsModel.ts +0 -204
  161. package/lib/front_end/core/sdk/StorageKeyManager.ts +0 -98
  162. package/lib/front_end/core/sdk/Target.ts +0 -332
  163. package/lib/front_end/core/sdk/TargetManager.ts +0 -453
  164. package/lib/front_end/core/sdk/TraceObject.ts +0 -61
  165. package/lib/front_end/core/sdk/WebAuthnModel.ts +0 -104
  166. package/lib/front_end/core/sdk/sdk.ts +0 -174
  167. package/lib/front_end/entrypoints/formatter_worker/FormatterActions.ts +0 -59
  168. package/lib/front_end/generated/InspectorBackendCommands.js +0 -1617
  169. package/lib/front_end/generated/SupportedCSSProperties.js +0 -7512
  170. package/lib/front_end/generated/protocol-proxy-api.d.ts +0 -5022
  171. package/lib/front_end/generated/protocol.ts +0 -22014
  172. package/lib/front_end/models/bindings/CSSWorkspaceBinding.ts +0 -318
  173. package/lib/front_end/models/bindings/CompilerScriptMapping.ts +0 -536
  174. package/lib/front_end/models/bindings/ContentProviderBasedProject.ts +0 -187
  175. package/lib/front_end/models/bindings/DebuggerLanguagePlugins.ts +0 -1197
  176. package/lib/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -733
  177. package/lib/front_end/models/bindings/DefaultScriptMapping.ts +0 -141
  178. package/lib/front_end/models/bindings/FileUtils.ts +0 -228
  179. package/lib/front_end/models/bindings/LiveLocation.ts +0 -81
  180. package/lib/front_end/models/bindings/NetworkProject.ts +0 -157
  181. package/lib/front_end/models/bindings/PresentationConsoleMessageHelper.ts +0 -312
  182. package/lib/front_end/models/bindings/ResourceMapping.ts +0 -539
  183. package/lib/front_end/models/bindings/ResourceScriptMapping.ts +0 -491
  184. package/lib/front_end/models/bindings/ResourceUtils.ts +0 -103
  185. package/lib/front_end/models/bindings/SASSSourceMapping.ts +0 -222
  186. package/lib/front_end/models/bindings/StylesSourceMapping.ts +0 -316
  187. package/lib/front_end/models/bindings/TempFile.ts +0 -67
  188. package/lib/front_end/models/bindings/bindings.ts +0 -39
  189. package/lib/front_end/models/cpu_profile/CPUProfileDataModel.ts +0 -571
  190. package/lib/front_end/models/cpu_profile/ProfileTreeModel.ts +0 -103
  191. package/lib/front_end/models/cpu_profile/cpu_profile.ts +0 -11
  192. package/lib/front_end/models/formatter/FormatterWorkerPool.ts +0 -219
  193. package/lib/front_end/models/formatter/ScriptFormatter.ts +0 -112
  194. package/lib/front_end/models/formatter/formatter.ts +0 -8
  195. package/lib/front_end/models/source_map_scopes/NamesResolver.ts +0 -765
  196. package/lib/front_end/models/source_map_scopes/ScopeChainModel.ts +0 -84
  197. package/lib/front_end/models/source_map_scopes/source_map_scopes.ts +0 -11
  198. package/lib/front_end/models/stack_trace/StackTrace.ts +0 -53
  199. package/lib/front_end/models/stack_trace/StackTraceImpl.ts +0 -85
  200. package/lib/front_end/models/stack_trace/StackTraceModel.ts +0 -128
  201. package/lib/front_end/models/stack_trace/Trie.ts +0 -163
  202. package/lib/front_end/models/stack_trace/stack_trace.ts +0 -9
  203. package/lib/front_end/models/stack_trace/stack_trace_impl.ts +0 -13
  204. package/lib/front_end/models/text_utils/CodeMirrorUtils.ts +0 -37
  205. package/lib/front_end/models/text_utils/ContentData.ts +0 -199
  206. package/lib/front_end/models/text_utils/ContentProvider.ts +0 -68
  207. package/lib/front_end/models/text_utils/StaticContentProvider.ts +0 -49
  208. package/lib/front_end/models/text_utils/StreamingContentData.ts +0 -108
  209. package/lib/front_end/models/text_utils/Text.ts +0 -90
  210. package/lib/front_end/models/text_utils/TextCursor.ts +0 -44
  211. package/lib/front_end/models/text_utils/TextRange.ts +0 -266
  212. package/lib/front_end/models/text_utils/TextUtils.ts +0 -401
  213. package/lib/front_end/models/text_utils/WasmDisassembly.ts +0 -87
  214. package/lib/front_end/models/text_utils/text_utils.ts +0 -27
  215. package/lib/front_end/models/trace/EntityMapper.ts +0 -141
  216. package/lib/front_end/models/trace/EventsSerializer.ts +0 -101
  217. package/lib/front_end/models/trace/LanternComputationData.ts +0 -438
  218. package/lib/front_end/models/trace/ModelImpl.ts +0 -236
  219. package/lib/front_end/models/trace/Name.ts +0 -136
  220. package/lib/front_end/models/trace/Processor.ts +0 -652
  221. package/lib/front_end/models/trace/Styles.ts +0 -1138
  222. package/lib/front_end/models/trace/extras/FilmStrip.ts +0 -78
  223. package/lib/front_end/models/trace/extras/MainThreadActivity.ts +0 -86
  224. package/lib/front_end/models/trace/extras/ScriptDuplication.ts +0 -236
  225. package/lib/front_end/models/trace/extras/StackTraceForEvent.ts +0 -203
  226. package/lib/front_end/models/trace/extras/ThirdParties.ts +0 -164
  227. package/lib/front_end/models/trace/extras/TraceFilter.ts +0 -62
  228. package/lib/front_end/models/trace/extras/TraceTree.ts +0 -701
  229. package/lib/front_end/models/trace/extras/extras.ts +0 -11
  230. package/lib/front_end/models/trace/handlers/AnimationFramesHandler.ts +0 -128
  231. package/lib/front_end/models/trace/handlers/AnimationHandler.ts +0 -36
  232. package/lib/front_end/models/trace/handlers/AsyncJSCallsHandler.ts +0 -239
  233. package/lib/front_end/models/trace/handlers/AuctionWorkletsHandler.ts +0 -183
  234. package/lib/front_end/models/trace/handlers/DOMStatsHandler.ts +0 -31
  235. package/lib/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +0 -306
  236. package/lib/front_end/models/trace/handlers/FlowsHandler.ts +0 -175
  237. package/lib/front_end/models/trace/handlers/FramesHandler.ts +0 -571
  238. package/lib/front_end/models/trace/handlers/GPUHandler.ts +0 -50
  239. package/lib/front_end/models/trace/handlers/ImagePaintingHandler.ts +0 -183
  240. package/lib/front_end/models/trace/handlers/InitiatorsHandler.ts +0 -193
  241. package/lib/front_end/models/trace/handlers/InvalidationsHandler.ts +0 -168
  242. package/lib/front_end/models/trace/handlers/LargestImagePaintHandler.ts +0 -109
  243. package/lib/front_end/models/trace/handlers/LargestTextPaintHandler.ts +0 -35
  244. package/lib/front_end/models/trace/handlers/LayerTreeHandler.ts +0 -123
  245. package/lib/front_end/models/trace/handlers/LayoutShiftsHandler.ts +0 -573
  246. package/lib/front_end/models/trace/handlers/MemoryHandler.ts +0 -31
  247. package/lib/front_end/models/trace/handlers/MetaHandler.ts +0 -525
  248. package/lib/front_end/models/trace/handlers/ModelHandlers.ts +0 -34
  249. package/lib/front_end/models/trace/handlers/NetworkRequestsHandler.ts +0 -672
  250. package/lib/front_end/models/trace/handlers/PageFramesHandler.ts +0 -52
  251. package/lib/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +0 -460
  252. package/lib/front_end/models/trace/handlers/RendererHandler.ts +0 -428
  253. package/lib/front_end/models/trace/handlers/SamplesHandler.ts +0 -271
  254. package/lib/front_end/models/trace/handlers/ScreenshotsHandler.ts +0 -122
  255. package/lib/front_end/models/trace/handlers/ScriptsHandler.ts +0 -336
  256. package/lib/front_end/models/trace/handlers/SelectorStatsHandler.ts +0 -110
  257. package/lib/front_end/models/trace/handlers/Threads.ts +0 -139
  258. package/lib/front_end/models/trace/handlers/UserInteractionsHandler.ts +0 -400
  259. package/lib/front_end/models/trace/handlers/UserTimingsHandler.ts +0 -233
  260. package/lib/front_end/models/trace/handlers/WarningsHandler.ts +0 -162
  261. package/lib/front_end/models/trace/handlers/WorkersHandler.ts +0 -45
  262. package/lib/front_end/models/trace/handlers/handlers.ts +0 -8
  263. package/lib/front_end/models/trace/handlers/helpers.ts +0 -196
  264. package/lib/front_end/models/trace/handlers/types.ts +0 -75
  265. package/lib/front_end/models/trace/helpers/Extensions.ts +0 -54
  266. package/lib/front_end/models/trace/helpers/Network.ts +0 -129
  267. package/lib/front_end/models/trace/helpers/SamplesIntegrator.ts +0 -544
  268. package/lib/front_end/models/trace/helpers/SyntheticEvents.ts +0 -87
  269. package/lib/front_end/models/trace/helpers/Timing.ts +0 -248
  270. package/lib/front_end/models/trace/helpers/Trace.ts +0 -928
  271. package/lib/front_end/models/trace/helpers/TreeHelpers.ts +0 -320
  272. package/lib/front_end/models/trace/helpers/helpers.ts +0 -11
  273. package/lib/front_end/models/trace/insights/CLSCulprits.ts +0 -668
  274. package/lib/front_end/models/trace/insights/Cache.ts +0 -269
  275. package/lib/front_end/models/trace/insights/Common.ts +0 -453
  276. package/lib/front_end/models/trace/insights/DOMSize.ts +0 -223
  277. package/lib/front_end/models/trace/insights/DocumentLatency.ts +0 -319
  278. package/lib/front_end/models/trace/insights/DuplicatedJavaScript.ts +0 -126
  279. package/lib/front_end/models/trace/insights/FontDisplay.ts +0 -119
  280. package/lib/front_end/models/trace/insights/ForcedReflow.ts +0 -220
  281. package/lib/front_end/models/trace/insights/INPBreakdown.ts +0 -171
  282. package/lib/front_end/models/trace/insights/ImageDelivery.ts +0 -348
  283. package/lib/front_end/models/trace/insights/LCPBreakdown.ts +0 -268
  284. package/lib/front_end/models/trace/insights/LCPDiscovery.ts +0 -237
  285. package/lib/front_end/models/trace/insights/LegacyJavaScript.ts +0 -138
  286. package/lib/front_end/models/trace/insights/Models.ts +0 -22
  287. package/lib/front_end/models/trace/insights/ModernHTTP.ts +0 -257
  288. package/lib/front_end/models/trace/insights/NetworkDependencyTree.ts +0 -726
  289. package/lib/front_end/models/trace/insights/RenderBlocking.ts +0 -257
  290. package/lib/front_end/models/trace/insights/SlowCSSSelector.ts +0 -175
  291. package/lib/front_end/models/trace/insights/Statistics.ts +0 -101
  292. package/lib/front_end/models/trace/insights/ThirdParties.ts +0 -130
  293. package/lib/front_end/models/trace/insights/Viewport.ts +0 -138
  294. package/lib/front_end/models/trace/insights/insights.ts +0 -10
  295. package/lib/front_end/models/trace/insights/types.ts +0 -157
  296. package/lib/front_end/models/trace/lantern/core/LanternError.ts +0 -7
  297. package/lib/front_end/models/trace/lantern/core/NetworkAnalyzer.ts +0 -619
  298. package/lib/front_end/models/trace/lantern/core/core.ts +0 -6
  299. package/lib/front_end/models/trace/lantern/graph/BaseNode.ts +0 -345
  300. package/lib/front_end/models/trace/lantern/graph/CPUNode.ts +0 -80
  301. package/lib/front_end/models/trace/lantern/graph/NetworkNode.ts +0 -101
  302. package/lib/front_end/models/trace/lantern/graph/PageDependencyGraph.ts +0 -636
  303. package/lib/front_end/models/trace/lantern/graph/graph.ts +0 -8
  304. package/lib/front_end/models/trace/lantern/lantern.ts +0 -17
  305. package/lib/front_end/models/trace/lantern/metrics/FirstContentfulPaint.ts +0 -187
  306. package/lib/front_end/models/trace/lantern/metrics/Interactive.ts +0 -88
  307. package/lib/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +0 -92
  308. package/lib/front_end/models/trace/lantern/metrics/MaxPotentialFID.ts +0 -72
  309. package/lib/front_end/models/trace/lantern/metrics/Metric.ts +0 -126
  310. package/lib/front_end/models/trace/lantern/metrics/SpeedIndex.ts +0 -126
  311. package/lib/front_end/models/trace/lantern/metrics/TBTUtils.ts +0 -82
  312. package/lib/front_end/models/trace/lantern/metrics/TotalBlockingTime.ts +0 -112
  313. package/lib/front_end/models/trace/lantern/metrics/metrics.ts +0 -12
  314. package/lib/front_end/models/trace/lantern/simulation/ConnectionPool.ts +0 -150
  315. package/lib/front_end/models/trace/lantern/simulation/Constants.ts +0 -46
  316. package/lib/front_end/models/trace/lantern/simulation/DNSCache.ts +0 -61
  317. package/lib/front_end/models/trace/lantern/simulation/SimulationTimingMap.ts +0 -196
  318. package/lib/front_end/models/trace/lantern/simulation/Simulator.ts +0 -556
  319. package/lib/front_end/models/trace/lantern/simulation/TCPConnection.ts +0 -192
  320. package/lib/front_end/models/trace/lantern/simulation/simulation.ts +0 -10
  321. package/lib/front_end/models/trace/lantern/types/Lantern.ts +0 -220
  322. package/lib/front_end/models/trace/lantern/types/types.ts +0 -5
  323. package/lib/front_end/models/trace/trace.ts +0 -33
  324. package/lib/front_end/models/trace/types/Configuration.ts +0 -110
  325. package/lib/front_end/models/trace/types/Extensions.ts +0 -136
  326. package/lib/front_end/models/trace/types/File.ts +0 -281
  327. package/lib/front_end/models/trace/types/Overlays.ts +0 -138
  328. package/lib/front_end/models/trace/types/Timing.ts +0 -30
  329. package/lib/front_end/models/trace/types/TraceEvents.ts +0 -3277
  330. package/lib/front_end/models/trace/types/types.ts +0 -10
  331. package/lib/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +0 -240
  332. package/lib/front_end/models/trace_source_maps_resolver/trace_source_maps_resolver.ts +0 -5
  333. package/lib/front_end/models/workspace/FileManager.ts +0 -97
  334. package/lib/front_end/models/workspace/IgnoreListManager.ts +0 -628
  335. package/lib/front_end/models/workspace/SearchConfig.ts +0 -149
  336. package/lib/front_end/models/workspace/UISourceCode.ts +0 -698
  337. package/lib/front_end/models/workspace/WorkspaceImpl.ts +0 -339
  338. package/lib/front_end/models/workspace/workspace.ts +0 -17
  339. package/lib/front_end/panels/timeline/TimelineUIUtils.ts +0 -1029
  340. package/lib/front_end/panels/timeline/extensions/ExtensionUI.ts +0 -49
  341. package/lib/front_end/panels/timeline/extensions/extensions.ts +0 -9
  342. package/lib/front_end/third_party/codemirror.next/LICENSE +0 -21
  343. package/lib/front_end/third_party/codemirror.next/README.chromium +0 -30
  344. package/lib/front_end/third_party/codemirror.next/bundle-tsconfig.json +0 -24
  345. package/lib/front_end/third_party/codemirror.next/bundle.ts +0 -135
  346. package/lib/front_end/third_party/codemirror.next/chunk/angular.js +0 -2
  347. package/lib/front_end/third_party/codemirror.next/chunk/angular.js.map +0 -1
  348. package/lib/front_end/third_party/codemirror.next/chunk/codemirror.js +0 -2
  349. package/lib/front_end/third_party/codemirror.next/chunk/codemirror.js.map +0 -1
  350. package/lib/front_end/third_party/codemirror.next/chunk/cpp.js +0 -2
  351. package/lib/front_end/third_party/codemirror.next/chunk/cpp.js.map +0 -1
  352. package/lib/front_end/third_party/codemirror.next/chunk/css.js +0 -2
  353. package/lib/front_end/third_party/codemirror.next/chunk/html.js +0 -4
  354. package/lib/front_end/third_party/codemirror.next/chunk/java.js +0 -2
  355. package/lib/front_end/third_party/codemirror.next/chunk/java.js.map +0 -1
  356. package/lib/front_end/third_party/codemirror.next/chunk/javascript.js +0 -2
  357. package/lib/front_end/third_party/codemirror.next/chunk/legacy.js +0 -2
  358. package/lib/front_end/third_party/codemirror.next/chunk/legacy.js.map +0 -1
  359. package/lib/front_end/third_party/codemirror.next/chunk/less.js +0 -2
  360. package/lib/front_end/third_party/codemirror.next/chunk/less.js.map +0 -1
  361. package/lib/front_end/third_party/codemirror.next/chunk/markdown.js +0 -2
  362. package/lib/front_end/third_party/codemirror.next/chunk/markdown.js.map +0 -1
  363. package/lib/front_end/third_party/codemirror.next/chunk/php.js +0 -2
  364. package/lib/front_end/third_party/codemirror.next/chunk/php.js.map +0 -1
  365. package/lib/front_end/third_party/codemirror.next/chunk/python.js +0 -2
  366. package/lib/front_end/third_party/codemirror.next/chunk/python.js.map +0 -1
  367. package/lib/front_end/third_party/codemirror.next/chunk/sass.js +0 -2
  368. package/lib/front_end/third_party/codemirror.next/chunk/sass.js.map +0 -1
  369. package/lib/front_end/third_party/codemirror.next/chunk/svelte.js +0 -2
  370. package/lib/front_end/third_party/codemirror.next/chunk/svelte.js.map +0 -1
  371. package/lib/front_end/third_party/codemirror.next/chunk/vue.js +0 -2
  372. package/lib/front_end/third_party/codemirror.next/chunk/vue.js.map +0 -1
  373. package/lib/front_end/third_party/codemirror.next/chunk/wast.js +0 -2
  374. package/lib/front_end/third_party/codemirror.next/chunk/wast.js.map +0 -1
  375. package/lib/front_end/third_party/codemirror.next/chunk/xml.js +0 -2
  376. package/lib/front_end/third_party/codemirror.next/chunk/xml.js.map +0 -1
  377. package/lib/front_end/third_party/codemirror.next/codemirror.next.d.ts +0 -8057
  378. package/lib/front_end/third_party/codemirror.next/codemirror.next.js +0 -2
  379. package/lib/front_end/third_party/codemirror.next/codemirror.next.js.map +0 -1
  380. package/lib/front_end/third_party/codemirror.next/package.json +0 -43
  381. package/lib/front_end/third_party/codemirror.next/rebuild.sh +0 -6
  382. package/lib/front_end/third_party/codemirror.next/rollup.config.mjs +0 -49
  383. package/lib/front_end/third_party/i18n/LICENSE +0 -202
  384. package/lib/front_end/third_party/i18n/README.chromium +0 -15
  385. package/lib/front_end/third_party/i18n/i18n-impl.ts +0 -61
  386. package/lib/front_end/third_party/i18n/i18n.ts +0 -11
  387. package/lib/front_end/third_party/i18n/localized-string-set.ts +0 -129
  388. package/lib/front_end/third_party/intl-messageformat/LICENSE +0 -33
  389. package/lib/front_end/third_party/intl-messageformat/README.chromium +0 -24
  390. package/lib/front_end/third_party/intl-messageformat/intl-messageformat-tsconfig.json +0 -16
  391. package/lib/front_end/third_party/intl-messageformat/intl-messageformat.ts +0 -6
  392. package/lib/front_end/third_party/intl-messageformat/package/LICENSE.md +0 -33
  393. package/lib/front_end/third_party/intl-messageformat/package/README.md +0 -3
  394. package/lib/front_end/third_party/intl-messageformat/package/index.d.ts +0 -6
  395. package/lib/front_end/third_party/intl-messageformat/package/index.d.ts.map +0 -1
  396. package/lib/front_end/third_party/intl-messageformat/package/index.js +0 -13
  397. package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.d.ts +0 -5
  398. package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.js +0 -1710
  399. package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.iife.js +0 -1815
  400. package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts +0 -6
  401. package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts.map +0 -1
  402. package/lib/front_end/third_party/intl-messageformat/package/lib/index.js +0 -10
  403. package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts +0 -34
  404. package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts.map +0 -1
  405. package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.js +0 -229
  406. package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts +0 -28
  407. package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts.map +0 -1
  408. package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.js +0 -48
  409. package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts +0 -34
  410. package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts.map +0 -1
  411. package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.js +0 -179
  412. package/lib/front_end/third_party/intl-messageformat/package/package.json +0 -42
  413. package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts +0 -34
  414. package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts.map +0 -1
  415. package/lib/front_end/third_party/intl-messageformat/package/src/core.js +0 -230
  416. package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts +0 -28
  417. package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts.map +0 -1
  418. package/lib/front_end/third_party/intl-messageformat/package/src/error.js +0 -51
  419. package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts +0 -34
  420. package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts.map +0 -1
  421. package/lib/front_end/third_party/intl-messageformat/package/src/formatters.js +0 -182
  422. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/error.d.ts +0 -79
  423. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/index.d.ts +0 -15
  424. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/parser.d.ts +0 -153
  425. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/types.d.ts +0 -139
  426. package/lib/front_end/third_party/legacy-javascript/LICENSE +0 -202
  427. package/lib/front_end/third_party/legacy-javascript/README.chromium +0 -13
  428. package/lib/front_end/third_party/legacy-javascript/legacy-javascript-tsconfig.json +0 -8
  429. package/lib/front_end/third_party/legacy-javascript/legacy-javascript.ts +0 -3
  430. package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.d.ts +0 -18
  431. package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.js +0 -943
  432. package/lib/front_end/third_party/legacy-javascript/package.json +0 -8
  433. package/lib/front_end/third_party/legacy-javascript/rebuild.sh +0 -9
  434. package/lib/front_end/third_party/source-map-scopes-codec/LICENSE +0 -26
  435. package/lib/front_end/third_party/source-map-scopes-codec/README.chromium +0 -31
  436. package/lib/front_end/third_party/source-map-scopes-codec/package/CONTRIBUTING.md +0 -33
  437. package/lib/front_end/third_party/source-map-scopes-codec/package/LICENSE +0 -26
  438. package/lib/front_end/third_party/source-map-scopes-codec/package/README.md +0 -64
  439. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts +0 -62
  440. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts.map +0 -1
  441. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts +0 -37
  442. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts.map +0 -1
  443. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts +0 -29
  444. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts.map +0 -1
  445. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts +0 -8
  446. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts.map +0 -1
  447. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts +0 -6
  448. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts.map +0 -1
  449. package/lib/front_end/third_party/source-map-scopes-codec/package/deno.json +0 -21
  450. package/lib/front_end/third_party/source-map-scopes-codec/package/package.json +0 -14
  451. package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js +0 -196
  452. package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js.map +0 -1
  453. package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.ts +0 -262
  454. package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js +0 -235
  455. package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js.map +0 -1
  456. package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.ts +0 -359
  457. package/lib/front_end/third_party/source-map-scopes-codec/package/src/codec.js +0 -39
  458. package/lib/front_end/third_party/source-map-scopes-codec/package/src/codec.js.map +0 -1
  459. package/lib/front_end/third_party/source-map-scopes-codec/package/src/codec.ts +0 -53
  460. package/lib/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js +0 -438
  461. package/lib/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js.map +0 -1
  462. package/lib/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.ts +0 -539
  463. package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js +0 -23
  464. package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js.map +0 -1
  465. package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.ts +0 -35
  466. package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js +0 -257
  467. package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js.map +0 -1
  468. package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.ts +0 -348
  469. package/lib/front_end/third_party/source-map-scopes-codec/package/src/mod.js +0 -8
  470. package/lib/front_end/third_party/source-map-scopes-codec/package/src/mod.js.map +0 -1
  471. package/lib/front_end/third_party/source-map-scopes-codec/package/src/mod.ts +0 -20
  472. package/lib/front_end/third_party/source-map-scopes-codec/package/src/scopes-tsconfig.json +0 -8
  473. package/lib/front_end/third_party/source-map-scopes-codec/package/src/scopes.d.ts +0 -184
  474. package/lib/front_end/third_party/source-map-scopes-codec/package/src/util.js +0 -9
  475. package/lib/front_end/third_party/source-map-scopes-codec/package/src/util.js.map +0 -1
  476. package/lib/front_end/third_party/source-map-scopes-codec/package/src/util.ts +0 -12
  477. package/lib/front_end/third_party/source-map-scopes-codec/package/src/vlq.js +0 -82
  478. package/lib/front_end/third_party/source-map-scopes-codec/package/src/vlq.js.map +0 -1
  479. package/lib/front_end/third_party/source-map-scopes-codec/package/src/vlq.ts +0 -99
  480. package/lib/front_end/third_party/source-map-scopes-codec/source-map-scopes-codec.ts +0 -5
  481. package/lib/front_end/third_party/third-party-web/LICENSE +0 -20
  482. package/lib/front_end/third_party/third-party-web/README.chromium +0 -13
  483. package/lib/front_end/third_party/third-party-web/lib/nostats-subset.d.ts +0 -2
  484. package/lib/front_end/third_party/third-party-web/lib/nostats-subset.js +0 -149
  485. package/lib/front_end/third_party/third-party-web/package/LICENSE +0 -20
  486. package/lib/front_end/third_party/third-party-web/package/README.md +0 -929
  487. package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive-nostats.json +0 -1
  488. package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive.json +0 -1
  489. package/lib/front_end/third_party/third-party-web/package/dist/entities-nostats.json +0 -1
  490. package/lib/front_end/third_party/third-party-web/package/dist/entities.json +0 -1
  491. package/lib/front_end/third_party/third-party-web/package/facades.md +0 -46
  492. package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.d.ts +0 -1
  493. package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.js +0 -1
  494. package/lib/front_end/third_party/third-party-web/package/httparchive-subset.d.ts +0 -1
  495. package/lib/front_end/third_party/third-party-web/package/httparchive-subset.js +0 -1
  496. package/lib/front_end/third_party/third-party-web/package/lib/__snapshots__/index.test.js.snap +0 -1006
  497. package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.js +0 -139
  498. package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.test.js +0 -44
  499. package/lib/front_end/third_party/third-party-web/package/lib/entities.test.js +0 -27
  500. package/lib/front_end/third_party/third-party-web/package/lib/index.d.ts +0 -34
  501. package/lib/front_end/third_party/third-party-web/package/lib/index.js +0 -3
  502. package/lib/front_end/third_party/third-party-web/package/lib/index.test.js +0 -246
  503. package/lib/front_end/third_party/third-party-web/package/lib/markdown/faqs.partial.md +0 -36
  504. package/lib/front_end/third_party/third-party-web/package/lib/markdown/goals.partial.md +0 -9
  505. package/lib/front_end/third_party/third-party-web/package/lib/markdown/methodology.partial.md +0 -5
  506. package/lib/front_end/third_party/third-party-web/package/lib/markdown/template.md +0 -151
  507. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-02-01.md +0 -1
  508. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-03-01.md +0 -1
  509. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-06.md +0 -1
  510. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-13.md +0 -14
  511. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2021-01-01.md +0 -1
  512. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2024-07-01.md +0 -3
  513. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.d.ts +0 -1
  514. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.js +0 -3
  515. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.d.ts +0 -1
  516. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.js +0 -3
  517. package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.d.ts +0 -1
  518. package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.js +0 -3
  519. package/lib/front_end/third_party/third-party-web/package/nostats-subset.d.ts +0 -1
  520. package/lib/front_end/third_party/third-party-web/package/nostats-subset.js +0 -1
  521. package/lib/front_end/third_party/third-party-web/package/package.json +0 -46
  522. package/lib/front_end/third_party/third-party-web/package.json +0 -8
  523. package/lib/front_end/third_party/third-party-web/rebuild.sh +0 -13
  524. package/lib/front_end/third_party/third-party-web/third-party-web-tsconfig.json +0 -8
  525. package/lib/front_end/third_party/third-party-web/third-party-web.ts +0 -3
  526. package/lib/front_end/ui/legacy/theme_support/ThemeSupport.ts +0 -222
  527. package/lib/front_end/ui/legacy/theme_support/theme_support.ts +0 -5
  528. package/patches/chrome-devtools-frontend+1.0.1533544.patch +0 -1716
@@ -1,1497 +0,0 @@
1
- // Copyright 2009 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import * as Platform from '../platform/platform.js';
6
- import * as Root from '../root/root.js';
7
-
8
- import {Console} from './Console.js';
9
- import type {EventDescriptor, EventTargetEvent, GenericEvents} from './EventTarget.js';
10
- import {ObjectWrapper} from './Object.js';
11
- import {
12
- getLocalizedSettingsCategory,
13
- getRegisteredSettings as getRegisteredSettingsInternal,
14
- type LearnMore,
15
- maybeRemoveSettingExtension,
16
- type RegExpSettingItem,
17
- registerSettingExtension,
18
- registerSettingsForTest,
19
- resetSettings,
20
- SettingCategory,
21
- type SettingExtensionOption,
22
- type SettingRegistration,
23
- SettingType,
24
- } from './SettingRegistration.js';
25
-
26
- let settingsInstance: Settings|undefined;
27
-
28
- export class Settings {
29
- readonly #sessionStorage = new SettingsStorage({});
30
- settingNameSet = new Set<string>();
31
- orderValuesBySettingCategory = new Map<SettingCategory, Set<number>>();
32
- #eventSupport = new ObjectWrapper<GenericEvents>();
33
- #registry = new Map<string, Setting<unknown>>();
34
- readonly moduleSettings = new Map<string, Setting<unknown>>();
35
- #logSettingAccess?: (name: string, value: number|string|boolean) => Promise<void>;
36
-
37
- private constructor(
38
- readonly syncedStorage: SettingsStorage,
39
- readonly globalStorage: SettingsStorage,
40
- readonly localStorage: SettingsStorage,
41
- logSettingAccess?: (name: string, value: number|string|boolean) => Promise<void>,
42
- ) {
43
- this.#logSettingAccess = logSettingAccess;
44
-
45
- for (const registration of this.getRegisteredSettings()) {
46
- const {settingName, defaultValue, storageType} = registration;
47
- const isRegex = registration.settingType === SettingType.REGEX;
48
-
49
- const evaluatedDefaultValue =
50
- typeof defaultValue === 'function' ? defaultValue(Root.Runtime.hostConfig) : defaultValue;
51
- const setting = isRegex && typeof evaluatedDefaultValue === 'string' ?
52
- this.createRegExpSetting(settingName, evaluatedDefaultValue, undefined, storageType) :
53
- this.createSetting(settingName, evaluatedDefaultValue, storageType);
54
-
55
- setting.setTitleFunction(registration.title);
56
- if (registration.userActionCondition) {
57
- setting.setRequiresUserAction(Boolean(Root.Runtime.Runtime.queryParam(registration.userActionCondition)));
58
- }
59
- setting.setRegistration(registration);
60
-
61
- this.registerModuleSetting(setting);
62
- }
63
- }
64
-
65
- getRegisteredSettings(): SettingRegistration[] {
66
- return getRegisteredSettingsInternal();
67
- }
68
-
69
- static hasInstance(): boolean {
70
- return typeof settingsInstance !== 'undefined';
71
- }
72
-
73
- static instance(opts: {
74
- forceNew: boolean|null,
75
- syncedStorage: SettingsStorage|null,
76
- globalStorage: SettingsStorage|null,
77
- localStorage: SettingsStorage|null,
78
- logSettingAccess?: (name: string, value: number|string|boolean) => Promise<void>,
79
- } = {forceNew: null, syncedStorage: null, globalStorage: null, localStorage: null}): Settings {
80
- const {forceNew, syncedStorage, globalStorage, localStorage, logSettingAccess} = opts;
81
- if (!settingsInstance || forceNew) {
82
- if (!syncedStorage || !globalStorage || !localStorage) {
83
- throw new Error(`Unable to create settings: global and local storage must be provided: ${new Error().stack}`);
84
- }
85
-
86
- settingsInstance = new Settings(syncedStorage, globalStorage, localStorage, logSettingAccess);
87
- }
88
-
89
- return settingsInstance;
90
- }
91
-
92
- static removeInstance(): void {
93
- settingsInstance = undefined;
94
- }
95
-
96
- private registerModuleSetting(setting: Setting<unknown>): void {
97
- const settingName = setting.name;
98
- const category = setting.category();
99
- const order = setting.order();
100
- if (this.settingNameSet.has(settingName)) {
101
- throw new Error(`Duplicate Setting name '${settingName}'`);
102
- }
103
- if (category && order) {
104
- const orderValues = this.orderValuesBySettingCategory.get(category) || new Set();
105
- if (orderValues.has(order)) {
106
- throw new Error(`Duplicate order value '${order}' for settings category '${category}'`);
107
- }
108
- orderValues.add(order);
109
- this.orderValuesBySettingCategory.set(category, orderValues);
110
- }
111
- this.settingNameSet.add(settingName);
112
- this.moduleSettings.set(setting.name, setting);
113
- }
114
-
115
- static normalizeSettingName(name: string): string {
116
- if ([
117
- VersionController.GLOBAL_VERSION_SETTING_NAME,
118
- VersionController.SYNCED_VERSION_SETTING_NAME,
119
- VersionController.LOCAL_VERSION_SETTING_NAME,
120
- 'currentDockState',
121
- 'isUnderTest',
122
- ].includes(name)) {
123
- return name;
124
- }
125
- return Platform.StringUtilities.toKebabCase(name);
126
- }
127
-
128
- /**
129
- * Prefer a module setting if this setting is one that you might not want to
130
- * surface to the user to control themselves. Examples of these are settings
131
- * to store UI state such as how a user choses to position a split widget or
132
- * which panel they last opened.
133
- * If you are creating a setting that you expect the user to control, and
134
- * sync, prefer {@link Settings.createSetting}
135
- */
136
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
137
- moduleSetting<T = any>(settingName: string): Setting<T> {
138
- const setting = this.moduleSettings.get(settingName) as Setting<T>;
139
- if (!setting) {
140
- throw new Error('No setting registered: ' + settingName);
141
- }
142
- return setting;
143
- }
144
-
145
- settingForTest(settingName: string): Setting<unknown> {
146
- const setting = this.#registry.get(settingName);
147
- if (!setting) {
148
- throw new Error('No setting registered: ' + settingName);
149
- }
150
- return setting;
151
- }
152
-
153
- /**
154
- * Get setting via key, and create a new setting if the requested setting does not exist.
155
- * @param key kebab-case string ID
156
- * @param defaultValue
157
- * @param storageType If not specified, SettingStorageType.GLOBAL is used.
158
- */
159
- createSetting<T>(key: string, defaultValue: T, storageType?: SettingStorageType): Setting<T> {
160
- const storage = this.storageFromType(storageType);
161
- let setting = this.#registry.get(key) as Setting<T>;
162
- if (!setting) {
163
- setting = new Setting(key, defaultValue, this.#eventSupport, storage, this.#logSettingAccess);
164
- this.#registry.set(key, setting);
165
- }
166
- return setting;
167
- }
168
-
169
- createLocalSetting<T>(key: string, defaultValue: T): Setting<T> {
170
- return this.createSetting(key, defaultValue, SettingStorageType.LOCAL);
171
- }
172
-
173
- createRegExpSetting(key: string, defaultValue: string, regexFlags?: string, storageType?: SettingStorageType):
174
- RegExpSetting {
175
- if (!this.#registry.get(key)) {
176
- this.#registry.set(
177
- key,
178
- new RegExpSetting(
179
- key, defaultValue, this.#eventSupport, this.storageFromType(storageType), regexFlags,
180
- this.#logSettingAccess));
181
- }
182
- return this.#registry.get(key) as RegExpSetting;
183
- }
184
-
185
- clearAll(): void {
186
- this.globalStorage.removeAll();
187
- this.syncedStorage.removeAll();
188
- this.localStorage.removeAll();
189
- new VersionController().resetToCurrent();
190
- }
191
-
192
- private storageFromType(storageType?: SettingStorageType): SettingsStorage {
193
- switch (storageType) {
194
- case SettingStorageType.LOCAL:
195
- return this.localStorage;
196
- case SettingStorageType.SESSION:
197
- return this.#sessionStorage;
198
- case SettingStorageType.GLOBAL:
199
- return this.globalStorage;
200
- case SettingStorageType.SYNCED:
201
- return this.syncedStorage;
202
- }
203
- return this.globalStorage;
204
- }
205
-
206
- getRegistry(): Map<string, Setting<unknown>> {
207
- return this.#registry;
208
- }
209
- }
210
-
211
- export interface SettingsBackingStore {
212
- register(setting: string): void;
213
- get(setting: string): Promise<string>;
214
- set(setting: string, value: string): void;
215
- remove(setting: string): void;
216
- clear(): void;
217
- }
218
-
219
- export const NOOP_STORAGE: SettingsBackingStore = {
220
- register: () => {},
221
- set: () => {},
222
- get: () => Promise.resolve(''),
223
- remove: () => {},
224
- clear: () => {},
225
- };
226
-
227
- export class SettingsStorage {
228
- constructor(
229
- private object: Record<string, string>, private readonly backingStore: SettingsBackingStore = NOOP_STORAGE,
230
- private readonly storagePrefix = '') {
231
- }
232
-
233
- register(name: string): void {
234
- name = this.storagePrefix + name;
235
- this.backingStore.register(name);
236
- }
237
-
238
- set(name: string, value: string): void {
239
- name = this.storagePrefix + name;
240
- this.object[name] = value;
241
- this.backingStore.set(name, value);
242
- }
243
-
244
- has(name: string): boolean {
245
- name = this.storagePrefix + name;
246
- return name in this.object;
247
- }
248
-
249
- get(name: string): string {
250
- name = this.storagePrefix + name;
251
- return this.object[name];
252
- }
253
-
254
- async forceGet(originalName: string): Promise<string> {
255
- const name = this.storagePrefix + originalName;
256
- const value = await this.backingStore.get(name);
257
- if (value && value !== this.object[name]) {
258
- this.set(originalName, value);
259
- } else if (!value) {
260
- this.remove(originalName);
261
- }
262
- return value;
263
- }
264
-
265
- remove(name: string): void {
266
- name = this.storagePrefix + name;
267
- delete this.object[name];
268
- this.backingStore.remove(name);
269
- }
270
-
271
- removeAll(): void {
272
- this.object = {};
273
- this.backingStore.clear();
274
- }
275
-
276
- keys(): string[] {
277
- return Object.keys(this.object);
278
- }
279
-
280
- dumpSizes(): void {
281
- Console.instance().log('Ten largest settings: ');
282
- // @ts-expect-error __proto__ optimization
283
- const sizes: Record<string, number> = {__proto__: null};
284
- for (const key in this.object) {
285
- sizes[key] = this.object[key].length;
286
- }
287
- const keys = Object.keys(sizes);
288
-
289
- function comparator(key1: string, key2: string): number {
290
- return sizes[key2] - sizes[key1];
291
- }
292
-
293
- keys.sort(comparator);
294
-
295
- for (let i = 0; i < 10 && i < keys.length; ++i) {
296
- Console.instance().log('Setting: \'' + keys[i] + '\', size: ' + sizes[keys[i]]);
297
- }
298
- }
299
- }
300
-
301
- function removeSetting(setting: {name: string, storage: SettingsStorage}): void {
302
- const name = setting.name;
303
- const settings = Settings.instance();
304
-
305
- settings.getRegistry().delete(name);
306
- settings.moduleSettings.delete(name);
307
-
308
- setting.storage.remove(name);
309
- }
310
-
311
- export class Deprecation {
312
- readonly disabled: boolean;
313
- readonly warning: Platform.UIString.LocalizedString;
314
- readonly experiment?: Root.Runtime.Experiment;
315
-
316
- constructor({deprecationNotice}: SettingRegistration) {
317
- if (!deprecationNotice) {
318
- throw new Error('Cannot create deprecation info for a non-deprecated setting');
319
- }
320
- this.disabled = deprecationNotice.disabled;
321
- this.warning = deprecationNotice.warning();
322
- this.experiment = deprecationNotice.experiment ?
323
- Root.Runtime.experiments.allConfigurableExperiments().find(e => e.name === deprecationNotice.experiment) :
324
- undefined;
325
- }
326
- }
327
-
328
- export class Setting<V> {
329
- #titleFunction?: () => Platform.UIString.LocalizedString;
330
- #title!: Platform.UIString.LocalizedString;
331
- #registration: SettingRegistration|null = null;
332
- #requiresUserAction?: boolean;
333
- #value?: V;
334
- // TODO(crbug.com/1172300) Type cannot be inferred without changes to consumers. See above.
335
- #serializer: Serializer<unknown, V> = JSON;
336
- #hadUserAction?: boolean;
337
- #disabled?: boolean;
338
- #deprecation: Deprecation|null = null;
339
- #loggedInitialAccess = false;
340
- #logSettingAccess?: (name: string, value: number|string|boolean) => Promise<void>;
341
-
342
- constructor(
343
- readonly name: string, readonly defaultValue: V, private readonly eventSupport: ObjectWrapper<GenericEvents>,
344
- readonly storage: SettingsStorage,
345
- logSettingAccess?: (name: string, value: number|string|boolean) => Promise<void>) {
346
- storage.register(this.name);
347
- this.#logSettingAccess = logSettingAccess;
348
- }
349
-
350
- setSerializer(serializer: Serializer<unknown, V>): void {
351
- this.#serializer = serializer;
352
- }
353
-
354
- addChangeListener(listener: (arg0: EventTargetEvent<V>) => void, thisObject?: Object): EventDescriptor {
355
- return this.eventSupport.addEventListener(this.name, listener, thisObject);
356
- }
357
-
358
- removeChangeListener(listener: (arg0: EventTargetEvent<V>) => void, thisObject?: Object): void {
359
- this.eventSupport.removeEventListener(this.name, listener, thisObject);
360
- }
361
-
362
- title(): Platform.UIString.LocalizedString {
363
- if (this.#title) {
364
- return this.#title;
365
- }
366
- if (this.#titleFunction) {
367
- return this.#titleFunction();
368
- }
369
- return '' as Platform.UIString.LocalizedString;
370
- }
371
-
372
- setTitleFunction(titleFunction: (() => Platform.UIString.LocalizedString)|undefined): void {
373
- if (titleFunction) {
374
- this.#titleFunction = titleFunction;
375
- }
376
- }
377
-
378
- setTitle(title: Platform.UIString.LocalizedString): void {
379
- this.#title = title;
380
- }
381
-
382
- setRequiresUserAction(requiresUserAction: boolean): void {
383
- this.#requiresUserAction = requiresUserAction;
384
- }
385
-
386
- disabled(): boolean {
387
- if (this.#registration?.disabledCondition) {
388
- const {disabled} = this.#registration.disabledCondition(Root.Runtime.hostConfig);
389
- // If registration does not disable it, pass through to #disabled
390
- // attribute check.
391
- if (disabled) {
392
- return true;
393
- }
394
- }
395
- return this.#disabled || false;
396
- }
397
-
398
- disabledReasons(): Platform.UIString.LocalizedString[] {
399
- if (this.#registration?.disabledCondition) {
400
- const result = this.#registration.disabledCondition(Root.Runtime.hostConfig);
401
- if (result.disabled) {
402
- return result.reasons;
403
- }
404
- }
405
- return [];
406
- }
407
-
408
- setDisabled(disabled: boolean): void {
409
- this.#disabled = disabled;
410
- this.eventSupport.dispatchEventToListeners(this.name);
411
- }
412
-
413
- #maybeLogAccess(value: V): void {
414
- try {
415
- const valueToLog = typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean' ?
416
- value :
417
- this.#serializer?.stringify(value);
418
- if (valueToLog !== undefined && this.#logSettingAccess) {
419
- void this.#logSettingAccess(this.name, valueToLog);
420
- }
421
- } catch {
422
- }
423
- }
424
-
425
- #maybeLogInitialAccess(value: V): void {
426
- if (!this.#loggedInitialAccess) {
427
- this.#maybeLogAccess(value);
428
- this.#loggedInitialAccess = true;
429
- }
430
- }
431
-
432
- get(): V {
433
- if (this.#requiresUserAction && !this.#hadUserAction) {
434
- this.#maybeLogInitialAccess(this.defaultValue);
435
- return this.defaultValue;
436
- }
437
-
438
- if (typeof this.#value !== 'undefined') {
439
- this.#maybeLogInitialAccess(this.#value);
440
- return this.#value;
441
- }
442
-
443
- this.#value = this.defaultValue;
444
- if (this.storage.has(this.name)) {
445
- try {
446
- this.#value = this.#serializer.parse(this.storage.get(this.name));
447
- } catch {
448
- this.storage.remove(this.name);
449
- }
450
- }
451
- this.#maybeLogInitialAccess(this.#value);
452
- return this.#value;
453
- }
454
-
455
- // Prefer this getter for settings which are "disableable". The plain getter returns `this.#value`,
456
- // even if the setting is disabled, which means the callsite has to explicitly call the `disabled()`
457
- // getter and add its own logic for the disabled state.
458
- getIfNotDisabled(): V|undefined {
459
- if (this.disabled()) {
460
- return;
461
- }
462
- return this.get();
463
- }
464
-
465
- async forceGet(): Promise<V> {
466
- const name = this.name;
467
- const oldValue = this.storage.get(name);
468
- const value = await this.storage.forceGet(name);
469
- this.#value = this.defaultValue;
470
- if (value) {
471
- try {
472
- this.#value = this.#serializer.parse(value);
473
- } catch {
474
- this.storage.remove(this.name);
475
- }
476
- }
477
-
478
- if (oldValue !== value) {
479
- this.eventSupport.dispatchEventToListeners(this.name, this.#value);
480
- }
481
-
482
- this.#maybeLogInitialAccess(this.#value);
483
- return this.#value;
484
- }
485
-
486
- set(value: V): void {
487
- this.#maybeLogAccess(value);
488
- this.#hadUserAction = true;
489
- this.#value = value;
490
- try {
491
- const settingString = this.#serializer.stringify(value);
492
- try {
493
- this.storage.set(this.name, settingString);
494
- } catch (e) {
495
- this.printSettingsSavingError(e.message, settingString);
496
- }
497
- } catch (e) {
498
- Console.instance().error('Cannot stringify setting with name: ' + this.name + ', error: ' + e.message);
499
- }
500
- this.eventSupport.dispatchEventToListeners(this.name, value);
501
- }
502
-
503
- setRegistration(registration: SettingRegistration): void {
504
- this.#registration = registration;
505
- const {deprecationNotice} = registration;
506
- if (deprecationNotice?.disabled) {
507
- const experiment = deprecationNotice.experiment ?
508
- Root.Runtime.experiments.allConfigurableExperiments().find(e => e.name === deprecationNotice.experiment) :
509
- undefined;
510
- if ((!experiment || experiment.isEnabled())) {
511
- this.set(this.defaultValue);
512
- this.setDisabled(true);
513
- }
514
- }
515
- }
516
-
517
- type(): SettingType|null {
518
- if (this.#registration) {
519
- return this.#registration.settingType;
520
- }
521
- return null;
522
- }
523
-
524
- options(): SimpleSettingOption[] {
525
- if (this.#registration && this.#registration.options) {
526
- return this.#registration.options.map(opt => {
527
- const {value, title, text, raw} = opt;
528
- return {
529
- value,
530
- title: title(),
531
- text: typeof text === 'function' ? text() : text,
532
- raw,
533
- };
534
- });
535
- }
536
- return [];
537
- }
538
-
539
- reloadRequired(): boolean|null {
540
- if (this.#registration) {
541
- return this.#registration.reloadRequired || null;
542
- }
543
- return null;
544
- }
545
-
546
- category(): SettingCategory|null {
547
- if (this.#registration) {
548
- return this.#registration.category || null;
549
- }
550
- return null;
551
- }
552
-
553
- tags(): string|null {
554
- if (this.#registration && this.#registration.tags) {
555
- // Get localized keys and separate by null character to prevent fuzzy matching from matching across them.
556
- return this.#registration.tags.map(tag => tag()).join('\0');
557
- }
558
- return null;
559
- }
560
-
561
- order(): number|null {
562
- if (this.#registration) {
563
- return this.#registration.order || null;
564
- }
565
- return null;
566
- }
567
-
568
- learnMore(): LearnMore|null {
569
- return this.#registration?.learnMore ?? null;
570
- }
571
-
572
- get deprecation(): Deprecation|null {
573
- if (!this.#registration || !this.#registration.deprecationNotice) {
574
- return null;
575
- }
576
- if (!this.#deprecation) {
577
- this.#deprecation = new Deprecation(this.#registration);
578
- }
579
- return this.#deprecation;
580
- }
581
-
582
- private printSettingsSavingError(message: string, value: string): void {
583
- const errorMessage =
584
- 'Error saving setting with name: ' + this.name + ', value length: ' + value.length + '. Error: ' + message;
585
- console.error(errorMessage);
586
- Console.instance().error(errorMessage);
587
- this.storage.dumpSizes();
588
- }
589
- }
590
-
591
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
592
- export class RegExpSetting extends Setting<any> {
593
- #regexFlags: string|undefined;
594
- #regex?: RegExp|null;
595
-
596
- constructor(
597
- name: string, defaultValue: string, eventSupport: ObjectWrapper<GenericEvents>, storage: SettingsStorage,
598
- regexFlags?: string, logSettingAccess?: (name: string, value: number|string|boolean) => Promise<void>) {
599
- super(name, defaultValue ? [{pattern: defaultValue}] : [], eventSupport, storage, logSettingAccess);
600
- this.#regexFlags = regexFlags;
601
- }
602
-
603
- override get(): string {
604
- const result = [];
605
- const items = this.getAsArray();
606
- for (let i = 0; i < items.length; ++i) {
607
- const item = items[i];
608
- if (item.pattern && !item.disabled) {
609
- result.push(item.pattern);
610
- }
611
- }
612
- return result.join('|');
613
- }
614
-
615
- getAsArray(): RegExpSettingItem[] {
616
- return super.get();
617
- }
618
-
619
- override set(value: string): void {
620
- this.setAsArray([{pattern: value, disabled: false}]);
621
- }
622
-
623
- setAsArray(value: RegExpSettingItem[]): void {
624
- this.#regex = undefined;
625
- super.set(value);
626
- }
627
-
628
- asRegExp(): RegExp|null {
629
- if (typeof this.#regex !== 'undefined') {
630
- return this.#regex;
631
- }
632
- this.#regex = null;
633
- try {
634
- const pattern = this.get();
635
- if (pattern) {
636
- this.#regex = new RegExp(pattern, this.#regexFlags || '');
637
- }
638
- } catch {
639
- }
640
- return this.#regex;
641
- }
642
- }
643
-
644
- // The VersionController does a lot of mapping and restructuring which often need
645
- // typecasting to any, allow it in there
646
- /* eslint-disable @typescript-eslint/no-explicit-any */
647
- export class VersionController {
648
- static readonly GLOBAL_VERSION_SETTING_NAME = 'inspectorVersion';
649
- static readonly SYNCED_VERSION_SETTING_NAME = 'syncedInspectorVersion';
650
- static readonly LOCAL_VERSION_SETTING_NAME = 'localInspectorVersion';
651
-
652
- static readonly CURRENT_VERSION = 40;
653
-
654
- readonly #globalVersionSetting: Setting<number>;
655
- readonly #syncedVersionSetting: Setting<number>;
656
- readonly #localVersionSetting: Setting<number>;
657
-
658
- constructor() {
659
- // If no version setting is found, we initialize with the current version and don't do anything.
660
- this.#globalVersionSetting = Settings.instance().createSetting(
661
- VersionController.GLOBAL_VERSION_SETTING_NAME, VersionController.CURRENT_VERSION, SettingStorageType.GLOBAL);
662
- this.#syncedVersionSetting = Settings.instance().createSetting(
663
- VersionController.SYNCED_VERSION_SETTING_NAME, VersionController.CURRENT_VERSION, SettingStorageType.SYNCED);
664
- this.#localVersionSetting = Settings.instance().createSetting(
665
- VersionController.LOCAL_VERSION_SETTING_NAME, VersionController.CURRENT_VERSION, SettingStorageType.LOCAL);
666
- }
667
-
668
- /**
669
- * Force re-sets all version number settings to the current version without
670
- * running any migrations.
671
- */
672
- resetToCurrent(): void {
673
- this.#globalVersionSetting.set(VersionController.CURRENT_VERSION);
674
- this.#syncedVersionSetting.set(VersionController.CURRENT_VERSION);
675
- this.#localVersionSetting.set(VersionController.CURRENT_VERSION);
676
- }
677
-
678
- /**
679
- * Runs the appropriate migrations and updates the version settings accordingly.
680
- *
681
- * To determine what migrations to run we take the minimum of all version number settings.
682
- *
683
- * IMPORTANT: All migrations must be idempotent since they might be applied multiple times.
684
- */
685
- updateVersion(): void {
686
- const currentVersion = VersionController.CURRENT_VERSION;
687
- const minimumVersion =
688
- Math.min(this.#globalVersionSetting.get(), this.#syncedVersionSetting.get(), this.#localVersionSetting.get());
689
- const methodsToRun = this.methodsToRunToUpdateVersion(minimumVersion, currentVersion);
690
- console.assert(
691
- // @ts-expect-error
692
- this[`updateVersionFrom${currentVersion}To${currentVersion + 1}`] === undefined,
693
- 'Unexpected migration method found. Increment CURRENT_VERSION or remove the method.');
694
- for (const method of methodsToRun) {
695
- // @ts-expect-error Special version method matching
696
- this[method].call(this);
697
- }
698
- this.resetToCurrent();
699
- }
700
-
701
- private methodsToRunToUpdateVersion(oldVersion: number, currentVersion: number): string[] {
702
- const result = [];
703
- for (let i = oldVersion; i < currentVersion; ++i) {
704
- result.push('updateVersionFrom' + i + 'To' + (i + 1));
705
- }
706
- return result;
707
- }
708
-
709
- updateVersionFrom0To1(): void {
710
- this.clearBreakpointsWhenTooMany(Settings.instance().createLocalSetting('breakpoints', []), 500000);
711
- }
712
-
713
- updateVersionFrom1To2(): void {
714
- Settings.instance().createSetting('previouslyViewedFiles', []).set([]);
715
- }
716
-
717
- updateVersionFrom2To3(): void {
718
- Settings.instance().createSetting('fileSystemMapping', {}).set({});
719
- removeSetting(Settings.instance().createSetting('fileMappingEntries', []));
720
- }
721
-
722
- updateVersionFrom3To4(): void {
723
- const advancedMode = Settings.instance().createSetting('showHeaSnapshotObjectsHiddenProperties', false);
724
- moduleSetting('showAdvancedHeapSnapshotProperties').set(advancedMode.get());
725
- removeSetting(advancedMode);
726
- }
727
-
728
- updateVersionFrom4To5(): void {
729
- const settingNames: Record<string, string> = {
730
- FileSystemViewSidebarWidth: 'fileSystemViewSplitViewState',
731
- elementsSidebarWidth: 'elementsPanelSplitViewState',
732
- StylesPaneSplitRatio: 'stylesPaneSplitViewState',
733
- heapSnapshotRetainersViewSize: 'heapSnapshotSplitViewState',
734
- 'InspectorView.splitView': 'InspectorView.splitViewState',
735
- 'InspectorView.screencastSplitView': 'InspectorView.screencastSplitViewState',
736
- 'Inspector.drawerSplitView': 'Inspector.drawerSplitViewState',
737
- layerDetailsSplitView: 'layerDetailsSplitViewState',
738
- networkSidebarWidth: 'networkPanelSplitViewState',
739
- sourcesSidebarWidth: 'sourcesPanelSplitViewState',
740
- scriptsPanelNavigatorSidebarWidth: 'sourcesPanelNavigatorSplitViewState',
741
- sourcesPanelSplitSidebarRatio: 'sourcesPanelDebuggerSidebarSplitViewState',
742
- 'timeline-details': 'timelinePanelDetailsSplitViewState',
743
- 'timeline-split': 'timelinePanelRecorsSplitViewState',
744
- 'timeline-view': 'timelinePanelTimelineStackSplitViewState',
745
- auditsSidebarWidth: 'auditsPanelSplitViewState',
746
- layersSidebarWidth: 'layersPanelSplitViewState',
747
- profilesSidebarWidth: 'profilesPanelSplitViewState',
748
- resourcesSidebarWidth: 'resourcesPanelSplitViewState',
749
- };
750
- const empty = {};
751
- for (const oldName in settingNames) {
752
- const newName = settingNames[oldName];
753
- const oldNameH = oldName + 'H';
754
-
755
- let newValue: object|null = null;
756
- const oldSetting = Settings.instance().createSetting(oldName, empty);
757
- if (oldSetting.get() !== empty) {
758
- newValue = newValue || {};
759
- // @ts-expect-error
760
- newValue.vertical = {};
761
- // @ts-expect-error
762
- newValue.vertical.size = oldSetting.get();
763
- removeSetting(oldSetting);
764
- }
765
- const oldSettingH = Settings.instance().createSetting(oldNameH, empty);
766
- if (oldSettingH.get() !== empty) {
767
- newValue = newValue || {};
768
- // @ts-expect-error
769
- newValue.horizontal = {};
770
- // @ts-expect-error
771
- newValue.horizontal.size = oldSettingH.get();
772
- removeSetting(oldSettingH);
773
- }
774
- if (newValue) {
775
- Settings.instance().createSetting(newName, {}).set(newValue);
776
- }
777
- }
778
- }
779
-
780
- updateVersionFrom5To6(): void {
781
- const settingNames: Record<string, string> = {
782
- debuggerSidebarHidden: 'sourcesPanelSplitViewState',
783
- navigatorHidden: 'sourcesPanelNavigatorSplitViewState',
784
- 'WebInspector.Drawer.showOnLoad': 'Inspector.drawerSplitViewState',
785
- };
786
-
787
- for (const oldName in settingNames) {
788
- const oldSetting = Settings.instance().createSetting(oldName, null);
789
- if (oldSetting.get() === null) {
790
- removeSetting(oldSetting);
791
- continue;
792
- }
793
-
794
- const newName = settingNames[oldName];
795
- const invert = oldName === 'WebInspector.Drawer.showOnLoad';
796
- const hidden = oldSetting.get() !== invert;
797
- removeSetting(oldSetting);
798
- const showMode = hidden ? 'OnlyMain' : 'Both';
799
-
800
- const newSetting = Settings.instance().createSetting(newName, {});
801
- const newValue = newSetting.get() || {};
802
-
803
- // @ts-expect-error
804
- newValue.vertical = newValue.vertical || {};
805
-
806
- // @ts-expect-error
807
- newValue.vertical.showMode = showMode;
808
-
809
- // @ts-expect-error
810
- newValue.horizontal = newValue.horizontal || {};
811
-
812
- // @ts-expect-error
813
- newValue.horizontal.showMode = showMode;
814
- newSetting.set(newValue);
815
- }
816
- }
817
-
818
- updateVersionFrom6To7(): void {
819
- const settingNames = {
820
- sourcesPanelNavigatorSplitViewState: 'sourcesPanelNavigatorSplitViewState',
821
- elementsPanelSplitViewState: 'elementsPanelSplitViewState',
822
- stylesPaneSplitViewState: 'stylesPaneSplitViewState',
823
- sourcesPanelDebuggerSidebarSplitViewState: 'sourcesPanelDebuggerSidebarSplitViewState',
824
- };
825
-
826
- const empty = {};
827
- for (const name in settingNames) {
828
- const setting =
829
- Settings.instance().createSetting<{vertical?: {size?: number}, horizontal?: {size?: number}}>(name, empty);
830
- const value = setting.get();
831
- if (value === empty) {
832
- continue;
833
- }
834
- // Zero out saved percentage sizes, and they will be restored to defaults.
835
- if (value.vertical?.size && value.vertical.size < 1) {
836
- value.vertical.size = 0;
837
- }
838
- if (value.horizontal?.size && value.horizontal.size < 1) {
839
- value.horizontal.size = 0;
840
- }
841
- setting.set(value);
842
- }
843
- }
844
-
845
- updateVersionFrom7To8(): void {
846
- }
847
-
848
- updateVersionFrom8To9(): void {
849
- const settingNames = ['skipStackFramesPattern', 'workspaceFolderExcludePattern'];
850
-
851
- for (let i = 0; i < settingNames.length; ++i) {
852
- const setting = Settings.instance().createSetting<string|unknown[]>(settingNames[i], '');
853
- let value = setting.get();
854
- if (!value) {
855
- return;
856
- }
857
- if (typeof value === 'string') {
858
- value = [value];
859
- }
860
- for (let j = 0; j < value.length; ++j) {
861
- if (typeof value[j] === 'string') {
862
- value[j] = {pattern: value[j]};
863
- }
864
- }
865
- setting.set(value);
866
- }
867
- }
868
-
869
- updateVersionFrom9To10(): void {
870
- // This one is localStorage specific, which is fine.
871
- if (!window.localStorage) {
872
- return;
873
- }
874
- for (const key in window.localStorage) {
875
- if (key.startsWith('revision-history')) {
876
- window.localStorage.removeItem(key);
877
- }
878
- }
879
- }
880
-
881
- updateVersionFrom10To11(): void {
882
- const oldSettingName = 'customDevicePresets';
883
- const newSettingName = 'customEmulatedDeviceList';
884
- const oldSetting = Settings.instance().createSetting<unknown>(oldSettingName, undefined);
885
- const list = oldSetting.get();
886
- if (!Array.isArray(list)) {
887
- return;
888
- }
889
- const newList = [];
890
- for (let i = 0; i < list.length; ++i) {
891
- const value = list[i];
892
-
893
- const device: Record<string, any> = {};
894
- device['title'] = value['title'];
895
- device['type'] = 'unknown';
896
- device['user-agent'] = value['userAgent'];
897
- device['capabilities'] = [];
898
- if (value['touch']) {
899
- device['capabilities'].push('touch');
900
- }
901
- if (value['mobile']) {
902
- device['capabilities'].push('mobile');
903
- }
904
- device['screen'] = {};
905
- device['screen']['vertical'] = {width: value['width'], height: value['height']};
906
- device['screen']['horizontal'] = {width: value['height'], height: value['width']};
907
- device['screen']['device-pixel-ratio'] = value['deviceScaleFactor'];
908
- device['modes'] = [];
909
- device['show-by-default'] = true;
910
- device['show'] = 'Default';
911
- newList.push(device);
912
- }
913
- if (newList.length) {
914
- Settings.instance().createSetting<unknown[]>(newSettingName, []).set(newList);
915
- }
916
- removeSetting(oldSetting);
917
- }
918
-
919
- updateVersionFrom11To12(): void {
920
- this.migrateSettingsFromLocalStorage();
921
- }
922
-
923
- updateVersionFrom12To13(): void {
924
- this.migrateSettingsFromLocalStorage();
925
- removeSetting(Settings.instance().createSetting('timelineOverviewMode', ''));
926
- }
927
-
928
- updateVersionFrom13To14(): void {
929
- const defaultValue = {throughput: -1, latency: 0};
930
- Settings.instance().createSetting('networkConditions', defaultValue).set(defaultValue);
931
- }
932
-
933
- updateVersionFrom14To15(): void {
934
- const setting = Settings.instance().createLocalSetting<any>('workspaceExcludedFolders', {});
935
- const oldValue = setting.get();
936
- const newValue: Record<string, string[]> = {};
937
- for (const fileSystemPath in oldValue) {
938
- newValue[fileSystemPath] = [];
939
- for (const entry of oldValue[fileSystemPath]) {
940
- newValue[fileSystemPath].push(entry.path);
941
- }
942
- }
943
- setting.set(newValue);
944
- }
945
-
946
- updateVersionFrom15To16(): void {
947
- const setting = Settings.instance().createSetting<any>('InspectorView.panelOrder', {});
948
- const tabOrders = setting.get();
949
- for (const key of Object.keys(tabOrders)) {
950
- tabOrders[key] = (tabOrders[key] + 1) * 10;
951
- }
952
- setting.set(tabOrders);
953
- }
954
-
955
- updateVersionFrom16To17(): void {
956
- const setting = Settings.instance().createSetting<any>('networkConditionsCustomProfiles', []);
957
- const oldValue = setting.get();
958
- const newValue = [];
959
- if (Array.isArray(oldValue)) {
960
- for (const preset of oldValue) {
961
- if (typeof preset.title === 'string' && typeof preset.value === 'object' &&
962
- typeof preset.value.throughput === 'number' && typeof preset.value.latency === 'number') {
963
- newValue.push({
964
- title: preset.title,
965
- value: {download: preset.value.throughput, upload: preset.value.throughput, latency: preset.value.latency},
966
- });
967
- }
968
- }
969
- }
970
- setting.set(newValue);
971
- }
972
-
973
- updateVersionFrom17To18(): void {
974
- const setting = Settings.instance().createLocalSetting<any>('workspaceExcludedFolders', {});
975
- const oldValue = setting.get();
976
- const newValue: Record<string, string> = {};
977
- for (const oldKey in oldValue) {
978
- let newKey = oldKey.replace(/\\/g, '/');
979
- if (!newKey.startsWith('file://')) {
980
- if (newKey.startsWith('/')) {
981
- newKey = 'file://' + newKey;
982
- } else {
983
- newKey = 'file:///' + newKey;
984
- }
985
- }
986
- newValue[newKey] = oldValue[oldKey];
987
- }
988
- setting.set(newValue);
989
- }
990
-
991
- updateVersionFrom18To19(): void {
992
- const defaultColumns = {status: true, type: true, initiator: true, size: true, time: true};
993
- const visibleColumnSettings = Settings.instance().createSetting<any>('networkLogColumnsVisibility', defaultColumns);
994
- const visibleColumns = visibleColumnSettings.get();
995
- visibleColumns.name = true;
996
- visibleColumns.timeline = true;
997
-
998
- const configs: Record<string, {
999
- visible: number,
1000
- }> = {};
1001
- for (const columnId in visibleColumns) {
1002
- if (!visibleColumns.hasOwnProperty(columnId)) {
1003
- continue;
1004
- }
1005
- configs[columnId.toLowerCase()] = {visible: visibleColumns[columnId]};
1006
- }
1007
- const newSetting = Settings.instance().createSetting('networkLogColumns', {});
1008
- newSetting.set(configs);
1009
- removeSetting(visibleColumnSettings);
1010
- }
1011
-
1012
- updateVersionFrom19To20(): void {
1013
- const oldSetting = Settings.instance().createSetting('InspectorView.panelOrder', {});
1014
- const newSetting = Settings.instance().createSetting('panel-tabOrder', {});
1015
- newSetting.set(oldSetting.get());
1016
- removeSetting(oldSetting);
1017
- }
1018
-
1019
- updateVersionFrom20To21(): void {
1020
- const networkColumns = Settings.instance().createSetting('networkLogColumns', {});
1021
- const columns = (networkColumns.get() as Record<string, string>);
1022
- delete columns['timeline'];
1023
- delete columns['waterfall'];
1024
- networkColumns.set(columns);
1025
- }
1026
-
1027
- updateVersionFrom21To22(): void {
1028
- const breakpointsSetting = Settings.instance().createLocalSetting<any>('breakpoints', []);
1029
- const breakpoints = breakpointsSetting.get();
1030
- for (const breakpoint of breakpoints) {
1031
- breakpoint['url'] = breakpoint['sourceFileId'];
1032
- delete breakpoint['sourceFileId'];
1033
- }
1034
- breakpointsSetting.set(breakpoints);
1035
- }
1036
-
1037
- updateVersionFrom22To23(): void {
1038
- // This update is no-op.
1039
- }
1040
-
1041
- updateVersionFrom23To24(): void {
1042
- const oldSetting = Settings.instance().createSetting('searchInContentScripts', false);
1043
- const newSetting = Settings.instance().createSetting('searchInAnonymousAndContentScripts', false);
1044
- newSetting.set(oldSetting.get());
1045
- removeSetting(oldSetting);
1046
- }
1047
-
1048
- updateVersionFrom24To25(): void {
1049
- const defaultColumns = {status: true, type: true, initiator: true, size: true, time: true};
1050
-
1051
- const networkLogColumnsSetting = Settings.instance().createSetting<any>('networkLogColumns', defaultColumns);
1052
- const columns = networkLogColumnsSetting.get();
1053
- delete columns.product;
1054
- networkLogColumnsSetting.set(columns);
1055
- }
1056
-
1057
- updateVersionFrom25To26(): void {
1058
- const oldSetting = Settings.instance().createSetting('messageURLFilters', {});
1059
- const urls = Object.keys(oldSetting.get());
1060
- const textFilter = urls.map(url => `-url:${url}`).join(' ');
1061
- if (textFilter) {
1062
- const textFilterSetting = Settings.instance().createSetting<any>('console.textFilter', '');
1063
- const suffix = textFilterSetting.get() ? ` ${textFilterSetting.get()}` : '';
1064
- textFilterSetting.set(`${textFilter}${suffix}`);
1065
- }
1066
- removeSetting(oldSetting);
1067
- }
1068
-
1069
- updateVersionFrom26To27(): void {
1070
- function renameKeyInObjectSetting(settingName: string, from: string, to: string): void {
1071
- const setting = Settings.instance().createSetting<any>(settingName, {});
1072
- const value = setting.get();
1073
- if (from in value) {
1074
- value[to] = value[from];
1075
- delete value[from];
1076
- setting.set(value);
1077
- }
1078
- }
1079
-
1080
- function renameInStringSetting(settingName: string, from: string, to: string): void {
1081
- const setting = Settings.instance().createSetting(settingName, '');
1082
- const value = setting.get();
1083
- if (value === from) {
1084
- setting.set(to);
1085
- }
1086
- }
1087
-
1088
- renameKeyInObjectSetting('panel-tabOrder', 'audits2', 'audits');
1089
- renameKeyInObjectSetting('panel-closeableTabs', 'audits2', 'audits');
1090
- renameInStringSetting('panel-selectedTab', 'audits2', 'audits');
1091
- }
1092
-
1093
- updateVersionFrom27To28(): void {
1094
- const setting = Settings.instance().createSetting('uiTheme', 'systemPreferred');
1095
- if (setting.get() === 'default') {
1096
- setting.set('systemPreferred');
1097
- }
1098
- }
1099
-
1100
- updateVersionFrom28To29(): void {
1101
- function renameKeyInObjectSetting(settingName: string, from: string, to: string): void {
1102
- const setting = Settings.instance().createSetting<any>(settingName, {});
1103
- const value = setting.get();
1104
- if (from in value) {
1105
- value[to] = value[from];
1106
- delete value[from];
1107
- setting.set(value);
1108
- }
1109
- }
1110
-
1111
- function renameInStringSetting(settingName: string, from: string, to: string): void {
1112
- const setting = Settings.instance().createSetting(settingName, '');
1113
- const value = setting.get();
1114
- if (value === from) {
1115
- setting.set(to);
1116
- }
1117
- }
1118
-
1119
- renameKeyInObjectSetting('panel-tabOrder', 'audits', 'lighthouse');
1120
- renameKeyInObjectSetting('panel-closeableTabs', 'audits', 'lighthouse');
1121
- renameInStringSetting('panel-selectedTab', 'audits', 'lighthouse');
1122
- }
1123
-
1124
- updateVersionFrom29To30(): void {
1125
- // Create new location agnostic setting
1126
- const closeableTabSetting = Settings.instance().createSetting('closeableTabs', {});
1127
-
1128
- // Read current settings
1129
- const panelCloseableTabSetting = Settings.instance().createSetting('panel-closeableTabs', {});
1130
- const drawerCloseableTabSetting = Settings.instance().createSetting('drawer-view-closeableTabs', {});
1131
- const openTabsInPanel = panelCloseableTabSetting.get();
1132
- const openTabsInDrawer = panelCloseableTabSetting.get();
1133
-
1134
- // Set #value of new setting
1135
- const newValue = Object.assign(openTabsInDrawer, openTabsInPanel);
1136
- closeableTabSetting.set(newValue);
1137
-
1138
- // Remove old settings
1139
- removeSetting(panelCloseableTabSetting);
1140
- removeSetting(drawerCloseableTabSetting);
1141
- }
1142
-
1143
- updateVersionFrom30To31(): void {
1144
- // Remove recorder_recordings setting that was used for storing recordings
1145
- // by an old recorder experiment.
1146
- const recordingsSetting = Settings.instance().createSetting('recorder_recordings', []);
1147
- removeSetting(recordingsSetting);
1148
- }
1149
-
1150
- updateVersionFrom31To32(): void {
1151
- // Introduce the new 'resourceTypeName' property on stored breakpoints. Prior to
1152
- // this change we synchronized the breakpoint only by URL, but since we don't
1153
- // know on which resource type the given breakpoint was set, we just assume
1154
- // 'script' here to keep things simple.
1155
-
1156
- const breakpointsSetting = Settings.instance().createLocalSetting<any>('breakpoints', []);
1157
- const breakpoints = breakpointsSetting.get();
1158
- for (const breakpoint of breakpoints) {
1159
- breakpoint['resourceTypeName'] = 'script';
1160
- }
1161
- breakpointsSetting.set(breakpoints);
1162
- }
1163
-
1164
- updateVersionFrom32To33(): void {
1165
- const previouslyViewedFilesSetting = Settings.instance().createLocalSetting<any>('previouslyViewedFiles', []);
1166
- let previouslyViewedFiles = previouslyViewedFilesSetting.get();
1167
-
1168
- // Discard old 'previouslyViewedFiles' items that don't have a 'url' property.
1169
-
1170
- previouslyViewedFiles = previouslyViewedFiles.filter((previouslyViewedFile: any) => 'url' in previouslyViewedFile);
1171
-
1172
- // Introduce the new 'resourceTypeName' property on previously viewed files.
1173
- // Prior to this change we only keyed them based on the URL, but since we
1174
- // don't know which resource type the given file had, we just assume 'script'
1175
- // here to keep things simple.
1176
- for (const previouslyViewedFile of previouslyViewedFiles) {
1177
- previouslyViewedFile['resourceTypeName'] = 'script';
1178
- }
1179
-
1180
- previouslyViewedFilesSetting.set(previouslyViewedFiles);
1181
- }
1182
-
1183
- updateVersionFrom33To34(): void {
1184
- // Introduces the 'isLogpoint' property on stored breakpoints. This information was
1185
- // previously encoded in the 'condition' itself. This migration leaves the condition
1186
- // alone but ensures that 'isLogpoint' is accurate for already stored breakpoints.
1187
- // This enables us to use the 'isLogpoint' property in code.
1188
- // A separate migration will remove the special encoding from the condition itself
1189
- // once all refactorings are done.
1190
-
1191
- // The prefix/suffix are hardcoded here, since these constants will be removed in
1192
- // the future.
1193
- const logpointPrefix = '/** DEVTOOLS_LOGPOINT */ console.log(';
1194
- const logpointSuffix = ')';
1195
-
1196
- const breakpointsSetting = Settings.instance().createLocalSetting<any>('breakpoints', []);
1197
- const breakpoints = breakpointsSetting.get();
1198
- for (const breakpoint of breakpoints) {
1199
- const isLogpoint =
1200
- breakpoint.condition.startsWith(logpointPrefix) && breakpoint.condition.endsWith(logpointSuffix);
1201
- breakpoint['isLogpoint'] = isLogpoint;
1202
- }
1203
- breakpointsSetting.set(breakpoints);
1204
- }
1205
-
1206
- updateVersionFrom34To35(): void {
1207
- // Uses the 'isLogpoint' property on stored breakpoints to remove the prefix/suffix
1208
- // from logpoints. This way, we store the entered log point condition as the user
1209
- // entered it.
1210
-
1211
- // The prefix/suffix are hardcoded here, since these constants will be removed in
1212
- // the future.
1213
- const logpointPrefix = '/** DEVTOOLS_LOGPOINT */ console.log(';
1214
- const logpointSuffix = ')';
1215
-
1216
- const breakpointsSetting = Settings.instance().createLocalSetting<any>('breakpoints', []);
1217
- const breakpoints = breakpointsSetting.get();
1218
- for (const breakpoint of breakpoints) {
1219
- const {condition, isLogpoint} = breakpoint;
1220
- if (isLogpoint) {
1221
- breakpoint.condition = condition.slice(logpointPrefix.length, condition.length - logpointSuffix.length);
1222
- }
1223
- }
1224
- breakpointsSetting.set(breakpoints);
1225
- }
1226
-
1227
- updateVersionFrom35To36(): void {
1228
- // We have changed the default from 'false' to 'true' and this updates the existing setting just for once.
1229
- Settings.instance().createSetting('showThirdPartyIssues', true).set(true);
1230
- }
1231
-
1232
- updateVersionFrom36To37(): void {
1233
- const updateStorage = (storage: SettingsStorage): void => {
1234
- for (const key of storage.keys()) {
1235
- const normalizedKey = Settings.normalizeSettingName(key);
1236
- if (normalizedKey !== key) {
1237
- const value = storage.get(key);
1238
- removeSetting({name: key, storage});
1239
- storage.set(normalizedKey, value);
1240
- }
1241
- }
1242
- };
1243
- updateStorage(Settings.instance().globalStorage);
1244
- updateStorage(Settings.instance().syncedStorage);
1245
- updateStorage(Settings.instance().localStorage);
1246
-
1247
- for (const key of Settings.instance().globalStorage.keys()) {
1248
- if ((key.startsWith('data-grid-') && key.endsWith('-column-weights')) || key.endsWith('-tab-order') ||
1249
- key === 'views-location-override' || key === 'closeable-tabs') {
1250
- const setting = Settings.instance().createSetting(key, {});
1251
- setting.set(Platform.StringUtilities.toKebabCaseKeys(setting.get()));
1252
- }
1253
- if (key.endsWith('-selected-tab')) {
1254
- const setting = Settings.instance().createSetting(key, '');
1255
- setting.set(Platform.StringUtilities.toKebabCase(setting.get()));
1256
- }
1257
- }
1258
- }
1259
-
1260
- updateVersionFrom37To38(): void {
1261
- const getConsoleInsightsEnabledSetting = (): Setting<boolean>|undefined => {
1262
- try {
1263
- return moduleSetting('console-insights-enabled') as Setting<boolean>;
1264
- } catch {
1265
- return;
1266
- }
1267
- };
1268
-
1269
- const consoleInsightsEnabled = getConsoleInsightsEnabledSetting();
1270
- const onboardingFinished = Settings.instance().createLocalSetting('console-insights-onboarding-finished', false);
1271
-
1272
- if (consoleInsightsEnabled && consoleInsightsEnabled.get() === true && onboardingFinished.get() === false) {
1273
- consoleInsightsEnabled.set(false);
1274
- }
1275
- if (consoleInsightsEnabled && consoleInsightsEnabled.get() === false) {
1276
- onboardingFinished.set(false);
1277
- }
1278
- }
1279
-
1280
- updateVersionFrom38To39(): void {
1281
- const PREFERRED_NETWORK_COND = 'preferred-network-condition';
1282
- // crrev.com/c/5582013 renamed "Slow 3G" to "3G" and "Fast 3G" => "Slow 4G".
1283
- // Any users with the old values need to have them moved to avoid breaking DevTools.
1284
- // Note: we load the raw value via the globalStorage here because
1285
- // `createSetting` creates if it is not present, and we do not want that;
1286
- // we only want to update existing, old values.
1287
- const setting = Settings.instance().globalStorage.get(PREFERRED_NETWORK_COND);
1288
- if (!setting) {
1289
- return;
1290
- }
1291
- try {
1292
- const networkSetting = JSON.parse(setting) as unknown as {
1293
- // Can't use SDK type here as it creates a common<>sdk circular
1294
- // dep. This type is not exhaustive but contains the fields we
1295
- // need.
1296
- title: string,
1297
- i18nTitleKey?: string,
1298
- };
1299
- if (networkSetting.title === 'Slow 3G') {
1300
- networkSetting.title = '3G';
1301
- networkSetting.i18nTitleKey = '3G';
1302
- Settings.instance().globalStorage.set(PREFERRED_NETWORK_COND, JSON.stringify(networkSetting));
1303
- } else if (networkSetting.title === 'Fast 3G') {
1304
- networkSetting.title = 'Slow 4G';
1305
- networkSetting.i18nTitleKey = 'Slow 4G';
1306
- Settings.instance().globalStorage.set(PREFERRED_NETWORK_COND, JSON.stringify(networkSetting));
1307
- }
1308
- } catch {
1309
- // If parsing the setting threw, it's in some invalid state, so remove it.
1310
- Settings.instance().globalStorage.remove(PREFERRED_NETWORK_COND);
1311
- }
1312
- }
1313
-
1314
- /**
1315
- * There are two related migrations here for handling network throttling persistence:
1316
- * 1. Go through all user custom throttling conditions and add a `key` property.
1317
- * 2. If the user has a 'preferred-network-condition' setting, take the value
1318
- * of that and set the right key for the new 'active-network-condition-key'
1319
- * setting. Then, remove the now-obsolete 'preferred-network-condition'
1320
- * setting.
1321
- */
1322
- updateVersionFrom39To40(): void {
1323
- const hasCustomNetworkConditionsSetting = (): boolean => {
1324
- try {
1325
- // this will error if it does not exist
1326
- moduleSetting('custom-network-conditions');
1327
- return true;
1328
- } catch {
1329
- return false;
1330
- }
1331
- };
1332
- if (hasCustomNetworkConditionsSetting()) {
1333
- /**
1334
- * We added keys to custom network throttling conditions in M140, so we
1335
- * need to go through any existing profiles the user has and add the key to
1336
- * them.
1337
- * We can't use the SDK.NetworkManager.Condition here as it would be a
1338
- * circular dependency. All that matters is that these conditions are
1339
- * objects, and we need to set the right key on each one. The actual keys &
1340
- * values in the object are not important.
1341
- */
1342
- const conditionsSetting = moduleSetting('custom-network-conditions') as Setting<Array<{key?: string}>>;
1343
- const customConditions = conditionsSetting.get();
1344
- if (customConditions?.length > 0) {
1345
- customConditions.forEach((condition, i) => {
1346
- // This could be run multiple times, make sure that we don't override any
1347
- // existing keys.
1348
- if (condition.key) {
1349
- return;
1350
- }
1351
- // The format of this key is important: see
1352
- // SDK.NetworkManager.UserDefinedThrottlingConditionKey
1353
- condition.key = `USER_CUSTOM_SETTING_${i + 1}`;
1354
- });
1355
- conditionsSetting.set(customConditions);
1356
- }
1357
- }
1358
-
1359
- // Additionally, we need to make sure we persist the right throttling for
1360
- // users who have a preferred-network-condition set.
1361
- const PREFERRED_NETWORK_COND_SETTING = 'preferred-network-condition';
1362
- // We shipped a change to how we persist network throttling conditions and
1363
- // added a `key` property rather than rely on any user visible string which
1364
- // is more likely to change. This migration step tries to update the
1365
- // setting for users, or removes it if we fail, so they start fresh next
1366
- // time they load DevTools.
1367
- const setting = Settings.instance().globalStorage.get(PREFERRED_NETWORK_COND_SETTING);
1368
- if (!setting) {
1369
- return;
1370
- }
1371
- // The keys here are the UI Strings as of July 2025 (shipped in M139).
1372
- // This migration shipped in M140. The values are the values of the
1373
- // `PredefinedThrottlingConditionKey` in SDK.NetworkManager.
1374
- const UI_STRING_TO_NEW_KEY = {
1375
- 'Fast 4G': 'SPEED_FAST_4G',
1376
- 'Slow 4G': 'SPEED_SLOW_4G',
1377
- '3G': 'SPEED_3G',
1378
- 'No throttling': 'NO_THROTTLING',
1379
- Offline: 'OFFLINE'
1380
- };
1381
- try {
1382
- const networkSetting = JSON.parse(setting) as unknown as {
1383
- // Can't use SDK type here as it creates a common<>sdk circular
1384
- // dep. We only rely on the i18nTitleKey.
1385
- i18nTitleKey?: string,
1386
- };
1387
- if (networkSetting.i18nTitleKey && UI_STRING_TO_NEW_KEY.hasOwnProperty(networkSetting.i18nTitleKey)) {
1388
- const key = UI_STRING_TO_NEW_KEY[networkSetting.i18nTitleKey as keyof typeof UI_STRING_TO_NEW_KEY];
1389
-
1390
- // The second argument is the default value, so it's important that we
1391
- // set this to the default, and then update it to the new key.
1392
- const newSetting = Settings.instance().createSetting('active-network-condition-key', 'NO_THROTTLING');
1393
- newSetting.set(key);
1394
- }
1395
- } finally {
1396
- // This setting is now not used, so we can remove it.
1397
- Settings.instance().globalStorage.remove(PREFERRED_NETWORK_COND_SETTING);
1398
- }
1399
- }
1400
-
1401
- /*
1402
- * Any new migration should be added before this comment.
1403
- *
1404
- * IMPORTANT: Migrations must be idempotent, since they may be applied
1405
- * multiple times! E.g. when renaming a setting one has to check that the
1406
- * a setting with the new name does not yet exist.
1407
- * ----------------------------------------------------------------------- */
1408
-
1409
- private migrateSettingsFromLocalStorage(): void {
1410
- // This step migrates all the settings except for the ones below into the browser profile.
1411
- const localSettings = new Set<string>([
1412
- 'advancedSearchConfig',
1413
- 'breakpoints',
1414
- 'consoleHistory',
1415
- 'domBreakpoints',
1416
- 'eventListenerBreakpoints',
1417
- 'fileSystemMapping',
1418
- 'lastSelectedSourcesSidebarPaneTab',
1419
- 'previouslyViewedFiles',
1420
- 'savedURLs',
1421
- 'watchExpressions',
1422
- 'workspaceExcludedFolders',
1423
- 'xhrBreakpoints',
1424
- ]);
1425
- if (!window.localStorage) {
1426
- return;
1427
- }
1428
-
1429
- for (const key in window.localStorage) {
1430
- if (localSettings.has(key)) {
1431
- continue;
1432
- }
1433
- const value = window.localStorage[key];
1434
- window.localStorage.removeItem(key);
1435
- Settings.instance().globalStorage.set(key, value);
1436
- }
1437
- }
1438
-
1439
- private clearBreakpointsWhenTooMany(breakpointsSetting: Setting<unknown[]>, maxBreakpointsCount: number): void {
1440
- // If there are too many breakpoints in a storage, it is likely due to a recent bug that caused
1441
- // periodical breakpoints duplication leading to inspector slowness.
1442
- if (breakpointsSetting.get().length > maxBreakpointsCount) {
1443
- breakpointsSetting.set([]);
1444
- }
1445
- }
1446
- }
1447
- /* eslint-enable @typescript-eslint/no-explicit-any */
1448
-
1449
- export const enum SettingStorageType {
1450
- /** Persists with the active Chrome profile but also syncs the settings across devices via Chrome Sync. */
1451
- SYNCED = 'Synced',
1452
- /**
1453
- * Persists with the active Chrome profile, but not synchronized to other devices.
1454
- * The default SettingStorageType of createSetting().
1455
- */
1456
- GLOBAL = 'Global',
1457
- /** Uses Window.localStorage. Not recommended, legacy. */
1458
- LOCAL = 'Local',
1459
- /**
1460
- * Session storage dies when DevTools window closes. Useful for atypical conditions that should be reverted when the
1461
- * user is done with their task. (eg Emulation modes, Debug overlays). These are also not carried into/out of incognito
1462
- */
1463
- SESSION = 'Session',
1464
- }
1465
-
1466
- export function moduleSetting(settingName: string): Setting<unknown> {
1467
- return Settings.instance().moduleSetting(settingName);
1468
- }
1469
-
1470
- export function settingForTest(settingName: string): Setting<unknown> {
1471
- return Settings.instance().settingForTest(settingName);
1472
- }
1473
-
1474
- export {
1475
- getLocalizedSettingsCategory,
1476
- maybeRemoveSettingExtension,
1477
- RegExpSettingItem,
1478
- registerSettingExtension,
1479
- registerSettingsForTest,
1480
- resetSettings,
1481
- SettingCategory,
1482
- SettingExtensionOption,
1483
- SettingRegistration,
1484
- SettingType,
1485
- };
1486
-
1487
- export interface Serializer<I, O> {
1488
- stringify: (value: I) => string;
1489
- parse: (value: string) => O;
1490
- }
1491
-
1492
- export interface SimpleSettingOption {
1493
- value: string|boolean;
1494
- title: string;
1495
- text?: string;
1496
- raw?: boolean;
1497
- }