chrome-devtools-frontend 1.0.1706026 → 1.0.1709383
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/.agents/skills/code-review/SKILL.md +121 -0
- package/AUTHORS +2 -0
- package/front_end/core/common/Color.ts +6 -0
- package/front_end/core/common/VersionController.ts +0 -53
- package/front_end/core/root/Runtime.ts +0 -41
- package/front_end/core/sdk/CSSModel.ts +57 -0
- package/front_end/core/sdk/CSSPropertyParser.ts +10 -17
- package/front_end/core/sdk/DOMModel.ts +13 -6
- package/front_end/core/sdk/DebuggerModel.ts +90 -56
- package/front_end/core/sdk/NetworkRequest.ts +70 -12
- package/front_end/core/sdk/OverlayModel.ts +47 -0
- package/front_end/core/sdk/PageResourceLoader.ts +26 -6
- package/front_end/core/sdk/SourceMap.ts +37 -9
- package/front_end/core/sdk/SourceMapScopesInfo.ts +223 -86
- package/front_end/core/text_utils/ContentData.ts +18 -1
- package/front_end/core/text_utils/TextUtils.ts +1 -1
- package/front_end/entrypoints/devtools_app/devtools_app.ts +1 -0
- package/front_end/entrypoints/heap_snapshot_worker/ContextAnalyzer.ts +102 -4
- package/front_end/entrypoints/main/MainImpl.ts +2 -21
- package/front_end/generated/InspectorBackendCommands.ts +9 -2
- package/front_end/generated/SupportedCSSProperties.ts +12 -3
- package/front_end/generated/protocol-mapping.d.ts +31 -0
- package/front_end/generated/protocol-proxy-api.d.ts +32 -0
- package/front_end/generated/protocol.ts +19 -3
- package/front_end/models/ai_assistance/AiAgent2.ts +127 -2
- package/front_end/models/ai_assistance/AiConversation.ts +2 -2
- package/front_end/models/ai_assistance/AiUtils.ts +4 -0
- package/front_end/models/ai_assistance/agents/AiAgent.ts +64 -13
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +2 -2
- package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +4 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +257 -2
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +1 -1
- package/front_end/models/ai_assistance/ai_assistance.ts +2 -2
- package/front_end/models/ai_assistance/contexts/{AccessibilityContext.snapshot.txt → LighthouseContext.snapshot.txt} +23 -2
- package/front_end/models/ai_assistance/contexts/{AccessibilityContext.ts → LighthouseContext.ts} +24 -5
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.ts +26 -3
- package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +15 -16
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +8 -18
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +2 -2
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +81 -103
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +202 -15
- package/front_end/models/ai_assistance/skills/Skill.ts +1 -2
- package/front_end/models/ai_assistance/skills/SkillRegistry.ts +2 -0
- package/front_end/models/ai_assistance/skills/lighthouse.md +33 -0
- package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +6 -0
- package/front_end/models/ai_assistance/tools/GetCookieValues.ts +3 -0
- package/front_end/models/ai_assistance/tools/GetDetailedCallTree.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetElementAccessibilityDetails.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetInsightDetails.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetLighthouseAudits.ts +8 -7
- package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetSourceContent.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetStorageBreakdown.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetStorageValues.ts +3 -0
- package/front_end/models/ai_assistance/tools/GetStyles.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetTraceEventByKey.ts +3 -1
- package/front_end/models/ai_assistance/tools/GetTraceFunctionCode.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetTraceMainThreadSummary.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetTraceNetworkSummary.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetTraceResourceContent.ts +2 -0
- package/front_end/models/ai_assistance/tools/ListCookies.ts +2 -0
- package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +2 -0
- package/front_end/models/ai_assistance/tools/ListPageOrigins.ts +2 -0
- package/front_end/models/ai_assistance/tools/ListSources.ts +2 -0
- package/front_end/models/ai_assistance/tools/ListStorageKeys.ts +2 -0
- package/front_end/models/ai_assistance/tools/RecordPerformanceTrace.ts +2 -0
- package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +2 -0
- package/front_end/models/ai_assistance/tools/RunLighthouse.ts +20 -12
- package/front_end/models/ai_assistance/tools/SelectTraceEventByKey.ts +2 -0
- package/front_end/models/ai_assistance/tools/Tool.ts +53 -0
- package/front_end/models/bindings/CompilerScriptMapping.ts +102 -45
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +25 -33
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +70 -49
- package/front_end/models/bindings/SourceMapStepping.ts +50 -0
- package/front_end/models/bindings/StylesSourceMapping.ts +3 -0
- package/front_end/models/bindings/bindings.ts +2 -0
- package/front_end/models/emulation/DeviceModeModel.ts +85 -62
- package/front_end/models/extensions/ExtensionEndpoint.ts +27 -6
- package/front_end/models/extensions/LanguageExtensionEndpoint.ts +106 -21
- package/front_end/models/extensions/RecorderExtensionEndpoint.ts +4 -2
- package/front_end/models/har/Importer.ts +2 -3
- package/front_end/models/javascript_metadata/NativeFunctions.ts +6 -2
- package/front_end/models/lighthouse/LighthouseReporterTypes.ts +5 -1
- package/front_end/models/persistence/NetworkPersistenceManager.ts +4 -3
- package/front_end/models/source_map_scopes/NamesResolver.ts +30 -13
- package/front_end/models/stack_trace/StackTraceImpl.ts +138 -47
- package/front_end/models/stack_trace/StackTraceModel.ts +117 -84
- package/front_end/models/stack_trace/Trie.ts +27 -0
- package/front_end/models/trace/LanternComputationData.ts +8 -0
- package/front_end/models/trace/Processor.ts +2 -1
- package/front_end/models/trace/lantern/core/NetworkAnalyzer.ts +7 -2
- package/front_end/models/trace/lantern/graph/NetworkNode.ts +14 -0
- package/front_end/models/trace/lantern/graph/PageDependencyGraph.ts +1 -1
- package/front_end/models/trace/lantern/simulation/ConnectionPool.ts +4 -4
- package/front_end/models/trace/lantern/simulation/Simulator.ts +6 -2
- package/front_end/models/trace/lantern/simulation/TCPConnection.ts +12 -12
- package/front_end/models/trace/lantern/types/Lantern.ts +8 -0
- package/front_end/panels/accessibility/ARIAAttributesView.ts +6 -6
- package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingView.ts +2 -2
- package/front_end/panels/accessibility/AccessibilityNodeView.ts +6 -9
- package/front_end/panels/accessibility/AccessibilitySidebarView.ts +83 -69
- package/front_end/panels/accessibility/AccessibilitySubPane.ts +24 -9
- package/front_end/panels/accessibility/SourceOrderView.ts +7 -3
- package/front_end/panels/accessibility/accessibilitySidebarView.css +5 -3
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +14 -12
- package/front_end/panels/ai_assistance/components/ChatInput.ts +1 -1
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +121 -13
- package/front_end/panels/ai_assistance/components/chatMessage.css +47 -0
- package/front_end/panels/application/BackgroundServiceView.ts +31 -33
- package/front_end/panels/application/IndexedDBModel.ts +8 -20
- package/front_end/panels/application/IndexedDBViews.ts +2 -6
- package/front_end/panels/application/ServiceWorkerUpdateCycleView.ts +8 -8
- package/front_end/panels/application/ServiceWorkersView.ts +44 -52
- package/front_end/panels/application/WebMCPView.ts +50 -50
- package/front_end/panels/application/serviceWorkersView.css +1 -1
- package/front_end/panels/comments/CommentsPane.ts +266 -0
- package/front_end/panels/comments/comments-meta.ts +47 -0
- package/front_end/panels/comments/comments.ts +9 -0
- package/front_end/panels/comments/commentsPane.css +206 -0
- package/front_end/panels/common/CommentThreadWidget.ts +30 -1
- package/front_end/panels/common/CommentsOverlayWidget.ts +42 -38
- package/front_end/panels/common/CommentsStatusBarPill.ts +3 -1
- package/front_end/panels/common/common-meta.ts +21 -9
- package/front_end/panels/console/ConsoleInsightTeaser.ts +25 -19
- package/front_end/panels/console/ConsoleViewMessage.ts +52 -23
- package/front_end/panels/console/ConsoleViewport.ts +1 -1
- package/front_end/panels/console/SymbolizedErrorWidget.ts +18 -9
- package/front_end/panels/console/console-meta.ts +1 -5
- package/front_end/panels/elements/CSSValueTraceView.ts +4 -4
- package/front_end/panels/elements/ComputedStyleWidget.ts +46 -42
- package/front_end/panels/elements/DOMPath.ts +11 -1
- package/front_end/panels/elements/DOMTreeContextMenu.ts +15 -0
- package/front_end/panels/elements/DOMTreeWidget.ts +237 -606
- package/front_end/panels/elements/ElementsPanel.ts +15 -16
- package/front_end/panels/elements/ElementsTreeElement.ts +24 -18
- package/front_end/panels/elements/EventListenersWidget.ts +5 -3
- package/front_end/panels/elements/InspectElementModeController.ts +6 -3
- package/front_end/panels/elements/LayoutPane.ts +3 -3
- package/front_end/panels/elements/PropertyRenderer.ts +132 -87
- package/front_end/panels/elements/StandaloneStylesContainer.ts +7 -3
- package/front_end/panels/elements/StylePropertiesSection.ts +49 -4
- package/front_end/panels/elements/StylePropertyTreeElement.ts +139 -36
- package/front_end/panels/elements/StylesContainer.ts +2 -1
- package/front_end/panels/elements/StylesSidebarPane.ts +75 -16
- package/front_end/panels/elements/components/CSSPropertyDocsView.ts +2 -1
- package/front_end/panels/elements/elements-meta.ts +24 -75
- package/front_end/panels/emulation/DeviceModeToolbar.ts +5 -2
- package/front_end/panels/emulation/DeviceModeView.ts +5 -2
- package/front_end/panels/emulation/emulation-meta.ts +3 -8
- package/front_end/panels/layer_viewer/Layers3DView.ts +8 -3
- package/front_end/panels/layer_viewer/layer_viewer-meta.ts +2 -5
- package/front_end/panels/lighthouse/LighthouseController.ts +9 -4
- package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +13 -3
- package/front_end/panels/network/NetworkConfigView.ts +261 -190
- package/front_end/panels/network/NetworkLogView.ts +7 -5
- package/front_end/panels/network/NetworkPanel.ts +4 -3
- package/front_end/panels/network/NetworkWaterfallColumn.ts +7 -4
- package/front_end/panels/network/RequestPayloadView.ts +22 -14
- package/front_end/panels/network/network-meta.ts +23 -34
- package/front_end/panels/profiler/HeapDetachedElementsDataGrid.ts +0 -1
- package/front_end/panels/profiler/HeapProfileView.ts +20 -24
- package/front_end/panels/profiler/ProfilesPanel.ts +8 -3
- package/front_end/panels/recorder/RecordingView.ts +42 -47
- package/front_end/panels/recorder/StepEditor.ts +1 -0
- package/front_end/panels/recorder/recordingView.css +4 -4
- package/front_end/panels/screencast/ScreencastView.ts +6 -4
- package/front_end/panels/sources/CSSPlugin.ts +11 -0
- package/front_end/panels/sources/CoveragePlugin.ts +34 -23
- package/front_end/panels/sources/NavigatorView.ts +97 -52
- package/front_end/panels/sources/Plugin.ts +15 -1
- package/front_end/panels/sources/SourcesView.ts +47 -80
- package/front_end/panels/sources/TabbedEditorContainer.ts +63 -34
- package/front_end/panels/sources/UISourceCodeFrame.ts +11 -2
- package/front_end/panels/sources/navigatorTree.css +2 -2
- package/front_end/panels/timeline/TimelineHistoryManager.ts +2 -4
- package/front_end/panels/timeline/components/LiveMetricsView.ts +7 -20
- package/front_end/panels/timeline/components/MetricCard.ts +262 -315
- package/front_end/panels/timeline/components/liveMetricsView.css +4 -0
- package/front_end/panels/timeline/components/metricCard.css +2 -24
- package/front_end/panels/timeline/overlays/OverlaysImpl.ts +33 -17
- package/front_end/panels/timeline/overlays/components/TimeRangeOverlay.ts +182 -130
- package/front_end/panels/timeline/overlays/components/timeRangeOverlay.css +76 -74
- package/front_end/panels/whats_new/WhatsNewImpl.ts +2 -1
- package/front_end/panels/whats_new/whats_new-meta.ts +2 -5
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/web-vitals/README.chromium +2 -2
- package/front_end/third_party/web-vitals/package/README.md +5 -3
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.js +8 -5
- package/front_end/third_party/web-vitals/package/package.json +1 -1
- package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +1 -1
- package/front_end/third_party/web-vitals/package/src/attribution/onLCP.ts +9 -5
- package/front_end/third_party/web-vitals/rebuild.sh +2 -2
- package/front_end/ui/comments/CommentAnchorResolver.ts +17 -0
- package/front_end/ui/components/suggestion_input/SuggestionInput.ts +10 -1
- package/front_end/ui/components/text_editor/AiCodeCompletionTeaser.ts +1 -1
- package/front_end/ui/components/text_editor/AiCodeGenerationTeaser.ts +2 -2
- package/front_end/ui/components/text_editor/aiCodeCompletionTeaser.css +0 -11
- package/front_end/ui/components/text_editor/aiCodeGenerationTeaser.css +0 -11
- package/front_end/ui/components/text_editor/config.ts +2 -1
- package/front_end/ui/legacy/SoftDropDown.ts +17 -4
- package/front_end/ui/legacy/StackPane.ts +141 -0
- package/front_end/ui/legacy/TabbedPane.ts +67 -12
- package/front_end/ui/legacy/TextPrompt.ts +37 -7
- package/front_end/ui/legacy/Toolbar.ts +36 -14
- package/front_end/ui/legacy/Widget.ts +3 -3
- package/front_end/ui/legacy/components/inline_editor/PositionAreaEditor.ts +85 -0
- package/front_end/ui/legacy/components/inline_editor/positionAreaEditor.css +61 -0
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +93 -31
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +15 -7
- package/front_end/ui/legacy/components/utils/Linkifier.ts +25 -45
- package/front_end/ui/legacy/inspectorCommon.css +11 -0
- package/front_end/ui/legacy/legacy.ts +2 -0
- package/front_end/ui/legacy/softContextMenu.css +2 -0
- package/front_end/ui/legacy/tabbedPane.css +12 -8
- package/front_end/ui/settings/ConsoleSettings.ts +7 -0
- package/front_end/ui/settings/ElementsSettings.ts +93 -0
- package/front_end/ui/settings/EmulationSettings.ts +17 -0
- package/front_end/ui/settings/LayerViewerSettings.ts +12 -0
- package/front_end/ui/settings/NetworkSettings.ts +26 -0
- package/front_end/ui/settings/WhatsNewSettings.ts +11 -0
- package/front_end/ui/settings/settings.ts +10 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +17 -0
- package/inspector_overlay/highlight_anchor.ts +1 -1
- package/package.json +1 -1
|
@@ -134,6 +134,31 @@ export const enum StepMode {
|
|
|
134
134
|
STEP_OVER = 'StepOver',
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/** A CDP step command. `ranges` is passed as `skipList` to stepInto/stepOver, and ignored for stepOut. */
|
|
138
|
+
export interface AutoStep {
|
|
139
|
+
readonly command: StepMode;
|
|
140
|
+
readonly ranges: readonly LocationRange[];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The step the user requested. It lives until a pause is presented to the user, or the user resumes or pauses, and
|
|
145
|
+
* allows the before-paused callback to continue the step automatically.
|
|
146
|
+
*/
|
|
147
|
+
export interface StepContext {
|
|
148
|
+
readonly mode: StepMode;
|
|
149
|
+
/** The call frames of the pause in which the user requested the step. */
|
|
150
|
+
readonly callFrames: readonly CallFrame[];
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** Computes the CDP step command for a user-requested step. */
|
|
154
|
+
export type ComputeAutoStepCallback = (mode: StepMode, callFrames: readonly CallFrame[]) => Promise<AutoStep>;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Invoked for every pause before it's presented. Returns null to present the pause, or the step to issue instead.
|
|
158
|
+
*/
|
|
159
|
+
export type BeforePausedCallback = (details: DebuggerPausedDetails, context: StepContext|null) =>
|
|
160
|
+
Promise<AutoStep|null>;
|
|
161
|
+
|
|
137
162
|
export const WASM_SYMBOLS_PRIORITY: Protocol.Debugger.DebugSymbolsType[] = [
|
|
138
163
|
Protocol.Debugger.DebugSymbolsType.ExternalDWARF,
|
|
139
164
|
Protocol.Debugger.DebugSymbolsType.EmbeddedDWARF,
|
|
@@ -166,20 +191,15 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
166
191
|
readonly #jsSourceMapsEnabledSetting: Common.Settings.Setting<boolean>;
|
|
167
192
|
readonly #skipAllPausesSetting: Common.Settings.Setting<boolean>;
|
|
168
193
|
#skipAllPausesTimeout?: ReturnType<typeof setTimeout>;
|
|
169
|
-
#beforePausedCallback:
|
|
170
|
-
#
|
|
171
|
-
start: Location,
|
|
172
|
-
end: Location,
|
|
173
|
-
}>>)|null = null;
|
|
194
|
+
#beforePausedCallback: BeforePausedCallback|null = null;
|
|
195
|
+
#computeAutoStepCallback: ComputeAutoStepCallback|null = null;
|
|
174
196
|
evaluateOnCallFrameCallback:
|
|
175
197
|
((arg0: CallFrame, arg1: EvaluationOptions) => Promise<EvaluationResult|null>)|null = null;
|
|
176
198
|
#synchronizeBreakpointsCallback: ((script: Script) => Promise<void>)|null = null;
|
|
177
199
|
// We need to be able to register listeners for individual breakpoints. As such, we dispatch
|
|
178
200
|
// on breakpoint ids, which are not statically known. The event #payload will always be a `Location`.
|
|
179
201
|
readonly #breakpointResolvedEventTarget = new Common.ObjectWrapper.ObjectWrapper<Record<string, Location>>();
|
|
180
|
-
|
|
181
|
-
// to by way of its functionLocation (as per Debugger.CallFrame).
|
|
182
|
-
#autoSteppingContext: Location|null = null;
|
|
202
|
+
#stepContext: StepContext|null = null;
|
|
183
203
|
#isPausing = false;
|
|
184
204
|
|
|
185
205
|
constructor(target: Target) {
|
|
@@ -429,58 +449,63 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
429
449
|
void this.agent.invoke_setBreakpointsActive({active: this.#breakpointsActiveSetting.get()});
|
|
430
450
|
}
|
|
431
451
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
this.#computeAutoStepRangesCallback = callback;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
private async computeAutoStepSkipList(mode: StepMode): Promise<Protocol.Debugger.LocationRange[]> {
|
|
438
|
-
let ranges: LocationRange[] = [];
|
|
439
|
-
if (this.#computeAutoStepRangesCallback && this.#debuggerPausedDetails &&
|
|
440
|
-
this.#debuggerPausedDetails.callFrames.length > 0) {
|
|
441
|
-
const [callFrame] = this.#debuggerPausedDetails.callFrames;
|
|
442
|
-
ranges = await this.#computeAutoStepRangesCallback.call(null, mode, callFrame);
|
|
443
|
-
}
|
|
444
|
-
const skipList = ranges.map(({start, end}) => ({
|
|
445
|
-
scriptId: start.scriptId,
|
|
446
|
-
start: {lineNumber: start.lineNumber, columnNumber: start.columnNumber},
|
|
447
|
-
end: {lineNumber: end.lineNumber, columnNumber: end.columnNumber},
|
|
448
|
-
}));
|
|
449
|
-
return sortAndMergeRanges(skipList);
|
|
452
|
+
setComputeAutoStepCallback(callback: ComputeAutoStepCallback|null): void {
|
|
453
|
+
this.#computeAutoStepCallback = callback;
|
|
450
454
|
}
|
|
451
455
|
|
|
452
456
|
async stepInto(): Promise<void> {
|
|
453
|
-
|
|
454
|
-
void this.agent.invoke_stepInto({breakOnAsyncCall: false, skipList});
|
|
457
|
+
await this.#userStep(StepMode.STEP_INTO);
|
|
455
458
|
}
|
|
456
459
|
|
|
457
460
|
async stepOver(): Promise<void> {
|
|
458
|
-
|
|
459
|
-
const skipList = await this.computeAutoStepSkipList(StepMode.STEP_OVER);
|
|
460
|
-
void this.agent.invoke_stepOver({skipList});
|
|
461
|
+
await this.#userStep(StepMode.STEP_OVER);
|
|
461
462
|
}
|
|
462
463
|
|
|
463
464
|
async stepOut(): Promise<void> {
|
|
464
|
-
|
|
465
|
-
if (skipList.length !== 0) {
|
|
466
|
-
void this.agent.invoke_stepOver({skipList});
|
|
467
|
-
} else {
|
|
468
|
-
void this.agent.invoke_stepOut();
|
|
469
|
-
}
|
|
465
|
+
await this.#userStep(StepMode.STEP_OUT);
|
|
470
466
|
}
|
|
471
467
|
|
|
472
468
|
scheduleStepIntoAsync(): void {
|
|
473
|
-
void this
|
|
474
|
-
|
|
475
|
-
|
|
469
|
+
void this.#userStep(StepMode.STEP_INTO, /* breakOnAsyncCall */ true);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
async #userStep(mode: StepMode, breakOnAsyncCall = false): Promise<void> {
|
|
473
|
+
const callFrames = this.#debuggerPausedDetails?.callFrames ?? [];
|
|
474
|
+
this.#stepContext = {mode, callFrames};
|
|
475
|
+
const step = this.#computeAutoStepCallback && callFrames.length > 0 ?
|
|
476
|
+
await this.#computeAutoStepCallback(mode, callFrames) :
|
|
477
|
+
{command: mode, ranges: []};
|
|
478
|
+
this.#issueStep(step, breakOnAsyncCall);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
#issueStep({command, ranges}: AutoStep, breakOnAsyncCall = false): void {
|
|
482
|
+
const skipList =
|
|
483
|
+
sortAndMergeRanges(ranges.map(({start, end}) => ({
|
|
484
|
+
scriptId: start.scriptId,
|
|
485
|
+
start: {lineNumber: start.lineNumber, columnNumber: start.columnNumber},
|
|
486
|
+
end: {lineNumber: end.lineNumber, columnNumber: end.columnNumber},
|
|
487
|
+
})));
|
|
488
|
+
switch (command) {
|
|
489
|
+
case StepMode.STEP_INTO:
|
|
490
|
+
void this.agent.invoke_stepInto({breakOnAsyncCall, skipList});
|
|
491
|
+
break;
|
|
492
|
+
case StepMode.STEP_OVER:
|
|
493
|
+
void this.agent.invoke_stepOver({skipList});
|
|
494
|
+
break;
|
|
495
|
+
case StepMode.STEP_OUT:
|
|
496
|
+
void this.agent.invoke_stepOut();
|
|
497
|
+
break;
|
|
498
|
+
}
|
|
476
499
|
}
|
|
477
500
|
|
|
478
501
|
resume(): void {
|
|
502
|
+
this.#stepContext = null;
|
|
479
503
|
void this.agent.invoke_resume({terminateOnResume: false});
|
|
480
504
|
this.#isPausing = false;
|
|
481
505
|
}
|
|
482
506
|
|
|
483
507
|
pause(): void {
|
|
508
|
+
this.#stepContext = null;
|
|
484
509
|
this.#isPausing = true;
|
|
485
510
|
this.skipAllPauses(false);
|
|
486
511
|
void this.agent.invoke_pause();
|
|
@@ -569,7 +594,7 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
569
594
|
this.#scripts.clear();
|
|
570
595
|
this.#scriptsBySourceURL.clear();
|
|
571
596
|
this.#discardableScripts = [];
|
|
572
|
-
this.#
|
|
597
|
+
this.#stepContext = null;
|
|
573
598
|
}
|
|
574
599
|
|
|
575
600
|
scripts(): Script[] {
|
|
@@ -611,20 +636,22 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
611
636
|
return this.#debuggerPausedDetails;
|
|
612
637
|
}
|
|
613
638
|
|
|
614
|
-
|
|
639
|
+
/**
|
|
640
|
+
* @returns null if the pause was presented, or the step to issue instead, as decided by the before-paused callback.
|
|
641
|
+
*/
|
|
642
|
+
private async setDebuggerPausedDetails(debuggerPausedDetails: DebuggerPausedDetails): Promise<AutoStep|null> {
|
|
615
643
|
this.#isPausing = false;
|
|
616
644
|
this.#debuggerPausedDetails = debuggerPausedDetails;
|
|
617
645
|
if (this.#beforePausedCallback) {
|
|
618
|
-
|
|
619
|
-
|
|
646
|
+
const autoStep = await this.#beforePausedCallback(debuggerPausedDetails, this.#stepContext);
|
|
647
|
+
if (autoStep) {
|
|
648
|
+
return autoStep;
|
|
620
649
|
}
|
|
621
650
|
}
|
|
622
|
-
|
|
623
|
-
// auto-step-over context.
|
|
624
|
-
this.#autoSteppingContext = null;
|
|
651
|
+
this.#stepContext = null;
|
|
625
652
|
this.dispatchEventToListeners(Events.DebuggerPaused, this);
|
|
626
653
|
this.setSelectedCallFrame(debuggerPausedDetails.callFrames[0]);
|
|
627
|
-
return
|
|
654
|
+
return null;
|
|
628
655
|
}
|
|
629
656
|
|
|
630
657
|
private resetDebuggerPausedDetails(): void {
|
|
@@ -633,8 +660,7 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
633
660
|
this.setSelectedCallFrame(null);
|
|
634
661
|
}
|
|
635
662
|
|
|
636
|
-
setBeforePausedCallback(
|
|
637
|
-
callback: ((arg0: DebuggerPausedDetails, autoSteppingContext: Location|null) => Promise<boolean>)|null): void {
|
|
663
|
+
setBeforePausedCallback(callback: BeforePausedCallback|null): void {
|
|
638
664
|
this.#beforePausedCallback = callback;
|
|
639
665
|
}
|
|
640
666
|
|
|
@@ -676,12 +702,9 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
676
702
|
}
|
|
677
703
|
}
|
|
678
704
|
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
} else {
|
|
683
|
-
void this.stepInto();
|
|
684
|
-
}
|
|
705
|
+
const autoStep = await this.setDebuggerPausedDetails(pausedDetails);
|
|
706
|
+
if (autoStep) {
|
|
707
|
+
this.#issueStep(autoStep);
|
|
685
708
|
}
|
|
686
709
|
}
|
|
687
710
|
|
|
@@ -1480,6 +1503,17 @@ export class Scope implements ScopeChainEntry {
|
|
|
1480
1503
|
return undefined;
|
|
1481
1504
|
}
|
|
1482
1505
|
|
|
1506
|
+
/**
|
|
1507
|
+
* Present iff V8 has no variable values to show for this scope, either because the scope
|
|
1508
|
+
* declares no variables or because all of them are unavailable (e.g. optimized out).
|
|
1509
|
+
*
|
|
1510
|
+
* Such scopes are retained in {@link CallFrame.scopeChain} so they can be addressed via
|
|
1511
|
+
* `scopeNumber` in `Debugger.evaluateOnCallFrame` and matched against source map scopes.
|
|
1512
|
+
*/
|
|
1513
|
+
emptyReason(): Protocol.Debugger.ScopeEmptyReason|undefined {
|
|
1514
|
+
return this.#payload.emptyReason;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1483
1517
|
extraProperties(): RemoteObjectProperty[] {
|
|
1484
1518
|
if (this !== this.#callFrame.localScope() || this.#callFrame.script.isWasm()) {
|
|
1485
1519
|
return [];
|
|
@@ -179,6 +179,7 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
179
179
|
#blockedReason: Protocol.Network.BlockedReason|undefined = undefined;
|
|
180
180
|
#renderBlockingBehavior?: Protocol.Network.RenderBlockingBehavior;
|
|
181
181
|
#initiatorSecurityOrigin?: SecurityOrigin;
|
|
182
|
+
#requestURLSecurityOrigin?: SecurityOrigin;
|
|
182
183
|
#corsErrorStatus: Protocol.Network.CorsErrorStatus|undefined = undefined;
|
|
183
184
|
statusCode = 0;
|
|
184
185
|
statusText = '';
|
|
@@ -193,6 +194,7 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
193
194
|
#resourceType: Common.ResourceType.ResourceType = Common.ResourceType.resourceTypes.Other;
|
|
194
195
|
#contentData: Promise<TextUtils.ContentData.ContentDataOrError>|null = null;
|
|
195
196
|
#streamingContentData: Promise<TextUtils.StreamingContentData.StreamingContentDataOrError>|null = null;
|
|
197
|
+
#resolvedStreamingContentData: TextUtils.StreamingContentData.StreamingContentData|null = null;
|
|
196
198
|
readonly #frames: WebSocketFrame[] = [];
|
|
197
199
|
#responseHeaderValues: Record<string, string|undefined> = {};
|
|
198
200
|
#responseHeadersText = '';
|
|
@@ -268,7 +270,7 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
268
270
|
/**
|
|
269
271
|
* Whether this request was imported from a HAR file.
|
|
270
272
|
*/
|
|
271
|
-
#isImportedHar
|
|
273
|
+
readonly #isImportedHar: boolean;
|
|
272
274
|
#associatedData = new Map<string, object>();
|
|
273
275
|
#hasOverriddenContent = false;
|
|
274
276
|
#hasThirdPartyCookiePhaseoutIssue = false;
|
|
@@ -293,6 +295,7 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
293
295
|
hasUserGesture?: boolean,
|
|
294
296
|
// eslint-disable-next-line @devtools/no-instance-of-migrated-singletons
|
|
295
297
|
console: Common.Console.Console = Common.Console.Console.instance(),
|
|
298
|
+
isImportedHar = false,
|
|
296
299
|
) {
|
|
297
300
|
super();
|
|
298
301
|
|
|
@@ -307,6 +310,7 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
307
310
|
this.#isAdRelated = false;
|
|
308
311
|
this.#isLinkPreload = false;
|
|
309
312
|
this.#console = console;
|
|
313
|
+
this.#isImportedHar = isImportedHar;
|
|
310
314
|
}
|
|
311
315
|
|
|
312
316
|
static create(
|
|
@@ -371,6 +375,36 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
371
375
|
);
|
|
372
376
|
}
|
|
373
377
|
|
|
378
|
+
/**
|
|
379
|
+
* Creates a network request representing an entry imported from a HAR file.
|
|
380
|
+
*
|
|
381
|
+
* Use this instead of {@link createWithoutBackendRequest} when importing HAR logs
|
|
382
|
+
* (or testing HAR-imported traffic) so that the request is marked as HAR-imported
|
|
383
|
+
* at construction time and its security origins ({@link requestURLSecurityOrigin}
|
|
384
|
+
* and {@link initiatorSecurityOrigin}) resolve to isolated `imported-har://`
|
|
385
|
+
* virtual origins rather than colliding with live web origins.
|
|
386
|
+
*/
|
|
387
|
+
static createForImportedHar(
|
|
388
|
+
requestId: string,
|
|
389
|
+
url: Platform.DevToolsPath.UrlString,
|
|
390
|
+
documentURL: Platform.DevToolsPath.UrlString,
|
|
391
|
+
initiator: Protocol.Network.Initiator|null,
|
|
392
|
+
console?: Common.Console.Console,
|
|
393
|
+
): NetworkRequest {
|
|
394
|
+
return new NetworkRequest(
|
|
395
|
+
requestId,
|
|
396
|
+
undefined,
|
|
397
|
+
url,
|
|
398
|
+
documentURL,
|
|
399
|
+
null,
|
|
400
|
+
null,
|
|
401
|
+
initiator,
|
|
402
|
+
undefined,
|
|
403
|
+
console,
|
|
404
|
+
true,
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
|
|
374
408
|
identityCompare(other: NetworkRequest): number {
|
|
375
409
|
const thisId = this.requestId();
|
|
376
410
|
const thatId = other.requestId();
|
|
@@ -402,10 +436,16 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
402
436
|
* (`imported-har://${authority}`) to ensure recorded network traffic never collides with
|
|
403
437
|
* live web origins.
|
|
404
438
|
*
|
|
439
|
+
* The result is cached, so repeated calls return the same instance until the URL changes.
|
|
440
|
+
* This keeps opaque origins (such as `data:` URLs) same-origin with themselves.
|
|
441
|
+
*
|
|
405
442
|
* @see {@link initiatorSecurityOrigin} to obtain the origin of the document that initiated the request.
|
|
406
443
|
*/
|
|
407
444
|
requestURLSecurityOrigin(): SecurityOrigin {
|
|
408
|
-
|
|
445
|
+
if (!this.#requestURLSecurityOrigin) {
|
|
446
|
+
this.#requestURLSecurityOrigin = this.#resolveSecurityOrigin(this.#url);
|
|
447
|
+
}
|
|
448
|
+
return this.#requestURLSecurityOrigin;
|
|
409
449
|
}
|
|
410
450
|
|
|
411
451
|
/**
|
|
@@ -422,6 +462,9 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
422
462
|
* For imported HAR files, the origin is mapped to an isolated virtual domain
|
|
423
463
|
* (`imported-har://${authority}`) matching the imported initiating document.
|
|
424
464
|
*
|
|
465
|
+
* The result is cached, so repeated calls return the same instance. This keeps opaque
|
|
466
|
+
* origins same-origin with themselves.
|
|
467
|
+
*
|
|
425
468
|
* @see {@link requestURLSecurityOrigin} to obtain the origin of the target resource URL being requested.
|
|
426
469
|
*/
|
|
427
470
|
initiatorSecurityOrigin(): SecurityOrigin {
|
|
@@ -462,6 +505,7 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
462
505
|
this.#parsedQueryParameters = undefined;
|
|
463
506
|
this.#name = undefined;
|
|
464
507
|
this.#path = undefined;
|
|
508
|
+
this.#requestURLSecurityOrigin = undefined;
|
|
465
509
|
}
|
|
466
510
|
|
|
467
511
|
get documentURL(): Platform.DevToolsPath.UrlString {
|
|
@@ -1206,10 +1250,6 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
1206
1250
|
return this.#isImportedHar;
|
|
1207
1251
|
}
|
|
1208
1252
|
|
|
1209
|
-
setIsImportedHar(isImportedHar: boolean): void {
|
|
1210
|
-
this.#isImportedHar = isImportedHar;
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
1253
|
setEarlyHintsHeaders(headers: NameValue[]): void {
|
|
1214
1254
|
this.earlyHintsHeaders = headers;
|
|
1215
1255
|
}
|
|
@@ -1488,9 +1528,11 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
1488
1528
|
}
|
|
1489
1529
|
// Note that this is save: "streamResponseBody()" always creates base64-based ContentData and
|
|
1490
1530
|
// for "contentData()" we'll never call "addChunk".
|
|
1491
|
-
|
|
1531
|
+
const streamingContentData = TextUtils.StreamingContentData.StreamingContentData.from(
|
|
1492
1532
|
contentData,
|
|
1493
1533
|
);
|
|
1534
|
+
this.#resolvedStreamingContentData = streamingContentData;
|
|
1535
|
+
return streamingContentData;
|
|
1494
1536
|
});
|
|
1495
1537
|
|
|
1496
1538
|
return this.#streamingContentData;
|
|
@@ -1510,6 +1552,18 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
1510
1552
|
isRegex: boolean,
|
|
1511
1553
|
): Promise<TextUtils.ContentProvider.SearchMatch[]> {
|
|
1512
1554
|
if (!this.#contentDataProvider) {
|
|
1555
|
+
const cachedContentData = this.finished && !this.failed ?
|
|
1556
|
+
(await this.#contentData ?? this.#resolvedStreamingContentData?.content()) :
|
|
1557
|
+
undefined;
|
|
1558
|
+
if (cachedContentData && !TextUtils.ContentData.ContentData.isError(cachedContentData) &&
|
|
1559
|
+
cachedContentData.isTextContent) {
|
|
1560
|
+
return TextUtils.TextUtils.performSearchInContentData(
|
|
1561
|
+
cachedContentData,
|
|
1562
|
+
query,
|
|
1563
|
+
caseSensitive,
|
|
1564
|
+
isRegex,
|
|
1565
|
+
);
|
|
1566
|
+
}
|
|
1513
1567
|
return await NetworkManager.searchInRequest(
|
|
1514
1568
|
this,
|
|
1515
1569
|
query,
|
|
@@ -1940,11 +1994,15 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
1940
1994
|
}
|
|
1941
1995
|
this.endTime = timestamp;
|
|
1942
1996
|
if (data) {
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1997
|
+
if (this.#resolvedStreamingContentData) {
|
|
1998
|
+
this.#resolvedStreamingContentData.addChunk(data);
|
|
1999
|
+
} else {
|
|
2000
|
+
void this.#streamingContentData?.then(contentData => {
|
|
2001
|
+
if (!TextUtils.StreamingContentData.isError(contentData)) {
|
|
2002
|
+
contentData.addChunk(data);
|
|
2003
|
+
}
|
|
2004
|
+
});
|
|
2005
|
+
}
|
|
1948
2006
|
}
|
|
1949
2007
|
}
|
|
1950
2008
|
|
|
@@ -662,6 +662,18 @@ export class OverlayModel extends SDKModel<EventTypes> implements ProtocolProxyA
|
|
|
662
662
|
color: Common.Color.PageHighlight.LayoutLine.toProtocolRGBA(),
|
|
663
663
|
},
|
|
664
664
|
};
|
|
665
|
+
|
|
666
|
+
highlightConfig.imcbHighlightConfig = {
|
|
667
|
+
imcbBorderColor: Common.Color.PageHighlight.AnchorIMCB.toProtocolRGBA(),
|
|
668
|
+
imcbBackgroundColor: Common.Color.PageHighlight.AnchorIMCBBackground.toProtocolRGBA(),
|
|
669
|
+
insetsBackgroundColor: Common.Color.PageHighlight.AnchorInsetsBackground.toProtocolRGBA(),
|
|
670
|
+
insetsHatchColor: Common.Color.PageHighlight.AnchorInsetsHatch.toProtocolRGBA(),
|
|
671
|
+
anchorBorderColor: Common.Color.PageHighlight.AnchorTarget.toProtocolRGBA(),
|
|
672
|
+
anchorBackgroundColor: Common.Color.PageHighlight.AnchorTargetBackground.toProtocolRGBA(),
|
|
673
|
+
showPositionAreaGrid: true,
|
|
674
|
+
positionAreaGridLineColor: Common.Color.PageHighlight.AnchorTarget.toProtocolRGBA(),
|
|
675
|
+
positionAreaActiveRegionColor: Common.Color.PageHighlight.AnchorTargetBackground.toProtocolRGBA(),
|
|
676
|
+
};
|
|
665
677
|
}
|
|
666
678
|
|
|
667
679
|
if (mode.endsWith('gap')) {
|
|
@@ -793,6 +805,41 @@ export class OverlayModel extends SDKModel<EventTypes> implements ProtocolProxyA
|
|
|
793
805
|
};
|
|
794
806
|
}
|
|
795
807
|
|
|
808
|
+
const baseImcbHighlightConfig = {
|
|
809
|
+
imcbBorderColor: Common.Color.PageHighlight.AnchorIMCB.toProtocolRGBA(),
|
|
810
|
+
imcbBackgroundColor: Common.Color.PageHighlight.AnchorIMCBBackground.toProtocolRGBA(),
|
|
811
|
+
anchorBorderColor: Common.Color.PageHighlight.AnchorTarget.toProtocolRGBA(),
|
|
812
|
+
anchorBackgroundColor: Common.Color.PageHighlight.AnchorTargetBackground.toProtocolRGBA(),
|
|
813
|
+
};
|
|
814
|
+
|
|
815
|
+
if (mode === 'anchor-positioning') {
|
|
816
|
+
highlightConfig.imcbHighlightConfig = {
|
|
817
|
+
...baseImcbHighlightConfig,
|
|
818
|
+
insetsBackgroundColor: Common.Color.PageHighlight.AnchorInsetsBackground.toProtocolRGBA(),
|
|
819
|
+
insetsHatchColor: Common.Color.PageHighlight.AnchorInsetsHatch.toProtocolRGBA(),
|
|
820
|
+
showPositionAreaGrid: true,
|
|
821
|
+
positionAreaGridLineColor: Common.Color.PageHighlight.AnchorTarget.toProtocolRGBA(),
|
|
822
|
+
positionAreaActiveRegionColor: Common.Color.PageHighlight.AnchorTargetBackground.toProtocolRGBA(),
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
if (mode === 'position-area') {
|
|
827
|
+
highlightConfig.imcbHighlightConfig = {
|
|
828
|
+
...baseImcbHighlightConfig,
|
|
829
|
+
showPositionAreaGrid: true,
|
|
830
|
+
positionAreaGridLineColor: Common.Color.PageHighlight.AnchorTarget.toProtocolRGBA(),
|
|
831
|
+
positionAreaActiveRegionColor: Common.Color.PageHighlight.AnchorTargetBackground.toProtocolRGBA(),
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
if (mode === 'insets') {
|
|
836
|
+
highlightConfig.imcbHighlightConfig = {
|
|
837
|
+
...baseImcbHighlightConfig,
|
|
838
|
+
insetsBackgroundColor: Common.Color.PageHighlight.AnchorInsetsBackground.toProtocolRGBA(),
|
|
839
|
+
insetsHatchColor: Common.Color.PageHighlight.AnchorInsetsHatch.toProtocolRGBA(),
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
|
|
796
843
|
return highlightConfig;
|
|
797
844
|
}
|
|
798
845
|
|
|
@@ -317,6 +317,29 @@ export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<Event
|
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
+
#resolveFrameTarget(initiator: PageResourceLoadInitiator): {
|
|
321
|
+
frameTarget: Target|null,
|
|
322
|
+
frameId: Protocol.Page.FrameId|null,
|
|
323
|
+
} {
|
|
324
|
+
let frameTarget: Target|null = initiator.target;
|
|
325
|
+
let parentFrameId: Protocol.Page.FrameId|null = null;
|
|
326
|
+
while (frameTarget && !frameTarget.model(ResourceTreeModel)) {
|
|
327
|
+
parentFrameId = parentFrameId ?? frameTarget.targetInfo()?.parentFrameId ?? null;
|
|
328
|
+
frameTarget = frameTarget.parentTarget();
|
|
329
|
+
}
|
|
330
|
+
const frameId = initiator.frameId ?? parentFrameId ?? frameTarget?.model(ResourceTreeModel)?.mainFrame?.id ?? null;
|
|
331
|
+
return {frameTarget, frameId};
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
#isSameOriginWithPrimaryPage(frameTarget: Target|null, frameId: Protocol.Page.FrameId|null): boolean {
|
|
335
|
+
const primaryFrame = this.#targetManager.primaryPageTarget()?.model(ResourceTreeModel)?.mainFrame;
|
|
336
|
+
const initiatorFrame = frameId ? frameTarget?.model(ResourceTreeModel)?.frameForId(frameId) : null;
|
|
337
|
+
if (!primaryFrame || !initiatorFrame) {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
return initiatorFrame.securityOrigin().isSameOriginWith(primaryFrame.securityOrigin());
|
|
341
|
+
}
|
|
342
|
+
|
|
320
343
|
private async dispatchLoad(
|
|
321
344
|
url: Platform.DevToolsPath.UrlString, initiator: PageResourceLoadInitiator, isBinary: boolean): Promise<{
|
|
322
345
|
success: boolean,
|
|
@@ -343,11 +366,7 @@ export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<Event
|
|
|
343
366
|
// directive is present. A null/error response keeps the guard armed so that a
|
|
344
367
|
// detached-frame or protocol-error path cannot fall through to loadFromHostBindings.
|
|
345
368
|
let mustEnforceCSP = isHttp;
|
|
346
|
-
|
|
347
|
-
while (frameTarget && !frameTarget.model(ResourceTreeModel)) {
|
|
348
|
-
frameTarget = frameTarget.parentTarget();
|
|
349
|
-
}
|
|
350
|
-
const frameId = initiator.frameId ?? frameTarget?.model(ResourceTreeModel)?.mainFrame?.id ?? null;
|
|
369
|
+
const {frameTarget, frameId} = this.#resolveFrameTarget(initiator);
|
|
351
370
|
if (isHttp && frameTarget) {
|
|
352
371
|
const networkManager = frameTarget.model(NetworkManager);
|
|
353
372
|
if (networkManager) {
|
|
@@ -366,7 +385,8 @@ export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<Event
|
|
|
366
385
|
} catch (e) {
|
|
367
386
|
if (e instanceof Error) {
|
|
368
387
|
Host.userMetrics.developerResourceLoaded(Host.UserMetrics.DeveloperResourceLoaded.LOAD_THROUGH_PAGE_FAILURE);
|
|
369
|
-
if (mustEnforceCSP ||
|
|
388
|
+
if (mustEnforceCSP || !this.#isSameOriginWithPrimaryPage(frameTarget, frameId) ||
|
|
389
|
+
e.message.includes('CSP violation')) {
|
|
370
390
|
return {
|
|
371
391
|
success: false,
|
|
372
392
|
content: '',
|
|
@@ -12,7 +12,12 @@ import {scopeTreeForScript} from './ScopeTreeCache.js';
|
|
|
12
12
|
import type {Script} from './Script.js';
|
|
13
13
|
import {buildOriginalScopes, decodePastaRanges, type NamedFunctionRange} from './SourceMapFunctionRanges.js';
|
|
14
14
|
import {decodeRangeMappings} from './SourceMapRangeMappings.js';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
type PositionRange,
|
|
17
|
+
type RawFrameTranslation,
|
|
18
|
+
scriptRelativePosition,
|
|
19
|
+
SourceMapScopesInfo,
|
|
20
|
+
} from './SourceMapScopesInfo.js';
|
|
16
21
|
|
|
17
22
|
/**
|
|
18
23
|
* Type of the base source map JSON object, which contains the sources and the mappings at the very least, plus
|
|
@@ -250,6 +255,16 @@ export class SourceMap {
|
|
|
250
255
|
return this.#scopesInfo !== null && !this.#scopesInfo.isEmpty();
|
|
251
256
|
}
|
|
252
257
|
|
|
258
|
+
/**
|
|
259
|
+
* True iff the scopes come from the source map itself (encoded `scopes`), not from the AST fallback or from an
|
|
260
|
+
* extension.
|
|
261
|
+
*/
|
|
262
|
+
hasEncodedScopeInfo(): boolean {
|
|
263
|
+
this.#ensureSourceMapProcessed();
|
|
264
|
+
return this.#scopesInfo !== null && this.#scopesFallbackPromise === undefined &&
|
|
265
|
+
this.#scopesInfo.hasGeneratedRanges();
|
|
266
|
+
}
|
|
267
|
+
|
|
253
268
|
waitForScopeInfo(): Promise<void> {
|
|
254
269
|
this.#ensureSourceMapProcessed();
|
|
255
270
|
return this.#scopesFallbackPromise ?? Promise.resolve();
|
|
@@ -867,19 +882,32 @@ export class SourceMap {
|
|
|
867
882
|
return this.#scopesInfo?.findOriginalFunctionScope(position) ?? null;
|
|
868
883
|
}
|
|
869
884
|
|
|
870
|
-
|
|
885
|
+
/** See {@link SourceMapScopesInfo.translateRawFrame}. `null` if no scopes information is available. */
|
|
886
|
+
translateRawFrame(generatedLine: number, generatedColumn: number): RawFrameTranslation|null {
|
|
871
887
|
this.#ensureSourceMapProcessed();
|
|
872
|
-
return this.#scopesInfo?.
|
|
888
|
+
return this.#scopesInfo?.translateRawFrame(generatedLine, generatedColumn) ?? null;
|
|
873
889
|
}
|
|
874
890
|
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
return this.#scopesInfo?.
|
|
891
|
+
/** See {@link SourceMapScopesInfo.inlinedFunctionRange}. `null` without encoded scopes. */
|
|
892
|
+
inlinedFunctionRange(generatedLine: number, generatedColumn: number): PositionRange|null {
|
|
893
|
+
return this.hasEncodedScopeInfo() ? this.#scopesInfo?.inlinedFunctionRange(generatedLine, generatedColumn) ?? null :
|
|
894
|
+
null;
|
|
878
895
|
}
|
|
879
896
|
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
return this.#scopesInfo?.
|
|
897
|
+
/** See {@link SourceMapScopesInfo.inlinedCalleeRanges}. Empty without encoded scopes. */
|
|
898
|
+
inlinedCalleeRanges(generatedLine: number, generatedColumn: number): PositionRange[] {
|
|
899
|
+
return this.hasEncodedScopeInfo() ? this.#scopesInfo?.inlinedCalleeRanges(generatedLine, generatedColumn) ?? [] :
|
|
900
|
+
[];
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
/** See {@link SourceMapScopesInfo.hasOutlinedFunctions}. False without encoded scopes. */
|
|
904
|
+
hasOutlinedFunctions(): boolean {
|
|
905
|
+
return this.hasEncodedScopeInfo() && (this.#scopesInfo?.hasOutlinedFunctions() ?? false);
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
/** See {@link SourceMapScopesInfo.artificialFunctionRanges}. Empty without encoded scopes. */
|
|
909
|
+
artificialFunctionRanges(): PositionRange[] {
|
|
910
|
+
return this.hasEncodedScopeInfo() ? this.#scopesInfo?.artificialFunctionRanges() ?? [] : [];
|
|
883
911
|
}
|
|
884
912
|
}
|
|
885
913
|
|