chrome-devtools-mcp-for-extension 0.19.2 → 0.20.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/build/node_modules/chrome-devtools-frontend/front_end/core/common/Color.js +13 -9
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/ColorConverter.js +9 -7
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Console.js +1 -8
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Debouncer.js +2 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Gzip.js +9 -7
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/MapWithDefault.js +5 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/ParsedURL.js +10 -20
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/ResourceType.js +0 -11
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/ReturnToPanel.js +6 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Revealer.js +5 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/SegmentedRange.js +1 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Settings.js +110 -99
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/StringOutputStream.js +1 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Throttler.js +2 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/common.js +1 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/AidaClient.js +21 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/DispatchHttpRequestClient.js +66 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/GdpClient.js +102 -86
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/InspectorFrontendHost.js +32 -450
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/InspectorFrontendHostAPI.js +32 -29
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/InspectorFrontendHostStub.js +430 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/Platform.js +5 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/ResourceLoader.js +10 -22
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/UserMetrics.js +26 -15
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/host.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/ArrayUtilities.js +2 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/HostRuntime.js +19 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/StringUtilities.js +34 -32
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/api/HostRuntime.js +4 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/api/api.js +5 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/browser/HostRuntime.js +63 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/browser/browser.js +5 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/node/HostRuntime.js +72 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/node/node.js +5 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/platform.js +2 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/protocol_client/CDPConnection.js +17 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/protocol_client/ConnectionTransport.js +12 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/protocol_client/DevToolsCDPConnection.js +138 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/protocol_client/InspectorBackend.js +49 -312
- package/build/node_modules/chrome-devtools-frontend/front_end/core/protocol_client/protocol_client.js +4 -9
- package/build/node_modules/chrome-devtools-frontend/front_end/core/root/DevToolsContext.js +54 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/root/root.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/AnimationModel.js +2 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CPUThrottlingManager.js +0 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSMatchedStyles.js +51 -17
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSMetadata.js +21 -7
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSModel.js +11 -5
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSProperty.js +4 -7
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSPropertyParser.js +11 -9
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSPropertyParserMatchers.js +34 -24
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSRule.js +52 -10
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSStartingStyle.js +21 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSStyleDeclaration.js +4 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ChildTargetManager.js +39 -35
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/Connections.js +10 -47
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ConsoleModel.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/Cookie.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/DOMModel.js +29 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/DebuggerModel.js +5 -20
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/EnhancedTracesParser.js +17 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/EventBreakpointsModel.js +4 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/HttpReasonPhraseStrings.js +4 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/IOModel.js +1 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/NetworkManager.js +428 -121
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/NetworkRequest.js +8 -22
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/PageResourceLoader.js +44 -34
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/PreloadingModel.js +64 -19
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/RehydratingConnection.js +139 -12
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/RemoteObject.js +5 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ResourceTreeModel.js +3 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ScopeTreeCache.js +36 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ScreenCaptureModel.js +20 -18
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/Script.js +26 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ServerSentEventsProtocol.js +3 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMap.js +54 -14
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMapCache.js +16 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMapManager.js +19 -7
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMapScopesInfo.js +240 -8
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/Target.js +12 -17
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/TargetManager.js +38 -29
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/TraceObject.js +11 -8
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/sdk-meta.js +80 -31
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/sdk.js +4 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/generated/ARIAProperties.js +1301 -174
- package/build/node_modules/chrome-devtools-frontend/front_end/generated/Deprecation.js +67 -22
- package/build/node_modules/chrome-devtools-frontend/front_end/generated/InspectorBackendCommands.js +62 -91
- package/build/node_modules/chrome-devtools-frontend/front_end/generated/SupportedCSSProperties.js +188 -100
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.js +30 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.js +50 -34
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.js +152 -101
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/performance/AICallTree.js +11 -6
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/performance/AIContext.js +25 -26
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/performance/AIQueries.js +46 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/CSSWorkspaceBinding.js +10 -8
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/CompilerScriptMapping.js +82 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/DebuggerWorkspaceBinding.js +33 -15
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/ResourceMapping.js +105 -14
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/ResourceScriptMapping.js +38 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/SASSSourceMapping.js +5 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/cpu_profile/CPUProfileDataModel.js +9 -7
- package/build/node_modules/chrome-devtools-frontend/front_end/models/cpu_profile/ProfileTreeModel.js +6 -7
- package/build/node_modules/chrome-devtools-frontend/front_end/models/crux-manager/CrUXManager.js +6 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/formatter/FormatterWorkerPool.js +16 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/network_time_calculator/RequestTimeRanges.js +6 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/source_map_scopes/FunctionCodeResolver.js +192 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/source_map_scopes/NamesResolver.js +12 -16
- package/build/node_modules/chrome-devtools-frontend/front_end/models/source_map_scopes/source_map_scopes.js +2 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/stack_trace/StackTraceModel.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/stack_trace/Trie.js +8 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/LanternComputationData.js +1 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/ModelImpl.js +6 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/Processor.js +4 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/Styles.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/extras/TraceTree.js +11 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/FramesHandler.js +7 -5
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/LayoutShiftsHandler.js +8 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/MetaHandler.js +4 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/NetworkRequestsHandler.js +29 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/SamplesHandler.js +59 -6
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/ScriptsHandler.js +26 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/UserTimingsHandler.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/helpers.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/helpers/Timing.js +4 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/helpers/Trace.js +18 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/CLSCulprits.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/Cache.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/DOMSize.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/DocumentLatency.js +12 -11
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/DuplicatedJavaScript.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/FontDisplay.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/ForcedReflow.js +3 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/INPBreakdown.js +14 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/ImageDelivery.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/LCPBreakdown.js +13 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/LCPDiscovery.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/LegacyJavaScript.js +4 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/ModernHTTP.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/NetworkDependencyTree.js +4 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/RenderBlocking.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/SlowCSSSelector.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/ThirdParties.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/Viewport.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/types/TraceEvents.js +9 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace_source_maps_resolver/SourceMapsResolver.js +25 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/IgnoreListManager.js +41 -48
- package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/UISourceCode.js +38 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/WorkspaceImpl.js +5 -8
- package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/workspace-meta.js +34 -0
- package/build/src/McpContext.js +8 -1
- package/build/src/tools/bookmarks.js +0 -1
- package/build/src/tools/gemini-web.js +17 -25
- package/build/src/tools/snapshot.js +9 -2
- package/package.json +3 -3
package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMapScopesInfo.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright 2024 The Chromium Authors
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
|
+
import * as Formatter from '../../models/formatter/formatter.js';
|
|
4
5
|
import { SourceMapScopeChainEntry } from './SourceMapScopeChainEntry.js';
|
|
5
6
|
export class SourceMapScopesInfo {
|
|
6
7
|
#sourceMap;
|
|
@@ -12,6 +13,129 @@ export class SourceMapScopesInfo {
|
|
|
12
13
|
this.#originalScopes = scopeInfo.scopes;
|
|
13
14
|
this.#generatedRanges = scopeInfo.ranges;
|
|
14
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* If the source map does not contain any scopes information, this factory function attempts to create scope information
|
|
18
|
+
* via the script's AST combined with the mappings.
|
|
19
|
+
*
|
|
20
|
+
* We create the generated ranges from the scope tree and for each range we create an original scope that matches the bounds 1:1.
|
|
21
|
+
*/
|
|
22
|
+
static createFromAst(sourceMap, scopeTree, text) {
|
|
23
|
+
const numSourceUrls = sourceMap.sourceURLs().length;
|
|
24
|
+
const scopeBySourceUrl = [];
|
|
25
|
+
for (let i = 0; i < numSourceUrls; i++) {
|
|
26
|
+
const scope = {
|
|
27
|
+
start: { line: 0, column: 0 },
|
|
28
|
+
end: { line: Number.POSITIVE_INFINITY, column: Number.POSITIVE_INFINITY },
|
|
29
|
+
isStackFrame: false,
|
|
30
|
+
variables: [],
|
|
31
|
+
children: [],
|
|
32
|
+
};
|
|
33
|
+
scopeBySourceUrl.push(scope);
|
|
34
|
+
}
|
|
35
|
+
// Convert the entire scopeTree. Returns a root range that encompasses everything,
|
|
36
|
+
// and inserts scopes by sourceIndex into the above scopeBySourceUrl.
|
|
37
|
+
const { range } = convertScope(scopeTree, undefined);
|
|
38
|
+
return new SourceMapScopesInfo(sourceMap, { scopes: scopeBySourceUrl, ranges: [range] });
|
|
39
|
+
/**
|
|
40
|
+
* Recursively finds the correct place in the tree to insert the new scope.
|
|
41
|
+
* Maintains the invariant that children are sorted and contained by their parent.
|
|
42
|
+
*/
|
|
43
|
+
function insertInScope(parent, newScope) {
|
|
44
|
+
// Check if the newScope fits strictly inside any of the existing children.
|
|
45
|
+
for (const child of parent.children) {
|
|
46
|
+
if (contains(child, newScope)) {
|
|
47
|
+
insertInScope(child, newScope);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// When here, newScope belongs directly in parent.
|
|
52
|
+
// However, newScope might encompass some of parent's existing children (due
|
|
53
|
+
// to compiler transform quirks or arbitrary insertion order). We must move
|
|
54
|
+
// those children inside newScope.
|
|
55
|
+
const childrenToKeep = [];
|
|
56
|
+
for (const child of parent.children) {
|
|
57
|
+
if (contains(newScope, child)) {
|
|
58
|
+
// child is actually inside newScope, so re-parent it.
|
|
59
|
+
newScope.children.push(child);
|
|
60
|
+
child.parent = newScope;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
childrenToKeep.push(child);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Find the correct index in the remaining children to insert newScope.
|
|
67
|
+
// We look for the first child that starts after the new scope.
|
|
68
|
+
const insertIndex = childrenToKeep.findIndex(child => compareScopes(newScope, child) < 0);
|
|
69
|
+
if (insertIndex === -1) {
|
|
70
|
+
// If no child starts after, it goes at the end.
|
|
71
|
+
childrenToKeep.push(newScope);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
childrenToKeep.splice(insertIndex, 0, newScope);
|
|
75
|
+
}
|
|
76
|
+
// Update parent's children to only be the ones that don't belong to newScope.
|
|
77
|
+
parent.children = childrenToKeep;
|
|
78
|
+
newScope.parent = parent;
|
|
79
|
+
}
|
|
80
|
+
function contains(outer, inner) {
|
|
81
|
+
return comparePositions(outer.start, inner.start) <= 0 && comparePositions(outer.end, inner.end) >= 0;
|
|
82
|
+
}
|
|
83
|
+
function compareScopes(a, b) {
|
|
84
|
+
return comparePositions(a.start, b.start);
|
|
85
|
+
}
|
|
86
|
+
function comparePositions(a, b) {
|
|
87
|
+
if (a.line !== b.line) {
|
|
88
|
+
return a.line - b.line;
|
|
89
|
+
}
|
|
90
|
+
return a.column - b.column;
|
|
91
|
+
}
|
|
92
|
+
function convertScope(node, parentRange) {
|
|
93
|
+
const start = positionFromOffset(node.start);
|
|
94
|
+
const end = positionFromOffset(node.end);
|
|
95
|
+
const startEntry = sourceMap.findEntry(start.line, start.column);
|
|
96
|
+
const endEntry = sourceMap.findEntry(end.line, end.column);
|
|
97
|
+
const sourceIndex = startEntry?.sourceIndex;
|
|
98
|
+
const canMapOriginalPosition = startEntry && endEntry && sourceIndex !== undefined &&
|
|
99
|
+
startEntry.sourceIndex === endEntry.sourceIndex && startEntry.sourceIndex !== undefined && sourceIndex >= 0 &&
|
|
100
|
+
sourceIndex < numSourceUrls;
|
|
101
|
+
const isStackFrame = node.kind === 2 /* Formatter.FormatterWorkerPool.ScopeKind.FUNCTION */ ||
|
|
102
|
+
node.kind === 4 /* Formatter.FormatterWorkerPool.ScopeKind.ARROW_FUNCTION */;
|
|
103
|
+
// TODO(crbug.com/368222773): Instead of mapping `start`, we should report a number of candidates. e.g. for arrow functions we should
|
|
104
|
+
// follow the spec and map the `=>` as the spec says that is where the original name (if any) for arrow functions can be found.
|
|
105
|
+
const name = node.kind === 2 /* Formatter.FormatterWorkerPool.ScopeKind.FUNCTION */ ? startEntry?.name : undefined;
|
|
106
|
+
let scope;
|
|
107
|
+
if (canMapOriginalPosition) {
|
|
108
|
+
scope = {
|
|
109
|
+
start: { line: startEntry.sourceLineNumber, column: startEntry.sourceColumnNumber },
|
|
110
|
+
end: { line: endEntry.sourceLineNumber, column: endEntry.sourceColumnNumber },
|
|
111
|
+
name,
|
|
112
|
+
isStackFrame,
|
|
113
|
+
variables: [],
|
|
114
|
+
children: [],
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
const range = {
|
|
118
|
+
start,
|
|
119
|
+
end,
|
|
120
|
+
originalScope: scope,
|
|
121
|
+
isStackFrame,
|
|
122
|
+
isHidden: false,
|
|
123
|
+
values: [],
|
|
124
|
+
children: [],
|
|
125
|
+
};
|
|
126
|
+
parentRange?.children.push(range);
|
|
127
|
+
if (canMapOriginalPosition && scope) {
|
|
128
|
+
const rootScope = scopeBySourceUrl[sourceIndex];
|
|
129
|
+
insertInScope(rootScope, scope);
|
|
130
|
+
}
|
|
131
|
+
node.children.forEach(child => convertScope(child, range));
|
|
132
|
+
return { range };
|
|
133
|
+
}
|
|
134
|
+
function positionFromOffset(offset) {
|
|
135
|
+
const location = text.positionFromOffset(offset);
|
|
136
|
+
return { line: location.lineNumber, column: location.columnNumber };
|
|
137
|
+
}
|
|
138
|
+
}
|
|
15
139
|
addOriginalScopes(scopes) {
|
|
16
140
|
for (const scope of scopes) {
|
|
17
141
|
this.#originalScopes.push(scope);
|
|
@@ -25,6 +149,9 @@ export class SourceMapScopesInfo {
|
|
|
25
149
|
hasOriginalScopes(sourceIdx) {
|
|
26
150
|
return Boolean(this.#originalScopes[sourceIdx]);
|
|
27
151
|
}
|
|
152
|
+
isEmpty() {
|
|
153
|
+
return !this.#originalScopes.length && !this.#generatedRanges.length;
|
|
154
|
+
}
|
|
28
155
|
addOriginalScopesAtIndex(sourceIdx, scope) {
|
|
29
156
|
if (!this.#originalScopes[sourceIdx]) {
|
|
30
157
|
this.#originalScopes[sourceIdx] = scope;
|
|
@@ -33,6 +160,38 @@ export class SourceMapScopesInfo {
|
|
|
33
160
|
throw new Error(`Trying to re-augment existing scopes for source at index: ${sourceIdx}`);
|
|
34
161
|
}
|
|
35
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* @returns true, iff the function surrounding the provided position is marked as "hidden".
|
|
165
|
+
*/
|
|
166
|
+
isOutlinedFrame(generatedLine, generatedColumn) {
|
|
167
|
+
const rangeChain = this.#findGeneratedRangeChain(generatedLine, generatedColumn);
|
|
168
|
+
return this.#isOutlinedFrame(rangeChain);
|
|
169
|
+
}
|
|
170
|
+
#isOutlinedFrame(rangeChain) {
|
|
171
|
+
for (let i = rangeChain.length - 1; i >= 0; --i) {
|
|
172
|
+
if (rangeChain[i].isStackFrame) {
|
|
173
|
+
return rangeChain[i].isHidden;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* @returns true, iff the range surrounding the provided position contains multiple
|
|
180
|
+
* inlined original functions.
|
|
181
|
+
*/
|
|
182
|
+
hasInlinedFrames(generatedLine, generatedColumn) {
|
|
183
|
+
const rangeChain = this.#findGeneratedRangeChain(generatedLine, generatedColumn);
|
|
184
|
+
for (let i = rangeChain.length - 1; i >= 0; --i) {
|
|
185
|
+
if (rangeChain[i].isStackFrame) {
|
|
186
|
+
// We stop looking for inlined original functions once we reach the current frame.
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
if (rangeChain[i].callSite) {
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
36
195
|
/**
|
|
37
196
|
* Given a generated position, returns the original name of the surrounding function as well as
|
|
38
197
|
* all the original function names that got inlined into the surrounding generated function and their
|
|
@@ -53,7 +212,10 @@ export class SourceMapScopesInfo {
|
|
|
53
212
|
const range = rangeChain[i];
|
|
54
213
|
if (range.callSite) {
|
|
55
214
|
// Record the name and call-site if the range corresponds to an inlined function.
|
|
56
|
-
result.inlinedFunctions.push({
|
|
215
|
+
result.inlinedFunctions.push({
|
|
216
|
+
name: range.originalScope?.name ?? '',
|
|
217
|
+
callsite: { ...range.callSite, sourceURL: this.#sourceMap.sourceURLForSourceIndex(range.callSite.sourceIndex) }
|
|
218
|
+
});
|
|
57
219
|
}
|
|
58
220
|
if (range.isStackFrame) {
|
|
59
221
|
// We arrived at an actual generated JS function, don't go further.
|
|
@@ -209,7 +371,14 @@ export class SourceMapScopesInfo {
|
|
|
209
371
|
/**
|
|
210
372
|
* Returns the authored function name of the function containing the provided generated position.
|
|
211
373
|
*/
|
|
212
|
-
findOriginalFunctionName(
|
|
374
|
+
findOriginalFunctionName(position) {
|
|
375
|
+
const originalInnerMostScope = this.findOriginalFunctionScope(position)?.scope ?? undefined;
|
|
376
|
+
return this.#findFunctionNameInOriginalScopeChain(originalInnerMostScope);
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Returns the authored function scope of the function containing the provided generated position.
|
|
380
|
+
*/
|
|
381
|
+
findOriginalFunctionScope({ line, column }) {
|
|
213
382
|
// There are 2 approaches:
|
|
214
383
|
// 1) Find the inner-most generated range containing the provided generated position
|
|
215
384
|
// and use it's OriginalScope (then walk it outwards until we hit a function).
|
|
@@ -235,13 +404,21 @@ export class SourceMapScopesInfo {
|
|
|
235
404
|
this.#findOriginalScopeChain({ sourceIndex: entry.sourceIndex, line: entry.sourceLineNumber, column: entry.sourceColumnNumber })
|
|
236
405
|
.at(-1);
|
|
237
406
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
if (originalScope.isStackFrame) {
|
|
241
|
-
return originalScope.name ?? '';
|
|
242
|
-
}
|
|
407
|
+
if (!originalInnerMostScope) {
|
|
408
|
+
return null;
|
|
243
409
|
}
|
|
244
|
-
|
|
410
|
+
const functionScope = this.#findFunctionScopeInOriginalScopeChain(originalInnerMostScope);
|
|
411
|
+
if (!functionScope) {
|
|
412
|
+
return null;
|
|
413
|
+
}
|
|
414
|
+
// Find the root scope for some given original source, to get the source url.
|
|
415
|
+
let rootScope = functionScope;
|
|
416
|
+
while (rootScope.parent) {
|
|
417
|
+
rootScope = rootScope.parent;
|
|
418
|
+
}
|
|
419
|
+
const sourceIndex = this.#originalScopes.indexOf(rootScope);
|
|
420
|
+
const url = sourceIndex !== -1 ? this.#sourceMap.sourceURLForSourceIndex(sourceIndex) : undefined;
|
|
421
|
+
return functionScope ? { scope: functionScope, url } : null;
|
|
245
422
|
}
|
|
246
423
|
/**
|
|
247
424
|
* Given an original position, this returns all the surrounding original scopes from outer
|
|
@@ -264,6 +441,61 @@ export class SourceMapScopesInfo {
|
|
|
264
441
|
})([scope]);
|
|
265
442
|
return result;
|
|
266
443
|
}
|
|
444
|
+
#findFunctionScopeInOriginalScopeChain(innerOriginalScope) {
|
|
445
|
+
for (let originalScope = innerOriginalScope; originalScope; originalScope = originalScope.parent) {
|
|
446
|
+
if (originalScope.isStackFrame) {
|
|
447
|
+
return originalScope;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return null;
|
|
451
|
+
}
|
|
452
|
+
#findFunctionNameInOriginalScopeChain(innerOriginalScope) {
|
|
453
|
+
const functionScope = this.#findFunctionScopeInOriginalScopeChain(innerOriginalScope);
|
|
454
|
+
if (!functionScope) {
|
|
455
|
+
return null;
|
|
456
|
+
}
|
|
457
|
+
return functionScope.name ?? '';
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Returns one or more original stack frames for this single "raw frame" or call-site.
|
|
461
|
+
*
|
|
462
|
+
* @returns An empty array if no mapping at the call-site was found, or the resulting frames
|
|
463
|
+
* in top-to-bottom order in case of inlining.
|
|
464
|
+
* @throws If this range is marked "hidden". Outlining needs to be handled externally as
|
|
465
|
+
* outlined function segments in stack traces can span across bundles.
|
|
466
|
+
*/
|
|
467
|
+
translateCallSite(generatedLine, generatedColumn) {
|
|
468
|
+
const rangeChain = this.#findGeneratedRangeChain(generatedLine, generatedColumn);
|
|
469
|
+
if (this.#isOutlinedFrame(rangeChain)) {
|
|
470
|
+
throw new Error('SourceMapScopesInfo is unable to translate an outlined function by itself');
|
|
471
|
+
}
|
|
472
|
+
const mapping = this.#sourceMap.findEntry(generatedLine, generatedColumn);
|
|
473
|
+
if (mapping?.sourceIndex === undefined) {
|
|
474
|
+
return [];
|
|
475
|
+
}
|
|
476
|
+
// The top-most frame is translated the same even if we have inlined functions.
|
|
477
|
+
const result = [{
|
|
478
|
+
line: mapping.sourceLineNumber,
|
|
479
|
+
column: mapping.sourceColumnNumber,
|
|
480
|
+
name: this.findOriginalFunctionName({ line: generatedLine, column: generatedColumn }) ?? undefined,
|
|
481
|
+
url: mapping.sourceURL,
|
|
482
|
+
}];
|
|
483
|
+
// Walk the range chain inside out until we find a generated function and for each inlined function add a frame.
|
|
484
|
+
for (let i = rangeChain.length - 1; i >= 0 && !rangeChain[i].isStackFrame; --i) {
|
|
485
|
+
const range = rangeChain[i];
|
|
486
|
+
if (!range.callSite) {
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
const originalScopeChain = this.#findOriginalScopeChain(range.callSite);
|
|
490
|
+
result.push({
|
|
491
|
+
line: range.callSite.line,
|
|
492
|
+
column: range.callSite.column,
|
|
493
|
+
name: this.#findFunctionNameInOriginalScopeChain(originalScopeChain.at(-1)) ?? undefined,
|
|
494
|
+
url: this.#sourceMap.sourceURLForSourceIndex(range.callSite.sourceIndex),
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
return result;
|
|
498
|
+
}
|
|
267
499
|
}
|
|
268
500
|
export function contains(range, line, column) {
|
|
269
501
|
if (range.start.line > line || (range.start.line === line && range.start.column > column)) {
|
|
@@ -31,8 +31,7 @@ export class Target extends ProtocolClient.InspectorBackend.TargetBase {
|
|
|
31
31
|
#targetInfo;
|
|
32
32
|
#creatingModels;
|
|
33
33
|
constructor(targetManager, id, name, type, parentTarget, sessionId, suspended, connection, targetInfo) {
|
|
34
|
-
|
|
35
|
-
super(needsNodeJSPatching, parentTarget, sessionId, connection);
|
|
34
|
+
super(parentTarget, sessionId, connection);
|
|
36
35
|
this.#targetManager = targetManager;
|
|
37
36
|
this.#name = name;
|
|
38
37
|
this.#capabilitiesMask = 0;
|
|
@@ -57,12 +56,15 @@ export class Target extends ProtocolClient.InspectorBackend.TargetBase {
|
|
|
57
56
|
this.#capabilitiesMask = 4 /* Capability.JS */ | 8 /* Capability.LOG */ | 16 /* Capability.NETWORK */ | 32 /* Capability.TARGET */ |
|
|
58
57
|
2048 /* Capability.INSPECTOR */ | 131072 /* Capability.IO */ | 524288 /* Capability.EVENT_BREAKPOINTS */;
|
|
59
58
|
if (parentTarget?.type() !== Type.FRAME) {
|
|
60
|
-
this.#capabilitiesMask |= 1 /* Capability.BROWSER */;
|
|
59
|
+
this.#capabilitiesMask |= 1 /* Capability.BROWSER */ | 8192 /* Capability.STORAGE */;
|
|
61
60
|
}
|
|
62
61
|
break;
|
|
63
62
|
case Type.SHARED_WORKER:
|
|
64
63
|
this.#capabilitiesMask = 4 /* Capability.JS */ | 8 /* Capability.LOG */ | 16 /* Capability.NETWORK */ | 32 /* Capability.TARGET */ |
|
|
65
64
|
131072 /* Capability.IO */ | 262144 /* Capability.MEDIA */ | 2048 /* Capability.INSPECTOR */ | 524288 /* Capability.EVENT_BREAKPOINTS */;
|
|
65
|
+
if (parentTarget?.type() !== Type.FRAME) {
|
|
66
|
+
this.#capabilitiesMask |= 8192 /* Capability.STORAGE */;
|
|
67
|
+
}
|
|
66
68
|
break;
|
|
67
69
|
case Type.SHARED_STORAGE_WORKLET:
|
|
68
70
|
this.#capabilitiesMask = 4 /* Capability.JS */ | 8 /* Capability.LOG */ | 2048 /* Capability.INSPECTOR */ | 524288 /* Capability.EVENT_BREAKPOINTS */;
|
|
@@ -70,6 +72,9 @@ export class Target extends ProtocolClient.InspectorBackend.TargetBase {
|
|
|
70
72
|
case Type.Worker:
|
|
71
73
|
this.#capabilitiesMask = 4 /* Capability.JS */ | 8 /* Capability.LOG */ | 16 /* Capability.NETWORK */ | 32 /* Capability.TARGET */ |
|
|
72
74
|
131072 /* Capability.IO */ | 262144 /* Capability.MEDIA */ | 256 /* Capability.EMULATION */ | 524288 /* Capability.EVENT_BREAKPOINTS */;
|
|
75
|
+
if (parentTarget?.type() !== Type.FRAME) {
|
|
76
|
+
this.#capabilitiesMask |= 8192 /* Capability.STORAGE */;
|
|
77
|
+
}
|
|
73
78
|
break;
|
|
74
79
|
case Type.WORKLET:
|
|
75
80
|
this.#capabilitiesMask = 4 /* Capability.JS */ | 8 /* Capability.LOG */ | 524288 /* Capability.EVENT_BREAKPOINTS */ | 16 /* Capability.NETWORK */;
|
|
@@ -95,20 +100,11 @@ export class Target extends ProtocolClient.InspectorBackend.TargetBase {
|
|
|
95
100
|
this.#isSuspended = suspended;
|
|
96
101
|
this.#targetInfo = targetInfo;
|
|
97
102
|
}
|
|
98
|
-
|
|
103
|
+
/** Creates the models in the order in which they are provided */
|
|
104
|
+
createModels(models) {
|
|
99
105
|
this.#creatingModels = true;
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
for (const [modelClass, info] of registeredModels) {
|
|
103
|
-
if (info.early) {
|
|
104
|
-
this.model(modelClass);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
// Create autostart and required models.
|
|
108
|
-
for (const [modelClass, info] of registeredModels) {
|
|
109
|
-
if (info.autostart || required.has(modelClass)) {
|
|
110
|
-
this.model(modelClass);
|
|
111
|
-
}
|
|
106
|
+
for (const model of models) {
|
|
107
|
+
this.model(model);
|
|
112
108
|
}
|
|
113
109
|
this.#creatingModels = false;
|
|
114
110
|
}
|
|
@@ -129,7 +125,6 @@ export class Target extends ProtocolClient.InspectorBackend.TargetBase {
|
|
|
129
125
|
return this.#type;
|
|
130
126
|
}
|
|
131
127
|
markAsNodeJSForTest() {
|
|
132
|
-
super.markAsNodeJSForTest();
|
|
133
128
|
this.#type = Type.NODE;
|
|
134
129
|
}
|
|
135
130
|
targetManager() {
|
|
@@ -6,12 +6,19 @@ import * as Host from '../host/host.js';
|
|
|
6
6
|
import * as Platform from '../platform/platform.js';
|
|
7
7
|
import { assertNotNullOrUndefined } from '../platform/platform.js';
|
|
8
8
|
import * as Root from '../root/root.js';
|
|
9
|
-
import { StubConnection } from './Connections.js';
|
|
10
|
-
import { RehydratingConnection } from './RehydratingConnection.js';
|
|
11
9
|
import { SDKModel } from './SDKModel.js';
|
|
12
10
|
import { Target, Type as TargetType } from './Target.js';
|
|
13
|
-
let targetManagerInstance;
|
|
14
11
|
export class TargetManager extends Common.ObjectWrapper.ObjectWrapper {
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated
|
|
14
|
+
*
|
|
15
|
+
* Intended for {@link SDKModel} classes to be able to retrieve scoped singletons like
|
|
16
|
+
* the "PageResourceLoader" or the "FrameManager".
|
|
17
|
+
*
|
|
18
|
+
* This is only an intermediate step to migrate towards our "layering vision" where
|
|
19
|
+
* SDKModels don't require things from the next layer.
|
|
20
|
+
*/
|
|
21
|
+
context;
|
|
15
22
|
#targets;
|
|
16
23
|
#observers;
|
|
17
24
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -24,8 +31,13 @@ export class TargetManager extends Common.ObjectWrapper.ObjectWrapper {
|
|
|
24
31
|
#scopeTarget;
|
|
25
32
|
#defaultScopeSet;
|
|
26
33
|
#scopeChangeListeners;
|
|
27
|
-
|
|
34
|
+
#overrideAutoStartModels;
|
|
35
|
+
/**
|
|
36
|
+
* @param overrideAutoStartModels If provided, then the `autostart` flag on {@link RegistrationInfo} will be ignored.
|
|
37
|
+
*/
|
|
38
|
+
constructor(context, overrideAutoStartModels) {
|
|
28
39
|
super();
|
|
40
|
+
this.context = context;
|
|
29
41
|
this.#targets = new Set();
|
|
30
42
|
this.#observers = new Set();
|
|
31
43
|
this.#modelListeners = new Platform.MapUtilities.Multimap();
|
|
@@ -36,15 +48,16 @@ export class TargetManager extends Common.ObjectWrapper.ObjectWrapper {
|
|
|
36
48
|
this.#scopedObservers = new WeakSet();
|
|
37
49
|
this.#defaultScopeSet = false;
|
|
38
50
|
this.#scopeChangeListeners = new Set();
|
|
51
|
+
this.#overrideAutoStartModels = overrideAutoStartModels;
|
|
39
52
|
}
|
|
40
53
|
static instance({ forceNew } = { forceNew: false }) {
|
|
41
|
-
if (!
|
|
42
|
-
|
|
54
|
+
if (!Root.DevToolsContext.globalInstance().has(TargetManager) || forceNew) {
|
|
55
|
+
Root.DevToolsContext.globalInstance().set(TargetManager, new TargetManager(Root.DevToolsContext.globalInstance()));
|
|
43
56
|
}
|
|
44
|
-
return
|
|
57
|
+
return Root.DevToolsContext.globalInstance().get(TargetManager);
|
|
45
58
|
}
|
|
46
59
|
static removeInstance() {
|
|
47
|
-
|
|
60
|
+
Root.DevToolsContext.globalInstance().delete(TargetManager);
|
|
48
61
|
}
|
|
49
62
|
onInspectedURLChange(target) {
|
|
50
63
|
if (target !== this.#scopeTarget) {
|
|
@@ -169,12 +182,27 @@ export class TargetManager extends Common.ObjectWrapper.ObjectWrapper {
|
|
|
169
182
|
this.#observers.delete(targetObserver);
|
|
170
183
|
this.#scopedObservers.delete(targetObserver);
|
|
171
184
|
}
|
|
185
|
+
/** @returns The set of models we create unconditionally for new targets in the order in which they should be created */
|
|
186
|
+
#autoStartModels() {
|
|
187
|
+
const earlyModels = new Set();
|
|
188
|
+
const models = new Set();
|
|
189
|
+
const shouldAutostart = (model, info) => this.#overrideAutoStartModels ? this.#overrideAutoStartModels.has(model) : info.autostart;
|
|
190
|
+
for (const [model, info] of SDKModel.registeredModels) {
|
|
191
|
+
if (info.early) {
|
|
192
|
+
earlyModels.add(model);
|
|
193
|
+
}
|
|
194
|
+
else if (shouldAutostart(model, info) || this.#modelObservers.has(model)) {
|
|
195
|
+
models.add(model);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return [...earlyModels, ...models];
|
|
199
|
+
}
|
|
172
200
|
createTarget(id, name, type, parentTarget, sessionId, waitForDebuggerInPage, connection, targetInfo) {
|
|
173
201
|
const target = new Target(this, id, name, type, parentTarget, sessionId || '', this.#isSuspended, connection || null, targetInfo);
|
|
174
202
|
if (waitForDebuggerInPage) {
|
|
175
203
|
void target.pageAgent().invoke_waitForDebugger();
|
|
176
204
|
}
|
|
177
|
-
target.createModels(
|
|
205
|
+
target.createModels(this.#autoStartModels());
|
|
178
206
|
this.#targets.add(target);
|
|
179
207
|
const inScope = this.isInScope(target);
|
|
180
208
|
// Iterate over a copy. #observers might be modified during iteration.
|
|
@@ -252,25 +280,6 @@ export class TargetManager extends Common.ObjectWrapper.ObjectWrapper {
|
|
|
252
280
|
browserTarget() {
|
|
253
281
|
return this.#browserTarget;
|
|
254
282
|
}
|
|
255
|
-
/**
|
|
256
|
-
* If this returns true, the target is not connected to a legit CDP server.
|
|
257
|
-
* However, it's not exhaustive, so some `false` responses may be misleading.
|
|
258
|
-
* (eg., tab URL of `devtools://devtools/bundled/devtools_app.html` uses a MainConnection but has no CDP server behind it).
|
|
259
|
-
*/
|
|
260
|
-
hasFakeConnection() {
|
|
261
|
-
// Rehydrated DevTools always has a fake connection, so we shortcut and avoid the race.
|
|
262
|
-
if (Root.Runtime.getPathName().includes('rehydrated_devtools_app')) {
|
|
263
|
-
return true;
|
|
264
|
-
}
|
|
265
|
-
// There _may_ be a race condition hiding here on the router/connection creation.
|
|
266
|
-
// So we play it safe and consider "no connection yet" as "not fake".
|
|
267
|
-
const connection = this.primaryPageTarget()?.router()?.connection();
|
|
268
|
-
if (!connection) {
|
|
269
|
-
return false;
|
|
270
|
-
}
|
|
271
|
-
const isFakeConnection = (connection instanceof StubConnection) || (connection instanceof RehydratingConnection);
|
|
272
|
-
return isFakeConnection;
|
|
273
|
-
}
|
|
274
283
|
async maybeAttachInitialTarget() {
|
|
275
284
|
if (!Boolean(Root.Runtime.Runtime.queryParam('browserConnection'))) {
|
|
276
285
|
return false;
|
|
@@ -278,7 +287,7 @@ export class TargetManager extends Common.ObjectWrapper.ObjectWrapper {
|
|
|
278
287
|
if (!this.#browserTarget) {
|
|
279
288
|
this.#browserTarget = new Target(this, /* #id*/ 'main', /* #name*/ 'browser', TargetType.BROWSER, /* #parentTarget*/ null,
|
|
280
289
|
/* #sessionId */ '', /* suspended*/ false, /* #connection*/ null, /* targetInfo*/ undefined);
|
|
281
|
-
this.#browserTarget.createModels(
|
|
290
|
+
this.#browserTarget.createModels(this.#autoStartModels());
|
|
282
291
|
}
|
|
283
292
|
const targetId = await Host.InspectorFrontendHost.InspectorFrontendHostInstance.initialTargetId();
|
|
284
293
|
// Do not await for Target.autoAttachRelated to return, as it goes throguh the renderer and we don't want to block early
|
|
@@ -3,19 +3,22 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
import * as Common from '../../core/common/common.js';
|
|
5
5
|
import { ResourceTreeModel } from './ResourceTreeModel.js';
|
|
6
|
-
|
|
6
|
+
/** A thin wrapper class, mostly to enable instanceof-based revealing of traces to open in Timeline. **/
|
|
7
7
|
export class TraceObject {
|
|
8
8
|
traceEvents;
|
|
9
9
|
metadata;
|
|
10
|
-
constructor(payload, meta
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
constructor(payload, meta) {
|
|
11
|
+
if (Array.isArray(payload)) {
|
|
12
|
+
this.traceEvents = payload;
|
|
13
|
+
this.metadata = meta ?? {};
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
this.traceEvents = payload.traceEvents;
|
|
17
|
+
this.metadata = payload.metadata;
|
|
18
|
+
}
|
|
16
19
|
}
|
|
17
20
|
}
|
|
18
|
-
|
|
21
|
+
/** Another thin wrapper class to enable revealing individual trace events (aka entries) in Timeline panel. **/
|
|
19
22
|
export class RevealableEvent {
|
|
20
23
|
event;
|
|
21
24
|
// Only Trace.Types.Events.Event are passed in, but we can't depend on that type from SDK
|
|
@@ -351,44 +351,46 @@ const UIStrings = {
|
|
|
351
351
|
/**
|
|
352
352
|
* @description Label of a checkbox in the DevTools settings UI.
|
|
353
353
|
*/
|
|
354
|
-
enableRemoteFileLoading: 'Allow
|
|
354
|
+
enableRemoteFileLoading: 'Allow loading remote file path resources in DevTools',
|
|
355
|
+
/**
|
|
356
|
+
* @description Tooltip text for a setting that controls whether external resource can be loaded in DevTools.
|
|
357
|
+
*/
|
|
358
|
+
remoteFileLoadingInfo: 'Example resource are source maps. Disabled by default for security reasons.',
|
|
355
359
|
/**
|
|
356
360
|
* @description Tooltip text for a setting that controls the network cache. Disabling the network cache can simulate the network connections of users that are visiting a page for the first time.
|
|
357
361
|
*/
|
|
358
362
|
networkCacheExplanation: 'Disabling the network cache will simulate a network experience similar to a first time visitor.',
|
|
363
|
+
/**
|
|
364
|
+
* @description Setting under the Sources category to toggle usage of JavaScript source maps.
|
|
365
|
+
*/
|
|
366
|
+
javaScriptSourceMaps: 'JavaScript source maps',
|
|
367
|
+
/**
|
|
368
|
+
* @description Title of a setting under the Sources category that can be invoked through the Command Menu
|
|
369
|
+
*/
|
|
370
|
+
enableJavaScriptSourceMaps: 'Enable JavaScript source maps',
|
|
371
|
+
/**
|
|
372
|
+
* @description Title of a setting under the Sources category that can be invoked through the Command Menu
|
|
373
|
+
*/
|
|
374
|
+
disableJavaScriptSourceMaps: 'Disable JavaScript source maps',
|
|
375
|
+
/**
|
|
376
|
+
* @description Title of a setting under the Sources category
|
|
377
|
+
*/
|
|
378
|
+
cssSourceMaps: 'CSS source maps',
|
|
379
|
+
/**
|
|
380
|
+
* @description Title of a setting under the Sources category that can be invoked through the Command Menu
|
|
381
|
+
*/
|
|
382
|
+
enableCssSourceMaps: 'Enable CSS source maps',
|
|
383
|
+
/**
|
|
384
|
+
* @description Title of a setting under the Sources category that can be invoked through the Command Menu
|
|
385
|
+
*/
|
|
386
|
+
disableCssSourceMaps: 'Disable CSS source maps',
|
|
387
|
+
/**
|
|
388
|
+
* @description Title of a setting under the Console category in Settings
|
|
389
|
+
*/
|
|
390
|
+
logXmlhttprequests: 'Log XMLHttpRequests',
|
|
359
391
|
};
|
|
360
392
|
const str_ = i18n.i18n.registerUIStrings('core/sdk/sdk-meta.ts', UIStrings);
|
|
361
393
|
const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
|
|
362
|
-
Common.Settings.registerSettingExtension({
|
|
363
|
-
storageType: "Synced" /* Common.Settings.SettingStorageType.SYNCED */,
|
|
364
|
-
settingName: 'skip-stack-frames-pattern',
|
|
365
|
-
settingType: "regex" /* Common.Settings.SettingType.REGEX */,
|
|
366
|
-
defaultValue: '/node_modules/|^node:',
|
|
367
|
-
});
|
|
368
|
-
Common.Settings.registerSettingExtension({
|
|
369
|
-
storageType: "Synced" /* Common.Settings.SettingStorageType.SYNCED */,
|
|
370
|
-
settingName: 'skip-content-scripts',
|
|
371
|
-
settingType: "boolean" /* Common.Settings.SettingType.BOOLEAN */,
|
|
372
|
-
defaultValue: true,
|
|
373
|
-
});
|
|
374
|
-
Common.Settings.registerSettingExtension({
|
|
375
|
-
storageType: "Synced" /* Common.Settings.SettingStorageType.SYNCED */,
|
|
376
|
-
settingName: 'automatically-ignore-list-known-third-party-scripts',
|
|
377
|
-
settingType: "boolean" /* Common.Settings.SettingType.BOOLEAN */,
|
|
378
|
-
defaultValue: true,
|
|
379
|
-
});
|
|
380
|
-
Common.Settings.registerSettingExtension({
|
|
381
|
-
storageType: "Synced" /* Common.Settings.SettingStorageType.SYNCED */,
|
|
382
|
-
settingName: 'skip-anonymous-scripts',
|
|
383
|
-
settingType: "boolean" /* Common.Settings.SettingType.BOOLEAN */,
|
|
384
|
-
defaultValue: false,
|
|
385
|
-
});
|
|
386
|
-
Common.Settings.registerSettingExtension({
|
|
387
|
-
storageType: "Synced" /* Common.Settings.SettingStorageType.SYNCED */,
|
|
388
|
-
settingName: 'enable-ignore-listing',
|
|
389
|
-
settingType: "boolean" /* Common.Settings.SettingType.BOOLEAN */,
|
|
390
|
-
defaultValue: true,
|
|
391
|
-
});
|
|
392
394
|
Common.Settings.registerSettingExtension({
|
|
393
395
|
category: "CONSOLE" /* Common.Settings.SettingCategory.CONSOLE */,
|
|
394
396
|
storageType: "Synced" /* Common.Settings.SettingStorageType.SYNCED */,
|
|
@@ -1114,4 +1116,51 @@ Common.Settings.registerSettingExtension({
|
|
|
1114
1116
|
settingName: 'network.enable-remote-file-loading',
|
|
1115
1117
|
settingType: "boolean" /* Common.Settings.SettingType.BOOLEAN */,
|
|
1116
1118
|
defaultValue: false,
|
|
1119
|
+
learnMore: {
|
|
1120
|
+
tooltip: i18nLazyString(UIStrings.remoteFileLoadingInfo),
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
Common.Settings.registerSettingExtension({
|
|
1124
|
+
category: "SOURCES" /* Common.Settings.SettingCategory.SOURCES */,
|
|
1125
|
+
storageType: "Synced" /* Common.Settings.SettingStorageType.SYNCED */,
|
|
1126
|
+
title: i18nLazyString(UIStrings.javaScriptSourceMaps),
|
|
1127
|
+
settingName: 'js-source-maps-enabled',
|
|
1128
|
+
settingType: "boolean" /* Common.Settings.SettingType.BOOLEAN */,
|
|
1129
|
+
defaultValue: true,
|
|
1130
|
+
options: [
|
|
1131
|
+
{
|
|
1132
|
+
value: true,
|
|
1133
|
+
title: i18nLazyString(UIStrings.enableJavaScriptSourceMaps),
|
|
1134
|
+
},
|
|
1135
|
+
{
|
|
1136
|
+
value: false,
|
|
1137
|
+
title: i18nLazyString(UIStrings.disableJavaScriptSourceMaps),
|
|
1138
|
+
},
|
|
1139
|
+
],
|
|
1140
|
+
});
|
|
1141
|
+
Common.Settings.registerSettingExtension({
|
|
1142
|
+
category: "SOURCES" /* Common.Settings.SettingCategory.SOURCES */,
|
|
1143
|
+
storageType: "Synced" /* Common.Settings.SettingStorageType.SYNCED */,
|
|
1144
|
+
title: i18nLazyString(UIStrings.cssSourceMaps),
|
|
1145
|
+
settingName: 'css-source-maps-enabled',
|
|
1146
|
+
settingType: "boolean" /* Common.Settings.SettingType.BOOLEAN */,
|
|
1147
|
+
defaultValue: true,
|
|
1148
|
+
options: [
|
|
1149
|
+
{
|
|
1150
|
+
value: true,
|
|
1151
|
+
title: i18nLazyString(UIStrings.enableCssSourceMaps),
|
|
1152
|
+
},
|
|
1153
|
+
{
|
|
1154
|
+
value: false,
|
|
1155
|
+
title: i18nLazyString(UIStrings.disableCssSourceMaps),
|
|
1156
|
+
},
|
|
1157
|
+
],
|
|
1158
|
+
});
|
|
1159
|
+
Common.Settings.registerSettingExtension({
|
|
1160
|
+
category: "CONSOLE" /* Common.Settings.SettingCategory.CONSOLE */,
|
|
1161
|
+
storageType: "Synced" /* Common.Settings.SettingStorageType.SYNCED */,
|
|
1162
|
+
title: i18nLazyString(UIStrings.logXmlhttprequests),
|
|
1163
|
+
settingName: 'monitoring-xhr-enabled',
|
|
1164
|
+
settingType: "boolean" /* Common.Settings.SettingType.BOOLEAN */,
|
|
1165
|
+
defaultValue: false,
|
|
1117
1166
|
});
|