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,1160 +0,0 @@
|
|
|
1
|
-
// Copyright 2009 The Chromium Authors
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
|
|
6
|
-
import * as Protocol from '../../generated/protocol.js';
|
|
7
|
-
import type {DOMPinnedWebIDLProp, DOMPinnedWebIDLType} from '../common/JavaScriptMetaData.js';
|
|
8
|
-
|
|
9
|
-
import type {DebuggerModel, FunctionDetails} from './DebuggerModel.js';
|
|
10
|
-
import type {RuntimeModel} from './RuntimeModel.js';
|
|
11
|
-
|
|
12
|
-
/** This cannot be an interface due to "instanceof RemoteObject" checks in the code. **/
|
|
13
|
-
export abstract class RemoteObject {
|
|
14
|
-
static fromLocalObject(value: unknown): RemoteObject {
|
|
15
|
-
return new LocalJSONObject(value);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
static type(remoteObject: RemoteObject): string {
|
|
19
|
-
if (remoteObject === null) {
|
|
20
|
-
return 'null';
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const type = typeof remoteObject;
|
|
24
|
-
if (type !== 'object' && type !== 'function') {
|
|
25
|
-
return type;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return remoteObject.type;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
static isNullOrUndefined(remoteObject?: RemoteObject): boolean {
|
|
32
|
-
if (remoteObject === undefined) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
switch (remoteObject.type) {
|
|
36
|
-
case Protocol.Runtime.RemoteObjectType.Object:
|
|
37
|
-
return remoteObject.subtype === Protocol.Runtime.RemoteObjectSubtype.Null;
|
|
38
|
-
case Protocol.Runtime.RemoteObjectType.Undefined:
|
|
39
|
-
return true;
|
|
40
|
-
default:
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
static arrayNameFromDescription(description: string): string {
|
|
46
|
-
return description.replace(descriptionLengthParenRegex, '').replace(descriptionLengthSquareRegex, '');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
static arrayLength(object: RemoteObject|Protocol.Runtime.RemoteObject|Protocol.Runtime.ObjectPreview): number {
|
|
50
|
-
if (object.subtype !== 'array' && object.subtype !== 'typedarray') {
|
|
51
|
-
return 0;
|
|
52
|
-
}
|
|
53
|
-
// Array lengths in V8-generated descriptions switched from square brackets to parentheses.
|
|
54
|
-
// Both formats are checked in case the front end is dealing with an old version of V8.
|
|
55
|
-
const parenMatches = object.description?.match(descriptionLengthParenRegex);
|
|
56
|
-
const squareMatches = object.description?.match(descriptionLengthSquareRegex);
|
|
57
|
-
return parenMatches ? parseInt(parenMatches[1], 10) : (squareMatches ? parseInt(squareMatches[1], 10) : 0);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
static arrayBufferByteLength(object: RemoteObject|Protocol.Runtime.RemoteObject|Protocol.Runtime.ObjectPreview):
|
|
61
|
-
number {
|
|
62
|
-
if (object.subtype !== 'arraybuffer') {
|
|
63
|
-
return 0;
|
|
64
|
-
}
|
|
65
|
-
const matches = object.description?.match(descriptionLengthParenRegex);
|
|
66
|
-
return matches ? parseInt(matches[1], 10) : 0;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
static unserializableDescription(object: unknown): string|null {
|
|
70
|
-
if (typeof object === 'number') {
|
|
71
|
-
const description = String(object);
|
|
72
|
-
if (object === 0 && 1 / object < 0) {
|
|
73
|
-
return UnserializableNumber.NEGATIVE_ZERO;
|
|
74
|
-
}
|
|
75
|
-
if (description === UnserializableNumber.NAN || description === UnserializableNumber.INFINITY ||
|
|
76
|
-
description === UnserializableNumber.NEGATIVE_INFINITY) {
|
|
77
|
-
return description;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
if (typeof object === 'bigint') {
|
|
81
|
-
return object + 'n';
|
|
82
|
-
}
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
static toCallArgument(object: string|number|bigint|boolean|RemoteObject|Protocol.Runtime.RemoteObject|null|undefined):
|
|
87
|
-
Protocol.Runtime.CallArgument {
|
|
88
|
-
const type = typeof object;
|
|
89
|
-
if (type === 'undefined') {
|
|
90
|
-
return {};
|
|
91
|
-
}
|
|
92
|
-
const unserializableDescription = RemoteObject.unserializableDescription(object);
|
|
93
|
-
if (type === 'number') {
|
|
94
|
-
if (unserializableDescription !== null) {
|
|
95
|
-
return {unserializableValue: unserializableDescription};
|
|
96
|
-
}
|
|
97
|
-
return {value: object};
|
|
98
|
-
}
|
|
99
|
-
if (type === 'bigint') {
|
|
100
|
-
return {unserializableValue: unserializableDescription ?? undefined};
|
|
101
|
-
}
|
|
102
|
-
if (type === 'string' || type === 'boolean') {
|
|
103
|
-
return {value: object};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (!object) {
|
|
107
|
-
return {value: null};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// The unserializableValue is a function on RemoteObject's and a simple property on
|
|
111
|
-
// Protocol.Runtime.RemoteObject's.
|
|
112
|
-
const objectAsProtocolRemoteObject = (object as Protocol.Runtime.RemoteObject);
|
|
113
|
-
if (object instanceof RemoteObject) {
|
|
114
|
-
const unserializableValue = object.unserializableValue();
|
|
115
|
-
if (unserializableValue !== undefined) {
|
|
116
|
-
return {unserializableValue};
|
|
117
|
-
}
|
|
118
|
-
} else if (objectAsProtocolRemoteObject.unserializableValue !== undefined) {
|
|
119
|
-
return {unserializableValue: objectAsProtocolRemoteObject.unserializableValue};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (typeof objectAsProtocolRemoteObject.objectId !== 'undefined') {
|
|
123
|
-
return {objectId: objectAsProtocolRemoteObject.objectId};
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return {value: objectAsProtocolRemoteObject.value};
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
static async loadFromObjectPerProto(object: RemoteObject, generatePreview: boolean, nonIndexedPropertiesOnly = false):
|
|
130
|
-
Promise<GetPropertiesResult> {
|
|
131
|
-
const result = await Promise.all([
|
|
132
|
-
object.getAllProperties(true /* accessorPropertiesOnly */, generatePreview, nonIndexedPropertiesOnly),
|
|
133
|
-
object.getOwnProperties(generatePreview, nonIndexedPropertiesOnly),
|
|
134
|
-
]);
|
|
135
|
-
const accessorProperties = result[0].properties;
|
|
136
|
-
const ownProperties = result[1].properties;
|
|
137
|
-
const internalProperties = result[1].internalProperties;
|
|
138
|
-
if (!ownProperties || !accessorProperties) {
|
|
139
|
-
return {properties: null, internalProperties: null};
|
|
140
|
-
}
|
|
141
|
-
const propertiesMap = new Map<string, RemoteObjectProperty>();
|
|
142
|
-
const propertySymbols = [];
|
|
143
|
-
for (let i = 0; i < accessorProperties.length; i++) {
|
|
144
|
-
const property = accessorProperties[i];
|
|
145
|
-
if (property.symbol) {
|
|
146
|
-
propertySymbols.push(property);
|
|
147
|
-
} else if (property.isOwn || property.name !== '__proto__') {
|
|
148
|
-
// TODO(crbug/1076820): Eventually we should move away from
|
|
149
|
-
// showing accessor #properties directly on the receiver.
|
|
150
|
-
propertiesMap.set(property.name, property);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
for (let i = 0; i < ownProperties.length; i++) {
|
|
154
|
-
const property = ownProperties[i];
|
|
155
|
-
if (property.isAccessorProperty()) {
|
|
156
|
-
continue;
|
|
157
|
-
}
|
|
158
|
-
if (property.private || property.symbol) {
|
|
159
|
-
propertySymbols.push(property);
|
|
160
|
-
} else {
|
|
161
|
-
propertiesMap.set(property.name, property);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return {
|
|
165
|
-
properties: [...propertiesMap.values()].concat(propertySymbols),
|
|
166
|
-
internalProperties: internalProperties ? internalProperties : null,
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
customPreview(): Protocol.Runtime.CustomPreview|null {
|
|
171
|
-
return null;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
abstract get objectId(): Protocol.Runtime.RemoteObjectId|undefined;
|
|
175
|
-
abstract get type(): string;
|
|
176
|
-
|
|
177
|
-
abstract get subtype(): string|undefined;
|
|
178
|
-
|
|
179
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
180
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
181
|
-
abstract get value(): any;
|
|
182
|
-
|
|
183
|
-
abstract get description(): string|undefined;
|
|
184
|
-
abstract set description(description: string|undefined);
|
|
185
|
-
|
|
186
|
-
abstract get hasChildren(): boolean;
|
|
187
|
-
|
|
188
|
-
abstract arrayLength(): number;
|
|
189
|
-
|
|
190
|
-
abstract getOwnProperties(generatePreview: boolean, nonIndexedPropertiesOnly?: boolean): Promise<GetPropertiesResult>;
|
|
191
|
-
|
|
192
|
-
abstract getAllProperties(
|
|
193
|
-
accessorPropertiesOnly: boolean, generatePreview: boolean,
|
|
194
|
-
nonIndexedPropertiesOnly?: boolean): Promise<GetPropertiesResult>;
|
|
195
|
-
|
|
196
|
-
unserializableValue(): string|undefined {
|
|
197
|
-
throw new Error('Not implemented');
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
get preview(): Protocol.Runtime.ObjectPreview|undefined {
|
|
201
|
-
return undefined;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
get className(): string|null {
|
|
205
|
-
return null;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
callFunction<T, U>(_functionDeclaration: (this: U, ...args: any[]) => T, _args?: Protocol.Runtime.CallArgument[]):
|
|
209
|
-
Promise<CallFunctionResult> {
|
|
210
|
-
throw new Error('Not implemented');
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
callFunctionJSON<T, U>(
|
|
214
|
-
_functionDeclaration: (this: U, ...args: any[]) => T,
|
|
215
|
-
_args: Protocol.Runtime.CallArgument[]|undefined): Promise<T|null> {
|
|
216
|
-
throw new Error('Not implemented');
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
arrayBufferByteLength(): number {
|
|
220
|
-
throw new Error('Not implemented');
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
deleteProperty(_name: Protocol.Runtime.CallArgument): Promise<string|undefined> {
|
|
224
|
-
throw new Error('Not implemented');
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
setPropertyValue(_name: string|Protocol.Runtime.CallArgument, _value: string): Promise<string|undefined> {
|
|
228
|
-
throw new Error('Not implemented');
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
release(): void {
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
debuggerModel(): DebuggerModel {
|
|
235
|
-
throw new Error('DebuggerModel-less object');
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
runtimeModel(): RuntimeModel {
|
|
239
|
-
throw new Error('RuntimeModel-less object');
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
isNode(): boolean {
|
|
243
|
-
return false;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Checks whether this object can be inspected with the Linear memory inspector.
|
|
248
|
-
* @returns `true` if this object can be inspected with the Linear memory inspector.
|
|
249
|
-
*/
|
|
250
|
-
isLinearMemoryInspectable(): boolean {
|
|
251
|
-
return false;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
webIdl?: RemoteObjectWebIdlTypeMetadata;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
export class RemoteObjectImpl extends RemoteObject {
|
|
258
|
-
#runtimeModel: RuntimeModel;
|
|
259
|
-
readonly #runtimeAgent: ProtocolProxyApi.RuntimeApi;
|
|
260
|
-
readonly #type: string;
|
|
261
|
-
readonly #subtype: string|undefined;
|
|
262
|
-
#objectId: Protocol.Runtime.RemoteObjectId|undefined;
|
|
263
|
-
#description: string|undefined;
|
|
264
|
-
#hasChildren: boolean;
|
|
265
|
-
readonly #preview: Protocol.Runtime.ObjectPreview|undefined;
|
|
266
|
-
readonly #unserializableValue: string|undefined;
|
|
267
|
-
readonly #value: typeof RemoteObject.prototype.value;
|
|
268
|
-
readonly #customPreview: Protocol.Runtime.CustomPreview|null;
|
|
269
|
-
readonly #className: string|null;
|
|
270
|
-
|
|
271
|
-
constructor(
|
|
272
|
-
runtimeModel: RuntimeModel,
|
|
273
|
-
objectId: Protocol.Runtime.RemoteObjectId|undefined,
|
|
274
|
-
type: string,
|
|
275
|
-
subtype: string|undefined,
|
|
276
|
-
value: typeof RemoteObject.prototype.value,
|
|
277
|
-
unserializableValue?: string,
|
|
278
|
-
description?: string,
|
|
279
|
-
preview?: Protocol.Runtime.ObjectPreview,
|
|
280
|
-
customPreview?: Protocol.Runtime.CustomPreview,
|
|
281
|
-
className?: string,
|
|
282
|
-
) {
|
|
283
|
-
super();
|
|
284
|
-
|
|
285
|
-
this.#runtimeModel = runtimeModel;
|
|
286
|
-
this.#runtimeAgent = runtimeModel.target().runtimeAgent();
|
|
287
|
-
|
|
288
|
-
this.#type = type;
|
|
289
|
-
this.#subtype = subtype;
|
|
290
|
-
if (objectId) {
|
|
291
|
-
// handle
|
|
292
|
-
this.#objectId = objectId;
|
|
293
|
-
this.#description = description;
|
|
294
|
-
this.#hasChildren = (type !== 'symbol');
|
|
295
|
-
this.#preview = preview;
|
|
296
|
-
} else {
|
|
297
|
-
this.#description = description;
|
|
298
|
-
if (!this.description && unserializableValue) {
|
|
299
|
-
this.#description = unserializableValue;
|
|
300
|
-
}
|
|
301
|
-
if (!this.#description && (typeof value !== 'object' || value === null)) {
|
|
302
|
-
this.#description = String(value);
|
|
303
|
-
}
|
|
304
|
-
this.#hasChildren = false;
|
|
305
|
-
if (typeof unserializableValue === 'string') {
|
|
306
|
-
this.#unserializableValue = unserializableValue;
|
|
307
|
-
if (unserializableValue === UnserializableNumber.INFINITY ||
|
|
308
|
-
unserializableValue === UnserializableNumber.NEGATIVE_INFINITY ||
|
|
309
|
-
unserializableValue === UnserializableNumber.NEGATIVE_ZERO ||
|
|
310
|
-
unserializableValue === UnserializableNumber.NAN) {
|
|
311
|
-
this.#value = Number(unserializableValue);
|
|
312
|
-
} else if (type === 'bigint' && unserializableValue.endsWith('n')) {
|
|
313
|
-
this.#value = BigInt(unserializableValue.substring(0, unserializableValue.length - 1));
|
|
314
|
-
} else {
|
|
315
|
-
this.#value = unserializableValue;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
} else {
|
|
319
|
-
this.#value = value;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
this.#customPreview = customPreview || null;
|
|
323
|
-
this.#className = typeof className === 'string' ? className : null;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
override customPreview(): Protocol.Runtime.CustomPreview|null {
|
|
327
|
-
return this.#customPreview;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
override get objectId(): Protocol.Runtime.RemoteObjectId|undefined {
|
|
331
|
-
return this.#objectId;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
override get type(): string {
|
|
335
|
-
return this.#type;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
override get subtype(): string|undefined {
|
|
339
|
-
return this.#subtype;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
override get value(): typeof RemoteObject.prototype.value {
|
|
343
|
-
return this.#value;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
override unserializableValue(): string|undefined {
|
|
347
|
-
return this.#unserializableValue;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
override get description(): string|undefined {
|
|
351
|
-
return this.#description;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
override set description(description: string|undefined) {
|
|
355
|
-
this.#description = description;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
override get hasChildren(): boolean {
|
|
359
|
-
return this.#hasChildren;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
override get preview(): Protocol.Runtime.ObjectPreview|undefined {
|
|
363
|
-
return this.#preview;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
override get className(): string|null {
|
|
367
|
-
return this.#className;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
override getOwnProperties(generatePreview: boolean, nonIndexedPropertiesOnly = false): Promise<GetPropertiesResult> {
|
|
371
|
-
return this.doGetProperties(true, false, nonIndexedPropertiesOnly, generatePreview);
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
override getAllProperties(
|
|
375
|
-
accessorPropertiesOnly: boolean, generatePreview: boolean,
|
|
376
|
-
nonIndexedPropertiesOnly = false): Promise<GetPropertiesResult> {
|
|
377
|
-
return this.doGetProperties(false, accessorPropertiesOnly, nonIndexedPropertiesOnly, generatePreview);
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
async createRemoteObject(object: Protocol.Runtime.RemoteObject): Promise<RemoteObject> {
|
|
381
|
-
return this.#runtimeModel.createRemoteObject(object);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
async doGetProperties(
|
|
385
|
-
ownProperties: boolean, accessorPropertiesOnly: boolean, nonIndexedPropertiesOnly: boolean,
|
|
386
|
-
generatePreview: boolean): Promise<GetPropertiesResult> {
|
|
387
|
-
if (!this.#objectId) {
|
|
388
|
-
return {properties: null, internalProperties: null};
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
const response = await this.#runtimeAgent.invoke_getProperties({
|
|
392
|
-
objectId: this.#objectId,
|
|
393
|
-
ownProperties,
|
|
394
|
-
accessorPropertiesOnly,
|
|
395
|
-
nonIndexedPropertiesOnly,
|
|
396
|
-
generatePreview,
|
|
397
|
-
});
|
|
398
|
-
if (response.getError()) {
|
|
399
|
-
return {properties: null, internalProperties: null};
|
|
400
|
-
}
|
|
401
|
-
if (response.exceptionDetails) {
|
|
402
|
-
this.#runtimeModel.exceptionThrown(Date.now(), response.exceptionDetails);
|
|
403
|
-
return {properties: null, internalProperties: null};
|
|
404
|
-
}
|
|
405
|
-
const {result: properties = [], internalProperties = [], privateProperties = []} = response;
|
|
406
|
-
const result = [];
|
|
407
|
-
for (const property of properties) {
|
|
408
|
-
const propertyValue = property.value ? await this.createRemoteObject(property.value) : null;
|
|
409
|
-
const propertySymbol = property.symbol ? this.#runtimeModel.createRemoteObject(property.symbol) : null;
|
|
410
|
-
const remoteProperty = new RemoteObjectProperty(
|
|
411
|
-
property.name, propertyValue, Boolean(property.enumerable), Boolean(property.writable),
|
|
412
|
-
Boolean(property.isOwn), Boolean(property.wasThrown), propertySymbol);
|
|
413
|
-
|
|
414
|
-
if (typeof property.value === 'undefined') {
|
|
415
|
-
if (property.get && property.get.type !== 'undefined') {
|
|
416
|
-
remoteProperty.getter = this.#runtimeModel.createRemoteObject(property.get);
|
|
417
|
-
}
|
|
418
|
-
if (property.set && property.set.type !== 'undefined') {
|
|
419
|
-
remoteProperty.setter = this.#runtimeModel.createRemoteObject(property.set);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
result.push(remoteProperty);
|
|
423
|
-
}
|
|
424
|
-
for (const property of privateProperties) {
|
|
425
|
-
const propertyValue = property.value ? this.#runtimeModel.createRemoteObject(property.value) : null;
|
|
426
|
-
const remoteProperty = new RemoteObjectProperty(
|
|
427
|
-
property.name, propertyValue, true, true, true, false, undefined, false, undefined, true);
|
|
428
|
-
|
|
429
|
-
if (typeof property.value === 'undefined') {
|
|
430
|
-
if (property.get && property.get.type !== 'undefined') {
|
|
431
|
-
remoteProperty.getter = this.#runtimeModel.createRemoteObject(property.get);
|
|
432
|
-
}
|
|
433
|
-
if (property.set && property.set.type !== 'undefined') {
|
|
434
|
-
remoteProperty.setter = this.#runtimeModel.createRemoteObject(property.set);
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
result.push(remoteProperty);
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
const internalPropertiesResult = [];
|
|
441
|
-
for (const property of internalProperties) {
|
|
442
|
-
if (!property.value) {
|
|
443
|
-
continue;
|
|
444
|
-
}
|
|
445
|
-
const propertyValue = this.#runtimeModel.createRemoteObject(property.value);
|
|
446
|
-
internalPropertiesResult.push(
|
|
447
|
-
new RemoteObjectProperty(property.name, propertyValue, true, false, undefined, undefined, undefined, true));
|
|
448
|
-
}
|
|
449
|
-
return {properties: result, internalProperties: internalPropertiesResult};
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
override async setPropertyValue(name: string|Protocol.Runtime.CallArgument, value: string):
|
|
453
|
-
Promise<string|undefined> {
|
|
454
|
-
if (!this.#objectId) {
|
|
455
|
-
return 'Can’t set a property of non-object.';
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
const response = await this.#runtimeAgent.invoke_evaluate({expression: value, silent: true});
|
|
459
|
-
if (response.getError() || response.exceptionDetails) {
|
|
460
|
-
return response.getError() ||
|
|
461
|
-
(response.result.type !== 'string' ? response.result.description : response.result.value as string);
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
if (typeof name === 'string') {
|
|
465
|
-
name = RemoteObject.toCallArgument(name);
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
const resultPromise = this.doSetObjectPropertyValue(response.result, name);
|
|
469
|
-
|
|
470
|
-
if (response.result.objectId) {
|
|
471
|
-
void this.#runtimeAgent.invoke_releaseObject({objectId: response.result.objectId});
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
return await resultPromise;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
async doSetObjectPropertyValue(result: Protocol.Runtime.RemoteObject, name: Protocol.Runtime.CallArgument):
|
|
478
|
-
Promise<string|undefined> {
|
|
479
|
-
// This assignment may be for a regular (data) property, and for an accessor property (with getter/setter).
|
|
480
|
-
// Note the sensitive matter about accessor property: the property may be physically defined in some proto object,
|
|
481
|
-
// but logically it is bound to the object in question. JavaScript passes this object to getters/setters, not the object
|
|
482
|
-
// where property was defined; so do we.
|
|
483
|
-
const setPropertyValueFunction = 'function(a, b) { this[a] = b; }';
|
|
484
|
-
|
|
485
|
-
const argv = [name, RemoteObject.toCallArgument(result)];
|
|
486
|
-
const response = await this.#runtimeAgent.invoke_callFunctionOn({
|
|
487
|
-
objectId: this.#objectId,
|
|
488
|
-
functionDeclaration: setPropertyValueFunction,
|
|
489
|
-
arguments: argv,
|
|
490
|
-
silent: true,
|
|
491
|
-
});
|
|
492
|
-
const error = response.getError();
|
|
493
|
-
return error || response.exceptionDetails ? error || response.result.description : undefined;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
override async deleteProperty(name: Protocol.Runtime.CallArgument): Promise<string|undefined> {
|
|
497
|
-
if (!this.#objectId) {
|
|
498
|
-
return 'Can’t delete a property of non-object.';
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
const deletePropertyFunction = 'function(a) { delete this[a]; return !(a in this); }';
|
|
502
|
-
const response = await this.#runtimeAgent.invoke_callFunctionOn({
|
|
503
|
-
objectId: this.#objectId,
|
|
504
|
-
functionDeclaration: deletePropertyFunction,
|
|
505
|
-
arguments: [name],
|
|
506
|
-
silent: true,
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
if (response.getError() || response.exceptionDetails) {
|
|
510
|
-
return response.getError() || response.result.description;
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
if (!response.result.value) {
|
|
514
|
-
return 'Failed to delete property.';
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
return undefined;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
override async callFunction<T, U>(
|
|
521
|
-
functionDeclaration: (this: U, ...args: any[]) => T,
|
|
522
|
-
args?: Protocol.Runtime.CallArgument[]): Promise<CallFunctionResult> {
|
|
523
|
-
const response = await this.#runtimeAgent.invoke_callFunctionOn({
|
|
524
|
-
objectId: this.#objectId,
|
|
525
|
-
functionDeclaration: functionDeclaration.toString(),
|
|
526
|
-
arguments: args,
|
|
527
|
-
silent: true,
|
|
528
|
-
});
|
|
529
|
-
if (response.getError()) {
|
|
530
|
-
return {object: null, wasThrown: false};
|
|
531
|
-
}
|
|
532
|
-
// TODO: release exceptionDetails object
|
|
533
|
-
return {
|
|
534
|
-
object: this.#runtimeModel.createRemoteObject(response.result),
|
|
535
|
-
wasThrown: Boolean(response.exceptionDetails),
|
|
536
|
-
};
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
override async callFunctionJSON<T, U>(
|
|
540
|
-
functionDeclaration: (this: U, ...args: any[]) => T,
|
|
541
|
-
args: Protocol.Runtime.CallArgument[]|undefined): Promise<T|null> {
|
|
542
|
-
const response = await this.#runtimeAgent.invoke_callFunctionOn({
|
|
543
|
-
objectId: this.#objectId,
|
|
544
|
-
functionDeclaration: functionDeclaration.toString(),
|
|
545
|
-
arguments: args,
|
|
546
|
-
silent: true,
|
|
547
|
-
returnByValue: true,
|
|
548
|
-
});
|
|
549
|
-
if (response.getError() || response.exceptionDetails) {
|
|
550
|
-
return null;
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
return response.result.value;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
override release(): void {
|
|
557
|
-
if (!this.#objectId) {
|
|
558
|
-
return;
|
|
559
|
-
}
|
|
560
|
-
void this.#runtimeAgent.invoke_releaseObject({objectId: this.#objectId});
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
override arrayLength(): number {
|
|
564
|
-
return RemoteObject.arrayLength(this);
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
override arrayBufferByteLength(): number {
|
|
568
|
-
return RemoteObject.arrayBufferByteLength(this);
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
override debuggerModel(): DebuggerModel {
|
|
572
|
-
return this.#runtimeModel.debuggerModel();
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
override runtimeModel(): RuntimeModel {
|
|
576
|
-
return this.#runtimeModel;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
override isNode(): boolean {
|
|
580
|
-
return Boolean(this.#objectId) && this.type === 'object' && this.subtype === 'node';
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
override isLinearMemoryInspectable(): boolean {
|
|
584
|
-
return this.type === 'object' && this.subtype !== undefined &&
|
|
585
|
-
['webassemblymemory', 'typedarray', 'dataview', 'arraybuffer'].includes(this.subtype);
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
export class ScopeRemoteObject extends RemoteObjectImpl {
|
|
590
|
-
readonly #scopeRef: ScopeRef;
|
|
591
|
-
#savedScopeProperties: RemoteObjectProperty[]|undefined;
|
|
592
|
-
|
|
593
|
-
constructor(
|
|
594
|
-
runtimeModel: RuntimeModel, objectId: Protocol.Runtime.RemoteObjectId|undefined, scopeRef: ScopeRef, type: string,
|
|
595
|
-
subtype: string|undefined, value: typeof RemoteObjectImpl.prototype.value, unserializableValue?: string,
|
|
596
|
-
description?: string, preview?: Protocol.Runtime.ObjectPreview) {
|
|
597
|
-
super(runtimeModel, objectId, type, subtype, value, unserializableValue, description, preview);
|
|
598
|
-
this.#scopeRef = scopeRef;
|
|
599
|
-
this.#savedScopeProperties = undefined;
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
override async doGetProperties(ownProperties: boolean, accessorPropertiesOnly: boolean, _generatePreview: boolean):
|
|
603
|
-
Promise<GetPropertiesResult> {
|
|
604
|
-
if (accessorPropertiesOnly) {
|
|
605
|
-
return {properties: [], internalProperties: []};
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
if (this.#savedScopeProperties) {
|
|
609
|
-
// No need to reload scope variables, as the remote object never
|
|
610
|
-
// changes its #properties. If variable is updated, the #properties
|
|
611
|
-
// array is patched locally.
|
|
612
|
-
return {properties: this.#savedScopeProperties.slice(), internalProperties: null};
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
const allProperties = await super.doGetProperties(
|
|
616
|
-
ownProperties, accessorPropertiesOnly, false /* nonIndexedPropertiesOnly */, true /* generatePreview */);
|
|
617
|
-
if (Array.isArray(allProperties.properties)) {
|
|
618
|
-
this.#savedScopeProperties = allProperties.properties.slice();
|
|
619
|
-
}
|
|
620
|
-
return allProperties;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
override async doSetObjectPropertyValue(
|
|
624
|
-
result: Protocol.Runtime.RemoteObject, argumentName: Protocol.Runtime.CallArgument): Promise<string|undefined> {
|
|
625
|
-
const name = (argumentName.value as string);
|
|
626
|
-
const error = await this.debuggerModel().setVariableValue(
|
|
627
|
-
this.#scopeRef.number, name, RemoteObject.toCallArgument(result), this.#scopeRef.callFrameId);
|
|
628
|
-
if (error) {
|
|
629
|
-
return error;
|
|
630
|
-
}
|
|
631
|
-
if (this.#savedScopeProperties) {
|
|
632
|
-
for (const property of this.#savedScopeProperties) {
|
|
633
|
-
if (property.name === name) {
|
|
634
|
-
property.value = this.runtimeModel().createRemoteObject(result);
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
return;
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
export class ScopeRef {
|
|
643
|
-
readonly number: number;
|
|
644
|
-
readonly callFrameId: Protocol.Debugger.CallFrameId;
|
|
645
|
-
|
|
646
|
-
constructor(number: number, callFrameId: Protocol.Debugger.CallFrameId) {
|
|
647
|
-
this.number = number;
|
|
648
|
-
this.callFrameId = callFrameId;
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
export class RemoteObjectProperty {
|
|
653
|
-
name: string;
|
|
654
|
-
value?: RemoteObject;
|
|
655
|
-
enumerable: boolean;
|
|
656
|
-
writable: boolean;
|
|
657
|
-
isOwn: boolean;
|
|
658
|
-
wasThrown: boolean;
|
|
659
|
-
symbol: RemoteObject|undefined;
|
|
660
|
-
synthetic: boolean;
|
|
661
|
-
syntheticSetter: ((arg0: string) => Promise<RemoteObject|null>)|undefined;
|
|
662
|
-
|
|
663
|
-
private: boolean;
|
|
664
|
-
getter: RemoteObject|undefined;
|
|
665
|
-
setter: RemoteObject|undefined;
|
|
666
|
-
|
|
667
|
-
webIdl?: RemoteObjectWebIdlPropertyMetadata;
|
|
668
|
-
|
|
669
|
-
constructor(
|
|
670
|
-
name: string, value: RemoteObject|null, enumerable?: boolean, writable?: boolean, isOwn?: boolean,
|
|
671
|
-
wasThrown?: boolean, symbol?: RemoteObject|null, synthetic?: boolean,
|
|
672
|
-
syntheticSetter?: ((arg0: string) => Promise<RemoteObject|null>), isPrivate?: boolean) {
|
|
673
|
-
this.name = name;
|
|
674
|
-
this.value = value !== null ? value : undefined;
|
|
675
|
-
this.enumerable = typeof enumerable !== 'undefined' ? enumerable : true;
|
|
676
|
-
const isNonSyntheticOrSyntheticWritable = !synthetic || Boolean(syntheticSetter);
|
|
677
|
-
this.writable = typeof writable !== 'undefined' ? writable : isNonSyntheticOrSyntheticWritable;
|
|
678
|
-
this.isOwn = Boolean(isOwn);
|
|
679
|
-
this.wasThrown = Boolean(wasThrown);
|
|
680
|
-
if (symbol) {
|
|
681
|
-
this.symbol = symbol;
|
|
682
|
-
}
|
|
683
|
-
this.synthetic = Boolean(synthetic);
|
|
684
|
-
if (syntheticSetter) {
|
|
685
|
-
this.syntheticSetter = syntheticSetter;
|
|
686
|
-
}
|
|
687
|
-
this.private = Boolean(isPrivate);
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
async setSyntheticValue(expression: string): Promise<boolean> {
|
|
691
|
-
if (!this.syntheticSetter) {
|
|
692
|
-
return false;
|
|
693
|
-
}
|
|
694
|
-
const result = await this.syntheticSetter(expression);
|
|
695
|
-
if (result) {
|
|
696
|
-
this.value = result;
|
|
697
|
-
}
|
|
698
|
-
return Boolean(result);
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
isAccessorProperty(): boolean {
|
|
702
|
-
return Boolean(this.getter || this.setter);
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
match({includeNullOrUndefinedValues, regex}: {includeNullOrUndefinedValues: boolean, regex: RegExp|null}): boolean {
|
|
706
|
-
if (regex !== null) {
|
|
707
|
-
if (!regex.test(this.name) && !regex.test(this.value?.description ?? '')) {
|
|
708
|
-
return false;
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
if (!includeNullOrUndefinedValues) {
|
|
712
|
-
if (!this.isAccessorProperty() && RemoteObject.isNullOrUndefined(this.value)) {
|
|
713
|
-
return false;
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
return true;
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
cloneWithNewName(newName: string): RemoteObjectProperty {
|
|
720
|
-
const property = new RemoteObjectProperty(
|
|
721
|
-
newName, this.value ?? null, this.enumerable, this.writable, this.isOwn, this.wasThrown, this.symbol,
|
|
722
|
-
this.synthetic, this.syntheticSetter, this.private);
|
|
723
|
-
property.getter = this.getter;
|
|
724
|
-
property.setter = this.setter;
|
|
725
|
-
return property;
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
// Below is a wrapper around a local object that implements the RemoteObject interface,
|
|
730
|
-
// which can be used by the UI code (primarily ObjectPropertiesSection).
|
|
731
|
-
// Note that only JSON-compliant objects are currently supported, as there's no provision
|
|
732
|
-
// for traversing prototypes, extracting class names via constructor, handling #properties
|
|
733
|
-
// or functions.
|
|
734
|
-
|
|
735
|
-
export class LocalJSONObject extends RemoteObject {
|
|
736
|
-
#value: typeof RemoteObject.prototype.value;
|
|
737
|
-
#cachedDescription!: string;
|
|
738
|
-
#cachedChildren!: RemoteObjectProperty[];
|
|
739
|
-
|
|
740
|
-
constructor(value: typeof RemoteObject.prototype.value) {
|
|
741
|
-
super();
|
|
742
|
-
this.#value = value;
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
override get objectId(): Protocol.Runtime.RemoteObjectId|undefined {
|
|
746
|
-
return undefined;
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
override get value(): typeof RemoteObject.prototype.value {
|
|
750
|
-
return this.#value;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
override unserializableValue(): string|undefined {
|
|
754
|
-
const unserializableDescription = RemoteObject.unserializableDescription(this.#value);
|
|
755
|
-
return unserializableDescription || undefined;
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
override get description(): string {
|
|
759
|
-
if (this.#cachedDescription) {
|
|
760
|
-
return this.#cachedDescription;
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
function formatArrayItem(this: LocalJSONObject, property: RemoteObjectProperty): string {
|
|
764
|
-
return this.formatValue(property.value || null);
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
function formatObjectItem(this: LocalJSONObject, property: RemoteObjectProperty): string {
|
|
768
|
-
let name: string = property.name;
|
|
769
|
-
if (/^\s|\s$|^$|\n/.test(name)) {
|
|
770
|
-
name = '"' + name.replace(/\n/g, '\u21B5') + '"';
|
|
771
|
-
}
|
|
772
|
-
return name + ': ' + this.formatValue(property.value || null);
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
if (this.type === 'object') {
|
|
776
|
-
switch (this.subtype) {
|
|
777
|
-
case 'array':
|
|
778
|
-
this.#cachedDescription = this.concatenate('[', ']', formatArrayItem.bind(this));
|
|
779
|
-
break;
|
|
780
|
-
case 'date':
|
|
781
|
-
this.#cachedDescription = String(this.#value);
|
|
782
|
-
break;
|
|
783
|
-
case 'null':
|
|
784
|
-
this.#cachedDescription = 'null';
|
|
785
|
-
break;
|
|
786
|
-
default:
|
|
787
|
-
this.#cachedDescription = this.concatenate('{', '}', formatObjectItem.bind(this));
|
|
788
|
-
}
|
|
789
|
-
} else {
|
|
790
|
-
this.#cachedDescription = String(this.#value);
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
return this.#cachedDescription;
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
private formatValue(value: RemoteObject|null): string {
|
|
797
|
-
if (!value) {
|
|
798
|
-
return 'undefined';
|
|
799
|
-
}
|
|
800
|
-
const description = value.description || '';
|
|
801
|
-
if (value.type === 'string') {
|
|
802
|
-
return '"' + description.replace(/\n/g, '\u21B5') + '"';
|
|
803
|
-
}
|
|
804
|
-
return description;
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
private concatenate(prefix: string, suffix: string, formatProperty: (arg0: RemoteObjectProperty) => string): string {
|
|
808
|
-
const previewChars = 100;
|
|
809
|
-
|
|
810
|
-
let buffer = prefix;
|
|
811
|
-
const children = this.children();
|
|
812
|
-
for (let i = 0; i < children.length; ++i) {
|
|
813
|
-
const itemDescription = formatProperty(children[i]);
|
|
814
|
-
if (buffer.length + itemDescription.length > previewChars) {
|
|
815
|
-
buffer += ',…';
|
|
816
|
-
break;
|
|
817
|
-
}
|
|
818
|
-
if (i) {
|
|
819
|
-
buffer += ', ';
|
|
820
|
-
}
|
|
821
|
-
buffer += itemDescription;
|
|
822
|
-
}
|
|
823
|
-
buffer += suffix;
|
|
824
|
-
return buffer;
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
override get type(): string {
|
|
828
|
-
return typeof this.#value;
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
override get subtype(): string|undefined {
|
|
832
|
-
if (this.#value === null) {
|
|
833
|
-
return 'null';
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
if (Array.isArray(this.#value)) {
|
|
837
|
-
return 'array';
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
if (this.#value instanceof Date) {
|
|
841
|
-
return 'date';
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
return undefined;
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
override get hasChildren(): boolean {
|
|
848
|
-
if ((typeof this.#value !== 'object') || (this.#value === null)) {
|
|
849
|
-
return false;
|
|
850
|
-
}
|
|
851
|
-
return Boolean(Object.keys(this.#value).length);
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
override async getOwnProperties(_generatePreview: boolean, nonIndexedPropertiesOnly = false):
|
|
855
|
-
Promise<GetPropertiesResult> {
|
|
856
|
-
function isArrayIndex(name: string): boolean {
|
|
857
|
-
const index = Number(name) >>> 0;
|
|
858
|
-
return String(index) === name;
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
let properties = this.children();
|
|
862
|
-
if (nonIndexedPropertiesOnly) {
|
|
863
|
-
properties = properties.filter(property => !isArrayIndex(property.name));
|
|
864
|
-
}
|
|
865
|
-
return {properties, internalProperties: null};
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
override async getAllProperties(
|
|
869
|
-
accessorPropertiesOnly: boolean, generatePreview: boolean,
|
|
870
|
-
nonIndexedPropertiesOnly = false): Promise<GetPropertiesResult> {
|
|
871
|
-
if (accessorPropertiesOnly) {
|
|
872
|
-
return {properties: [], internalProperties: null};
|
|
873
|
-
}
|
|
874
|
-
return await this.getOwnProperties(generatePreview, nonIndexedPropertiesOnly);
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
private children(): RemoteObjectProperty[] {
|
|
878
|
-
if (!this.hasChildren) {
|
|
879
|
-
return [];
|
|
880
|
-
}
|
|
881
|
-
if (!this.#cachedChildren) {
|
|
882
|
-
this.#cachedChildren = Object.entries(this.#value).map(([name, value]) => {
|
|
883
|
-
return new RemoteObjectProperty(
|
|
884
|
-
name, value instanceof RemoteObject ? value : RemoteObject.fromLocalObject(value));
|
|
885
|
-
});
|
|
886
|
-
}
|
|
887
|
-
return this.#cachedChildren;
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
override arrayLength(): number {
|
|
891
|
-
return Array.isArray(this.#value) ? this.#value.length : 0;
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
override async callFunction<T, U>(
|
|
895
|
-
functionDeclaration: (this: U, ...args: any[]) => T,
|
|
896
|
-
args?: Protocol.Runtime.CallArgument[]): Promise<CallFunctionResult> {
|
|
897
|
-
const target = this.#value as U;
|
|
898
|
-
const rawArgs = args ? args.map(arg => arg.value) : [];
|
|
899
|
-
|
|
900
|
-
let result;
|
|
901
|
-
let wasThrown = false;
|
|
902
|
-
try {
|
|
903
|
-
result = functionDeclaration.apply(target, rawArgs);
|
|
904
|
-
} catch {
|
|
905
|
-
wasThrown = true;
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
const object = RemoteObject.fromLocalObject(result);
|
|
909
|
-
|
|
910
|
-
return {object, wasThrown};
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
override async callFunctionJSON<T, U>(
|
|
914
|
-
functionDeclaration: (this: U, ...args: any[]) => T,
|
|
915
|
-
args: Protocol.Runtime.CallArgument[]|undefined): Promise<T|null> {
|
|
916
|
-
const target = this.#value as U;
|
|
917
|
-
const rawArgs = args ? args.map(arg => arg.value) : [];
|
|
918
|
-
|
|
919
|
-
let result;
|
|
920
|
-
try {
|
|
921
|
-
result = functionDeclaration.apply(target, rawArgs);
|
|
922
|
-
} catch {
|
|
923
|
-
result = null;
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
return result;
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
export class RemoteArrayBuffer {
|
|
931
|
-
readonly #object: RemoteObject;
|
|
932
|
-
constructor(object: RemoteObject) {
|
|
933
|
-
if (object.type !== 'object' || object.subtype !== 'arraybuffer') {
|
|
934
|
-
throw new Error('Object is not an arraybuffer');
|
|
935
|
-
}
|
|
936
|
-
this.#object = object;
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
byteLength(): number {
|
|
940
|
-
return this.#object.arrayBufferByteLength();
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
async bytes(start = 0, end = this.byteLength()): Promise<number[]|null> {
|
|
944
|
-
if (start < 0 || start >= this.byteLength()) {
|
|
945
|
-
throw new RangeError('start is out of range');
|
|
946
|
-
}
|
|
947
|
-
if (end < start || end > this.byteLength()) {
|
|
948
|
-
throw new RangeError('end is out of range');
|
|
949
|
-
}
|
|
950
|
-
return await this.#object.callFunctionJSON(bytes, [{value: start}, {value: end - start}]);
|
|
951
|
-
|
|
952
|
-
function bytes(this: ArrayBuffer, offset: number, length: number): number[] {
|
|
953
|
-
return [...new Uint8Array(this, offset, length)];
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
object(): RemoteObject {
|
|
958
|
-
return this.#object;
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
export class RemoteArray {
|
|
963
|
-
readonly #object: RemoteObject;
|
|
964
|
-
constructor(object: RemoteObject) {
|
|
965
|
-
this.#object = object;
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
static objectAsArray(object: RemoteObject|null): RemoteArray {
|
|
969
|
-
if (!object || object.type !== 'object' || (object.subtype !== 'array' && object.subtype !== 'typedarray')) {
|
|
970
|
-
throw new Error('Object is empty or not an array');
|
|
971
|
-
}
|
|
972
|
-
return new RemoteArray(object);
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
static async createFromRemoteObjects(objects: RemoteObject[]): Promise<RemoteArray> {
|
|
976
|
-
if (!objects.length) {
|
|
977
|
-
throw new Error('Input array is empty');
|
|
978
|
-
}
|
|
979
|
-
const result = await objects[0].callFunction(createArray, objects.map(RemoteObject.toCallArgument));
|
|
980
|
-
if (result.wasThrown || !result.object) {
|
|
981
|
-
throw new Error('Call function throws exceptions or returns empty value');
|
|
982
|
-
}
|
|
983
|
-
return RemoteArray.objectAsArray(result.object);
|
|
984
|
-
|
|
985
|
-
function createArray<T>(...args: T[]): T[] {
|
|
986
|
-
return args;
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
async at(index: number): Promise<RemoteObject> {
|
|
991
|
-
if (index < 0 || index > this.#object.arrayLength()) {
|
|
992
|
-
throw new Error('Out of range');
|
|
993
|
-
}
|
|
994
|
-
const result = await this.#object.callFunction<unknown, unknown[]>(at, [RemoteObject.toCallArgument(index)]);
|
|
995
|
-
if (result.wasThrown || !result.object) {
|
|
996
|
-
throw new Error('Exception in callFunction or result value is empty');
|
|
997
|
-
}
|
|
998
|
-
return result.object;
|
|
999
|
-
|
|
1000
|
-
function at<T>(this: T[], index: number): T {
|
|
1001
|
-
return this[index];
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
length(): number {
|
|
1006
|
-
return this.#object.arrayLength();
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
map<T>(func: (arg0: RemoteObject) => Promise<T>): Promise<T[]> {
|
|
1010
|
-
const promises = [];
|
|
1011
|
-
for (let i = 0; i < this.length(); ++i) {
|
|
1012
|
-
promises.push(this.at(i).then(func));
|
|
1013
|
-
}
|
|
1014
|
-
return Promise.all(promises);
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
object(): RemoteObject {
|
|
1018
|
-
return this.#object;
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
export class RemoteFunction {
|
|
1023
|
-
readonly #object: RemoteObject;
|
|
1024
|
-
|
|
1025
|
-
constructor(object: RemoteObject) {
|
|
1026
|
-
this.#object = object;
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
static objectAsFunction(object: RemoteObject): RemoteFunction {
|
|
1030
|
-
if (object.type !== 'function') {
|
|
1031
|
-
throw new Error('Object is empty or not a function');
|
|
1032
|
-
}
|
|
1033
|
-
return new RemoteFunction(object);
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
async targetFunction(): Promise<RemoteObject> {
|
|
1037
|
-
const ownProperties = await this.#object.getOwnProperties(false /* generatePreview */);
|
|
1038
|
-
const targetFunction = ownProperties.internalProperties?.find(({name}) => name === '[[TargetFunction]]');
|
|
1039
|
-
return targetFunction?.value ?? this.#object;
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
async targetFunctionDetails(): Promise<FunctionDetails|null> {
|
|
1043
|
-
const targetFunction = await this.targetFunction();
|
|
1044
|
-
const functionDetails = await targetFunction.debuggerModel().functionDetailsPromise(targetFunction);
|
|
1045
|
-
if (this.#object !== targetFunction) {
|
|
1046
|
-
targetFunction.release();
|
|
1047
|
-
}
|
|
1048
|
-
return functionDetails;
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
export class RemoteError {
|
|
1053
|
-
readonly #object: RemoteObject;
|
|
1054
|
-
|
|
1055
|
-
#exceptionDetails?: Promise<Protocol.Runtime.ExceptionDetails|undefined>;
|
|
1056
|
-
#cause?: Promise<RemoteObject|undefined>;
|
|
1057
|
-
|
|
1058
|
-
private constructor(object: RemoteObject) {
|
|
1059
|
-
this.#object = object;
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
static objectAsError(object: RemoteObject): RemoteError {
|
|
1063
|
-
if (object.subtype !== 'error') {
|
|
1064
|
-
throw new Error(`Object of type ${object.subtype} is not an error`);
|
|
1065
|
-
}
|
|
1066
|
-
return new RemoteError(object);
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
get errorStack(): string {
|
|
1070
|
-
return this.#object.description ?? '';
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
exceptionDetails(): Promise<Protocol.Runtime.ExceptionDetails|undefined> {
|
|
1074
|
-
if (!this.#exceptionDetails) {
|
|
1075
|
-
this.#exceptionDetails = this.#lookupExceptionDetails();
|
|
1076
|
-
}
|
|
1077
|
-
return this.#exceptionDetails;
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
#lookupExceptionDetails(): Promise<Protocol.Runtime.ExceptionDetails|undefined> {
|
|
1081
|
-
if (this.#object.objectId) {
|
|
1082
|
-
return this.#object.runtimeModel().getExceptionDetails(this.#object.objectId);
|
|
1083
|
-
}
|
|
1084
|
-
return Promise.resolve(undefined);
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
cause(): Promise<RemoteObject|undefined> {
|
|
1088
|
-
if (!this.#cause) {
|
|
1089
|
-
this.#cause = this.#lookupCause();
|
|
1090
|
-
}
|
|
1091
|
-
return this.#cause;
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
async #lookupCause(): Promise<RemoteObject|undefined> {
|
|
1095
|
-
const allProperties =
|
|
1096
|
-
await this.#object.getAllProperties(false /* accessorPropertiesOnly */, false /* generatePreview */);
|
|
1097
|
-
const cause = allProperties.properties?.find(prop => prop.name === 'cause');
|
|
1098
|
-
|
|
1099
|
-
return cause?.value;
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
const descriptionLengthParenRegex = /\(([0-9]+)\)/;
|
|
1104
|
-
const descriptionLengthSquareRegex = /\[([0-9]+)\]/;
|
|
1105
|
-
|
|
1106
|
-
const enum UnserializableNumber {
|
|
1107
|
-
NEGATIVE_ZERO = ('-0'),
|
|
1108
|
-
NAN = ('NaN'),
|
|
1109
|
-
INFINITY = ('Infinity'),
|
|
1110
|
-
NEGATIVE_INFINITY = ('-Infinity'),
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
export interface CallFunctionResult {
|
|
1114
|
-
object: RemoteObject|null;
|
|
1115
|
-
wasThrown?: boolean;
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
export interface GetPropertiesResult {
|
|
1119
|
-
properties: RemoteObjectProperty[]|null;
|
|
1120
|
-
internalProperties: RemoteObjectProperty[]|null;
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
export interface RemoteObjectWebIdlTypeMetadata {
|
|
1124
|
-
info: DOMPinnedWebIDLType;
|
|
1125
|
-
state: Map<string, string>;
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
export interface RemoteObjectWebIdlPropertyMetadata {
|
|
1129
|
-
info: DOMPinnedWebIDLProp;
|
|
1130
|
-
applicable?: boolean;
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
/**
|
|
1134
|
-
* Pair of a linear memory inspectable {@link RemoteObject} and an optional
|
|
1135
|
-
* expression, which identifies the variable holding the object in the
|
|
1136
|
-
* current scope or the name of the field holding the object.
|
|
1137
|
-
*
|
|
1138
|
-
* This data structure is used to reveal an object in the Linear Memory
|
|
1139
|
-
* Inspector panel.
|
|
1140
|
-
*/
|
|
1141
|
-
export class LinearMemoryInspectable {
|
|
1142
|
-
/** The linear memory inspectable {@link RemoteObject}. */
|
|
1143
|
-
readonly object: RemoteObject;
|
|
1144
|
-
/** The name of the variable or the field holding the `object`. */
|
|
1145
|
-
readonly expression: string|undefined;
|
|
1146
|
-
|
|
1147
|
-
/**
|
|
1148
|
-
* Wrap `object` and `expression` into a reveable structure.
|
|
1149
|
-
*
|
|
1150
|
-
* @param object A linear memory inspectable {@link RemoteObject}.
|
|
1151
|
-
* @param expression An optional name of the field or variable holding the `object`.
|
|
1152
|
-
*/
|
|
1153
|
-
constructor(object: RemoteObject, expression?: string) {
|
|
1154
|
-
if (!object.isLinearMemoryInspectable()) {
|
|
1155
|
-
throw new Error('object must be linear memory inspectable');
|
|
1156
|
-
}
|
|
1157
|
-
this.object = object;
|
|
1158
|
-
this.expression = expression;
|
|
1159
|
-
}
|
|
1160
|
-
}
|