devtools-tracing 1.1.1 → 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.
- package/.claude/settings.local.json +14 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +28854 -0
- package/package.json +11 -8
- package/generate.ts +0 -649
- package/index.ts +0 -17
- package/lib/extension-api/ExtensionAPI.d.ts +0 -357
- package/lib/front_end/core/common/App.ts +0 -7
- package/lib/front_end/core/common/AppProvider.ts +0 -32
- package/lib/front_end/core/common/Base64.ts +0 -47
- package/lib/front_end/core/common/CharacterIdMap.ts +0 -30
- package/lib/front_end/core/common/Color.ts +0 -2506
- package/lib/front_end/core/common/ColorConverter.ts +0 -402
- package/lib/front_end/core/common/ColorUtils.ts +0 -252
- package/lib/front_end/core/common/Console.ts +0 -114
- package/lib/front_end/core/common/Debouncer.ts +0 -15
- package/lib/front_end/core/common/EventTarget.ts +0 -52
- package/lib/front_end/core/common/Gzip.ts +0 -74
- package/lib/front_end/core/common/JavaScriptMetaData.ts +0 -29
- package/lib/front_end/core/common/Lazy.ts +0 -31
- package/lib/front_end/core/common/Linkifier.ts +0 -55
- package/lib/front_end/core/common/MapWithDefault.ts +0 -26
- package/lib/front_end/core/common/Mutex.ts +0 -55
- package/lib/front_end/core/common/Object.ts +0 -145
- package/lib/front_end/core/common/ParsedURL.ts +0 -554
- package/lib/front_end/core/common/Progress.ts +0 -180
- package/lib/front_end/core/common/QueryParamHandler.ts +0 -7
- package/lib/front_end/core/common/ResolverBase.ts +0 -85
- package/lib/front_end/core/common/ResourceType.ts +0 -588
- package/lib/front_end/core/common/ReturnToPanel.ts +0 -17
- package/lib/front_end/core/common/Revealer.ts +0 -192
- package/lib/front_end/core/common/Runnable.ts +0 -41
- package/lib/front_end/core/common/SegmentedRange.ts +0 -87
- package/lib/front_end/core/common/SettingRegistration.ts +0 -339
- package/lib/front_end/core/common/Settings.ts +0 -1497
- package/lib/front_end/core/common/SimpleHistoryManager.ts +0 -124
- package/lib/front_end/core/common/StringOutputStream.ts +0 -26
- package/lib/front_end/core/common/TextDictionary.ts +0 -48
- package/lib/front_end/core/common/Throttler.ts +0 -99
- package/lib/front_end/core/common/Trie.ts +0 -152
- package/lib/front_end/core/common/Worker.ts +0 -60
- package/lib/front_end/core/common/common.ts +0 -81
- package/lib/front_end/core/host/AidaClient.ts +0 -733
- package/lib/front_end/core/host/GdpClient.ts +0 -316
- package/lib/front_end/core/host/InspectorFrontendHost.ts +0 -648
- package/lib/front_end/core/host/InspectorFrontendHostAPI.ts +0 -551
- package/lib/front_end/core/host/Platform.ts +0 -76
- package/lib/front_end/core/host/ResourceLoader.ts +0 -282
- package/lib/front_end/core/host/UserMetrics.ts +0 -1230
- package/lib/front_end/core/host/host.ts +0 -23
- package/lib/front_end/core/i18n/ByteUtilities.ts +0 -82
- package/lib/front_end/core/i18n/DevToolsLocale.ts +0 -87
- package/lib/front_end/core/i18n/NumberFormatter.ts +0 -82
- package/lib/front_end/core/i18n/i18n.ts +0 -17
- package/lib/front_end/core/i18n/i18nImpl.ts +0 -204
- package/lib/front_end/core/i18n/i18nTypes.ts +0 -10
- package/lib/front_end/core/i18n/locales.js +0 -14
- package/lib/front_end/core/i18n/time-utilities.ts +0 -174
- package/lib/front_end/core/platform/ArrayUtilities.ts +0 -271
- package/lib/front_end/core/platform/Brand.ts +0 -23
- package/lib/front_end/core/platform/Constructor.ts +0 -10
- package/lib/front_end/core/platform/DOMUtilities.ts +0 -138
- package/lib/front_end/core/platform/DateUtilities.ts +0 -15
- package/lib/front_end/core/platform/DevToolsPath.ts +0 -53
- package/lib/front_end/core/platform/KeyboardUtilities.ts +0 -38
- package/lib/front_end/core/platform/MapUtilities.ts +0 -95
- package/lib/front_end/core/platform/MimeType.ts +0 -175
- package/lib/front_end/core/platform/NumberUtilities.ts +0 -80
- package/lib/front_end/core/platform/StringUtilities.ts +0 -588
- package/lib/front_end/core/platform/Timing.ts +0 -17
- package/lib/front_end/core/platform/TypedArrayUtilities.ts +0 -189
- package/lib/front_end/core/platform/TypescriptUtilities.ts +0 -86
- package/lib/front_end/core/platform/UIString.ts +0 -39
- package/lib/front_end/core/platform/UserVisibleError.ts +0 -28
- package/lib/front_end/core/platform/platform.ts +0 -45
- package/lib/front_end/core/protocol_client/ConnectionTransport.ts +0 -26
- package/lib/front_end/core/protocol_client/InspectorBackend.ts +0 -1050
- package/lib/front_end/core/protocol_client/NodeURL.ts +0 -42
- package/lib/front_end/core/protocol_client/protocol_client.ts +0 -13
- package/lib/front_end/core/root/Runtime.ts +0 -609
- package/lib/front_end/core/root/root.ts +0 -6
- package/lib/front_end/core/sdk/AccessibilityModel.ts +0 -353
- package/lib/front_end/core/sdk/AnimationModel.ts +0 -1041
- package/lib/front_end/core/sdk/AutofillModel.ts +0 -184
- package/lib/front_end/core/sdk/CPUProfilerModel.ts +0 -148
- package/lib/front_end/core/sdk/CPUThrottlingManager.ts +0 -282
- package/lib/front_end/core/sdk/CSSContainerQuery.ts +0 -139
- package/lib/front_end/core/sdk/CSSFontFace.ts +0 -40
- package/lib/front_end/core/sdk/CSSLayer.ts +0 -30
- package/lib/front_end/core/sdk/CSSMatchedStyles.ts +0 -1646
- package/lib/front_end/core/sdk/CSSMedia.ts +0 -121
- package/lib/front_end/core/sdk/CSSMetadata.ts +0 -1647
- package/lib/front_end/core/sdk/CSSModel.ts +0 -1128
- package/lib/front_end/core/sdk/CSSProperty.ts +0 -384
- package/lib/front_end/core/sdk/CSSPropertyParser.ts +0 -681
- package/lib/front_end/core/sdk/CSSPropertyParserMatchers.ts +0 -1395
- package/lib/front_end/core/sdk/CSSQuery.ts +0 -72
- package/lib/front_end/core/sdk/CSSRule.ts +0 -465
- package/lib/front_end/core/sdk/CSSScope.ts +0 -30
- package/lib/front_end/core/sdk/CSSStartingStyle.ts +0 -29
- package/lib/front_end/core/sdk/CSSStyleDeclaration.ts +0 -313
- package/lib/front_end/core/sdk/CSSStyleSheetHeader.ts +0 -196
- package/lib/front_end/core/sdk/CSSSupports.ts +0 -33
- package/lib/front_end/core/sdk/CategorizedBreakpoint.ts +0 -64
- package/lib/front_end/core/sdk/ChildTargetManager.ts +0 -314
- package/lib/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +0 -62
- package/lib/front_end/core/sdk/Connections.ts +0 -293
- package/lib/front_end/core/sdk/ConsoleModel.ts +0 -808
- package/lib/front_end/core/sdk/ConsoleModelTypes.ts +0 -15
- package/lib/front_end/core/sdk/Cookie.ts +0 -319
- package/lib/front_end/core/sdk/CookieModel.ts +0 -239
- package/lib/front_end/core/sdk/CookieParser.ts +0 -185
- package/lib/front_end/core/sdk/DOMDebuggerModel.ts +0 -787
- package/lib/front_end/core/sdk/DOMModel.ts +0 -1961
- package/lib/front_end/core/sdk/DebuggerModel.ts +0 -1605
- package/lib/front_end/core/sdk/EmulationModel.ts +0 -648
- package/lib/front_end/core/sdk/EnhancedTracesParser.ts +0 -515
- package/lib/front_end/core/sdk/EventBreakpointsModel.ts +0 -183
- package/lib/front_end/core/sdk/FrameAssociated.ts +0 -11
- package/lib/front_end/core/sdk/FrameManager.ts +0 -259
- package/lib/front_end/core/sdk/HeapProfilerModel.ts +0 -225
- package/lib/front_end/core/sdk/HttpReasonPhraseStrings.ts +0 -77
- package/lib/front_end/core/sdk/IOModel.ts +0 -91
- package/lib/front_end/core/sdk/IsolateManager.ts +0 -257
- package/lib/front_end/core/sdk/IssuesModel.ts +0 -70
- package/lib/front_end/core/sdk/LayerTreeBase.ts +0 -169
- package/lib/front_end/core/sdk/LogModel.ts +0 -56
- package/lib/front_end/core/sdk/NetworkManager.ts +0 -2823
- package/lib/front_end/core/sdk/NetworkRequest.ts +0 -2253
- package/lib/front_end/core/sdk/OverlayColorGenerator.ts +0 -52
- package/lib/front_end/core/sdk/OverlayModel.ts +0 -1011
- package/lib/front_end/core/sdk/OverlayPersistentHighlighter.ts +0 -522
- package/lib/front_end/core/sdk/PageLoad.ts +0 -35
- package/lib/front_end/core/sdk/PageResourceLoader.ts +0 -435
- package/lib/front_end/core/sdk/PaintProfiler.ts +0 -110
- package/lib/front_end/core/sdk/PerformanceMetricsModel.ts +0 -84
- package/lib/front_end/core/sdk/PreloadingModel.ts +0 -863
- package/lib/front_end/core/sdk/RehydratingConnection.ts +0 -386
- package/lib/front_end/core/sdk/RehydratingObject.ts +0 -66
- package/lib/front_end/core/sdk/RemoteObject.ts +0 -1160
- package/lib/front_end/core/sdk/Resource.ts +0 -232
- package/lib/front_end/core/sdk/ResourceTreeModel.ts +0 -1160
- package/lib/front_end/core/sdk/RuntimeModel.ts +0 -732
- package/lib/front_end/core/sdk/SDKModel.ts +0 -65
- package/lib/front_end/core/sdk/ScopeTreeCache.ts +0 -45
- package/lib/front_end/core/sdk/ScreenCaptureModel.ts +0 -255
- package/lib/front_end/core/sdk/Script.ts +0 -534
- package/lib/front_end/core/sdk/SecurityOriginManager.ts +0 -76
- package/lib/front_end/core/sdk/ServerSentEvents.ts +0 -80
- package/lib/front_end/core/sdk/ServerSentEventsProtocol.ts +0 -122
- package/lib/front_end/core/sdk/ServerTiming.ts +0 -260
- package/lib/front_end/core/sdk/ServiceWorkerCacheModel.ts +0 -377
- package/lib/front_end/core/sdk/ServiceWorkerManager.ts +0 -605
- package/lib/front_end/core/sdk/SourceMap.ts +0 -867
- package/lib/front_end/core/sdk/SourceMapCache.ts +0 -54
- package/lib/front_end/core/sdk/SourceMapFunctionRanges.ts +0 -156
- package/lib/front_end/core/sdk/SourceMapManager.ts +0 -239
- package/lib/front_end/core/sdk/SourceMapScopeChainEntry.ts +0 -189
- package/lib/front_end/core/sdk/SourceMapScopesInfo.ts +0 -508
- package/lib/front_end/core/sdk/StorageBucketsModel.ts +0 -204
- package/lib/front_end/core/sdk/StorageKeyManager.ts +0 -98
- package/lib/front_end/core/sdk/Target.ts +0 -332
- package/lib/front_end/core/sdk/TargetManager.ts +0 -453
- package/lib/front_end/core/sdk/TraceObject.ts +0 -61
- package/lib/front_end/core/sdk/WebAuthnModel.ts +0 -104
- package/lib/front_end/core/sdk/sdk.ts +0 -174
- package/lib/front_end/entrypoints/formatter_worker/FormatterActions.ts +0 -59
- package/lib/front_end/generated/InspectorBackendCommands.js +0 -1617
- package/lib/front_end/generated/SupportedCSSProperties.js +0 -7512
- package/lib/front_end/generated/protocol-proxy-api.d.ts +0 -5022
- package/lib/front_end/generated/protocol.ts +0 -22014
- package/lib/front_end/models/bindings/CSSWorkspaceBinding.ts +0 -318
- package/lib/front_end/models/bindings/CompilerScriptMapping.ts +0 -536
- package/lib/front_end/models/bindings/ContentProviderBasedProject.ts +0 -187
- package/lib/front_end/models/bindings/DebuggerLanguagePlugins.ts +0 -1197
- package/lib/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -733
- package/lib/front_end/models/bindings/DefaultScriptMapping.ts +0 -141
- package/lib/front_end/models/bindings/FileUtils.ts +0 -228
- package/lib/front_end/models/bindings/LiveLocation.ts +0 -81
- package/lib/front_end/models/bindings/NetworkProject.ts +0 -157
- package/lib/front_end/models/bindings/PresentationConsoleMessageHelper.ts +0 -312
- package/lib/front_end/models/bindings/ResourceMapping.ts +0 -539
- package/lib/front_end/models/bindings/ResourceScriptMapping.ts +0 -491
- package/lib/front_end/models/bindings/ResourceUtils.ts +0 -103
- package/lib/front_end/models/bindings/SASSSourceMapping.ts +0 -222
- package/lib/front_end/models/bindings/StylesSourceMapping.ts +0 -316
- package/lib/front_end/models/bindings/TempFile.ts +0 -67
- package/lib/front_end/models/bindings/bindings.ts +0 -39
- package/lib/front_end/models/cpu_profile/CPUProfileDataModel.ts +0 -571
- package/lib/front_end/models/cpu_profile/ProfileTreeModel.ts +0 -103
- package/lib/front_end/models/cpu_profile/cpu_profile.ts +0 -11
- package/lib/front_end/models/formatter/FormatterWorkerPool.ts +0 -219
- package/lib/front_end/models/formatter/ScriptFormatter.ts +0 -112
- package/lib/front_end/models/formatter/formatter.ts +0 -8
- package/lib/front_end/models/source_map_scopes/NamesResolver.ts +0 -765
- package/lib/front_end/models/source_map_scopes/ScopeChainModel.ts +0 -84
- package/lib/front_end/models/source_map_scopes/source_map_scopes.ts +0 -11
- package/lib/front_end/models/stack_trace/StackTrace.ts +0 -53
- package/lib/front_end/models/stack_trace/StackTraceImpl.ts +0 -85
- package/lib/front_end/models/stack_trace/StackTraceModel.ts +0 -128
- package/lib/front_end/models/stack_trace/Trie.ts +0 -163
- package/lib/front_end/models/stack_trace/stack_trace.ts +0 -9
- package/lib/front_end/models/stack_trace/stack_trace_impl.ts +0 -13
- package/lib/front_end/models/text_utils/CodeMirrorUtils.ts +0 -37
- package/lib/front_end/models/text_utils/ContentData.ts +0 -199
- package/lib/front_end/models/text_utils/ContentProvider.ts +0 -68
- package/lib/front_end/models/text_utils/StaticContentProvider.ts +0 -49
- package/lib/front_end/models/text_utils/StreamingContentData.ts +0 -108
- package/lib/front_end/models/text_utils/Text.ts +0 -90
- package/lib/front_end/models/text_utils/TextCursor.ts +0 -44
- package/lib/front_end/models/text_utils/TextRange.ts +0 -266
- package/lib/front_end/models/text_utils/TextUtils.ts +0 -401
- package/lib/front_end/models/text_utils/WasmDisassembly.ts +0 -87
- package/lib/front_end/models/text_utils/text_utils.ts +0 -27
- package/lib/front_end/models/trace/EntityMapper.ts +0 -141
- package/lib/front_end/models/trace/EventsSerializer.ts +0 -101
- package/lib/front_end/models/trace/LanternComputationData.ts +0 -438
- package/lib/front_end/models/trace/ModelImpl.ts +0 -236
- package/lib/front_end/models/trace/Name.ts +0 -136
- package/lib/front_end/models/trace/Processor.ts +0 -652
- package/lib/front_end/models/trace/Styles.ts +0 -1138
- package/lib/front_end/models/trace/extras/FilmStrip.ts +0 -78
- package/lib/front_end/models/trace/extras/MainThreadActivity.ts +0 -86
- package/lib/front_end/models/trace/extras/ScriptDuplication.ts +0 -236
- package/lib/front_end/models/trace/extras/StackTraceForEvent.ts +0 -203
- package/lib/front_end/models/trace/extras/ThirdParties.ts +0 -164
- package/lib/front_end/models/trace/extras/TraceFilter.ts +0 -62
- package/lib/front_end/models/trace/extras/TraceTree.ts +0 -701
- package/lib/front_end/models/trace/extras/extras.ts +0 -11
- package/lib/front_end/models/trace/handlers/AnimationFramesHandler.ts +0 -128
- package/lib/front_end/models/trace/handlers/AnimationHandler.ts +0 -36
- package/lib/front_end/models/trace/handlers/AsyncJSCallsHandler.ts +0 -239
- package/lib/front_end/models/trace/handlers/AuctionWorkletsHandler.ts +0 -183
- package/lib/front_end/models/trace/handlers/DOMStatsHandler.ts +0 -31
- package/lib/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +0 -306
- package/lib/front_end/models/trace/handlers/FlowsHandler.ts +0 -175
- package/lib/front_end/models/trace/handlers/FramesHandler.ts +0 -571
- package/lib/front_end/models/trace/handlers/GPUHandler.ts +0 -50
- package/lib/front_end/models/trace/handlers/ImagePaintingHandler.ts +0 -183
- package/lib/front_end/models/trace/handlers/InitiatorsHandler.ts +0 -193
- package/lib/front_end/models/trace/handlers/InvalidationsHandler.ts +0 -168
- package/lib/front_end/models/trace/handlers/LargestImagePaintHandler.ts +0 -109
- package/lib/front_end/models/trace/handlers/LargestTextPaintHandler.ts +0 -35
- package/lib/front_end/models/trace/handlers/LayerTreeHandler.ts +0 -123
- package/lib/front_end/models/trace/handlers/LayoutShiftsHandler.ts +0 -573
- package/lib/front_end/models/trace/handlers/MemoryHandler.ts +0 -31
- package/lib/front_end/models/trace/handlers/MetaHandler.ts +0 -525
- package/lib/front_end/models/trace/handlers/ModelHandlers.ts +0 -34
- package/lib/front_end/models/trace/handlers/NetworkRequestsHandler.ts +0 -672
- package/lib/front_end/models/trace/handlers/PageFramesHandler.ts +0 -52
- package/lib/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +0 -460
- package/lib/front_end/models/trace/handlers/RendererHandler.ts +0 -428
- package/lib/front_end/models/trace/handlers/SamplesHandler.ts +0 -271
- package/lib/front_end/models/trace/handlers/ScreenshotsHandler.ts +0 -122
- package/lib/front_end/models/trace/handlers/ScriptsHandler.ts +0 -336
- package/lib/front_end/models/trace/handlers/SelectorStatsHandler.ts +0 -110
- package/lib/front_end/models/trace/handlers/Threads.ts +0 -139
- package/lib/front_end/models/trace/handlers/UserInteractionsHandler.ts +0 -400
- package/lib/front_end/models/trace/handlers/UserTimingsHandler.ts +0 -233
- package/lib/front_end/models/trace/handlers/WarningsHandler.ts +0 -162
- package/lib/front_end/models/trace/handlers/WorkersHandler.ts +0 -45
- package/lib/front_end/models/trace/handlers/handlers.ts +0 -8
- package/lib/front_end/models/trace/handlers/helpers.ts +0 -196
- package/lib/front_end/models/trace/handlers/types.ts +0 -75
- package/lib/front_end/models/trace/helpers/Extensions.ts +0 -54
- package/lib/front_end/models/trace/helpers/Network.ts +0 -129
- package/lib/front_end/models/trace/helpers/SamplesIntegrator.ts +0 -544
- package/lib/front_end/models/trace/helpers/SyntheticEvents.ts +0 -87
- package/lib/front_end/models/trace/helpers/Timing.ts +0 -248
- package/lib/front_end/models/trace/helpers/Trace.ts +0 -928
- package/lib/front_end/models/trace/helpers/TreeHelpers.ts +0 -320
- package/lib/front_end/models/trace/helpers/helpers.ts +0 -11
- package/lib/front_end/models/trace/insights/CLSCulprits.ts +0 -668
- package/lib/front_end/models/trace/insights/Cache.ts +0 -269
- package/lib/front_end/models/trace/insights/Common.ts +0 -453
- package/lib/front_end/models/trace/insights/DOMSize.ts +0 -223
- package/lib/front_end/models/trace/insights/DocumentLatency.ts +0 -319
- package/lib/front_end/models/trace/insights/DuplicatedJavaScript.ts +0 -126
- package/lib/front_end/models/trace/insights/FontDisplay.ts +0 -119
- package/lib/front_end/models/trace/insights/ForcedReflow.ts +0 -220
- package/lib/front_end/models/trace/insights/INPBreakdown.ts +0 -171
- package/lib/front_end/models/trace/insights/ImageDelivery.ts +0 -348
- package/lib/front_end/models/trace/insights/LCPBreakdown.ts +0 -268
- package/lib/front_end/models/trace/insights/LCPDiscovery.ts +0 -237
- package/lib/front_end/models/trace/insights/LegacyJavaScript.ts +0 -138
- package/lib/front_end/models/trace/insights/Models.ts +0 -22
- package/lib/front_end/models/trace/insights/ModernHTTP.ts +0 -257
- package/lib/front_end/models/trace/insights/NetworkDependencyTree.ts +0 -726
- package/lib/front_end/models/trace/insights/RenderBlocking.ts +0 -257
- package/lib/front_end/models/trace/insights/SlowCSSSelector.ts +0 -175
- package/lib/front_end/models/trace/insights/Statistics.ts +0 -101
- package/lib/front_end/models/trace/insights/ThirdParties.ts +0 -130
- package/lib/front_end/models/trace/insights/Viewport.ts +0 -138
- package/lib/front_end/models/trace/insights/insights.ts +0 -10
- package/lib/front_end/models/trace/insights/types.ts +0 -157
- package/lib/front_end/models/trace/lantern/core/LanternError.ts +0 -7
- package/lib/front_end/models/trace/lantern/core/NetworkAnalyzer.ts +0 -619
- package/lib/front_end/models/trace/lantern/core/core.ts +0 -6
- package/lib/front_end/models/trace/lantern/graph/BaseNode.ts +0 -345
- package/lib/front_end/models/trace/lantern/graph/CPUNode.ts +0 -80
- package/lib/front_end/models/trace/lantern/graph/NetworkNode.ts +0 -101
- package/lib/front_end/models/trace/lantern/graph/PageDependencyGraph.ts +0 -636
- package/lib/front_end/models/trace/lantern/graph/graph.ts +0 -8
- package/lib/front_end/models/trace/lantern/lantern.ts +0 -17
- package/lib/front_end/models/trace/lantern/metrics/FirstContentfulPaint.ts +0 -187
- package/lib/front_end/models/trace/lantern/metrics/Interactive.ts +0 -88
- package/lib/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +0 -92
- package/lib/front_end/models/trace/lantern/metrics/MaxPotentialFID.ts +0 -72
- package/lib/front_end/models/trace/lantern/metrics/Metric.ts +0 -126
- package/lib/front_end/models/trace/lantern/metrics/SpeedIndex.ts +0 -126
- package/lib/front_end/models/trace/lantern/metrics/TBTUtils.ts +0 -82
- package/lib/front_end/models/trace/lantern/metrics/TotalBlockingTime.ts +0 -112
- package/lib/front_end/models/trace/lantern/metrics/metrics.ts +0 -12
- package/lib/front_end/models/trace/lantern/simulation/ConnectionPool.ts +0 -150
- package/lib/front_end/models/trace/lantern/simulation/Constants.ts +0 -46
- package/lib/front_end/models/trace/lantern/simulation/DNSCache.ts +0 -61
- package/lib/front_end/models/trace/lantern/simulation/SimulationTimingMap.ts +0 -196
- package/lib/front_end/models/trace/lantern/simulation/Simulator.ts +0 -556
- package/lib/front_end/models/trace/lantern/simulation/TCPConnection.ts +0 -192
- package/lib/front_end/models/trace/lantern/simulation/simulation.ts +0 -10
- package/lib/front_end/models/trace/lantern/types/Lantern.ts +0 -220
- package/lib/front_end/models/trace/lantern/types/types.ts +0 -5
- package/lib/front_end/models/trace/trace.ts +0 -33
- package/lib/front_end/models/trace/types/Configuration.ts +0 -110
- package/lib/front_end/models/trace/types/Extensions.ts +0 -136
- package/lib/front_end/models/trace/types/File.ts +0 -281
- package/lib/front_end/models/trace/types/Overlays.ts +0 -138
- package/lib/front_end/models/trace/types/Timing.ts +0 -30
- package/lib/front_end/models/trace/types/TraceEvents.ts +0 -3277
- package/lib/front_end/models/trace/types/types.ts +0 -10
- package/lib/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +0 -240
- package/lib/front_end/models/trace_source_maps_resolver/trace_source_maps_resolver.ts +0 -5
- package/lib/front_end/models/workspace/FileManager.ts +0 -97
- package/lib/front_end/models/workspace/IgnoreListManager.ts +0 -628
- package/lib/front_end/models/workspace/SearchConfig.ts +0 -149
- package/lib/front_end/models/workspace/UISourceCode.ts +0 -698
- package/lib/front_end/models/workspace/WorkspaceImpl.ts +0 -339
- package/lib/front_end/models/workspace/workspace.ts +0 -17
- package/lib/front_end/panels/timeline/TimelineUIUtils.ts +0 -1029
- package/lib/front_end/panels/timeline/extensions/ExtensionUI.ts +0 -49
- package/lib/front_end/panels/timeline/extensions/extensions.ts +0 -9
- package/lib/front_end/third_party/codemirror.next/LICENSE +0 -21
- package/lib/front_end/third_party/codemirror.next/README.chromium +0 -30
- package/lib/front_end/third_party/codemirror.next/bundle-tsconfig.json +0 -24
- package/lib/front_end/third_party/codemirror.next/bundle.ts +0 -135
- package/lib/front_end/third_party/codemirror.next/chunk/angular.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/angular.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/codemirror.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/codemirror.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/cpp.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/cpp.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/css.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/html.js +0 -4
- package/lib/front_end/third_party/codemirror.next/chunk/java.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/java.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/javascript.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/legacy.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/legacy.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/less.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/less.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/markdown.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/markdown.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/php.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/php.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/python.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/python.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/sass.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/sass.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/svelte.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/svelte.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/vue.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/vue.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/wast.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/wast.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/chunk/xml.js +0 -2
- package/lib/front_end/third_party/codemirror.next/chunk/xml.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/codemirror.next.d.ts +0 -8057
- package/lib/front_end/third_party/codemirror.next/codemirror.next.js +0 -2
- package/lib/front_end/third_party/codemirror.next/codemirror.next.js.map +0 -1
- package/lib/front_end/third_party/codemirror.next/package.json +0 -43
- package/lib/front_end/third_party/codemirror.next/rebuild.sh +0 -6
- package/lib/front_end/third_party/codemirror.next/rollup.config.mjs +0 -49
- package/lib/front_end/third_party/i18n/LICENSE +0 -202
- package/lib/front_end/third_party/i18n/README.chromium +0 -15
- package/lib/front_end/third_party/i18n/i18n-impl.ts +0 -61
- package/lib/front_end/third_party/i18n/i18n.ts +0 -11
- package/lib/front_end/third_party/i18n/localized-string-set.ts +0 -129
- package/lib/front_end/third_party/intl-messageformat/LICENSE +0 -33
- package/lib/front_end/third_party/intl-messageformat/README.chromium +0 -24
- package/lib/front_end/third_party/intl-messageformat/intl-messageformat-tsconfig.json +0 -16
- package/lib/front_end/third_party/intl-messageformat/intl-messageformat.ts +0 -6
- package/lib/front_end/third_party/intl-messageformat/package/LICENSE.md +0 -33
- package/lib/front_end/third_party/intl-messageformat/package/README.md +0 -3
- package/lib/front_end/third_party/intl-messageformat/package/index.d.ts +0 -6
- package/lib/front_end/third_party/intl-messageformat/package/index.d.ts.map +0 -1
- package/lib/front_end/third_party/intl-messageformat/package/index.js +0 -13
- package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.d.ts +0 -5
- package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.js +0 -1710
- package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.iife.js +0 -1815
- package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts +0 -6
- package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts.map +0 -1
- package/lib/front_end/third_party/intl-messageformat/package/lib/index.js +0 -10
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts +0 -34
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts.map +0 -1
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.js +0 -229
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts +0 -28
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts.map +0 -1
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.js +0 -48
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts +0 -34
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts.map +0 -1
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.js +0 -179
- package/lib/front_end/third_party/intl-messageformat/package/package.json +0 -42
- package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts +0 -34
- package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts.map +0 -1
- package/lib/front_end/third_party/intl-messageformat/package/src/core.js +0 -230
- package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts +0 -28
- package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts.map +0 -1
- package/lib/front_end/third_party/intl-messageformat/package/src/error.js +0 -51
- package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts +0 -34
- package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts.map +0 -1
- package/lib/front_end/third_party/intl-messageformat/package/src/formatters.js +0 -182
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/error.d.ts +0 -79
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/index.d.ts +0 -15
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/parser.d.ts +0 -153
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/types.d.ts +0 -139
- package/lib/front_end/third_party/legacy-javascript/LICENSE +0 -202
- package/lib/front_end/third_party/legacy-javascript/README.chromium +0 -13
- package/lib/front_end/third_party/legacy-javascript/legacy-javascript-tsconfig.json +0 -8
- package/lib/front_end/third_party/legacy-javascript/legacy-javascript.ts +0 -3
- package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.d.ts +0 -18
- package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.js +0 -943
- package/lib/front_end/third_party/legacy-javascript/package.json +0 -8
- package/lib/front_end/third_party/legacy-javascript/rebuild.sh +0 -9
- package/lib/front_end/third_party/source-map-scopes-codec/LICENSE +0 -26
- package/lib/front_end/third_party/source-map-scopes-codec/README.chromium +0 -31
- package/lib/front_end/third_party/source-map-scopes-codec/package/CONTRIBUTING.md +0 -33
- package/lib/front_end/third_party/source-map-scopes-codec/package/LICENSE +0 -26
- package/lib/front_end/third_party/source-map-scopes-codec/package/README.md +0 -64
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts +0 -62
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts +0 -37
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts +0 -29
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts +0 -8
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts +0 -6
- package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/deno.json +0 -21
- package/lib/front_end/third_party/source-map-scopes-codec/package/package.json +0 -14
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js +0 -196
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.ts +0 -262
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js +0 -235
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.ts +0 -359
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/codec.js +0 -39
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/codec.js.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/codec.ts +0 -53
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js +0 -438
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.ts +0 -539
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js +0 -23
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.ts +0 -35
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js +0 -257
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.ts +0 -348
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/mod.js +0 -8
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/mod.js.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/mod.ts +0 -20
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/scopes-tsconfig.json +0 -8
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/scopes.d.ts +0 -184
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/util.js +0 -9
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/util.js.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/util.ts +0 -12
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/vlq.js +0 -82
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/vlq.js.map +0 -1
- package/lib/front_end/third_party/source-map-scopes-codec/package/src/vlq.ts +0 -99
- package/lib/front_end/third_party/source-map-scopes-codec/source-map-scopes-codec.ts +0 -5
- package/lib/front_end/third_party/third-party-web/LICENSE +0 -20
- package/lib/front_end/third_party/third-party-web/README.chromium +0 -13
- package/lib/front_end/third_party/third-party-web/lib/nostats-subset.d.ts +0 -2
- package/lib/front_end/third_party/third-party-web/lib/nostats-subset.js +0 -149
- package/lib/front_end/third_party/third-party-web/package/LICENSE +0 -20
- package/lib/front_end/third_party/third-party-web/package/README.md +0 -929
- package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive-nostats.json +0 -1
- package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive.json +0 -1
- package/lib/front_end/third_party/third-party-web/package/dist/entities-nostats.json +0 -1
- package/lib/front_end/third_party/third-party-web/package/dist/entities.json +0 -1
- package/lib/front_end/third_party/third-party-web/package/facades.md +0 -46
- package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.d.ts +0 -1
- package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.js +0 -1
- package/lib/front_end/third_party/third-party-web/package/httparchive-subset.d.ts +0 -1
- package/lib/front_end/third_party/third-party-web/package/httparchive-subset.js +0 -1
- package/lib/front_end/third_party/third-party-web/package/lib/__snapshots__/index.test.js.snap +0 -1006
- package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.js +0 -139
- package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.test.js +0 -44
- package/lib/front_end/third_party/third-party-web/package/lib/entities.test.js +0 -27
- package/lib/front_end/third_party/third-party-web/package/lib/index.d.ts +0 -34
- package/lib/front_end/third_party/third-party-web/package/lib/index.js +0 -3
- package/lib/front_end/third_party/third-party-web/package/lib/index.test.js +0 -246
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/faqs.partial.md +0 -36
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/goals.partial.md +0 -9
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/methodology.partial.md +0 -5
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/template.md +0 -151
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-02-01.md +0 -1
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-03-01.md +0 -1
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-06.md +0 -1
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-13.md +0 -14
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2021-01-01.md +0 -1
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2024-07-01.md +0 -3
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.d.ts +0 -1
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.js +0 -3
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.d.ts +0 -1
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.js +0 -3
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.d.ts +0 -1
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.js +0 -3
- package/lib/front_end/third_party/third-party-web/package/nostats-subset.d.ts +0 -1
- package/lib/front_end/third_party/third-party-web/package/nostats-subset.js +0 -1
- package/lib/front_end/third_party/third-party-web/package/package.json +0 -46
- package/lib/front_end/third_party/third-party-web/package.json +0 -8
- package/lib/front_end/third_party/third-party-web/rebuild.sh +0 -13
- package/lib/front_end/third_party/third-party-web/third-party-web-tsconfig.json +0 -8
- package/lib/front_end/third_party/third-party-web/third-party-web.ts +0 -3
- package/lib/front_end/ui/legacy/theme_support/ThemeSupport.ts +0 -222
- package/lib/front_end/ui/legacy/theme_support/theme_support.ts +0 -5
- package/patches/chrome-devtools-frontend+1.0.1533544.patch +0 -1716
|
@@ -1,1605 +0,0 @@
|
|
|
1
|
-
// Copyright 2010 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 type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
|
|
6
|
-
import * as Protocol from '../../generated/protocol.js';
|
|
7
|
-
import * as Common from '../common/common.js';
|
|
8
|
-
import * as Host from '../host/host.js';
|
|
9
|
-
import * as i18n from '../i18n/i18n.js';
|
|
10
|
-
import * as Platform from '../platform/platform.js';
|
|
11
|
-
import * as Root from '../root/root.js';
|
|
12
|
-
|
|
13
|
-
import type {PageResourceLoadInitiator} from './PageResourceLoader.js';
|
|
14
|
-
import {type GetPropertiesResult, type RemoteObject, RemoteObjectProperty, ScopeRef} from './RemoteObject.js';
|
|
15
|
-
import {Events as ResourceTreeModelEvents, ResourceTreeModel} from './ResourceTreeModel.js';
|
|
16
|
-
import {type EvaluationOptions, type EvaluationResult, type ExecutionContext, RuntimeModel} from './RuntimeModel.js';
|
|
17
|
-
import {Script} from './Script.js';
|
|
18
|
-
import {SDKModel} from './SDKModel.js';
|
|
19
|
-
import {SourceMap} from './SourceMap.js';
|
|
20
|
-
import {SourceMapManager} from './SourceMapManager.js';
|
|
21
|
-
import {Capability, type Target, Type} from './Target.js';
|
|
22
|
-
|
|
23
|
-
const UIStrings = {
|
|
24
|
-
/**
|
|
25
|
-
* @description Title of a section in the debugger showing local JavaScript variables.
|
|
26
|
-
*/
|
|
27
|
-
local: 'Local',
|
|
28
|
-
/**
|
|
29
|
-
* @description Text that refers to closure as a programming term
|
|
30
|
-
*/
|
|
31
|
-
closure: 'Closure',
|
|
32
|
-
/**
|
|
33
|
-
* @description Noun that represents a section or block of code in the Debugger Model. Shown in the Sources tab, while paused on a breakpoint.
|
|
34
|
-
*/
|
|
35
|
-
block: 'Block',
|
|
36
|
-
/**
|
|
37
|
-
* @description Label for a group of JavaScript files
|
|
38
|
-
*/
|
|
39
|
-
script: 'Script',
|
|
40
|
-
/**
|
|
41
|
-
* @description Title of a section in the debugger showing JavaScript variables from the a 'with'
|
|
42
|
-
*block. Block here means section of code, 'with' refers to a JavaScript programming concept and
|
|
43
|
-
*is a fixed term.
|
|
44
|
-
*/
|
|
45
|
-
withBlock: '`With` block',
|
|
46
|
-
/**
|
|
47
|
-
* @description Title of a section in the debugger showing JavaScript variables from the a 'catch'
|
|
48
|
-
*block. Block here means section of code, 'catch' refers to a JavaScript programming concept and
|
|
49
|
-
*is a fixed term.
|
|
50
|
-
*/
|
|
51
|
-
catchBlock: '`Catch` block',
|
|
52
|
-
/**
|
|
53
|
-
* @description Title of a section in the debugger showing JavaScript variables from the global scope.
|
|
54
|
-
*/
|
|
55
|
-
global: 'Global',
|
|
56
|
-
/**
|
|
57
|
-
* @description Text for a JavaScript module, the programming concept
|
|
58
|
-
*/
|
|
59
|
-
module: 'Module',
|
|
60
|
-
/**
|
|
61
|
-
* @description Text describing the expression scope in WebAssembly
|
|
62
|
-
*/
|
|
63
|
-
expression: 'Expression',
|
|
64
|
-
/**
|
|
65
|
-
* @description Text in Scope Chain Sidebar Pane of the Sources panel
|
|
66
|
-
*/
|
|
67
|
-
exception: 'Exception',
|
|
68
|
-
/**
|
|
69
|
-
* @description Text in Scope Chain Sidebar Pane of the Sources panel
|
|
70
|
-
*/
|
|
71
|
-
returnValue: 'Return value',
|
|
72
|
-
} as const;
|
|
73
|
-
const str_ = i18n.i18n.registerUIStrings('core/sdk/DebuggerModel.ts', UIStrings);
|
|
74
|
-
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
75
|
-
|
|
76
|
-
export function sortAndMergeRanges(locationRanges: Protocol.Debugger.LocationRange[]):
|
|
77
|
-
Protocol.Debugger.LocationRange[] {
|
|
78
|
-
function compare(p1: Protocol.Debugger.ScriptPosition, p2: Protocol.Debugger.ScriptPosition): number {
|
|
79
|
-
return (p1.lineNumber - p2.lineNumber) || (p1.columnNumber - p2.columnNumber);
|
|
80
|
-
}
|
|
81
|
-
function overlap(r1: Protocol.Debugger.LocationRange, r2: Protocol.Debugger.LocationRange): boolean {
|
|
82
|
-
if (r1.scriptId !== r2.scriptId) {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
const n = compare(r1.start, r2.start);
|
|
86
|
-
if (n < 0) {
|
|
87
|
-
return compare(r1.end, r2.start) >= 0;
|
|
88
|
-
}
|
|
89
|
-
if (n > 0) {
|
|
90
|
-
return compare(r1.start, r2.end) <= 0;
|
|
91
|
-
}
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (locationRanges.length === 0) {
|
|
96
|
-
return [];
|
|
97
|
-
}
|
|
98
|
-
locationRanges.sort((r1, r2) => {
|
|
99
|
-
if (r1.scriptId < r2.scriptId) {
|
|
100
|
-
return -1;
|
|
101
|
-
}
|
|
102
|
-
if (r1.scriptId > r2.scriptId) {
|
|
103
|
-
return 1;
|
|
104
|
-
}
|
|
105
|
-
return compare(r1.start, r2.start) || compare(r1.end, r2.end);
|
|
106
|
-
});
|
|
107
|
-
let prev = locationRanges[0];
|
|
108
|
-
const merged = [];
|
|
109
|
-
for (let i = 1; i < locationRanges.length; ++i) {
|
|
110
|
-
const curr = locationRanges[i];
|
|
111
|
-
if (overlap(prev, curr)) {
|
|
112
|
-
if (compare(prev.end, curr.end) <= 0) {
|
|
113
|
-
prev = {...prev, end: curr.end};
|
|
114
|
-
}
|
|
115
|
-
} else {
|
|
116
|
-
merged.push(prev);
|
|
117
|
-
prev = curr;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
merged.push(prev);
|
|
121
|
-
return merged;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export const enum StepMode {
|
|
125
|
-
STEP_INTO = 'StepInto',
|
|
126
|
-
STEP_OUT = 'StepOut',
|
|
127
|
-
STEP_OVER = 'StepOver',
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export const WASM_SYMBOLS_PRIORITY = [
|
|
131
|
-
Protocol.Debugger.DebugSymbolsType.ExternalDWARF,
|
|
132
|
-
Protocol.Debugger.DebugSymbolsType.EmbeddedDWARF,
|
|
133
|
-
Protocol.Debugger.DebugSymbolsType.SourceMap,
|
|
134
|
-
];
|
|
135
|
-
|
|
136
|
-
export class DebuggerModel extends SDKModel<EventTypes> {
|
|
137
|
-
readonly agent: ProtocolProxyApi.DebuggerApi;
|
|
138
|
-
#runtimeModel: RuntimeModel;
|
|
139
|
-
readonly #sourceMapManager: SourceMapManager<Script>;
|
|
140
|
-
#debuggerPausedDetails: DebuggerPausedDetails|null = null;
|
|
141
|
-
readonly #scripts = new Map<string, Script>();
|
|
142
|
-
readonly #scriptsBySourceURL = new Map<string, Script[]>();
|
|
143
|
-
#discardableScripts: Script[] = [];
|
|
144
|
-
continueToLocationCallback: ((arg0: DebuggerPausedDetails) => boolean)|null = null;
|
|
145
|
-
#selectedCallFrame: CallFrame|null = null;
|
|
146
|
-
#debuggerEnabled = false;
|
|
147
|
-
#debuggerId: string|null = null;
|
|
148
|
-
#skipAllPausesTimeout = 0;
|
|
149
|
-
#beforePausedCallback: ((arg0: DebuggerPausedDetails, stepOver: Location|null) => Promise<boolean>)|null = null;
|
|
150
|
-
#computeAutoStepRangesCallback: ((arg0: StepMode, arg1: CallFrame) => Promise<Array<{
|
|
151
|
-
start: Location,
|
|
152
|
-
end: Location,
|
|
153
|
-
}>>)|null = null;
|
|
154
|
-
#expandCallFramesCallback: ((arg0: CallFrame[]) => Promise<CallFrame[]>)|null = null;
|
|
155
|
-
evaluateOnCallFrameCallback:
|
|
156
|
-
((arg0: CallFrame, arg1: EvaluationOptions) => Promise<EvaluationResult|null>)|null = null;
|
|
157
|
-
#synchronizeBreakpointsCallback: ((script: Script) => Promise<void>)|null = null;
|
|
158
|
-
// We need to be able to register listeners for individual breakpoints. As such, we dispatch
|
|
159
|
-
// on breakpoint ids, which are not statically known. The event #payload will always be a `Location`.
|
|
160
|
-
readonly #breakpointResolvedEventTarget = new Common.ObjectWrapper.ObjectWrapper<Record<string, Location>>();
|
|
161
|
-
// When stepping over with autostepping enabled, the context denotes the function to which autostepping is restricted
|
|
162
|
-
// to by way of its functionLocation (as per Debugger.CallFrame).
|
|
163
|
-
#autoSteppingContext: Location|null = null;
|
|
164
|
-
#isPausing = false;
|
|
165
|
-
|
|
166
|
-
constructor(target: Target) {
|
|
167
|
-
super(target);
|
|
168
|
-
|
|
169
|
-
target.registerDebuggerDispatcher(new DebuggerDispatcher(this));
|
|
170
|
-
this.agent = target.debuggerAgent();
|
|
171
|
-
this.#runtimeModel = (target.model(RuntimeModel) as RuntimeModel);
|
|
172
|
-
|
|
173
|
-
this.#sourceMapManager = new SourceMapManager(
|
|
174
|
-
target,
|
|
175
|
-
(compiledURL, sourceMappingURL, payload, script) =>
|
|
176
|
-
new SourceMap(compiledURL, sourceMappingURL, payload, script));
|
|
177
|
-
|
|
178
|
-
Common.Settings.Settings.instance()
|
|
179
|
-
.moduleSetting('pause-on-exception-enabled')
|
|
180
|
-
.addChangeListener(this.pauseOnExceptionStateChanged, this);
|
|
181
|
-
Common.Settings.Settings.instance()
|
|
182
|
-
.moduleSetting('pause-on-caught-exception')
|
|
183
|
-
.addChangeListener(this.pauseOnExceptionStateChanged, this);
|
|
184
|
-
Common.Settings.Settings.instance()
|
|
185
|
-
.moduleSetting('pause-on-uncaught-exception')
|
|
186
|
-
.addChangeListener(this.pauseOnExceptionStateChanged, this);
|
|
187
|
-
Common.Settings.Settings.instance()
|
|
188
|
-
.moduleSetting('disable-async-stack-traces')
|
|
189
|
-
.addChangeListener(this.asyncStackTracesStateChanged, this);
|
|
190
|
-
Common.Settings.Settings.instance()
|
|
191
|
-
.moduleSetting('breakpoints-active')
|
|
192
|
-
.addChangeListener(this.breakpointsActiveChanged, this);
|
|
193
|
-
|
|
194
|
-
if (!target.suspended()) {
|
|
195
|
-
void this.enableDebugger();
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
this.#sourceMapManager.setEnabled(
|
|
199
|
-
Common.Settings.Settings.instance().moduleSetting('js-source-maps-enabled').get());
|
|
200
|
-
Common.Settings.Settings.instance()
|
|
201
|
-
.moduleSetting('js-source-maps-enabled')
|
|
202
|
-
.addChangeListener(event => this.#sourceMapManager.setEnabled((event.data as boolean)));
|
|
203
|
-
|
|
204
|
-
const resourceTreeModel = (target.model(ResourceTreeModel) as ResourceTreeModel);
|
|
205
|
-
if (resourceTreeModel) {
|
|
206
|
-
resourceTreeModel.addEventListener(ResourceTreeModelEvents.FrameNavigated, this.onFrameNavigated, this);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
static selectSymbolSource(debugSymbols: Protocol.Debugger.DebugSymbols[]|null): Protocol.Debugger.DebugSymbols|null {
|
|
211
|
-
if (!debugSymbols || debugSymbols.length === 0) {
|
|
212
|
-
return null;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// Provides backwards compatibility to previous CDP version on Protocol.Debugger.DebugSymbols.
|
|
216
|
-
// TODO(crbug.com/369515221): Remove extra code as soon as old v8 versions used in Node are no longer supported.
|
|
217
|
-
if ('type' in debugSymbols) {
|
|
218
|
-
if (debugSymbols.type === 'None') {
|
|
219
|
-
return null;
|
|
220
|
-
}
|
|
221
|
-
return debugSymbols as Protocol.Debugger.DebugSymbols;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
let debugSymbolsSource = null;
|
|
225
|
-
const symbolTypes = new Map(debugSymbols.map(symbol => [symbol.type, symbol]));
|
|
226
|
-
for (const symbol of WASM_SYMBOLS_PRIORITY) {
|
|
227
|
-
if (symbolTypes.has(symbol)) {
|
|
228
|
-
debugSymbolsSource = symbolTypes.get(symbol) || null;
|
|
229
|
-
break;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
console.assert(
|
|
234
|
-
debugSymbolsSource !== null,
|
|
235
|
-
'Unknown symbol types. Front-end and back-end should be kept in sync regarding Protocol.Debugger.DebugSymbolTypes');
|
|
236
|
-
if (debugSymbolsSource && debugSymbols.length > 1) {
|
|
237
|
-
Common.Console.Console.instance().warn(
|
|
238
|
-
`Multiple debug symbols for script were found. Using ${debugSymbolsSource.type}`);
|
|
239
|
-
}
|
|
240
|
-
return debugSymbolsSource;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
sourceMapManager(): SourceMapManager<Script> {
|
|
244
|
-
return this.#sourceMapManager;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
runtimeModel(): RuntimeModel {
|
|
248
|
-
return this.#runtimeModel;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
debuggerEnabled(): boolean {
|
|
252
|
-
return Boolean(this.#debuggerEnabled);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
debuggerId(): string|null {
|
|
256
|
-
return this.#debuggerId;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
private async enableDebugger(): Promise<void> {
|
|
260
|
-
if (this.#debuggerEnabled) {
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
this.#debuggerEnabled = true;
|
|
264
|
-
|
|
265
|
-
// Set a limit for the total size of collected script sources retained by debugger.
|
|
266
|
-
// 10MB for remote frontends, 100MB for others.
|
|
267
|
-
const isRemoteFrontend = Root.Runtime.Runtime.queryParam('remoteFrontend') || Root.Runtime.Runtime.queryParam('ws');
|
|
268
|
-
const maxScriptsCacheSize = isRemoteFrontend ? 10e6 : 100e6;
|
|
269
|
-
const enablePromise = this.agent.invoke_enable({maxScriptsCacheSize});
|
|
270
|
-
let instrumentationPromise: Promise<Protocol.Debugger.SetInstrumentationBreakpointResponse>|undefined;
|
|
271
|
-
if (Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.INSTRUMENTATION_BREAKPOINTS)) {
|
|
272
|
-
instrumentationPromise = this.agent.invoke_setInstrumentationBreakpoint({
|
|
273
|
-
instrumentation: Protocol.Debugger.SetInstrumentationBreakpointRequestInstrumentation.BeforeScriptExecution,
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
this.pauseOnExceptionStateChanged();
|
|
277
|
-
void this.asyncStackTracesStateChanged();
|
|
278
|
-
if (!Common.Settings.Settings.instance().moduleSetting('breakpoints-active').get()) {
|
|
279
|
-
this.breakpointsActiveChanged();
|
|
280
|
-
}
|
|
281
|
-
this.dispatchEventToListeners(Events.DebuggerWasEnabled, this);
|
|
282
|
-
const [enableResult] = await Promise.all([enablePromise, instrumentationPromise]);
|
|
283
|
-
this.registerDebugger(enableResult);
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
async syncDebuggerId(): Promise<Protocol.Debugger.EnableResponse> {
|
|
287
|
-
const isRemoteFrontend = Root.Runtime.Runtime.queryParam('remoteFrontend') || Root.Runtime.Runtime.queryParam('ws');
|
|
288
|
-
const maxScriptsCacheSize = isRemoteFrontend ? 10e6 : 100e6;
|
|
289
|
-
const enablePromise = this.agent.invoke_enable({maxScriptsCacheSize});
|
|
290
|
-
void enablePromise.then(this.registerDebugger.bind(this));
|
|
291
|
-
return await enablePromise;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
private onFrameNavigated(): void {
|
|
295
|
-
if (DebuggerModel.shouldResyncDebuggerId) {
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
DebuggerModel.shouldResyncDebuggerId = true;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
private registerDebugger(response: Protocol.Debugger.EnableResponse): void {
|
|
303
|
-
if (response.getError()) {
|
|
304
|
-
this.#debuggerEnabled = false;
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
const {debuggerId} = response;
|
|
308
|
-
debuggerIdToModel.set(debuggerId, this);
|
|
309
|
-
this.#debuggerId = debuggerId;
|
|
310
|
-
this.dispatchEventToListeners(Events.DebuggerIsReadyToPause, this);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
isReadyToPause(): boolean {
|
|
314
|
-
return Boolean(this.#debuggerId);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
static async modelForDebuggerId(debuggerId: string): Promise<DebuggerModel|null> {
|
|
318
|
-
if (DebuggerModel.shouldResyncDebuggerId) {
|
|
319
|
-
await DebuggerModel.resyncDebuggerIdForModels();
|
|
320
|
-
DebuggerModel.shouldResyncDebuggerId = false;
|
|
321
|
-
}
|
|
322
|
-
return debuggerIdToModel.get(debuggerId) || null;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
static async resyncDebuggerIdForModels(): Promise<void> {
|
|
326
|
-
const dbgModels = debuggerIdToModel.values();
|
|
327
|
-
for (const dbgModel of dbgModels) {
|
|
328
|
-
if (dbgModel.debuggerEnabled()) {
|
|
329
|
-
await dbgModel.syncDebuggerId();
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
private async disableDebugger(): Promise<void> {
|
|
335
|
-
if (!this.#debuggerEnabled) {
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
this.#debuggerEnabled = false;
|
|
339
|
-
|
|
340
|
-
await this.asyncStackTracesStateChanged();
|
|
341
|
-
await this.agent.invoke_disable();
|
|
342
|
-
this.#isPausing = false;
|
|
343
|
-
this.globalObjectCleared();
|
|
344
|
-
this.dispatchEventToListeners(Events.DebuggerWasDisabled, this);
|
|
345
|
-
if (typeof this.#debuggerId === 'string') {
|
|
346
|
-
debuggerIdToModel.delete(this.#debuggerId);
|
|
347
|
-
}
|
|
348
|
-
this.#debuggerId = null;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
private skipAllPauses(skip: boolean): void {
|
|
352
|
-
if (this.#skipAllPausesTimeout) {
|
|
353
|
-
clearTimeout(this.#skipAllPausesTimeout);
|
|
354
|
-
this.#skipAllPausesTimeout = 0;
|
|
355
|
-
}
|
|
356
|
-
void this.agent.invoke_setSkipAllPauses({skip});
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
skipAllPausesUntilReloadOrTimeout(timeout: number): void {
|
|
360
|
-
if (this.#skipAllPausesTimeout) {
|
|
361
|
-
clearTimeout(this.#skipAllPausesTimeout);
|
|
362
|
-
}
|
|
363
|
-
void this.agent.invoke_setSkipAllPauses({skip: true});
|
|
364
|
-
// If reload happens before the timeout, the flag will be already unset and the timeout callback won't change anything.
|
|
365
|
-
this.#skipAllPausesTimeout = window.setTimeout(this.skipAllPauses.bind(this, false), timeout);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
private pauseOnExceptionStateChanged(): void {
|
|
369
|
-
const pauseOnCaughtEnabled = Common.Settings.Settings.instance().moduleSetting('pause-on-caught-exception').get();
|
|
370
|
-
let state: Protocol.Debugger.SetPauseOnExceptionsRequestState;
|
|
371
|
-
|
|
372
|
-
const pauseOnUncaughtEnabled =
|
|
373
|
-
Common.Settings.Settings.instance().moduleSetting('pause-on-uncaught-exception').get();
|
|
374
|
-
if (pauseOnCaughtEnabled && pauseOnUncaughtEnabled) {
|
|
375
|
-
state = Protocol.Debugger.SetPauseOnExceptionsRequestState.All;
|
|
376
|
-
} else if (pauseOnCaughtEnabled) {
|
|
377
|
-
state = Protocol.Debugger.SetPauseOnExceptionsRequestState.Caught;
|
|
378
|
-
} else if (pauseOnUncaughtEnabled) {
|
|
379
|
-
state = Protocol.Debugger.SetPauseOnExceptionsRequestState.Uncaught;
|
|
380
|
-
} else {
|
|
381
|
-
state = Protocol.Debugger.SetPauseOnExceptionsRequestState.None;
|
|
382
|
-
}
|
|
383
|
-
void this.agent.invoke_setPauseOnExceptions({state});
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
private asyncStackTracesStateChanged(): Promise<Protocol.ProtocolResponseWithError> {
|
|
387
|
-
const maxAsyncStackChainDepth = 32;
|
|
388
|
-
const enabled =
|
|
389
|
-
!Common.Settings.Settings.instance().moduleSetting('disable-async-stack-traces').get() && this.#debuggerEnabled;
|
|
390
|
-
const maxDepth = enabled ? maxAsyncStackChainDepth : 0;
|
|
391
|
-
return this.agent.invoke_setAsyncCallStackDepth({maxDepth});
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
private breakpointsActiveChanged(): void {
|
|
395
|
-
void this.agent.invoke_setBreakpointsActive(
|
|
396
|
-
{active: Common.Settings.Settings.instance().moduleSetting('breakpoints-active').get()});
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
setComputeAutoStepRangesCallback(callback: ((arg0: StepMode, arg1: CallFrame) => Promise<LocationRange[]>)|null):
|
|
400
|
-
void {
|
|
401
|
-
this.#computeAutoStepRangesCallback = callback;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
private async computeAutoStepSkipList(mode: StepMode): Promise<Protocol.Debugger.LocationRange[]> {
|
|
405
|
-
let ranges: LocationRange[] = [];
|
|
406
|
-
if (this.#computeAutoStepRangesCallback && this.#debuggerPausedDetails &&
|
|
407
|
-
this.#debuggerPausedDetails.callFrames.length > 0) {
|
|
408
|
-
const [callFrame] = this.#debuggerPausedDetails.callFrames;
|
|
409
|
-
ranges = await this.#computeAutoStepRangesCallback.call(null, mode, callFrame);
|
|
410
|
-
}
|
|
411
|
-
const skipList = ranges.map(({start, end}) => ({
|
|
412
|
-
scriptId: start.scriptId,
|
|
413
|
-
start: {lineNumber: start.lineNumber, columnNumber: start.columnNumber},
|
|
414
|
-
end: {lineNumber: end.lineNumber, columnNumber: end.columnNumber},
|
|
415
|
-
}));
|
|
416
|
-
return sortAndMergeRanges(skipList);
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
async stepInto(): Promise<void> {
|
|
420
|
-
const skipList = await this.computeAutoStepSkipList(StepMode.STEP_INTO);
|
|
421
|
-
void this.agent.invoke_stepInto({breakOnAsyncCall: false, skipList});
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
async stepOver(): Promise<void> {
|
|
425
|
-
this.#autoSteppingContext = this.#debuggerPausedDetails?.callFrames[0]?.functionLocation() ?? null;
|
|
426
|
-
const skipList = await this.computeAutoStepSkipList(StepMode.STEP_OVER);
|
|
427
|
-
void this.agent.invoke_stepOver({skipList});
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
async stepOut(): Promise<void> {
|
|
431
|
-
const skipList = await this.computeAutoStepSkipList(StepMode.STEP_OUT);
|
|
432
|
-
if (skipList.length !== 0) {
|
|
433
|
-
void this.agent.invoke_stepOver({skipList});
|
|
434
|
-
} else {
|
|
435
|
-
void this.agent.invoke_stepOut();
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
scheduleStepIntoAsync(): void {
|
|
440
|
-
void this.computeAutoStepSkipList(StepMode.STEP_INTO).then(skipList => {
|
|
441
|
-
void this.agent.invoke_stepInto({breakOnAsyncCall: true, skipList});
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
resume(): void {
|
|
446
|
-
void this.agent.invoke_resume({terminateOnResume: false});
|
|
447
|
-
this.#isPausing = false;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
pause(): void {
|
|
451
|
-
this.#isPausing = true;
|
|
452
|
-
this.skipAllPauses(false);
|
|
453
|
-
void this.agent.invoke_pause();
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
async setBreakpointByURL(
|
|
457
|
-
url: Platform.DevToolsPath.UrlString, lineNumber: number, columnNumber?: number,
|
|
458
|
-
condition?: BackendCondition): Promise<SetBreakpointResult> {
|
|
459
|
-
// Convert file url to node-js path.
|
|
460
|
-
let urlRegex;
|
|
461
|
-
if (this.target().type() === Type.NODE && Common.ParsedURL.schemeIs(url, 'file:')) {
|
|
462
|
-
const platformPath = Common.ParsedURL.ParsedURL.urlToRawPathString(url, Host.Platform.isWin());
|
|
463
|
-
urlRegex =
|
|
464
|
-
`${Platform.StringUtilities.escapeForRegExp(platformPath)}|${Platform.StringUtilities.escapeForRegExp(url)}`;
|
|
465
|
-
if (Host.Platform.isWin() && platformPath.match(/^.:\\/)) {
|
|
466
|
-
// Match upper or lower case drive letter
|
|
467
|
-
urlRegex = `[${platformPath[0].toUpperCase()}${platformPath[0].toLowerCase()}]` + urlRegex.substr(1);
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
// Adjust column if needed.
|
|
471
|
-
let minColumnNumber = 0;
|
|
472
|
-
const scripts = this.#scriptsBySourceURL.get(url) || [];
|
|
473
|
-
for (let i = 0, l = scripts.length; i < l; ++i) {
|
|
474
|
-
const script = scripts[i];
|
|
475
|
-
if (lineNumber === script.lineOffset) {
|
|
476
|
-
minColumnNumber = minColumnNumber ? Math.min(minColumnNumber, script.columnOffset) : script.columnOffset;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
columnNumber = Math.max(columnNumber || 0, minColumnNumber);
|
|
480
|
-
const response = await this.agent.invoke_setBreakpointByUrl({
|
|
481
|
-
lineNumber,
|
|
482
|
-
url: urlRegex ? undefined : url,
|
|
483
|
-
urlRegex,
|
|
484
|
-
columnNumber,
|
|
485
|
-
condition,
|
|
486
|
-
});
|
|
487
|
-
if (response.getError()) {
|
|
488
|
-
return {locations: [], breakpointId: null};
|
|
489
|
-
}
|
|
490
|
-
let locations: Location[] = [];
|
|
491
|
-
if (response.locations) {
|
|
492
|
-
locations = response.locations.map(payload => Location.fromPayload(this, payload));
|
|
493
|
-
}
|
|
494
|
-
return {locations, breakpointId: response.breakpointId};
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
async setBreakpointInAnonymousScript(
|
|
498
|
-
scriptHash: string, lineNumber: number, columnNumber?: number,
|
|
499
|
-
condition?: BackendCondition): Promise<SetBreakpointResult> {
|
|
500
|
-
const response = await this.agent.invoke_setBreakpointByUrl({lineNumber, scriptHash, columnNumber, condition});
|
|
501
|
-
if (response.getError()) {
|
|
502
|
-
return {locations: [], breakpointId: null};
|
|
503
|
-
}
|
|
504
|
-
let locations: Location[] = [];
|
|
505
|
-
if (response.locations) {
|
|
506
|
-
locations = response.locations.map(payload => Location.fromPayload(this, payload));
|
|
507
|
-
}
|
|
508
|
-
return {locations, breakpointId: response.breakpointId};
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
async removeBreakpoint(breakpointId: Protocol.Debugger.BreakpointId): Promise<void> {
|
|
512
|
-
await this.agent.invoke_removeBreakpoint({breakpointId});
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
async getPossibleBreakpoints(startLocation: Location, endLocation: Location|null, restrictToFunction: boolean):
|
|
516
|
-
Promise<BreakLocation[]> {
|
|
517
|
-
const response = await this.agent.invoke_getPossibleBreakpoints({
|
|
518
|
-
start: startLocation.payload(),
|
|
519
|
-
end: endLocation ? endLocation.payload() : undefined,
|
|
520
|
-
restrictToFunction,
|
|
521
|
-
});
|
|
522
|
-
if (response.getError() || !response.locations) {
|
|
523
|
-
return [];
|
|
524
|
-
}
|
|
525
|
-
return response.locations.map(location => BreakLocation.fromPayload(this, location));
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
async fetchAsyncStackTrace(stackId: Protocol.Runtime.StackTraceId): Promise<Protocol.Runtime.StackTrace|null> {
|
|
529
|
-
const response = await this.agent.invoke_getStackTrace({stackTraceId: stackId});
|
|
530
|
-
return response.getError() ? null : response.stackTrace;
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
breakpointResolved(breakpointId: string, location: Protocol.Debugger.Location): void {
|
|
534
|
-
this.#breakpointResolvedEventTarget.dispatchEventToListeners(breakpointId, Location.fromPayload(this, location));
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
globalObjectCleared(): void {
|
|
538
|
-
this.resetDebuggerPausedDetails();
|
|
539
|
-
this.reset();
|
|
540
|
-
// TODO(dgozman): move clients to ExecutionContextDestroyed/ScriptCollected events.
|
|
541
|
-
this.dispatchEventToListeners(Events.GlobalObjectCleared, this);
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
private reset(): void {
|
|
545
|
-
for (const script of this.#scripts.values()) {
|
|
546
|
-
this.#sourceMapManager.detachSourceMap(script);
|
|
547
|
-
}
|
|
548
|
-
this.#scripts.clear();
|
|
549
|
-
this.#scriptsBySourceURL.clear();
|
|
550
|
-
this.#discardableScripts = [];
|
|
551
|
-
this.#autoSteppingContext = null;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
scripts(): Script[] {
|
|
555
|
-
return Array.from(this.#scripts.values());
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
scriptForId(scriptId: string): Script|null {
|
|
559
|
-
return this.#scripts.get(scriptId) || null;
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
/**
|
|
563
|
-
* Returns all `Script` objects with the same provided `sourceURL`. The
|
|
564
|
-
* resulting array is sorted by time with the newest `Script` in the front.
|
|
565
|
-
*/
|
|
566
|
-
scriptsForSourceURL(sourceURL: string): Script[] {
|
|
567
|
-
return this.#scriptsBySourceURL.get(sourceURL) || [];
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
scriptsForExecutionContext(executionContext: ExecutionContext): Script[] {
|
|
571
|
-
const result = [];
|
|
572
|
-
for (const script of this.#scripts.values()) {
|
|
573
|
-
if (script.executionContextId === executionContext.id) {
|
|
574
|
-
result.push(script);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
return result;
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
get callFrames(): CallFrame[]|null {
|
|
581
|
-
return this.#debuggerPausedDetails ? this.#debuggerPausedDetails.callFrames : null;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
debuggerPausedDetails(): DebuggerPausedDetails|null {
|
|
585
|
-
return this.#debuggerPausedDetails;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
private async setDebuggerPausedDetails(debuggerPausedDetails: DebuggerPausedDetails): Promise<boolean> {
|
|
589
|
-
this.#isPausing = false;
|
|
590
|
-
this.#debuggerPausedDetails = debuggerPausedDetails;
|
|
591
|
-
if (this.#beforePausedCallback) {
|
|
592
|
-
if (!await this.#beforePausedCallback.call(null, debuggerPausedDetails, this.#autoSteppingContext)) {
|
|
593
|
-
return false;
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
// If we resolved a location in auto-stepping callback, reset the
|
|
597
|
-
// auto-step-over context.
|
|
598
|
-
this.#autoSteppingContext = null;
|
|
599
|
-
this.dispatchEventToListeners(Events.DebuggerPaused, this);
|
|
600
|
-
this.setSelectedCallFrame(debuggerPausedDetails.callFrames[0]);
|
|
601
|
-
return true;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
private resetDebuggerPausedDetails(): void {
|
|
605
|
-
this.#isPausing = false;
|
|
606
|
-
this.#debuggerPausedDetails = null;
|
|
607
|
-
this.setSelectedCallFrame(null);
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
setBeforePausedCallback(
|
|
611
|
-
callback: ((arg0: DebuggerPausedDetails, autoSteppingContext: Location|null) => Promise<boolean>)|null): void {
|
|
612
|
-
this.#beforePausedCallback = callback;
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
setExpandCallFramesCallback(callback: ((arg0: CallFrame[]) => Promise<CallFrame[]>)|null): void {
|
|
616
|
-
this.#expandCallFramesCallback = callback;
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
setEvaluateOnCallFrameCallback(
|
|
620
|
-
callback: ((arg0: CallFrame, arg1: EvaluationOptions) => Promise<EvaluationResult|null>)|null): void {
|
|
621
|
-
this.evaluateOnCallFrameCallback = callback;
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
setSynchronizeBreakpointsCallback(callback: ((script: Script) => Promise<void>)|null): void {
|
|
625
|
-
this.#synchronizeBreakpointsCallback = callback;
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
async pausedScript(
|
|
629
|
-
callFrames: Protocol.Debugger.CallFrame[], reason: Protocol.Debugger.PausedEventReason, auxData: Object|undefined,
|
|
630
|
-
breakpointIds: string[], asyncStackTrace?: Protocol.Runtime.StackTrace,
|
|
631
|
-
asyncStackTraceId?: Protocol.Runtime.StackTraceId): Promise<void> {
|
|
632
|
-
if (reason === Protocol.Debugger.PausedEventReason.Instrumentation) {
|
|
633
|
-
const script = this.scriptForId((auxData as PausedOnInstrumentationData).scriptId);
|
|
634
|
-
if (this.#synchronizeBreakpointsCallback && script) {
|
|
635
|
-
await this.#synchronizeBreakpointsCallback(script);
|
|
636
|
-
}
|
|
637
|
-
this.resume();
|
|
638
|
-
return;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
const pausedDetails =
|
|
642
|
-
new DebuggerPausedDetails(this, callFrames, reason, auxData, breakpointIds, asyncStackTrace, asyncStackTraceId);
|
|
643
|
-
await this.#expandCallFrames(pausedDetails);
|
|
644
|
-
|
|
645
|
-
if (this.continueToLocationCallback) {
|
|
646
|
-
const callback = this.continueToLocationCallback;
|
|
647
|
-
this.continueToLocationCallback = null;
|
|
648
|
-
if (callback(pausedDetails)) {
|
|
649
|
-
return;
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
if (!await this.setDebuggerPausedDetails(pausedDetails)) {
|
|
654
|
-
if (this.#autoSteppingContext) {
|
|
655
|
-
void this.stepOver();
|
|
656
|
-
} else {
|
|
657
|
-
void this.stepInto();
|
|
658
|
-
}
|
|
659
|
-
} else {
|
|
660
|
-
Common.EventTarget.fireEvent('DevTools.DebuggerPaused');
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
/** Delegates to the DebuggerLanguagePlugin and potential attached source maps to expand inlined call frames */
|
|
665
|
-
async #expandCallFrames(pausedDetails: DebuggerPausedDetails): Promise<void> {
|
|
666
|
-
if (this.#expandCallFramesCallback) {
|
|
667
|
-
pausedDetails.callFrames = await this.#expandCallFramesCallback.call(null, pausedDetails.callFrames);
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
if (!Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.USE_SOURCE_MAP_SCOPES)) {
|
|
671
|
-
return;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
// TODO(crbug.com/40277685): Support attaching/detaching source maps after pausing.
|
|
675
|
-
// Expanding call frames via source maps here is only suitable for the experiment prototype because
|
|
676
|
-
// we block until all relevant source maps are loaded.
|
|
677
|
-
// We should change this so the "Debugger Plugin" and "Source Map" have a bottle neck where they expand
|
|
678
|
-
// call frames and that bottleneck should support attaching/detaching source maps while paused.
|
|
679
|
-
const finalFrames: CallFrame[] = [];
|
|
680
|
-
for (const frame of pausedDetails.callFrames) {
|
|
681
|
-
const sourceMap = await this.sourceMapManager().sourceMapForClientPromise(frame.script);
|
|
682
|
-
if (sourceMap?.hasScopeInfo()) {
|
|
683
|
-
finalFrames.push(...sourceMap.expandCallFrame(frame));
|
|
684
|
-
} else {
|
|
685
|
-
finalFrames.push(frame);
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
pausedDetails.callFrames = finalFrames;
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
resumedScript(): void {
|
|
692
|
-
this.resetDebuggerPausedDetails();
|
|
693
|
-
this.dispatchEventToListeners(Events.DebuggerResumed, this);
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
parsedScriptSource(
|
|
697
|
-
scriptId: Protocol.Runtime.ScriptId, sourceURL: Platform.DevToolsPath.UrlString, startLine: number,
|
|
698
|
-
startColumn: number, endLine: number, endColumn: number,
|
|
699
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
700
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
701
|
-
executionContextId: number, hash: string, executionContextAuxData: any, isLiveEdit: boolean,
|
|
702
|
-
sourceMapURL: string|undefined, hasSourceURLComment: boolean, hasSyntaxError: boolean, length: number,
|
|
703
|
-
isModule: boolean|null, originStackTrace: Protocol.Runtime.StackTrace|null, codeOffset: number|null,
|
|
704
|
-
scriptLanguage: string|null, debugSymbols: Protocol.Debugger.DebugSymbols[]|null,
|
|
705
|
-
embedderName: Platform.DevToolsPath.UrlString|null, buildId: string|null): Script {
|
|
706
|
-
const knownScript = this.#scripts.get(scriptId);
|
|
707
|
-
if (knownScript) {
|
|
708
|
-
return knownScript;
|
|
709
|
-
}
|
|
710
|
-
let isContentScript = false;
|
|
711
|
-
if (executionContextAuxData && ('isDefault' in executionContextAuxData)) {
|
|
712
|
-
isContentScript = !executionContextAuxData['isDefault'];
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
const selectedDebugSymbol = DebuggerModel.selectSymbolSource(debugSymbols);
|
|
716
|
-
const script = new Script(
|
|
717
|
-
this, scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, hash,
|
|
718
|
-
isContentScript, isLiveEdit, sourceMapURL, hasSourceURLComment, length, isModule, originStackTrace, codeOffset,
|
|
719
|
-
scriptLanguage, selectedDebugSymbol, embedderName, buildId);
|
|
720
|
-
this.registerScript(script);
|
|
721
|
-
this.dispatchEventToListeners(Events.ParsedScriptSource, script);
|
|
722
|
-
|
|
723
|
-
if (script.sourceMapURL && !hasSyntaxError) {
|
|
724
|
-
this.#sourceMapManager.attachSourceMap(script, script.sourceURL, script.sourceMapURL);
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
const isDiscardable = hasSyntaxError && script.isAnonymousScript();
|
|
728
|
-
if (isDiscardable) {
|
|
729
|
-
this.#discardableScripts.push(script);
|
|
730
|
-
this.collectDiscardedScripts();
|
|
731
|
-
}
|
|
732
|
-
return script;
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
setSourceMapURL(script: Script, newSourceMapURL: Platform.DevToolsPath.UrlString): void {
|
|
736
|
-
// Detach any previous source map from the `script` first.
|
|
737
|
-
this.#sourceMapManager.detachSourceMap(script);
|
|
738
|
-
script.sourceMapURL = newSourceMapURL;
|
|
739
|
-
this.#sourceMapManager.attachSourceMap(script, script.sourceURL, script.sourceMapURL);
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
async setDebugInfoURL(script: Script, _externalURL: Platform.DevToolsPath.UrlString): Promise<void> {
|
|
743
|
-
if (this.#expandCallFramesCallback && this.#debuggerPausedDetails) {
|
|
744
|
-
this.#debuggerPausedDetails.callFrames =
|
|
745
|
-
await this.#expandCallFramesCallback.call(null, this.#debuggerPausedDetails.callFrames);
|
|
746
|
-
}
|
|
747
|
-
this.dispatchEventToListeners(Events.DebugInfoAttached, script);
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
executionContextDestroyed(executionContext: ExecutionContext): void {
|
|
751
|
-
for (const script of this.#scripts.values()) {
|
|
752
|
-
if (script.executionContextId === executionContext.id) {
|
|
753
|
-
this.#sourceMapManager.detachSourceMap(script);
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
private registerScript(script: Script): void {
|
|
759
|
-
this.#scripts.set(script.scriptId, script);
|
|
760
|
-
if (script.isAnonymousScript()) {
|
|
761
|
-
return;
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
let scripts = this.#scriptsBySourceURL.get(script.sourceURL);
|
|
765
|
-
if (!scripts) {
|
|
766
|
-
scripts = [];
|
|
767
|
-
this.#scriptsBySourceURL.set(script.sourceURL, scripts);
|
|
768
|
-
}
|
|
769
|
-
// Newer scripts with the same URL should be preferred so we put them in
|
|
770
|
-
// the front. Consuming code usually will iterate over the array and pick
|
|
771
|
-
// the first script that works.
|
|
772
|
-
scripts.unshift(script);
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
private unregisterScript(script: Script): void {
|
|
776
|
-
console.assert(script.isAnonymousScript());
|
|
777
|
-
this.#scripts.delete(script.scriptId);
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
private collectDiscardedScripts(): void {
|
|
781
|
-
if (this.#discardableScripts.length < 1000) {
|
|
782
|
-
return;
|
|
783
|
-
}
|
|
784
|
-
const scriptsToDiscard = this.#discardableScripts.splice(0, 100);
|
|
785
|
-
for (const script of scriptsToDiscard) {
|
|
786
|
-
this.unregisterScript(script);
|
|
787
|
-
this.dispatchEventToListeners(Events.DiscardedAnonymousScriptSource, script);
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
createRawLocation(script: Script, lineNumber: number, columnNumber: number, inlineFrameIndex?: number): Location {
|
|
792
|
-
return this.createRawLocationByScriptId(script.scriptId, lineNumber, columnNumber, inlineFrameIndex);
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
createRawLocationByURL(sourceURL: string, lineNumber: number, columnNumber?: number, inlineFrameIndex?: number):
|
|
796
|
-
Location|null {
|
|
797
|
-
for (const script of this.#scriptsBySourceURL.get(sourceURL) || []) {
|
|
798
|
-
if (script.lineOffset > lineNumber ||
|
|
799
|
-
(script.lineOffset === lineNumber && columnNumber !== undefined && script.columnOffset > columnNumber)) {
|
|
800
|
-
continue;
|
|
801
|
-
}
|
|
802
|
-
if (script.endLine < lineNumber ||
|
|
803
|
-
(script.endLine === lineNumber && columnNumber !== undefined && script.endColumn <= columnNumber)) {
|
|
804
|
-
continue;
|
|
805
|
-
}
|
|
806
|
-
return new Location(this, script.scriptId, lineNumber, columnNumber, inlineFrameIndex);
|
|
807
|
-
}
|
|
808
|
-
return null;
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
createRawLocationByScriptId(
|
|
812
|
-
scriptId: Protocol.Runtime.ScriptId, lineNumber: number, columnNumber?: number,
|
|
813
|
-
inlineFrameIndex?: number): Location {
|
|
814
|
-
return new Location(this, scriptId, lineNumber, columnNumber, inlineFrameIndex);
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
createRawLocationsByStackTrace(stackTrace: Protocol.Runtime.StackTrace): Location[] {
|
|
818
|
-
const rawLocations: Location[] = [];
|
|
819
|
-
for (let current: Protocol.Runtime.StackTrace|undefined = stackTrace; current; current = current.parent) {
|
|
820
|
-
for (const {scriptId, lineNumber, columnNumber} of current.callFrames) {
|
|
821
|
-
rawLocations.push(this.createRawLocationByScriptId(scriptId, lineNumber, columnNumber));
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
return rawLocations;
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
isPaused(): boolean {
|
|
828
|
-
return Boolean(this.debuggerPausedDetails());
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
isPausing(): boolean {
|
|
832
|
-
return this.#isPausing;
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
setSelectedCallFrame(callFrame: CallFrame|null): void {
|
|
836
|
-
if (this.#selectedCallFrame === callFrame) {
|
|
837
|
-
return;
|
|
838
|
-
}
|
|
839
|
-
this.#selectedCallFrame = callFrame;
|
|
840
|
-
this.dispatchEventToListeners(Events.CallFrameSelected, this);
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
selectedCallFrame(): CallFrame|null {
|
|
844
|
-
return this.#selectedCallFrame;
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
async evaluateOnSelectedCallFrame(options: EvaluationOptions): Promise<EvaluationResult> {
|
|
848
|
-
const callFrame = this.selectedCallFrame();
|
|
849
|
-
if (!callFrame) {
|
|
850
|
-
throw new Error('No call frame selected');
|
|
851
|
-
}
|
|
852
|
-
return await callFrame.evaluate(options);
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
functionDetailsPromise(remoteObject: RemoteObject): Promise<FunctionDetails|null> {
|
|
856
|
-
return remoteObject.getAllProperties(false /* accessorPropertiesOnly */, false /* generatePreview */)
|
|
857
|
-
.then(buildDetails.bind(this));
|
|
858
|
-
|
|
859
|
-
function buildDetails(this: DebuggerModel, response: GetPropertiesResult): FunctionDetails|null {
|
|
860
|
-
if (!response) {
|
|
861
|
-
return null;
|
|
862
|
-
}
|
|
863
|
-
let location: (RemoteObject|null|undefined)|null = null;
|
|
864
|
-
if (response.internalProperties) {
|
|
865
|
-
for (const prop of response.internalProperties) {
|
|
866
|
-
if (prop.name === '[[FunctionLocation]]') {
|
|
867
|
-
location = prop.value;
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
let functionName: RemoteObject|null = null;
|
|
872
|
-
if (response.properties) {
|
|
873
|
-
for (const prop of response.properties) {
|
|
874
|
-
if (prop.name === 'name' && prop.value && prop.value.type === 'string') {
|
|
875
|
-
functionName = prop.value;
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
let debuggerLocation: Location|null = null;
|
|
880
|
-
if (location) {
|
|
881
|
-
debuggerLocation = this.createRawLocationByScriptId(
|
|
882
|
-
location.value.scriptId, location.value.lineNumber, location.value.columnNumber);
|
|
883
|
-
}
|
|
884
|
-
return {location: debuggerLocation, functionName: functionName ? functionName.value as string : ''};
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
async setVariableValue(
|
|
889
|
-
scopeNumber: number, variableName: string, newValue: Protocol.Runtime.CallArgument,
|
|
890
|
-
callFrameId: Protocol.Debugger.CallFrameId): Promise<string|undefined> {
|
|
891
|
-
const response = await this.agent.invoke_setVariableValue({scopeNumber, variableName, newValue, callFrameId});
|
|
892
|
-
const error = response.getError();
|
|
893
|
-
return error;
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
addBreakpointListener(
|
|
897
|
-
breakpointId: string, listener: (arg0: Common.EventTarget.EventTargetEvent<Location>) => void,
|
|
898
|
-
thisObject?: Object): void {
|
|
899
|
-
this.#breakpointResolvedEventTarget.addEventListener(breakpointId, listener, thisObject);
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
removeBreakpointListener(
|
|
903
|
-
breakpointId: string, listener: (arg0: Common.EventTarget.EventTargetEvent<Location>) => void,
|
|
904
|
-
thisObject?: Object): void {
|
|
905
|
-
this.#breakpointResolvedEventTarget.removeEventListener(breakpointId, listener, thisObject);
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
async setBlackboxPatterns(patterns: string[], skipAnonymous: boolean): Promise<boolean> {
|
|
909
|
-
const response = await this.agent.invoke_setBlackboxPatterns({patterns, skipAnonymous});
|
|
910
|
-
const error = response.getError();
|
|
911
|
-
return !error;
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
async setBlackboxExecutionContexts(uniqueIds: string[]): Promise<boolean> {
|
|
915
|
-
const response = await this.agent.invoke_setBlackboxExecutionContexts({uniqueIds});
|
|
916
|
-
const error = response.getError();
|
|
917
|
-
return !error;
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
override dispose(): void {
|
|
921
|
-
if (this.#debuggerId) {
|
|
922
|
-
debuggerIdToModel.delete(this.#debuggerId);
|
|
923
|
-
}
|
|
924
|
-
Common.Settings.Settings.instance()
|
|
925
|
-
.moduleSetting('pause-on-exception-enabled')
|
|
926
|
-
.removeChangeListener(this.pauseOnExceptionStateChanged, this);
|
|
927
|
-
Common.Settings.Settings.instance()
|
|
928
|
-
.moduleSetting('pause-on-caught-exception')
|
|
929
|
-
.removeChangeListener(this.pauseOnExceptionStateChanged, this);
|
|
930
|
-
Common.Settings.Settings.instance()
|
|
931
|
-
.moduleSetting('disable-async-stack-traces')
|
|
932
|
-
.removeChangeListener(this.asyncStackTracesStateChanged, this);
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
override async suspendModel(): Promise<void> {
|
|
936
|
-
await this.disableDebugger();
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
override async resumeModel(): Promise<void> {
|
|
940
|
-
await this.enableDebugger();
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
private static shouldResyncDebuggerId = false;
|
|
944
|
-
|
|
945
|
-
getEvaluateOnCallFrameCallback():
|
|
946
|
-
((arg0: CallFrame, arg1: EvaluationOptions) => Promise<EvaluationResult|null>)|null {
|
|
947
|
-
return this.evaluateOnCallFrameCallback;
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
/**
|
|
951
|
-
* Iterates the async stack trace parents.
|
|
952
|
-
*
|
|
953
|
-
* Retrieving cross-target async stack fragments requires CDP interaction, so this is an async generator.
|
|
954
|
-
*
|
|
955
|
-
* Important: This iterator will not yield the "synchronous" part of the stack trace, only the async parent chain.
|
|
956
|
-
*/
|
|
957
|
-
async *
|
|
958
|
-
iterateAsyncParents(stackTraceOrPausedDetails: Protocol.Runtime.StackTrace|DebuggerPausedDetails):
|
|
959
|
-
AsyncGenerator<{stackTrace: Protocol.Runtime.StackTrace, target: Target}> {
|
|
960
|
-
// We make `DebuggerPausedDetails` look like a stack trace. We are only interested in `parent` and `parentId` in any case.
|
|
961
|
-
let stackTrace: Protocol.Runtime.StackTrace = stackTraceOrPausedDetails instanceof DebuggerPausedDetails ?
|
|
962
|
-
{
|
|
963
|
-
callFrames: [],
|
|
964
|
-
parent: stackTraceOrPausedDetails.asyncStackTrace,
|
|
965
|
-
parentId: stackTraceOrPausedDetails.asyncStackTraceId
|
|
966
|
-
} :
|
|
967
|
-
stackTraceOrPausedDetails;
|
|
968
|
-
let target = this.target();
|
|
969
|
-
|
|
970
|
-
while (true) {
|
|
971
|
-
if (stackTrace.parent) {
|
|
972
|
-
stackTrace = stackTrace.parent;
|
|
973
|
-
} else if (stackTrace.parentId) {
|
|
974
|
-
const model: DebuggerModel|null = stackTrace.parentId.debuggerId ?
|
|
975
|
-
await DebuggerModel.modelForDebuggerId(stackTrace.parentId.debuggerId) :
|
|
976
|
-
this;
|
|
977
|
-
if (!model) {
|
|
978
|
-
return;
|
|
979
|
-
}
|
|
980
|
-
const maybeStackTrace = await model.fetchAsyncStackTrace(stackTrace.parentId);
|
|
981
|
-
if (!maybeStackTrace) {
|
|
982
|
-
return;
|
|
983
|
-
}
|
|
984
|
-
stackTrace = maybeStackTrace;
|
|
985
|
-
target = model.target();
|
|
986
|
-
} else {
|
|
987
|
-
return;
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
yield {stackTrace, target};
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
const debuggerIdToModel = new Map<string, DebuggerModel>();
|
|
996
|
-
|
|
997
|
-
/**
|
|
998
|
-
* Keep these in sync with WebCore::V8Debugger
|
|
999
|
-
*/
|
|
1000
|
-
export enum PauseOnExceptionsState {
|
|
1001
|
-
/* eslint-disable @typescript-eslint/naming-convention -- Used by web_tests. */
|
|
1002
|
-
DontPauseOnExceptions = 'none',
|
|
1003
|
-
PauseOnAllExceptions = 'all',
|
|
1004
|
-
PauseOnCaughtExceptions = 'caught',
|
|
1005
|
-
PauseOnUncaughtExceptions = 'uncaught',
|
|
1006
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
export enum Events {
|
|
1010
|
-
/* eslint-disable @typescript-eslint/naming-convention -- Used by web_tests. */
|
|
1011
|
-
DebuggerWasEnabled = 'DebuggerWasEnabled',
|
|
1012
|
-
DebuggerWasDisabled = 'DebuggerWasDisabled',
|
|
1013
|
-
DebuggerPaused = 'DebuggerPaused',
|
|
1014
|
-
DebuggerResumed = 'DebuggerResumed',
|
|
1015
|
-
DebugInfoAttached = 'DebugInfoAttached',
|
|
1016
|
-
ParsedScriptSource = 'ParsedScriptSource',
|
|
1017
|
-
DiscardedAnonymousScriptSource = 'DiscardedAnonymousScriptSource',
|
|
1018
|
-
GlobalObjectCleared = 'GlobalObjectCleared',
|
|
1019
|
-
CallFrameSelected = 'CallFrameSelected',
|
|
1020
|
-
DebuggerIsReadyToPause = 'DebuggerIsReadyToPause',
|
|
1021
|
-
ScriptSourceWasEdited = 'ScriptSourceWasEdited',
|
|
1022
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
export interface EventTypes {
|
|
1026
|
-
[Events.DebuggerWasEnabled]: DebuggerModel;
|
|
1027
|
-
[Events.DebuggerWasDisabled]: DebuggerModel;
|
|
1028
|
-
[Events.DebuggerPaused]: DebuggerModel;
|
|
1029
|
-
[Events.DebuggerResumed]: DebuggerModel;
|
|
1030
|
-
[Events.ParsedScriptSource]: Script;
|
|
1031
|
-
[Events.DiscardedAnonymousScriptSource]: Script;
|
|
1032
|
-
[Events.GlobalObjectCleared]: DebuggerModel;
|
|
1033
|
-
[Events.CallFrameSelected]: DebuggerModel;
|
|
1034
|
-
[Events.DebuggerIsReadyToPause]: DebuggerModel;
|
|
1035
|
-
[Events.DebugInfoAttached]: Script;
|
|
1036
|
-
[Events.ScriptSourceWasEdited]: {
|
|
1037
|
-
script: Script,
|
|
1038
|
-
status: Protocol.Debugger.SetScriptSourceResponseStatus,
|
|
1039
|
-
};
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
class DebuggerDispatcher implements ProtocolProxyApi.DebuggerDispatcher {
|
|
1043
|
-
#debuggerModel: DebuggerModel;
|
|
1044
|
-
|
|
1045
|
-
constructor(debuggerModel: DebuggerModel) {
|
|
1046
|
-
this.#debuggerModel = debuggerModel;
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
paused({callFrames, reason, data, hitBreakpoints, asyncStackTrace, asyncStackTraceId}: Protocol.Debugger.PausedEvent):
|
|
1050
|
-
void {
|
|
1051
|
-
if (!this.#debuggerModel.debuggerEnabled()) {
|
|
1052
|
-
return;
|
|
1053
|
-
}
|
|
1054
|
-
void this.#debuggerModel.pausedScript(
|
|
1055
|
-
callFrames, reason, data, hitBreakpoints || [], asyncStackTrace, asyncStackTraceId);
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
resumed(): void {
|
|
1059
|
-
if (!this.#debuggerModel.debuggerEnabled()) {
|
|
1060
|
-
return;
|
|
1061
|
-
}
|
|
1062
|
-
this.#debuggerModel.resumedScript();
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
scriptParsed({
|
|
1066
|
-
scriptId,
|
|
1067
|
-
url,
|
|
1068
|
-
startLine,
|
|
1069
|
-
startColumn,
|
|
1070
|
-
endLine,
|
|
1071
|
-
endColumn,
|
|
1072
|
-
executionContextId,
|
|
1073
|
-
hash,
|
|
1074
|
-
executionContextAuxData,
|
|
1075
|
-
isLiveEdit,
|
|
1076
|
-
sourceMapURL,
|
|
1077
|
-
hasSourceURL,
|
|
1078
|
-
length,
|
|
1079
|
-
isModule,
|
|
1080
|
-
stackTrace,
|
|
1081
|
-
codeOffset,
|
|
1082
|
-
scriptLanguage,
|
|
1083
|
-
debugSymbols,
|
|
1084
|
-
embedderName,
|
|
1085
|
-
buildId,
|
|
1086
|
-
}: Protocol.Debugger.ScriptParsedEvent): void {
|
|
1087
|
-
if (!this.#debuggerModel.debuggerEnabled()) {
|
|
1088
|
-
return;
|
|
1089
|
-
}
|
|
1090
|
-
this.#debuggerModel.parsedScriptSource(
|
|
1091
|
-
scriptId, url as Platform.DevToolsPath.UrlString, startLine, startColumn, endLine, endColumn,
|
|
1092
|
-
executionContextId, hash, executionContextAuxData, Boolean(isLiveEdit), sourceMapURL, Boolean(hasSourceURL),
|
|
1093
|
-
false, length || 0, isModule || null, stackTrace || null, codeOffset || null, scriptLanguage || null,
|
|
1094
|
-
debugSymbols || null, embedderName as Platform.DevToolsPath.UrlString || null, buildId || null);
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
scriptFailedToParse({
|
|
1098
|
-
scriptId,
|
|
1099
|
-
url,
|
|
1100
|
-
startLine,
|
|
1101
|
-
startColumn,
|
|
1102
|
-
endLine,
|
|
1103
|
-
endColumn,
|
|
1104
|
-
executionContextId,
|
|
1105
|
-
hash,
|
|
1106
|
-
executionContextAuxData,
|
|
1107
|
-
sourceMapURL,
|
|
1108
|
-
hasSourceURL,
|
|
1109
|
-
length,
|
|
1110
|
-
isModule,
|
|
1111
|
-
stackTrace,
|
|
1112
|
-
codeOffset,
|
|
1113
|
-
scriptLanguage,
|
|
1114
|
-
embedderName,
|
|
1115
|
-
buildId,
|
|
1116
|
-
}: Protocol.Debugger.ScriptFailedToParseEvent): void {
|
|
1117
|
-
if (!this.#debuggerModel.debuggerEnabled()) {
|
|
1118
|
-
return;
|
|
1119
|
-
}
|
|
1120
|
-
this.#debuggerModel.parsedScriptSource(
|
|
1121
|
-
scriptId, url as Platform.DevToolsPath.UrlString, startLine, startColumn, endLine, endColumn,
|
|
1122
|
-
executionContextId, hash, executionContextAuxData, false, sourceMapURL, Boolean(hasSourceURL), true,
|
|
1123
|
-
length || 0, isModule || null, stackTrace || null, codeOffset || null, scriptLanguage || null, null,
|
|
1124
|
-
embedderName as Platform.DevToolsPath.UrlString || null, buildId || null);
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
breakpointResolved({breakpointId, location}: Protocol.Debugger.BreakpointResolvedEvent): void {
|
|
1128
|
-
if (!this.#debuggerModel.debuggerEnabled()) {
|
|
1129
|
-
return;
|
|
1130
|
-
}
|
|
1131
|
-
this.#debuggerModel.breakpointResolved(breakpointId, location);
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
|
-
export class Location {
|
|
1136
|
-
debuggerModel: DebuggerModel;
|
|
1137
|
-
scriptId: Protocol.Runtime.ScriptId;
|
|
1138
|
-
lineNumber: number;
|
|
1139
|
-
columnNumber: number;
|
|
1140
|
-
inlineFrameIndex: number;
|
|
1141
|
-
|
|
1142
|
-
constructor(
|
|
1143
|
-
debuggerModel: DebuggerModel, scriptId: Protocol.Runtime.ScriptId, lineNumber: number, columnNumber?: number,
|
|
1144
|
-
inlineFrameIndex?: number) {
|
|
1145
|
-
this.debuggerModel = debuggerModel;
|
|
1146
|
-
this.scriptId = scriptId;
|
|
1147
|
-
this.lineNumber = lineNumber;
|
|
1148
|
-
this.columnNumber = columnNumber || 0;
|
|
1149
|
-
this.inlineFrameIndex = inlineFrameIndex || 0;
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
static fromPayload(debuggerModel: DebuggerModel, payload: Protocol.Debugger.Location, inlineFrameIndex?: number):
|
|
1153
|
-
Location {
|
|
1154
|
-
return new Location(debuggerModel, payload.scriptId, payload.lineNumber, payload.columnNumber, inlineFrameIndex);
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
payload(): Protocol.Debugger.Location {
|
|
1158
|
-
return {scriptId: this.scriptId, lineNumber: this.lineNumber, columnNumber: this.columnNumber};
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
script(): Script|null {
|
|
1162
|
-
return this.debuggerModel.scriptForId(this.scriptId);
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
continueToLocation(pausedCallback?: (() => void)): void {
|
|
1166
|
-
if (pausedCallback) {
|
|
1167
|
-
this.debuggerModel.continueToLocationCallback = this.paused.bind(this, pausedCallback);
|
|
1168
|
-
}
|
|
1169
|
-
void this.debuggerModel.agent.invoke_continueToLocation({
|
|
1170
|
-
location: this.payload(),
|
|
1171
|
-
targetCallFrames: Protocol.Debugger.ContinueToLocationRequestTargetCallFrames.Current,
|
|
1172
|
-
});
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
|
-
private paused(pausedCallback: () => void|undefined, debuggerPausedDetails: DebuggerPausedDetails): boolean {
|
|
1176
|
-
const location = debuggerPausedDetails.callFrames[0].location();
|
|
1177
|
-
if (location.scriptId === this.scriptId && location.lineNumber === this.lineNumber &&
|
|
1178
|
-
location.columnNumber === this.columnNumber) {
|
|
1179
|
-
pausedCallback();
|
|
1180
|
-
return true;
|
|
1181
|
-
}
|
|
1182
|
-
return false;
|
|
1183
|
-
}
|
|
1184
|
-
|
|
1185
|
-
id(): string {
|
|
1186
|
-
return this.debuggerModel.target().id() + ':' + this.scriptId + ':' + this.lineNumber + ':' + this.columnNumber;
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
|
-
export interface LocationRange {
|
|
1191
|
-
start: Location;
|
|
1192
|
-
end: Location;
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
export class BreakLocation extends Location {
|
|
1196
|
-
type: Protocol.Debugger.BreakLocationType|undefined;
|
|
1197
|
-
constructor(
|
|
1198
|
-
debuggerModel: DebuggerModel, scriptId: Protocol.Runtime.ScriptId, lineNumber: number, columnNumber?: number,
|
|
1199
|
-
type?: Protocol.Debugger.BreakLocationType) {
|
|
1200
|
-
super(debuggerModel, scriptId, lineNumber, columnNumber);
|
|
1201
|
-
if (type) {
|
|
1202
|
-
this.type = type;
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
static override fromPayload(debuggerModel: DebuggerModel, payload: Protocol.Debugger.BreakLocation): BreakLocation {
|
|
1207
|
-
return new BreakLocation(debuggerModel, payload.scriptId, payload.lineNumber, payload.columnNumber, payload.type);
|
|
1208
|
-
}
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
export interface MissingDebugFiles {
|
|
1212
|
-
resourceUrl: Platform.DevToolsPath.UrlString;
|
|
1213
|
-
initiator: PageResourceLoadInitiator;
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
export interface MissingDebugInfoDetails {
|
|
1217
|
-
details: string;
|
|
1218
|
-
resources: MissingDebugFiles[];
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
export class CallFrame {
|
|
1222
|
-
debuggerModel: DebuggerModel;
|
|
1223
|
-
readonly script: Script;
|
|
1224
|
-
payload: Protocol.Debugger.CallFrame;
|
|
1225
|
-
readonly #location: Location;
|
|
1226
|
-
readonly #scopeChain: Scope[];
|
|
1227
|
-
readonly #localScope: Scope|null;
|
|
1228
|
-
readonly inlineFrameIndex: number;
|
|
1229
|
-
readonly functionName: string;
|
|
1230
|
-
readonly #functionLocation: Location|undefined;
|
|
1231
|
-
#returnValue: RemoteObject|null;
|
|
1232
|
-
missingDebugInfoDetails: MissingDebugInfoDetails|null;
|
|
1233
|
-
readonly exception: RemoteObject|null;
|
|
1234
|
-
|
|
1235
|
-
readonly canBeRestarted: boolean;
|
|
1236
|
-
|
|
1237
|
-
constructor(
|
|
1238
|
-
debuggerModel: DebuggerModel, script: Script, payload: Protocol.Debugger.CallFrame, inlineFrameIndex?: number,
|
|
1239
|
-
functionName?: string, exception: RemoteObject|null = null) {
|
|
1240
|
-
this.debuggerModel = debuggerModel;
|
|
1241
|
-
this.script = script;
|
|
1242
|
-
this.payload = payload;
|
|
1243
|
-
this.#location = Location.fromPayload(debuggerModel, payload.location, inlineFrameIndex);
|
|
1244
|
-
this.#scopeChain = [];
|
|
1245
|
-
this.#localScope = null;
|
|
1246
|
-
this.inlineFrameIndex = inlineFrameIndex || 0;
|
|
1247
|
-
this.functionName = functionName ?? payload.functionName;
|
|
1248
|
-
this.missingDebugInfoDetails = null;
|
|
1249
|
-
this.canBeRestarted = Boolean(payload.canBeRestarted);
|
|
1250
|
-
this.exception = exception;
|
|
1251
|
-
for (let i = 0; i < payload.scopeChain.length; ++i) {
|
|
1252
|
-
const scope = new Scope(this, i);
|
|
1253
|
-
this.#scopeChain.push(scope);
|
|
1254
|
-
if (scope.type() === Protocol.Debugger.ScopeType.Local) {
|
|
1255
|
-
this.#localScope = scope;
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
|
-
if (payload.functionLocation) {
|
|
1259
|
-
this.#functionLocation = Location.fromPayload(debuggerModel, payload.functionLocation);
|
|
1260
|
-
}
|
|
1261
|
-
this.#returnValue =
|
|
1262
|
-
payload.returnValue ? this.debuggerModel.runtimeModel().createRemoteObject(payload.returnValue) : null;
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
static fromPayloadArray(
|
|
1266
|
-
debuggerModel: DebuggerModel, callFrames: Protocol.Debugger.CallFrame[],
|
|
1267
|
-
exception: RemoteObject|null): CallFrame[] {
|
|
1268
|
-
const result = [];
|
|
1269
|
-
for (let i = 0; i < callFrames.length; ++i) {
|
|
1270
|
-
const callFrame = callFrames[i];
|
|
1271
|
-
const script = debuggerModel.scriptForId(callFrame.location.scriptId);
|
|
1272
|
-
if (script) {
|
|
1273
|
-
const ex = i === 0 ? exception : null;
|
|
1274
|
-
result.push(new CallFrame(debuggerModel, script, callFrame, undefined, undefined, ex));
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
return result;
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
createVirtualCallFrame(inlineFrameIndex: number, name: string): CallFrame {
|
|
1281
|
-
return new CallFrame(this.debuggerModel, this.script, this.payload, inlineFrameIndex, name, this.exception);
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
get id(): Protocol.Debugger.CallFrameId {
|
|
1285
|
-
return this.payload.callFrameId;
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
scopeChain(): Scope[] {
|
|
1289
|
-
return this.#scopeChain;
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1292
|
-
localScope(): Scope|null {
|
|
1293
|
-
return this.#localScope;
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
thisObject(): RemoteObject|null {
|
|
1297
|
-
return this.payload.this ? this.debuggerModel.runtimeModel().createRemoteObject(this.payload.this) : null;
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
returnValue(): RemoteObject|null {
|
|
1301
|
-
return this.#returnValue;
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
|
-
async setReturnValue(expression: string): Promise<RemoteObject|null> {
|
|
1305
|
-
if (!this.#returnValue) {
|
|
1306
|
-
return null;
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
const evaluateResponse = await this.debuggerModel.agent.invoke_evaluateOnCallFrame(
|
|
1310
|
-
{callFrameId: this.id, expression, silent: true, objectGroup: 'backtrace'});
|
|
1311
|
-
if (evaluateResponse.getError() || evaluateResponse.exceptionDetails) {
|
|
1312
|
-
return null;
|
|
1313
|
-
}
|
|
1314
|
-
const response = await this.debuggerModel.agent.invoke_setReturnValue({newValue: evaluateResponse.result});
|
|
1315
|
-
if (response.getError()) {
|
|
1316
|
-
return null;
|
|
1317
|
-
}
|
|
1318
|
-
this.#returnValue = this.debuggerModel.runtimeModel().createRemoteObject(evaluateResponse.result);
|
|
1319
|
-
return this.#returnValue;
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
location(): Location {
|
|
1323
|
-
return this.#location;
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
functionLocation(): Location|null {
|
|
1327
|
-
return this.#functionLocation || null;
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1330
|
-
async evaluate(options: EvaluationOptions): Promise<EvaluationResult> {
|
|
1331
|
-
const debuggerModel = this.debuggerModel;
|
|
1332
|
-
const runtimeModel = debuggerModel.runtimeModel();
|
|
1333
|
-
|
|
1334
|
-
const evaluateOnCallFrameCallback = debuggerModel.getEvaluateOnCallFrameCallback();
|
|
1335
|
-
if (evaluateOnCallFrameCallback) {
|
|
1336
|
-
const result = await evaluateOnCallFrameCallback(this, options);
|
|
1337
|
-
if (result) {
|
|
1338
|
-
return result;
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
|
-
const response = await this.debuggerModel.agent.invoke_evaluateOnCallFrame({
|
|
1343
|
-
callFrameId: this.id,
|
|
1344
|
-
expression: options.expression,
|
|
1345
|
-
objectGroup: options.objectGroup,
|
|
1346
|
-
includeCommandLineAPI: options.includeCommandLineAPI,
|
|
1347
|
-
silent: options.silent,
|
|
1348
|
-
returnByValue: options.returnByValue,
|
|
1349
|
-
generatePreview: options.generatePreview,
|
|
1350
|
-
throwOnSideEffect: options.throwOnSideEffect,
|
|
1351
|
-
timeout: options.timeout,
|
|
1352
|
-
});
|
|
1353
|
-
const error = response.getError();
|
|
1354
|
-
if (error) {
|
|
1355
|
-
return {error};
|
|
1356
|
-
}
|
|
1357
|
-
return {object: runtimeModel.createRemoteObject(response.result), exceptionDetails: response.exceptionDetails};
|
|
1358
|
-
}
|
|
1359
|
-
|
|
1360
|
-
async restart(): Promise<void> {
|
|
1361
|
-
console.assert(this.canBeRestarted, 'This frame can not be restarted.');
|
|
1362
|
-
// Note that even if `canBeRestarted` is true, the restart frame call can still fail.
|
|
1363
|
-
// The user can evaluate arbitrary code between pausing and restarting the frame that
|
|
1364
|
-
// could mess with the call stack.
|
|
1365
|
-
await this.debuggerModel.agent.invoke_restartFrame(
|
|
1366
|
-
{callFrameId: this.id, mode: Protocol.Debugger.RestartFrameRequestMode.StepInto});
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
getPayload(): Protocol.Debugger.CallFrame {
|
|
1370
|
-
return this.payload;
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
export interface ScopeChainEntry {
|
|
1375
|
-
callFrame(): CallFrame;
|
|
1376
|
-
|
|
1377
|
-
type(): string;
|
|
1378
|
-
|
|
1379
|
-
typeName(): string;
|
|
1380
|
-
|
|
1381
|
-
name(): string|undefined;
|
|
1382
|
-
|
|
1383
|
-
range(): LocationRange|null;
|
|
1384
|
-
|
|
1385
|
-
object(): RemoteObject;
|
|
1386
|
-
|
|
1387
|
-
description(): string;
|
|
1388
|
-
|
|
1389
|
-
icon(): string|undefined;
|
|
1390
|
-
|
|
1391
|
-
/**
|
|
1392
|
-
* Extra and/or synthetic properties that should be added to the `RemoteObject`
|
|
1393
|
-
* returned by {@link ScopeChainEntry.object}.
|
|
1394
|
-
*/
|
|
1395
|
-
extraProperties(): RemoteObjectProperty[];
|
|
1396
|
-
}
|
|
1397
|
-
|
|
1398
|
-
export class Scope implements ScopeChainEntry {
|
|
1399
|
-
#callFrame: CallFrame;
|
|
1400
|
-
#payload: Protocol.Debugger.Scope;
|
|
1401
|
-
readonly #type: Protocol.Debugger.ScopeType;
|
|
1402
|
-
readonly #name: string|undefined;
|
|
1403
|
-
#ordinal: number;
|
|
1404
|
-
readonly #locationRange: LocationRange|null;
|
|
1405
|
-
#object: RemoteObject|null;
|
|
1406
|
-
constructor(callFrame: CallFrame, ordinal: number) {
|
|
1407
|
-
this.#callFrame = callFrame;
|
|
1408
|
-
this.#payload = callFrame.getPayload().scopeChain[ordinal];
|
|
1409
|
-
this.#type = this.#payload.type;
|
|
1410
|
-
this.#name = this.#payload.name;
|
|
1411
|
-
this.#ordinal = ordinal;
|
|
1412
|
-
this.#object = null;
|
|
1413
|
-
|
|
1414
|
-
const start =
|
|
1415
|
-
this.#payload.startLocation ? Location.fromPayload(callFrame.debuggerModel, this.#payload.startLocation) : null;
|
|
1416
|
-
const end =
|
|
1417
|
-
this.#payload.endLocation ? Location.fromPayload(callFrame.debuggerModel, this.#payload.endLocation) : null;
|
|
1418
|
-
if (start && end && start.scriptId === end.scriptId) {
|
|
1419
|
-
this.#locationRange = {start, end};
|
|
1420
|
-
} else {
|
|
1421
|
-
this.#locationRange = null;
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1424
|
-
|
|
1425
|
-
callFrame(): CallFrame {
|
|
1426
|
-
return this.#callFrame;
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
|
-
type(): string {
|
|
1430
|
-
return this.#type;
|
|
1431
|
-
}
|
|
1432
|
-
|
|
1433
|
-
typeName(): string {
|
|
1434
|
-
switch (this.#type) {
|
|
1435
|
-
case Protocol.Debugger.ScopeType.Local:
|
|
1436
|
-
return i18nString(UIStrings.local);
|
|
1437
|
-
case Protocol.Debugger.ScopeType.Closure:
|
|
1438
|
-
return i18nString(UIStrings.closure);
|
|
1439
|
-
case Protocol.Debugger.ScopeType.Catch:
|
|
1440
|
-
return i18nString(UIStrings.catchBlock);
|
|
1441
|
-
case Protocol.Debugger.ScopeType.Eval:
|
|
1442
|
-
return i18n.i18n.lockedString('Eval');
|
|
1443
|
-
case Protocol.Debugger.ScopeType.Block:
|
|
1444
|
-
return i18nString(UIStrings.block);
|
|
1445
|
-
case Protocol.Debugger.ScopeType.Script:
|
|
1446
|
-
return i18nString(UIStrings.script);
|
|
1447
|
-
case Protocol.Debugger.ScopeType.With:
|
|
1448
|
-
return i18nString(UIStrings.withBlock);
|
|
1449
|
-
case Protocol.Debugger.ScopeType.Global:
|
|
1450
|
-
return i18nString(UIStrings.global);
|
|
1451
|
-
case Protocol.Debugger.ScopeType.Module:
|
|
1452
|
-
return i18nString(UIStrings.module);
|
|
1453
|
-
case Protocol.Debugger.ScopeType.WasmExpressionStack:
|
|
1454
|
-
return i18nString(UIStrings.expression);
|
|
1455
|
-
}
|
|
1456
|
-
return '';
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
|
-
name(): string|undefined {
|
|
1460
|
-
return this.#name;
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
range(): LocationRange|null {
|
|
1464
|
-
return this.#locationRange;
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
|
-
object(): RemoteObject {
|
|
1468
|
-
if (this.#object) {
|
|
1469
|
-
return this.#object;
|
|
1470
|
-
}
|
|
1471
|
-
const runtimeModel = this.#callFrame.debuggerModel.runtimeModel();
|
|
1472
|
-
|
|
1473
|
-
const declarativeScope =
|
|
1474
|
-
this.#type !== Protocol.Debugger.ScopeType.With && this.#type !== Protocol.Debugger.ScopeType.Global;
|
|
1475
|
-
if (declarativeScope) {
|
|
1476
|
-
this.#object =
|
|
1477
|
-
runtimeModel.createScopeRemoteObject(this.#payload.object, new ScopeRef(this.#ordinal, this.#callFrame.id));
|
|
1478
|
-
} else {
|
|
1479
|
-
this.#object = runtimeModel.createRemoteObject(this.#payload.object);
|
|
1480
|
-
}
|
|
1481
|
-
|
|
1482
|
-
return this.#object;
|
|
1483
|
-
}
|
|
1484
|
-
|
|
1485
|
-
description(): string {
|
|
1486
|
-
const declarativeScope =
|
|
1487
|
-
this.#type !== Protocol.Debugger.ScopeType.With && this.#type !== Protocol.Debugger.ScopeType.Global;
|
|
1488
|
-
return declarativeScope ? '' : (this.#payload.object.description || '');
|
|
1489
|
-
}
|
|
1490
|
-
|
|
1491
|
-
icon(): undefined {
|
|
1492
|
-
return undefined;
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
extraProperties(): RemoteObjectProperty[] {
|
|
1496
|
-
if (this.#ordinal !== 0 || this.#type !== Protocol.Debugger.ScopeType.Local || this.#callFrame.script.isWasm()) {
|
|
1497
|
-
return [];
|
|
1498
|
-
}
|
|
1499
|
-
|
|
1500
|
-
const extraProperties = [];
|
|
1501
|
-
const exception = this.#callFrame.exception;
|
|
1502
|
-
if (exception) {
|
|
1503
|
-
extraProperties.push(new RemoteObjectProperty(
|
|
1504
|
-
i18nString(UIStrings.exception), exception, undefined, undefined, undefined, undefined, undefined,
|
|
1505
|
-
/* synthetic */ true));
|
|
1506
|
-
}
|
|
1507
|
-
const returnValue = this.#callFrame.returnValue();
|
|
1508
|
-
if (returnValue) {
|
|
1509
|
-
extraProperties.push(new RemoteObjectProperty(
|
|
1510
|
-
i18nString(UIStrings.returnValue), returnValue, undefined, undefined, undefined, undefined, undefined,
|
|
1511
|
-
/* synthetic */ true, this.#callFrame.setReturnValue.bind(this.#callFrame)));
|
|
1512
|
-
}
|
|
1513
|
-
return extraProperties;
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1516
|
-
|
|
1517
|
-
export class DebuggerPausedDetails {
|
|
1518
|
-
debuggerModel: DebuggerModel;
|
|
1519
|
-
callFrames: CallFrame[];
|
|
1520
|
-
reason: Protocol.Debugger.PausedEventReason;
|
|
1521
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1522
|
-
auxData: Record<string, any>|undefined;
|
|
1523
|
-
breakpointIds: string[];
|
|
1524
|
-
asyncStackTrace: Protocol.Runtime.StackTrace|undefined;
|
|
1525
|
-
asyncStackTraceId: Protocol.Runtime.StackTraceId|undefined;
|
|
1526
|
-
constructor(
|
|
1527
|
-
debuggerModel: DebuggerModel,
|
|
1528
|
-
callFrames: Protocol.Debugger.CallFrame[],
|
|
1529
|
-
reason: Protocol.Debugger.PausedEventReason,
|
|
1530
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1531
|
-
auxData: Record<string, any>|undefined,
|
|
1532
|
-
breakpointIds: string[],
|
|
1533
|
-
asyncStackTrace?: Protocol.Runtime.StackTrace,
|
|
1534
|
-
asyncStackTraceId?: Protocol.Runtime.StackTraceId,
|
|
1535
|
-
) {
|
|
1536
|
-
this.debuggerModel = debuggerModel;
|
|
1537
|
-
this.reason = reason;
|
|
1538
|
-
this.auxData = auxData;
|
|
1539
|
-
this.breakpointIds = breakpointIds;
|
|
1540
|
-
if (asyncStackTrace) {
|
|
1541
|
-
this.asyncStackTrace = this.cleanRedundantFrames(asyncStackTrace);
|
|
1542
|
-
}
|
|
1543
|
-
this.asyncStackTraceId = asyncStackTraceId;
|
|
1544
|
-
this.callFrames = CallFrame.fromPayloadArray(debuggerModel, callFrames, this.exception());
|
|
1545
|
-
}
|
|
1546
|
-
|
|
1547
|
-
private exception(): RemoteObject|null {
|
|
1548
|
-
if (this.reason !== Protocol.Debugger.PausedEventReason.Exception &&
|
|
1549
|
-
this.reason !== Protocol.Debugger.PausedEventReason.PromiseRejection) {
|
|
1550
|
-
return null;
|
|
1551
|
-
}
|
|
1552
|
-
return this.debuggerModel.runtimeModel().createRemoteObject((this.auxData as Protocol.Runtime.RemoteObject));
|
|
1553
|
-
}
|
|
1554
|
-
|
|
1555
|
-
private cleanRedundantFrames(asyncStackTrace: Protocol.Runtime.StackTrace): Protocol.Runtime.StackTrace {
|
|
1556
|
-
let stack: (Protocol.Runtime.StackTrace|undefined)|Protocol.Runtime.StackTrace = asyncStackTrace;
|
|
1557
|
-
let previous: Protocol.Runtime.StackTrace|null = null;
|
|
1558
|
-
while (stack) {
|
|
1559
|
-
if (previous && !stack.callFrames.length) {
|
|
1560
|
-
previous.parent = stack.parent;
|
|
1561
|
-
} else {
|
|
1562
|
-
previous = stack;
|
|
1563
|
-
}
|
|
1564
|
-
stack = stack.parent;
|
|
1565
|
-
}
|
|
1566
|
-
return asyncStackTrace;
|
|
1567
|
-
}
|
|
1568
|
-
}
|
|
1569
|
-
|
|
1570
|
-
SDKModel.register(DebuggerModel, {capabilities: Capability.JS, autostart: true});
|
|
1571
|
-
|
|
1572
|
-
export interface FunctionDetails {
|
|
1573
|
-
location: Location|null;
|
|
1574
|
-
functionName: string;
|
|
1575
|
-
}
|
|
1576
|
-
export interface SetBreakpointResult {
|
|
1577
|
-
breakpointId: Protocol.Debugger.BreakpointId|null;
|
|
1578
|
-
locations: Location[];
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
|
-
interface PausedOnInstrumentationData {
|
|
1582
|
-
scriptId: Protocol.Runtime.ScriptId;
|
|
1583
|
-
}
|
|
1584
|
-
|
|
1585
|
-
export interface EventListenerPausedDetailsAuxData {
|
|
1586
|
-
eventName: string;
|
|
1587
|
-
targetName?: string;
|
|
1588
|
-
webglErrorName?: string;
|
|
1589
|
-
directiveText?: string;
|
|
1590
|
-
}
|
|
1591
|
-
|
|
1592
|
-
export const enum BreakpointType {
|
|
1593
|
-
LOGPOINT = 'LOGPOINT',
|
|
1594
|
-
CONDITIONAL_BREAKPOINT = 'CONDITIONAL_BREAKPOINT',
|
|
1595
|
-
REGULAR_BREAKPOINT = 'REGULAR_BREAKPOINT',
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1598
|
-
/**
|
|
1599
|
-
* A breakpoint condition as sent to V8. This helps distinguish
|
|
1600
|
-
* the breakpoint condition as it is entered by the user.
|
|
1601
|
-
*/
|
|
1602
|
-
export type BackendCondition = Platform.Brand.Brand<string, 'BackendCondition'>;
|
|
1603
|
-
|
|
1604
|
-
export const LOGPOINT_SOURCE_URL = 'debugger://logpoint';
|
|
1605
|
-
export const COND_BREAKPOINT_SOURCE_URL = 'debugger://breakpoint';
|