chrome-devtools-frontend 1.0.927127 → 1.0.928589
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/AUTHORS +1 -0
- package/config/gni/all_devtools_files.gni +0 -1
- package/config/gni/devtools_grd_files.gni +30 -4
- package/config/gni/devtools_image_files.gni +1 -0
- package/front_end/Images/src/ic_preview_feature.svg +3 -0
- package/front_end/Tests.js +2 -3
- package/front_end/core/common/Settings.ts +26 -45
- package/front_end/core/host/UserMetrics.ts +2 -2
- package/front_end/core/i18n/locales/en-US.json +60 -15
- package/front_end/core/i18n/locales/en-XL.json +60 -15
- package/front_end/core/platform/keyboard-utilities.ts +1 -0
- package/front_end/core/root/Runtime.ts +62 -61
- package/front_end/core/sdk/AccessibilityModel.ts +73 -73
- package/front_end/core/sdk/CPUProfileDataModel.ts +14 -14
- package/front_end/core/sdk/CPUProfilerModel.ts +33 -33
- package/front_end/core/sdk/CPUThrottlingManager.ts +8 -8
- package/front_end/core/sdk/CSSFontFace.ts +10 -10
- package/front_end/core/sdk/CSSMatchedStyles.ts +114 -114
- package/front_end/core/sdk/CSSMedia.ts +22 -22
- package/front_end/core/sdk/CSSMetadata.ts +53 -49
- package/front_end/core/sdk/CSSModel.ts +139 -135
- package/front_end/core/sdk/CSSProperty.ts +18 -18
- package/front_end/core/sdk/CSSRule.ts +15 -15
- package/front_end/core/sdk/CSSStyleDeclaration.ts +49 -47
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +12 -12
- package/front_end/core/sdk/ChildTargetManager.ts +41 -40
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +10 -10
- package/front_end/core/sdk/Connections.ts +81 -81
- package/front_end/core/sdk/ConsoleModel.ts +68 -68
- package/front_end/core/sdk/Cookie.ts +48 -48
- package/front_end/core/sdk/CookieModel.ts +13 -13
- package/front_end/core/sdk/CookieParser.ts +45 -45
- package/front_end/core/sdk/DOMDebuggerModel.ts +131 -131
- package/front_end/core/sdk/DOMModel.ts +264 -252
- package/front_end/core/sdk/DebuggerModel.ts +209 -205
- package/front_end/core/sdk/EmulationModel.ts +76 -76
- package/front_end/core/sdk/FilmStripModel.ts +29 -29
- package/front_end/core/sdk/FrameManager.ts +43 -42
- package/front_end/core/sdk/HeapProfilerModel.ts +36 -36
- package/front_end/core/sdk/IsolateManager.ts +82 -82
- package/front_end/core/sdk/IssuesModel.ts +6 -6
- package/front_end/core/sdk/LayerTreeBase.ts +37 -37
- package/front_end/core/sdk/LogModel.ts +5 -5
- package/front_end/core/sdk/NetworkManager.ts +229 -225
- package/front_end/core/sdk/NetworkRequest.ts +368 -360
- package/front_end/core/sdk/OverlayColorGenerator.ts +9 -9
- package/front_end/core/sdk/OverlayModel.ts +155 -153
- package/front_end/core/sdk/OverlayPersistentHighlighter.ts +100 -101
- package/front_end/core/sdk/PageResourceLoader.ts +30 -30
- package/front_end/core/sdk/PaintProfiler.ts +16 -16
- package/front_end/core/sdk/PerformanceMetricsModel.ts +12 -12
- package/front_end/core/sdk/ProfileTreeModel.ts +3 -3
- package/front_end/core/sdk/RemoteObject.ts +108 -104
- package/front_end/core/sdk/Resource.ts +85 -84
- package/front_end/core/sdk/ResourceTreeModel.ts +150 -145
- package/front_end/core/sdk/RuntimeModel.ts +38 -34
- package/front_end/core/sdk/SDKModel.ts +3 -3
- package/front_end/core/sdk/ScreenCaptureModel.ts +19 -19
- package/front_end/core/sdk/Script.ts +29 -29
- package/front_end/core/sdk/SecurityOriginManager.ts +19 -19
- package/front_end/core/sdk/ServerTiming.ts +2 -2
- package/front_end/core/sdk/ServiceWorkerCacheModel.ts +43 -43
- package/front_end/core/sdk/ServiceWorkerManager.ts +72 -68
- package/front_end/core/sdk/SourceMap.ts +40 -36
- package/front_end/core/sdk/SourceMapManager.ts +57 -57
- package/front_end/core/sdk/Target.ts +64 -63
- package/front_end/core/sdk/TargetManager.ts +60 -56
- package/front_end/core/sdk/TracingManager.ts +39 -39
- package/front_end/core/sdk/TracingModel.ts +125 -125
- package/front_end/core/sdk/WebAuthnModel.ts +9 -9
- package/front_end/entrypoints/lighthouse_worker/{LighthouseService.js → LighthouseService.ts} +20 -45
- package/front_end/entrypoints/lighthouse_worker/{lighthouse_worker.js → lighthouse_worker.ts} +0 -0
- package/front_end/entrypoints/main/MainImpl.ts +7 -2
- package/front_end/legacy_test_runner/elements_test_runner/ElementsTestRunner.js +4 -4
- package/front_end/legacy_test_runner/sdk_test_runner/sdk_test_runner.js +1 -1
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -6
- package/front_end/models/issues_manager/GenericIssue.ts +86 -0
- package/front_end/models/issues_manager/Issue.ts +24 -0
- package/front_end/models/issues_manager/IssuesManager.ts +18 -6
- package/front_end/models/issues_manager/descriptions/genericCrossOriginPortalPostMessageError.md +3 -0
- package/front_end/models/issues_manager/issues_manager.ts +2 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +5422 -1
- package/front_end/panels/console/ConsoleSidebar.ts +0 -3
- package/front_end/panels/elements/ElementsTreeElement.ts +53 -61
- package/front_end/panels/elements/ElementsTreeOutline.ts +0 -1
- package/front_end/panels/elements/components/LayoutPane.ts +5 -1
- package/front_end/panels/issues/GenericIssueDetailsView.ts +68 -0
- package/front_end/panels/issues/IssueAggregator.ts +16 -0
- package/front_end/panels/issues/IssueKindView.ts +95 -0
- package/front_end/panels/issues/IssueView.ts +6 -0
- package/front_end/panels/issues/IssuesPane.ts +81 -18
- package/front_end/panels/issues/issuesTree.css +8 -3
- package/front_end/panels/lighthouse/LighthouseController.ts +3 -1
- package/front_end/panels/network/NetworkItemView.ts +1 -1
- package/front_end/panels/network/networkLogView.css +5 -0
- package/front_end/panels/sensors/LocationsSettingsTab.ts +1 -1
- package/front_end/panels/settings/SettingsScreen.ts +1 -0
- package/front_end/panels/settings/settingsScreen.css +24 -0
- package/front_end/panels/snippets/SnippetsQuickOpen.ts +8 -3
- package/front_end/panels/sources/TabbedEditorContainer.ts +1 -1
- package/front_end/panels/sources/sources-meta.ts +22 -7
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +4 -4
- package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +137 -0
- package/front_end/ui/components/code_highlighter/codeHighlighter.css +51 -0
- package/front_end/ui/components/code_highlighter/code_highlighter.ts +11 -0
- package/front_end/ui/components/docs/text_editor/basic.html +28 -0
- package/front_end/ui/components/docs/text_editor/basic.ts +14 -0
- package/front_end/ui/components/docs/text_prompt/basic.html +35 -0
- package/front_end/ui/components/docs/text_prompt/basic.ts +19 -0
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +1 -0
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +17 -0
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -0
- package/front_end/ui/components/text_editor/TextEditor.ts +161 -0
- package/front_end/ui/components/text_editor/config.ts +264 -0
- package/front_end/{panels/console/components/components.ts → ui/components/text_editor/text_editor.ts} +2 -5
- package/front_end/ui/components/text_editor/theme.ts +113 -0
- package/front_end/ui/components/text_prompt/TextPrompt.ts +144 -0
- package/front_end/ui/components/text_prompt/textPrompt.css +33 -0
- package/front_end/ui/components/text_prompt/text_prompt.ts +9 -0
- package/front_end/ui/legacy/ARIAUtils.ts +14 -11
- package/front_end/ui/legacy/TabbedPane.ts +32 -3
- package/front_end/ui/legacy/UIUtils.ts +3 -1
- package/front_end/ui/legacy/View.ts +6 -0
- package/front_end/ui/legacy/ViewManager.ts +5 -1
- package/front_end/ui/legacy/ViewRegistration.ts +5 -0
- package/front_end/ui/legacy/XLink.ts +1 -1
- package/front_end/ui/legacy/closeButton.css +6 -0
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +8 -3
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +38 -38
- package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +10 -4
- package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +23 -6
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +14 -16
- package/front_end/ui/legacy/filter.css +1 -0
- package/front_end/ui/legacy/tabbedPane.css +24 -0
- package/front_end/ui/legacy/toolbar.css +5 -0
- package/inspector_overlay/main.ts +2 -1
- package/inspector_overlay/tool_screenshot.ts +8 -1
- package/package.json +1 -1
- package/scripts/build/rollup.config.js +9 -0
- package/scripts/migration/class-fields/migrate.js +56 -0
- package/scripts/migration/class-fields/package.json +5 -0
- package/front_end/panels/console/components/SidebarDeprecation.ts +0 -58
- package/front_end/panels/console/components/sidebarDeprecation.css +0 -17
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// Copyright 2021 The Chromium Authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
1
5
|
/*
|
|
2
6
|
* Copyright (C) 2010 Google Inc. All rights reserved.
|
|
3
7
|
*
|
|
@@ -11,7 +15,7 @@
|
|
|
11
15
|
* copyright notice, this list of conditions and the following disclaimer
|
|
12
16
|
* in the documentation and/or other materials provided with the
|
|
13
17
|
* distribution.
|
|
14
|
-
* * Neither the name of Google Inc. nor the names of its
|
|
18
|
+
* * Neither the #name of Google Inc. nor the names of its
|
|
15
19
|
* contributors may be used to endorse or promote products derived from
|
|
16
20
|
* this software without specific prior written permission.
|
|
17
21
|
*
|
|
@@ -117,30 +121,30 @@ export enum StepMode {
|
|
|
117
121
|
export class DebuggerModel extends SDKModel<EventTypes> {
|
|
118
122
|
readonly agent: ProtocolProxyApi.DebuggerApi;
|
|
119
123
|
runtimeModelInternal: RuntimeModel;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
readonly #sourceMapManagerInternal: SourceMapManager<Script>;
|
|
125
|
+
readonly #sourceMapIdToScript: Map<string, Script>;
|
|
126
|
+
#debuggerPausedDetailsInternal: DebuggerPausedDetails|null;
|
|
127
|
+
readonly #scriptsInternal: Map<string, Script>;
|
|
128
|
+
readonly #scriptsBySourceURL: Map<string, Script[]>;
|
|
129
|
+
#discardableScripts: Script[];
|
|
126
130
|
continueToLocationCallback: ((arg0: DebuggerPausedDetails) => boolean)|null;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
131
|
+
#selectedCallFrameInternal: CallFrame|null;
|
|
132
|
+
#debuggerEnabledInternal: boolean;
|
|
133
|
+
#debuggerId: string|null;
|
|
134
|
+
#skipAllPausesTimeout: number;
|
|
135
|
+
#beforePausedCallback: ((arg0: DebuggerPausedDetails) => boolean)|null;
|
|
136
|
+
#computeAutoStepRangesCallback: ((arg0: StepMode, arg1: CallFrame) => Promise<Array<{
|
|
137
|
+
start: Location,
|
|
138
|
+
end: Location,
|
|
139
|
+
}>>)|null;
|
|
140
|
+
#expandCallFramesCallback: ((arg0: Array<CallFrame>) => Promise<Array<CallFrame>>)|null;
|
|
137
141
|
evaluateOnCallFrameCallback: ((arg0: CallFrame, arg1: EvaluationOptions) => Promise<EvaluationResult|null>)|null;
|
|
138
142
|
// We need to be able to register listeners for individual breakpoints. As such, we dispatch
|
|
139
|
-
// on breakpoint ids, which are not statically known. The event payload will always be a `Location`.
|
|
140
|
-
|
|
143
|
+
// on breakpoint ids, which are not statically known. The event #payload will always be a `Location`.
|
|
144
|
+
readonly #breakpointResolvedEventTarget =
|
|
141
145
|
new Common.ObjectWrapper.ObjectWrapper<{[breakpointId: string]: Location}>();
|
|
142
|
-
|
|
143
|
-
|
|
146
|
+
#autoStepOver: boolean;
|
|
147
|
+
#isPausingInternal: boolean;
|
|
144
148
|
|
|
145
149
|
constructor(target: Target) {
|
|
146
150
|
super(target);
|
|
@@ -149,26 +153,26 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
149
153
|
this.agent = target.debuggerAgent();
|
|
150
154
|
this.runtimeModelInternal = (target.model(RuntimeModel) as RuntimeModel);
|
|
151
155
|
|
|
152
|
-
this
|
|
153
|
-
this
|
|
156
|
+
this.#sourceMapManagerInternal = new SourceMapManager(target);
|
|
157
|
+
this.#sourceMapIdToScript = new Map();
|
|
154
158
|
|
|
155
|
-
this
|
|
156
|
-
this
|
|
157
|
-
this
|
|
158
|
-
this
|
|
159
|
+
this.#debuggerPausedDetailsInternal = null;
|
|
160
|
+
this.#scriptsInternal = new Map();
|
|
161
|
+
this.#scriptsBySourceURL = new Map();
|
|
162
|
+
this.#discardableScripts = [];
|
|
159
163
|
this.continueToLocationCallback = null;
|
|
160
|
-
this
|
|
161
|
-
this
|
|
162
|
-
this
|
|
163
|
-
this
|
|
164
|
-
this
|
|
165
|
-
this
|
|
166
|
-
this
|
|
164
|
+
this.#selectedCallFrameInternal = null;
|
|
165
|
+
this.#debuggerEnabledInternal = false;
|
|
166
|
+
this.#debuggerId = null;
|
|
167
|
+
this.#skipAllPausesTimeout = 0;
|
|
168
|
+
this.#beforePausedCallback = null;
|
|
169
|
+
this.#computeAutoStepRangesCallback = null;
|
|
170
|
+
this.#expandCallFramesCallback = null;
|
|
167
171
|
this.evaluateOnCallFrameCallback = null;
|
|
168
172
|
|
|
169
|
-
this
|
|
173
|
+
this.#autoStepOver = false;
|
|
170
174
|
|
|
171
|
-
this
|
|
175
|
+
this.#isPausingInternal = false;
|
|
172
176
|
Common.Settings.Settings.instance()
|
|
173
177
|
.moduleSetting('pauseOnExceptionEnabled')
|
|
174
178
|
.addChangeListener(this.pauseOnExceptionStateChanged, this);
|
|
@@ -186,11 +190,11 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
186
190
|
this.enableDebugger();
|
|
187
191
|
}
|
|
188
192
|
|
|
189
|
-
this
|
|
193
|
+
this.#sourceMapManagerInternal.setEnabled(
|
|
190
194
|
Common.Settings.Settings.instance().moduleSetting('jsSourceMapsEnabled').get());
|
|
191
195
|
Common.Settings.Settings.instance()
|
|
192
196
|
.moduleSetting('jsSourceMapsEnabled')
|
|
193
|
-
.addChangeListener(event => this
|
|
197
|
+
.addChangeListener(event => this.#sourceMapManagerInternal.setEnabled((event.data as boolean)));
|
|
194
198
|
|
|
195
199
|
const resourceTreeModel = (target.model(ResourceTreeModel) as ResourceTreeModel);
|
|
196
200
|
if (resourceTreeModel) {
|
|
@@ -206,7 +210,7 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
206
210
|
}
|
|
207
211
|
|
|
208
212
|
sourceMapManager(): SourceMapManager<Script> {
|
|
209
|
-
return this
|
|
213
|
+
return this.#sourceMapManagerInternal;
|
|
210
214
|
}
|
|
211
215
|
|
|
212
216
|
runtimeModel(): RuntimeModel {
|
|
@@ -214,14 +218,14 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
214
218
|
}
|
|
215
219
|
|
|
216
220
|
debuggerEnabled(): boolean {
|
|
217
|
-
return Boolean(this
|
|
221
|
+
return Boolean(this.#debuggerEnabledInternal);
|
|
218
222
|
}
|
|
219
223
|
|
|
220
224
|
private async enableDebugger(): Promise<void> {
|
|
221
|
-
if (this
|
|
225
|
+
if (this.#debuggerEnabledInternal) {
|
|
222
226
|
return;
|
|
223
227
|
}
|
|
224
|
-
this
|
|
228
|
+
this.#debuggerEnabledInternal = true;
|
|
225
229
|
|
|
226
230
|
// Set a limit for the total size of collected script sources retained by debugger.
|
|
227
231
|
// 10MB for remote frontends, 100MB for others.
|
|
@@ -263,12 +267,12 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
263
267
|
}
|
|
264
268
|
const {debuggerId} = response;
|
|
265
269
|
_debuggerIdToModel.set(debuggerId, this);
|
|
266
|
-
this
|
|
270
|
+
this.#debuggerId = debuggerId;
|
|
267
271
|
this.dispatchEventToListeners(Events.DebuggerIsReadyToPause, this);
|
|
268
272
|
}
|
|
269
273
|
|
|
270
274
|
isReadyToPause(): boolean {
|
|
271
|
-
return Boolean(this
|
|
275
|
+
return Boolean(this.#debuggerId);
|
|
272
276
|
}
|
|
273
277
|
|
|
274
278
|
static async modelForDebuggerId(debuggerId: string): Promise<DebuggerModel|null> {
|
|
@@ -289,37 +293,37 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
289
293
|
}
|
|
290
294
|
|
|
291
295
|
private async disableDebugger(): Promise<void> {
|
|
292
|
-
if (!this
|
|
296
|
+
if (!this.#debuggerEnabledInternal) {
|
|
293
297
|
return;
|
|
294
298
|
}
|
|
295
|
-
this
|
|
299
|
+
this.#debuggerEnabledInternal = false;
|
|
296
300
|
|
|
297
301
|
await this.asyncStackTracesStateChanged();
|
|
298
302
|
await this.agent.invoke_disable();
|
|
299
|
-
this
|
|
303
|
+
this.#isPausingInternal = false;
|
|
300
304
|
this.globalObjectCleared();
|
|
301
305
|
this.dispatchEventToListeners(Events.DebuggerWasDisabled);
|
|
302
|
-
if (typeof this
|
|
303
|
-
_debuggerIdToModel.delete(this
|
|
306
|
+
if (typeof this.#debuggerId === 'string') {
|
|
307
|
+
_debuggerIdToModel.delete(this.#debuggerId);
|
|
304
308
|
}
|
|
305
|
-
this
|
|
309
|
+
this.#debuggerId = null;
|
|
306
310
|
}
|
|
307
311
|
|
|
308
312
|
private skipAllPauses(skip: boolean): void {
|
|
309
|
-
if (this
|
|
310
|
-
clearTimeout(this
|
|
311
|
-
this
|
|
313
|
+
if (this.#skipAllPausesTimeout) {
|
|
314
|
+
clearTimeout(this.#skipAllPausesTimeout);
|
|
315
|
+
this.#skipAllPausesTimeout = 0;
|
|
312
316
|
}
|
|
313
317
|
this.agent.invoke_setSkipAllPauses({skip});
|
|
314
318
|
}
|
|
315
319
|
|
|
316
320
|
skipAllPausesUntilReloadOrTimeout(timeout: number): void {
|
|
317
|
-
if (this
|
|
318
|
-
clearTimeout(this
|
|
321
|
+
if (this.#skipAllPausesTimeout) {
|
|
322
|
+
clearTimeout(this.#skipAllPausesTimeout);
|
|
319
323
|
}
|
|
320
324
|
this.agent.invoke_setSkipAllPauses({skip: true});
|
|
321
325
|
// If reload happens before the timeout, the flag will be already unset and the timeout callback won't change anything.
|
|
322
|
-
this
|
|
326
|
+
this.#skipAllPausesTimeout = window.setTimeout(this.skipAllPauses.bind(this, false), timeout);
|
|
323
327
|
}
|
|
324
328
|
|
|
325
329
|
private pauseOnExceptionStateChanged(): void {
|
|
@@ -338,7 +342,7 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
338
342
|
private asyncStackTracesStateChanged(): Promise<Protocol.ProtocolResponseWithError> {
|
|
339
343
|
const maxAsyncStackChainDepth = 32;
|
|
340
344
|
const enabled = !Common.Settings.Settings.instance().moduleSetting('disableAsyncStackTraces').get() &&
|
|
341
|
-
this
|
|
345
|
+
this.#debuggerEnabledInternal;
|
|
342
346
|
const maxDepth = enabled ? maxAsyncStackChainDepth : 0;
|
|
343
347
|
return this.agent.invoke_setAsyncCallStackDepth({maxDepth});
|
|
344
348
|
}
|
|
@@ -352,7 +356,7 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
352
356
|
start: Location,
|
|
353
357
|
end: Location,
|
|
354
358
|
}>>)|null): void {
|
|
355
|
-
this
|
|
359
|
+
this.#computeAutoStepRangesCallback = callback;
|
|
356
360
|
}
|
|
357
361
|
|
|
358
362
|
private async computeAutoStepSkipList(mode: StepMode): Promise<Protocol.Debugger.LocationRange[]> {
|
|
@@ -360,9 +364,9 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
360
364
|
start: Location,
|
|
361
365
|
end: Location,
|
|
362
366
|
}[] = [];
|
|
363
|
-
if (this
|
|
364
|
-
const [callFrame] = this
|
|
365
|
-
ranges = await this
|
|
367
|
+
if (this.#computeAutoStepRangesCallback && this.#debuggerPausedDetailsInternal) {
|
|
368
|
+
const [callFrame] = this.#debuggerPausedDetailsInternal.callFrames;
|
|
369
|
+
ranges = await this.#computeAutoStepRangesCallback.call(null, mode, callFrame);
|
|
366
370
|
}
|
|
367
371
|
const skipList = ranges.map(
|
|
368
372
|
location => new LocationRange(
|
|
@@ -379,7 +383,7 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
379
383
|
async stepOver(): Promise<void> {
|
|
380
384
|
// Mark that in case of auto-stepping, we should be doing
|
|
381
385
|
// step-over instead of step-in.
|
|
382
|
-
this
|
|
386
|
+
this.#autoStepOver = true;
|
|
383
387
|
const skipList = await this.computeAutoStepSkipList(StepMode.StepOver);
|
|
384
388
|
this.agent.invoke_stepOver({skipList});
|
|
385
389
|
}
|
|
@@ -401,11 +405,11 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
401
405
|
|
|
402
406
|
resume(): void {
|
|
403
407
|
this.agent.invoke_resume({terminateOnResume: false});
|
|
404
|
-
this
|
|
408
|
+
this.#isPausingInternal = false;
|
|
405
409
|
}
|
|
406
410
|
|
|
407
411
|
pause(): void {
|
|
408
|
-
this
|
|
412
|
+
this.#isPausingInternal = true;
|
|
409
413
|
this.skipAllPauses(false);
|
|
410
414
|
this.agent.invoke_pause();
|
|
411
415
|
}
|
|
@@ -425,7 +429,7 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
425
429
|
}
|
|
426
430
|
// Adjust column if needed.
|
|
427
431
|
let minColumnNumber = 0;
|
|
428
|
-
const scripts = this
|
|
432
|
+
const scripts = this.#scriptsBySourceURL.get(url) || [];
|
|
429
433
|
for (let i = 0, l = scripts.length; i < l; ++i) {
|
|
430
434
|
const script = scripts[i];
|
|
431
435
|
if (lineNumber === script.lineOffset) {
|
|
@@ -512,7 +516,7 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
512
516
|
}
|
|
513
517
|
|
|
514
518
|
breakpointResolved(breakpointId: string, location: Protocol.Debugger.Location): void {
|
|
515
|
-
this
|
|
519
|
+
this.#breakpointResolvedEventTarget.dispatchEventToListeners(breakpointId, Location.fromPayload(this, location));
|
|
516
520
|
}
|
|
517
521
|
|
|
518
522
|
globalObjectCleared(): void {
|
|
@@ -523,35 +527,35 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
523
527
|
}
|
|
524
528
|
|
|
525
529
|
private reset(): void {
|
|
526
|
-
for (const scriptWithSourceMap of this
|
|
527
|
-
this
|
|
530
|
+
for (const scriptWithSourceMap of this.#sourceMapIdToScript.values()) {
|
|
531
|
+
this.#sourceMapManagerInternal.detachSourceMap(scriptWithSourceMap);
|
|
528
532
|
}
|
|
529
|
-
this
|
|
533
|
+
this.#sourceMapIdToScript.clear();
|
|
530
534
|
|
|
531
|
-
this
|
|
532
|
-
this
|
|
533
|
-
this
|
|
534
|
-
this
|
|
535
|
+
this.#scriptsInternal.clear();
|
|
536
|
+
this.#scriptsBySourceURL.clear();
|
|
537
|
+
this.#discardableScripts = [];
|
|
538
|
+
this.#autoStepOver = false;
|
|
535
539
|
}
|
|
536
540
|
|
|
537
541
|
scripts(): Script[] {
|
|
538
|
-
return Array.from(this
|
|
542
|
+
return Array.from(this.#scriptsInternal.values());
|
|
539
543
|
}
|
|
540
544
|
|
|
541
545
|
scriptForId(scriptId: string): Script|null {
|
|
542
|
-
return this
|
|
546
|
+
return this.#scriptsInternal.get(scriptId) || null;
|
|
543
547
|
}
|
|
544
548
|
|
|
545
549
|
scriptsForSourceURL(sourceURL: string|null): Script[] {
|
|
546
550
|
if (!sourceURL) {
|
|
547
551
|
return [];
|
|
548
552
|
}
|
|
549
|
-
return this
|
|
553
|
+
return this.#scriptsBySourceURL.get(sourceURL) || [];
|
|
550
554
|
}
|
|
551
555
|
|
|
552
556
|
scriptsForExecutionContext(executionContext: ExecutionContext): Script[] {
|
|
553
557
|
const result = [];
|
|
554
|
-
for (const script of this
|
|
558
|
+
for (const script of this.#scriptsInternal.values()) {
|
|
555
559
|
if (script.executionContextId === executionContext.id) {
|
|
556
560
|
result.push(script);
|
|
557
561
|
}
|
|
@@ -562,7 +566,7 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
562
566
|
setScriptSource(
|
|
563
567
|
scriptId: string, newSource: string,
|
|
564
568
|
callback: (error: string|null, arg1?: Protocol.Runtime.ExceptionDetails|undefined) => void): void {
|
|
565
|
-
const script = this
|
|
569
|
+
const script = this.#scriptsInternal.get(scriptId);
|
|
566
570
|
if (script) {
|
|
567
571
|
script.editSource(newSource, this.didEditScriptSource.bind(this, scriptId, newSource, callback));
|
|
568
572
|
}
|
|
@@ -580,49 +584,49 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
580
584
|
return;
|
|
581
585
|
}
|
|
582
586
|
|
|
583
|
-
if (!error && callFrames && callFrames.length && this
|
|
587
|
+
if (!error && callFrames && callFrames.length && this.#debuggerPausedDetailsInternal) {
|
|
584
588
|
this.pausedScript(
|
|
585
|
-
callFrames, this
|
|
586
|
-
this
|
|
589
|
+
callFrames, this.#debuggerPausedDetailsInternal.reason, this.#debuggerPausedDetailsInternal.auxData,
|
|
590
|
+
this.#debuggerPausedDetailsInternal.breakpointIds, asyncStackTrace, asyncStackTraceId);
|
|
587
591
|
}
|
|
588
592
|
}
|
|
589
593
|
|
|
590
594
|
get callFrames(): CallFrame[]|null {
|
|
591
|
-
return this
|
|
595
|
+
return this.#debuggerPausedDetailsInternal ? this.#debuggerPausedDetailsInternal.callFrames : null;
|
|
592
596
|
}
|
|
593
597
|
|
|
594
598
|
debuggerPausedDetails(): DebuggerPausedDetails|null {
|
|
595
|
-
return this
|
|
599
|
+
return this.#debuggerPausedDetailsInternal;
|
|
596
600
|
}
|
|
597
601
|
|
|
598
602
|
private setDebuggerPausedDetails(debuggerPausedDetails: DebuggerPausedDetails|null): boolean {
|
|
599
603
|
if (debuggerPausedDetails) {
|
|
600
|
-
this
|
|
601
|
-
this
|
|
602
|
-
if (this
|
|
603
|
-
if (!this
|
|
604
|
+
this.#isPausingInternal = false;
|
|
605
|
+
this.#debuggerPausedDetailsInternal = debuggerPausedDetails;
|
|
606
|
+
if (this.#beforePausedCallback) {
|
|
607
|
+
if (!this.#beforePausedCallback.call(null, debuggerPausedDetails)) {
|
|
604
608
|
return false;
|
|
605
609
|
}
|
|
606
610
|
}
|
|
607
611
|
// If we resolved a location in auto-stepping callback, reset the
|
|
608
612
|
// step-over marker.
|
|
609
|
-
this
|
|
613
|
+
this.#autoStepOver = false;
|
|
610
614
|
this.dispatchEventToListeners(Events.DebuggerPaused, this);
|
|
611
615
|
this.setSelectedCallFrame(debuggerPausedDetails.callFrames[0]);
|
|
612
616
|
} else {
|
|
613
|
-
this
|
|
614
|
-
this
|
|
617
|
+
this.#isPausingInternal = false;
|
|
618
|
+
this.#debuggerPausedDetailsInternal = null;
|
|
615
619
|
this.setSelectedCallFrame(null);
|
|
616
620
|
}
|
|
617
621
|
return true;
|
|
618
622
|
}
|
|
619
623
|
|
|
620
624
|
setBeforePausedCallback(callback: ((arg0: DebuggerPausedDetails) => boolean)|null): void {
|
|
621
|
-
this
|
|
625
|
+
this.#beforePausedCallback = callback;
|
|
622
626
|
}
|
|
623
627
|
|
|
624
628
|
setExpandCallFramesCallback(callback: ((arg0: Array<CallFrame>) => Promise<Array<CallFrame>>)|null): void {
|
|
625
|
-
this
|
|
629
|
+
this.#expandCallFramesCallback = callback;
|
|
626
630
|
}
|
|
627
631
|
|
|
628
632
|
setEvaluateOnCallFrameCallback(callback:
|
|
@@ -651,8 +655,8 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
651
655
|
const pausedDetails =
|
|
652
656
|
new DebuggerPausedDetails(this, callFrames, reason, auxData, breakpointIds, asyncStackTrace, asyncStackTraceId);
|
|
653
657
|
|
|
654
|
-
if (this
|
|
655
|
-
pausedDetails.callFrames = await this
|
|
658
|
+
if (this.#expandCallFramesCallback) {
|
|
659
|
+
pausedDetails.callFrames = await this.#expandCallFramesCallback.call(null, pausedDetails.callFrames);
|
|
656
660
|
}
|
|
657
661
|
|
|
658
662
|
if (this.continueToLocationCallback) {
|
|
@@ -664,7 +668,7 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
664
668
|
}
|
|
665
669
|
|
|
666
670
|
if (!this.setDebuggerPausedDetails(pausedDetails)) {
|
|
667
|
-
if (this
|
|
671
|
+
if (this.#autoStepOver) {
|
|
668
672
|
this.stepOver();
|
|
669
673
|
} else {
|
|
670
674
|
this.stepInto();
|
|
@@ -691,7 +695,7 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
691
695
|
isModule: boolean|null, originStackTrace: Protocol.Runtime.StackTrace|null, codeOffset: number|null,
|
|
692
696
|
scriptLanguage: string|null, debugSymbols: Protocol.Debugger.DebugSymbols|null,
|
|
693
697
|
embedderName: string|null): Script {
|
|
694
|
-
const knownScript = this
|
|
698
|
+
const knownScript = this.#scriptsInternal.get(scriptId);
|
|
695
699
|
if (knownScript) {
|
|
696
700
|
return knownScript;
|
|
697
701
|
}
|
|
@@ -708,19 +712,19 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
708
712
|
|
|
709
713
|
const sourceMapId = DebuggerModel.sourceMapId(script.executionContextId, script.sourceURL, script.sourceMapURL);
|
|
710
714
|
if (sourceMapId && !hasSyntaxError) {
|
|
711
|
-
// Consecutive script evaluations in the same execution context with the same sourceURL
|
|
715
|
+
// Consecutive script evaluations in the same execution context with the same #sourceURL
|
|
712
716
|
// and sourceMappingURL should result in source map reloading.
|
|
713
|
-
const previousScript = this
|
|
717
|
+
const previousScript = this.#sourceMapIdToScript.get(sourceMapId);
|
|
714
718
|
if (previousScript) {
|
|
715
|
-
this
|
|
719
|
+
this.#sourceMapManagerInternal.detachSourceMap(previousScript);
|
|
716
720
|
}
|
|
717
|
-
this
|
|
718
|
-
this
|
|
721
|
+
this.#sourceMapIdToScript.set(sourceMapId, script);
|
|
722
|
+
this.#sourceMapManagerInternal.attachSourceMap(script, script.sourceURL, script.sourceMapURL);
|
|
719
723
|
}
|
|
720
724
|
|
|
721
725
|
const isDiscardable = hasSyntaxError && script.isAnonymousScript();
|
|
722
726
|
if (isDiscardable) {
|
|
723
|
-
this
|
|
727
|
+
this.#discardableScripts.push(script);
|
|
724
728
|
this.collectDiscardedScripts();
|
|
725
729
|
}
|
|
726
730
|
return script;
|
|
@@ -728,55 +732,55 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
728
732
|
|
|
729
733
|
setSourceMapURL(script: Script, newSourceMapURL: string): void {
|
|
730
734
|
let sourceMapId = DebuggerModel.sourceMapId(script.executionContextId, script.sourceURL, script.sourceMapURL);
|
|
731
|
-
if (sourceMapId && this
|
|
732
|
-
this
|
|
735
|
+
if (sourceMapId && this.#sourceMapIdToScript.get(sourceMapId) === script) {
|
|
736
|
+
this.#sourceMapIdToScript.delete(sourceMapId);
|
|
733
737
|
}
|
|
734
|
-
this
|
|
738
|
+
this.#sourceMapManagerInternal.detachSourceMap(script);
|
|
735
739
|
|
|
736
740
|
script.sourceMapURL = newSourceMapURL;
|
|
737
741
|
sourceMapId = DebuggerModel.sourceMapId(script.executionContextId, script.sourceURL, script.sourceMapURL);
|
|
738
742
|
if (!sourceMapId) {
|
|
739
743
|
return;
|
|
740
744
|
}
|
|
741
|
-
this
|
|
742
|
-
this
|
|
745
|
+
this.#sourceMapIdToScript.set(sourceMapId, script);
|
|
746
|
+
this.#sourceMapManagerInternal.attachSourceMap(script, script.sourceURL, script.sourceMapURL);
|
|
743
747
|
}
|
|
744
748
|
|
|
745
749
|
executionContextDestroyed(executionContext: ExecutionContext): void {
|
|
746
|
-
const sourceMapIds = Array.from(this
|
|
750
|
+
const sourceMapIds = Array.from(this.#sourceMapIdToScript.keys());
|
|
747
751
|
for (const sourceMapId of sourceMapIds) {
|
|
748
|
-
const script = this
|
|
752
|
+
const script = this.#sourceMapIdToScript.get(sourceMapId);
|
|
749
753
|
if (script && script.executionContextId === executionContext.id) {
|
|
750
|
-
this
|
|
751
|
-
this
|
|
754
|
+
this.#sourceMapIdToScript.delete(sourceMapId);
|
|
755
|
+
this.#sourceMapManagerInternal.detachSourceMap(script);
|
|
752
756
|
}
|
|
753
757
|
}
|
|
754
758
|
}
|
|
755
759
|
|
|
756
760
|
private registerScript(script: Script): void {
|
|
757
|
-
this
|
|
761
|
+
this.#scriptsInternal.set(script.scriptId, script);
|
|
758
762
|
if (script.isAnonymousScript()) {
|
|
759
763
|
return;
|
|
760
764
|
}
|
|
761
765
|
|
|
762
|
-
let scripts = this
|
|
766
|
+
let scripts = this.#scriptsBySourceURL.get(script.sourceURL);
|
|
763
767
|
if (!scripts) {
|
|
764
768
|
scripts = [];
|
|
765
|
-
this
|
|
769
|
+
this.#scriptsBySourceURL.set(script.sourceURL, scripts);
|
|
766
770
|
}
|
|
767
771
|
scripts.push(script);
|
|
768
772
|
}
|
|
769
773
|
|
|
770
774
|
private unregisterScript(script: Script): void {
|
|
771
775
|
console.assert(script.isAnonymousScript());
|
|
772
|
-
this
|
|
776
|
+
this.#scriptsInternal.delete(script.scriptId);
|
|
773
777
|
}
|
|
774
778
|
|
|
775
779
|
private collectDiscardedScripts(): void {
|
|
776
|
-
if (this
|
|
780
|
+
if (this.#discardableScripts.length < 1000) {
|
|
777
781
|
return;
|
|
778
782
|
}
|
|
779
|
-
const scriptsToDiscard = this
|
|
783
|
+
const scriptsToDiscard = this.#discardableScripts.splice(0, 100);
|
|
780
784
|
for (const script of scriptsToDiscard) {
|
|
781
785
|
this.unregisterScript(script);
|
|
782
786
|
this.dispatchEventToListeners(Events.DiscardedAnonymousScriptSource, script);
|
|
@@ -789,7 +793,7 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
789
793
|
|
|
790
794
|
createRawLocationByURL(sourceURL: string, lineNumber: number, columnNumber?: number, inlineFrameIndex?: number):
|
|
791
795
|
Location|null {
|
|
792
|
-
for (const script of this
|
|
796
|
+
for (const script of this.#scriptsBySourceURL.get(sourceURL) || []) {
|
|
793
797
|
if (script.lineOffset > lineNumber ||
|
|
794
798
|
(script.lineOffset === lineNumber && columnNumber !== undefined && script.columnOffset > columnNumber)) {
|
|
795
799
|
continue;
|
|
@@ -834,19 +838,19 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
834
838
|
}
|
|
835
839
|
|
|
836
840
|
isPausing(): boolean {
|
|
837
|
-
return this
|
|
841
|
+
return this.#isPausingInternal;
|
|
838
842
|
}
|
|
839
843
|
|
|
840
844
|
setSelectedCallFrame(callFrame: CallFrame|null): void {
|
|
841
|
-
if (this
|
|
845
|
+
if (this.#selectedCallFrameInternal === callFrame) {
|
|
842
846
|
return;
|
|
843
847
|
}
|
|
844
|
-
this
|
|
848
|
+
this.#selectedCallFrameInternal = callFrame;
|
|
845
849
|
this.dispatchEventToListeners(Events.CallFrameSelected, this);
|
|
846
850
|
}
|
|
847
851
|
|
|
848
852
|
selectedCallFrame(): CallFrame|null {
|
|
849
|
-
return this
|
|
853
|
+
return this.#selectedCallFrameInternal;
|
|
850
854
|
}
|
|
851
855
|
|
|
852
856
|
async evaluateOnSelectedCallFrame(options: EvaluationOptions): Promise<EvaluationResult> {
|
|
@@ -904,13 +908,13 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
904
908
|
addBreakpointListener(
|
|
905
909
|
breakpointId: string, listener: (arg0: Common.EventTarget.EventTargetEvent<Location>) => void,
|
|
906
910
|
thisObject?: Object): void {
|
|
907
|
-
this
|
|
911
|
+
this.#breakpointResolvedEventTarget.addEventListener(breakpointId, listener, thisObject);
|
|
908
912
|
}
|
|
909
913
|
|
|
910
914
|
removeBreakpointListener(
|
|
911
915
|
breakpointId: string, listener: (arg0: Common.EventTarget.EventTargetEvent<Location>) => void,
|
|
912
916
|
thisObject?: Object): void {
|
|
913
|
-
this
|
|
917
|
+
this.#breakpointResolvedEventTarget.removeEventListener(breakpointId, listener, thisObject);
|
|
914
918
|
}
|
|
915
919
|
|
|
916
920
|
async setBlackboxPatterns(patterns: string[]): Promise<boolean> {
|
|
@@ -923,9 +927,9 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
923
927
|
}
|
|
924
928
|
|
|
925
929
|
dispose(): void {
|
|
926
|
-
this
|
|
927
|
-
if (this
|
|
928
|
-
_debuggerIdToModel.delete(this
|
|
930
|
+
this.#sourceMapManagerInternal.dispose();
|
|
931
|
+
if (this.#debuggerId) {
|
|
932
|
+
_debuggerIdToModel.delete(this.#debuggerId);
|
|
929
933
|
}
|
|
930
934
|
Common.Settings.Settings.instance()
|
|
931
935
|
.moduleSetting('pauseOnExceptionEnabled')
|
|
@@ -1004,26 +1008,26 @@ export type EventTypes = {
|
|
|
1004
1008
|
};
|
|
1005
1009
|
|
|
1006
1010
|
class DebuggerDispatcher implements ProtocolProxyApi.DebuggerDispatcher {
|
|
1007
|
-
|
|
1011
|
+
#debuggerModel: DebuggerModel;
|
|
1008
1012
|
|
|
1009
1013
|
constructor(debuggerModel: DebuggerModel) {
|
|
1010
|
-
this
|
|
1014
|
+
this.#debuggerModel = debuggerModel;
|
|
1011
1015
|
}
|
|
1012
1016
|
|
|
1013
1017
|
paused({callFrames, reason, data, hitBreakpoints, asyncStackTrace, asyncStackTraceId, asyncCallStackTraceId}:
|
|
1014
1018
|
Protocol.Debugger.PausedEvent): void {
|
|
1015
|
-
if (!this
|
|
1019
|
+
if (!this.#debuggerModel.debuggerEnabled()) {
|
|
1016
1020
|
return;
|
|
1017
1021
|
}
|
|
1018
|
-
this
|
|
1022
|
+
this.#debuggerModel.pausedScript(
|
|
1019
1023
|
callFrames, reason, data, hitBreakpoints || [], asyncStackTrace, asyncStackTraceId, asyncCallStackTraceId);
|
|
1020
1024
|
}
|
|
1021
1025
|
|
|
1022
1026
|
resumed(): void {
|
|
1023
|
-
if (!this
|
|
1027
|
+
if (!this.#debuggerModel.debuggerEnabled()) {
|
|
1024
1028
|
return;
|
|
1025
1029
|
}
|
|
1026
|
-
this
|
|
1030
|
+
this.#debuggerModel.resumedScript();
|
|
1027
1031
|
}
|
|
1028
1032
|
|
|
1029
1033
|
scriptParsed({
|
|
@@ -1047,10 +1051,10 @@ class DebuggerDispatcher implements ProtocolProxyApi.DebuggerDispatcher {
|
|
|
1047
1051
|
debugSymbols,
|
|
1048
1052
|
embedderName,
|
|
1049
1053
|
}: Protocol.Debugger.ScriptParsedEvent): void {
|
|
1050
|
-
if (!this
|
|
1054
|
+
if (!this.#debuggerModel.debuggerEnabled()) {
|
|
1051
1055
|
return;
|
|
1052
1056
|
}
|
|
1053
|
-
this
|
|
1057
|
+
this.#debuggerModel.parsedScriptSource(
|
|
1054
1058
|
scriptId, url, startLine, startColumn, endLine, endColumn, executionContextId, hash, executionContextAuxData,
|
|
1055
1059
|
Boolean(isLiveEdit), sourceMapURL, Boolean(hasSourceURL), false, length || 0, isModule || null,
|
|
1056
1060
|
stackTrace || null, codeOffset || null, scriptLanguage || null, debugSymbols || null, embedderName || null);
|
|
@@ -1075,20 +1079,20 @@ class DebuggerDispatcher implements ProtocolProxyApi.DebuggerDispatcher {
|
|
|
1075
1079
|
scriptLanguage,
|
|
1076
1080
|
embedderName,
|
|
1077
1081
|
}: Protocol.Debugger.ScriptFailedToParseEvent): void {
|
|
1078
|
-
if (!this
|
|
1082
|
+
if (!this.#debuggerModel.debuggerEnabled()) {
|
|
1079
1083
|
return;
|
|
1080
1084
|
}
|
|
1081
|
-
this
|
|
1085
|
+
this.#debuggerModel.parsedScriptSource(
|
|
1082
1086
|
scriptId, url, startLine, startColumn, endLine, endColumn, executionContextId, hash, executionContextAuxData,
|
|
1083
1087
|
false, sourceMapURL, Boolean(hasSourceURL), true, length || 0, isModule || null, stackTrace || null,
|
|
1084
1088
|
codeOffset || null, scriptLanguage || null, null, embedderName || null);
|
|
1085
1089
|
}
|
|
1086
1090
|
|
|
1087
1091
|
breakpointResolved({breakpointId, location}: Protocol.Debugger.BreakpointResolvedEvent): void {
|
|
1088
|
-
if (!this
|
|
1092
|
+
if (!this.#debuggerModel.debuggerEnabled()) {
|
|
1089
1093
|
return;
|
|
1090
1094
|
}
|
|
1091
|
-
this
|
|
1095
|
+
this.#debuggerModel.breakpointResolved(breakpointId, location);
|
|
1092
1096
|
}
|
|
1093
1097
|
}
|
|
1094
1098
|
|
|
@@ -1233,39 +1237,39 @@ export class BreakLocation extends Location {
|
|
|
1233
1237
|
|
|
1234
1238
|
export class CallFrame {
|
|
1235
1239
|
debuggerModel: DebuggerModel;
|
|
1236
|
-
|
|
1240
|
+
readonly #scriptInternal: Script;
|
|
1237
1241
|
payload: Protocol.Debugger.CallFrame;
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1242
|
+
readonly #locationInternal: Location;
|
|
1243
|
+
readonly #scopeChainInternal: Scope[];
|
|
1244
|
+
readonly #localScopeInternal: Scope|null;
|
|
1245
|
+
readonly #inlineFrameIndexInternal: number;
|
|
1246
|
+
readonly #functionNameInternal: string;
|
|
1247
|
+
readonly #functionLocationInternal: Location|undefined;
|
|
1248
|
+
#returnValueInternal: RemoteObject|null;
|
|
1245
1249
|
readonly warnings: string[] = [];
|
|
1246
1250
|
|
|
1247
1251
|
constructor(
|
|
1248
1252
|
debuggerModel: DebuggerModel, script: Script, payload: Protocol.Debugger.CallFrame, inlineFrameIndex?: number,
|
|
1249
1253
|
functionName?: string) {
|
|
1250
1254
|
this.debuggerModel = debuggerModel;
|
|
1251
|
-
this
|
|
1255
|
+
this.#scriptInternal = script;
|
|
1252
1256
|
this.payload = payload;
|
|
1253
|
-
this
|
|
1254
|
-
this
|
|
1255
|
-
this
|
|
1256
|
-
this
|
|
1257
|
-
this
|
|
1257
|
+
this.#locationInternal = Location.fromPayload(debuggerModel, payload.location, inlineFrameIndex);
|
|
1258
|
+
this.#scopeChainInternal = [];
|
|
1259
|
+
this.#localScopeInternal = null;
|
|
1260
|
+
this.#inlineFrameIndexInternal = inlineFrameIndex || 0;
|
|
1261
|
+
this.#functionNameInternal = functionName || payload.functionName;
|
|
1258
1262
|
for (let i = 0; i < payload.scopeChain.length; ++i) {
|
|
1259
1263
|
const scope = new Scope(this, i);
|
|
1260
|
-
this
|
|
1264
|
+
this.#scopeChainInternal.push(scope);
|
|
1261
1265
|
if (scope.type() === Protocol.Debugger.ScopeType.Local) {
|
|
1262
|
-
this
|
|
1266
|
+
this.#localScopeInternal = scope;
|
|
1263
1267
|
}
|
|
1264
1268
|
}
|
|
1265
1269
|
if (payload.functionLocation) {
|
|
1266
|
-
this
|
|
1270
|
+
this.#functionLocationInternal = Location.fromPayload(debuggerModel, payload.functionLocation);
|
|
1267
1271
|
}
|
|
1268
|
-
this
|
|
1272
|
+
this.#returnValueInternal =
|
|
1269
1273
|
payload.returnValue ? this.debuggerModel.runtimeModel().createRemoteObject(payload.returnValue) : null;
|
|
1270
1274
|
}
|
|
1271
1275
|
|
|
@@ -1282,7 +1286,7 @@ export class CallFrame {
|
|
|
1282
1286
|
}
|
|
1283
1287
|
|
|
1284
1288
|
createVirtualCallFrame(inlineFrameIndex: number, name: string): CallFrame {
|
|
1285
|
-
return new CallFrame(this.debuggerModel, this
|
|
1289
|
+
return new CallFrame(this.debuggerModel, this.#scriptInternal, this.payload, inlineFrameIndex, name);
|
|
1286
1290
|
}
|
|
1287
1291
|
|
|
1288
1292
|
addWarning(warning: string): void {
|
|
@@ -1290,7 +1294,7 @@ export class CallFrame {
|
|
|
1290
1294
|
}
|
|
1291
1295
|
|
|
1292
1296
|
get script(): Script {
|
|
1293
|
-
return this
|
|
1297
|
+
return this.#scriptInternal;
|
|
1294
1298
|
}
|
|
1295
1299
|
|
|
1296
1300
|
get id(): Protocol.Debugger.CallFrameId {
|
|
@@ -1298,15 +1302,15 @@ export class CallFrame {
|
|
|
1298
1302
|
}
|
|
1299
1303
|
|
|
1300
1304
|
get inlineFrameIndex(): number {
|
|
1301
|
-
return this
|
|
1305
|
+
return this.#inlineFrameIndexInternal;
|
|
1302
1306
|
}
|
|
1303
1307
|
|
|
1304
1308
|
scopeChain(): Scope[] {
|
|
1305
|
-
return this
|
|
1309
|
+
return this.#scopeChainInternal;
|
|
1306
1310
|
}
|
|
1307
1311
|
|
|
1308
1312
|
localScope(): Scope|null {
|
|
1309
|
-
return this
|
|
1313
|
+
return this.#localScopeInternal;
|
|
1310
1314
|
}
|
|
1311
1315
|
|
|
1312
1316
|
thisObject(): RemoteObject|null {
|
|
@@ -1314,11 +1318,11 @@ export class CallFrame {
|
|
|
1314
1318
|
}
|
|
1315
1319
|
|
|
1316
1320
|
returnValue(): RemoteObject|null {
|
|
1317
|
-
return this
|
|
1321
|
+
return this.#returnValueInternal;
|
|
1318
1322
|
}
|
|
1319
1323
|
|
|
1320
1324
|
async setReturnValue(expression: string): Promise<RemoteObject|null> {
|
|
1321
|
-
if (!this
|
|
1325
|
+
if (!this.#returnValueInternal) {
|
|
1322
1326
|
return null;
|
|
1323
1327
|
}
|
|
1324
1328
|
|
|
@@ -1331,20 +1335,20 @@ export class CallFrame {
|
|
|
1331
1335
|
if (response.getError()) {
|
|
1332
1336
|
return null;
|
|
1333
1337
|
}
|
|
1334
|
-
this
|
|
1335
|
-
return this
|
|
1338
|
+
this.#returnValueInternal = this.debuggerModel.runtimeModel().createRemoteObject(evaluateResponse.result);
|
|
1339
|
+
return this.#returnValueInternal;
|
|
1336
1340
|
}
|
|
1337
1341
|
|
|
1338
1342
|
get functionName(): string {
|
|
1339
|
-
return this
|
|
1343
|
+
return this.#functionNameInternal;
|
|
1340
1344
|
}
|
|
1341
1345
|
|
|
1342
1346
|
location(): Location {
|
|
1343
|
-
return this
|
|
1347
|
+
return this.#locationInternal;
|
|
1344
1348
|
}
|
|
1345
1349
|
|
|
1346
1350
|
functionLocation(): Location|null {
|
|
1347
|
-
return this
|
|
1351
|
+
return this.#functionLocationInternal || null;
|
|
1348
1352
|
}
|
|
1349
1353
|
|
|
1350
1354
|
async evaluate(options: EvaluationOptions): Promise<EvaluationResult> {
|
|
@@ -1412,37 +1416,37 @@ export interface ScopeChainEntry {
|
|
|
1412
1416
|
}
|
|
1413
1417
|
|
|
1414
1418
|
export class Scope implements ScopeChainEntry {
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1419
|
+
#callFrameInternal: CallFrame;
|
|
1420
|
+
#payload: Protocol.Debugger.Scope;
|
|
1421
|
+
readonly #typeInternal: Protocol.Debugger.ScopeType;
|
|
1422
|
+
readonly #nameInternal: string|undefined;
|
|
1423
|
+
#ordinal: number;
|
|
1424
|
+
readonly #startLocationInternal: Location|null;
|
|
1425
|
+
readonly #endLocationInternal: Location|null;
|
|
1426
|
+
#objectInternal: RemoteObject|null;
|
|
1423
1427
|
constructor(callFrame: CallFrame, ordinal: number) {
|
|
1424
|
-
this
|
|
1425
|
-
this
|
|
1426
|
-
this
|
|
1427
|
-
this
|
|
1428
|
-
this
|
|
1429
|
-
this
|
|
1430
|
-
this
|
|
1431
|
-
this
|
|
1432
|
-
this
|
|
1433
|
-
this
|
|
1428
|
+
this.#callFrameInternal = callFrame;
|
|
1429
|
+
this.#payload = callFrame.getPayload().scopeChain[ordinal];
|
|
1430
|
+
this.#typeInternal = this.#payload.type;
|
|
1431
|
+
this.#nameInternal = this.#payload.name;
|
|
1432
|
+
this.#ordinal = ordinal;
|
|
1433
|
+
this.#startLocationInternal =
|
|
1434
|
+
this.#payload.startLocation ? Location.fromPayload(callFrame.debuggerModel, this.#payload.startLocation) : null;
|
|
1435
|
+
this.#endLocationInternal =
|
|
1436
|
+
this.#payload.endLocation ? Location.fromPayload(callFrame.debuggerModel, this.#payload.endLocation) : null;
|
|
1437
|
+
this.#objectInternal = null;
|
|
1434
1438
|
}
|
|
1435
1439
|
|
|
1436
1440
|
callFrame(): CallFrame {
|
|
1437
|
-
return this
|
|
1441
|
+
return this.#callFrameInternal;
|
|
1438
1442
|
}
|
|
1439
1443
|
|
|
1440
1444
|
type(): string {
|
|
1441
|
-
return this
|
|
1445
|
+
return this.#typeInternal;
|
|
1442
1446
|
}
|
|
1443
1447
|
|
|
1444
1448
|
typeName(): string {
|
|
1445
|
-
switch (this
|
|
1449
|
+
switch (this.#typeInternal) {
|
|
1446
1450
|
case Protocol.Debugger.ScopeType.Local:
|
|
1447
1451
|
return i18nString(UIStrings.local);
|
|
1448
1452
|
case Protocol.Debugger.ScopeType.Closure:
|
|
@@ -1466,39 +1470,39 @@ export class Scope implements ScopeChainEntry {
|
|
|
1466
1470
|
}
|
|
1467
1471
|
|
|
1468
1472
|
name(): string|undefined {
|
|
1469
|
-
return this
|
|
1473
|
+
return this.#nameInternal;
|
|
1470
1474
|
}
|
|
1471
1475
|
|
|
1472
1476
|
startLocation(): Location|null {
|
|
1473
|
-
return this
|
|
1477
|
+
return this.#startLocationInternal;
|
|
1474
1478
|
}
|
|
1475
1479
|
|
|
1476
1480
|
endLocation(): Location|null {
|
|
1477
|
-
return this
|
|
1481
|
+
return this.#endLocationInternal;
|
|
1478
1482
|
}
|
|
1479
1483
|
|
|
1480
1484
|
object(): RemoteObject {
|
|
1481
|
-
if (this
|
|
1482
|
-
return this
|
|
1485
|
+
if (this.#objectInternal) {
|
|
1486
|
+
return this.#objectInternal;
|
|
1483
1487
|
}
|
|
1484
|
-
const runtimeModel = this
|
|
1488
|
+
const runtimeModel = this.#callFrameInternal.debuggerModel.runtimeModel();
|
|
1485
1489
|
|
|
1486
|
-
const declarativeScope = this
|
|
1487
|
-
this
|
|
1490
|
+
const declarativeScope = this.#typeInternal !== Protocol.Debugger.ScopeType.With &&
|
|
1491
|
+
this.#typeInternal !== Protocol.Debugger.ScopeType.Global;
|
|
1488
1492
|
if (declarativeScope) {
|
|
1489
|
-
this
|
|
1490
|
-
this
|
|
1493
|
+
this.#objectInternal = runtimeModel.createScopeRemoteObject(
|
|
1494
|
+
this.#payload.object, new ScopeRef(this.#ordinal, this.#callFrameInternal.id));
|
|
1491
1495
|
} else {
|
|
1492
|
-
this
|
|
1496
|
+
this.#objectInternal = runtimeModel.createRemoteObject(this.#payload.object);
|
|
1493
1497
|
}
|
|
1494
1498
|
|
|
1495
|
-
return this
|
|
1499
|
+
return this.#objectInternal;
|
|
1496
1500
|
}
|
|
1497
1501
|
|
|
1498
1502
|
description(): string {
|
|
1499
|
-
const declarativeScope = this
|
|
1500
|
-
this
|
|
1501
|
-
return declarativeScope ? '' : (this
|
|
1503
|
+
const declarativeScope = this.#typeInternal !== Protocol.Debugger.ScopeType.With &&
|
|
1504
|
+
this.#typeInternal !== Protocol.Debugger.ScopeType.Global;
|
|
1505
|
+
return declarativeScope ? '' : (this.#payload.object.description || '');
|
|
1502
1506
|
}
|
|
1503
1507
|
|
|
1504
1508
|
icon(): undefined {
|