chrome-devtools-frontend 1.0.1699061 → 1.0.1700561
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/front_end/core/sdk/CSSPropertyParserMatchers.ts +2 -2
- package/front_end/core/sdk/ServiceWorkerCacheModel.ts +3 -0
- package/front_end/core/sdk/StorageBucketsModel.ts +2 -0
- package/front_end/entrypoints/main/GlobalAiButton.ts +2 -6
- package/front_end/entrypoints/main/MainImpl.ts +8 -1
- package/front_end/generated/InspectorBackendCommands.ts +12 -2
- package/front_end/generated/SupportedCSSProperties.ts +14 -0
- package/front_end/generated/protocol-mapping.d.ts +48 -1
- package/front_end/generated/protocol-proxy-api.d.ts +37 -1
- package/front_end/generated/protocol.ts +131 -0
- package/front_end/models/bindings/NetworkProject.ts +30 -0
- package/front_end/models/bindings/ResourceScriptMapping.ts +62 -0
- package/front_end/models/change_tracker/ChangeTracker.ts +1 -1
- package/front_end/models/comment_manager/CD4ABridge.ts +2 -2
- package/front_end/models/comment_manager/CommentManager.ts +18 -0
- package/front_end/models/extensions/ExtensionAPI.ts +4 -2
- package/front_end/models/issues_manager/CookieIssue.ts +0 -2
- package/front_end/models/persistence/NetworkPersistenceManager.ts +29 -4
- package/front_end/models/source_map_scopes/NamesResolver.ts +23 -1
- package/front_end/models/source_map_scopes/ScopeChainModel.ts +21 -1
- package/front_end/panels/ai_assistance/ai_assistance-meta.ts +5 -8
- package/front_end/panels/application/AppManifestView.ts +128 -134
- package/front_end/panels/application/CrashReportContextView.ts +5 -5
- package/front_end/panels/application/DeviceBoundSessionsTreeElement.ts +17 -17
- package/front_end/panels/application/DeviceBoundSessionsView.ts +136 -137
- package/front_end/panels/application/IndexedDBModel.ts +3 -0
- package/front_end/panels/application/OriginTrialTreeView.ts +18 -23
- package/front_end/panels/application/ReportingApiTreeElement.ts +3 -3
- package/front_end/panels/application/ReportingApiView.ts +6 -14
- package/front_end/panels/application/application-meta.ts +7 -7
- package/front_end/panels/common/CommentThreadWidget.ts +19 -6
- package/front_end/panels/common/CommentsOverlayWidget.ts +115 -9
- package/front_end/panels/common/CommentsStatusBarPill.ts +13 -1
- package/front_end/panels/common/ExtensionServer.ts +43 -34
- package/front_end/panels/common/GeminiRebrandPromoDialog.ts +1 -1
- package/front_end/panels/common/commentThreadWidget.css +18 -0
- package/front_end/panels/common/common-meta.ts +4 -1
- package/front_end/panels/elements/ElementsTreeElement.ts +2 -0
- package/front_end/panels/elements/ElementsTreeOutline.ts +11 -7
- package/front_end/panels/elements/elementsTreeOutline.css +4 -0
- package/front_end/panels/event_listeners/EventListenersView.ts +9 -4
- package/front_end/panels/issues/IssuesPane.ts +34 -22
- package/front_end/panels/network/RequestPayloadView.ts +17 -15
- package/front_end/panels/recorder/RecordingView.ts +32 -53
- package/front_end/panels/recorder/controlButton.css +6 -0
- package/front_end/panels/recorder/recordingView.css +11 -2
- package/front_end/panels/sources/DebuggerPlugin.ts +136 -55
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +17 -15
- package/front_end/panels/timeline/components/IgnoreListSetting.ts +0 -2
- package/front_end/panels/timeline/components/LiveMetricsView.ts +59 -64
- package/front_end/panels/timeline/components/liveMetricsView.css +1 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/lighthouse/README.chromium +2 -2
- package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1580 -1524
- package/front_end/third_party/lighthouse/locales/ar-XB.json +111 -72
- package/front_end/third_party/lighthouse/locales/ar.json +113 -74
- package/front_end/third_party/lighthouse/locales/bg.json +112 -73
- package/front_end/third_party/lighthouse/locales/ca.json +112 -73
- package/front_end/third_party/lighthouse/locales/cs.json +112 -73
- package/front_end/third_party/lighthouse/locales/da.json +112 -73
- package/front_end/third_party/lighthouse/locales/de.json +112 -73
- package/front_end/third_party/lighthouse/locales/el.json +112 -73
- package/front_end/third_party/lighthouse/locales/en-GB.json +111 -72
- package/front_end/third_party/lighthouse/locales/en-US.json +102 -66
- package/front_end/third_party/lighthouse/locales/en-XA.json +111 -72
- package/front_end/third_party/lighthouse/locales/en-XL.json +102 -66
- package/front_end/third_party/lighthouse/locales/es-419.json +112 -73
- package/front_end/third_party/lighthouse/locales/es.json +112 -73
- package/front_end/third_party/lighthouse/locales/fi.json +112 -73
- package/front_end/third_party/lighthouse/locales/fil.json +112 -73
- package/front_end/third_party/lighthouse/locales/fr.json +112 -73
- package/front_end/third_party/lighthouse/locales/he.json +112 -73
- package/front_end/third_party/lighthouse/locales/hi.json +112 -73
- package/front_end/third_party/lighthouse/locales/hr.json +112 -73
- package/front_end/third_party/lighthouse/locales/hu.json +112 -73
- package/front_end/third_party/lighthouse/locales/id.json +112 -73
- package/front_end/third_party/lighthouse/locales/it.json +113 -74
- package/front_end/third_party/lighthouse/locales/ja.json +112 -73
- package/front_end/third_party/lighthouse/locales/ko.json +112 -73
- package/front_end/third_party/lighthouse/locales/lt.json +112 -73
- package/front_end/third_party/lighthouse/locales/lv.json +112 -73
- package/front_end/third_party/lighthouse/locales/nl.json +112 -73
- package/front_end/third_party/lighthouse/locales/no.json +112 -73
- package/front_end/third_party/lighthouse/locales/pl.json +112 -73
- package/front_end/third_party/lighthouse/locales/pt-PT.json +112 -73
- package/front_end/third_party/lighthouse/locales/pt.json +112 -73
- package/front_end/third_party/lighthouse/locales/ro.json +112 -73
- package/front_end/third_party/lighthouse/locales/ru.json +112 -73
- package/front_end/third_party/lighthouse/locales/sk.json +112 -73
- package/front_end/third_party/lighthouse/locales/sl.json +112 -73
- package/front_end/third_party/lighthouse/locales/sr-Latn.json +112 -73
- package/front_end/third_party/lighthouse/locales/sr.json +112 -73
- package/front_end/third_party/lighthouse/locales/sv.json +124 -85
- package/front_end/third_party/lighthouse/locales/ta.json +112 -73
- package/front_end/third_party/lighthouse/locales/te.json +112 -73
- package/front_end/third_party/lighthouse/locales/th.json +112 -73
- package/front_end/third_party/lighthouse/locales/tr.json +113 -74
- package/front_end/third_party/lighthouse/locales/uk.json +112 -73
- package/front_end/third_party/lighthouse/locales/vi.json +112 -73
- package/front_end/third_party/lighthouse/locales/zh-HK.json +112 -73
- package/front_end/third_party/lighthouse/locales/zh-TW.json +113 -74
- package/front_end/third_party/lighthouse/locales/zh.json +113 -74
- package/front_end/third_party/lighthouse/report/bundle.d.ts +4 -4
- package/front_end/third_party/lighthouse/report/bundle.js +10 -3
- package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +2 -2
- package/front_end/third_party/lit/lit.ts +3 -0
- package/front_end/third_party/lit/package.json +3 -0
- package/front_end/third_party/lit/rebuild.sh +3 -2
- package/front_end/ui/comments/CommentAnchorResolver.ts +8 -2
- package/front_end/ui/comments/CommentOverlayManager.ts +2 -1
- package/front_end/ui/legacy/InspectorView.ts +4 -3
- package/front_end/ui/legacy/TabbedPane.ts +121 -80
- package/front_end/ui/legacy/Treeoutline.ts +35 -6
- package/front_end/ui/legacy/UIUtils.ts +7 -0
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +135 -146
- package/front_end/ui/lit/lit.ts +1 -1
- package/front_end/ui/visual_logging/KnownContextValues.ts +4 -0
- package/inspector_overlay/highlight_anchor.ts +197 -0
- package/inspector_overlay/tool_highlight.ts +8 -0
- package/package.json +1 -1
|
@@ -14,6 +14,19 @@ import {type DebuggerSourceMapping, DebuggerWorkspaceBinding} from './DebuggerWo
|
|
|
14
14
|
import {NetworkProject} from './NetworkProject.js';
|
|
15
15
|
import {metadataForURL} from './ResourceUtils.js';
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* The security origin of the URL that `target` (or its closest ancestor that has
|
|
19
|
+
* one) is inspecting, or `null` if none of them has an inspected URL yet.
|
|
20
|
+
*/
|
|
21
|
+
function inspectedSecurityOrigin(target: SDK.Target.Target): SDK.SecurityOrigin.SecurityOrigin|null {
|
|
22
|
+
for (let current: SDK.Target.Target|null = target; current; current = current.parentTarget()) {
|
|
23
|
+
if (current.inspectedURL()) {
|
|
24
|
+
return current.inspectedSecurityOrigin();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
17
30
|
export class ResourceScriptMapping implements DebuggerSourceMapping {
|
|
18
31
|
readonly debuggerModel: SDK.DebuggerModel.DebuggerModel;
|
|
19
32
|
#workspace: Workspace.Workspace.WorkspaceImpl;
|
|
@@ -197,6 +210,19 @@ export class ResourceScriptMapping implements DebuggerSourceMapping {
|
|
|
197
210
|
// Try to resolve `//# sourceURL=` annotations relative to
|
|
198
211
|
// the base URL, according to the sourcemap specification.
|
|
199
212
|
url = SDK.SourceMapManager.SourceMapManager.resolveRelativeSourceURL(script.debuggerModel.target(), url);
|
|
213
|
+
|
|
214
|
+
// `//# sourceURL=` annotations are fully controlled by the page, so don't let
|
|
215
|
+
// them impersonate a resource of a different origin (b/553931271).
|
|
216
|
+
if (!this.#isTrustworthySourceURL(script, url)) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Don't let a synthetic source evict the `UISourceCode` of a script that was
|
|
221
|
+
// actually fetched from the network under the same URL.
|
|
222
|
+
const previousUISourceCode = this.project(script).uiSourceCodeForURL(url);
|
|
223
|
+
if (previousUISourceCode && !NetworkProject.isSourceURLSynthesized(previousUISourceCode)) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
200
226
|
} else {
|
|
201
227
|
// Ignore inline <script>s without `//# sourceURL` annotation here.
|
|
202
228
|
if (script.isInlineScript()) {
|
|
@@ -225,6 +251,9 @@ export class ResourceScriptMapping implements DebuggerSourceMapping {
|
|
|
225
251
|
// Create UISourceCode.
|
|
226
252
|
const originalContentProvider = script.originalContentProvider();
|
|
227
253
|
const uiSourceCode = project.createUISourceCode(url, originalContentProvider.contentType());
|
|
254
|
+
if (script.hasSourceURL) {
|
|
255
|
+
NetworkProject.setSourceURLSynthesized(uiSourceCode);
|
|
256
|
+
}
|
|
228
257
|
NetworkProject.setInitialFrameAttribution(uiSourceCode, script.frameId);
|
|
229
258
|
const metadata = metadataForURL(this.debuggerModel.target(), script.frameId, url);
|
|
230
259
|
|
|
@@ -238,6 +267,39 @@ export class ResourceScriptMapping implements DebuggerSourceMapping {
|
|
|
238
267
|
void this.debuggerWorkspaceBinding.updateLocations(script);
|
|
239
268
|
}
|
|
240
269
|
|
|
270
|
+
/**
|
|
271
|
+
* Whether the (already resolved) `//# sourceURL=` annotation `url` of `script` may
|
|
272
|
+
* be used as-is.
|
|
273
|
+
*
|
|
274
|
+
* Only `http(s)` URLs can collide with genuine network resources, so an origin is
|
|
275
|
+
* only enforced for those. Annotations using other schemes (e.g. `webpack-internal://`,
|
|
276
|
+
* `snippet://` or `chrome-extension://` for content scripts) cannot impersonate a
|
|
277
|
+
* network resource and are always accepted.
|
|
278
|
+
*
|
|
279
|
+
* The origin of the script's frame is authoritative. For targets that don't have a
|
|
280
|
+
* frame (e.g. workers) we fall back to the inspected URL of the target (or of its
|
|
281
|
+
* closest ancestor that has one). If no origin can be established at all, the
|
|
282
|
+
* annotation is rejected, since we cannot rule out that it spoofs another origin.
|
|
283
|
+
*/
|
|
284
|
+
#isTrustworthySourceURL(script: SDK.Script.Script, url: Platform.DevToolsPath.UrlString): boolean {
|
|
285
|
+
if (script.isContentScript()) {
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
const parsedURL = Common.ParsedURL.ParsedURL.fromString(url);
|
|
289
|
+
if (!parsedURL || !['http', 'https'].includes(parsedURL.scheme)) {
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
292
|
+
const target = script.debuggerModel.target();
|
|
293
|
+
const frame = script.frameId ?
|
|
294
|
+
target.model(SDK.ResourceTreeModel.ResourceTreeModel)?.frameForId(script.frameId) ?? null :
|
|
295
|
+
null;
|
|
296
|
+
const securityOrigin = frame ? frame.securityOrigin() : inspectedSecurityOrigin(target);
|
|
297
|
+
if (!securityOrigin) {
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
return SDK.SecurityOrigin.SecurityOrigin.create(url).isSameOriginWith(securityOrigin);
|
|
301
|
+
}
|
|
302
|
+
|
|
241
303
|
scriptFile(uiSourceCode: Workspace.UISourceCode.UISourceCode): ResourceScriptFile|null {
|
|
242
304
|
return this.#uiSourceCodeToScriptFile.get(uiSourceCode) || null;
|
|
243
305
|
}
|
|
@@ -25,7 +25,7 @@ export class ChangeTracker {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
get isTracking(): boolean {
|
|
28
|
-
return Boolean(Root.Runtime.hostConfig.devToolsComments?.enabled);
|
|
28
|
+
return Boolean(Root.Runtime.hostConfig.devToolsComments?.enabled) && this.#commentManager.isAgentAttached();
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
trackChange(
|
|
@@ -132,8 +132,8 @@ export class CD4ABridge extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
setAgentAttached(value: boolean): void {
|
|
136
|
+
this.#commentManager.setAgentAttached(value);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
resolveCommentThread(threadId: string, replyText?: string): boolean {
|
|
@@ -32,11 +32,13 @@ export {
|
|
|
32
32
|
export const enum Events {
|
|
33
33
|
COMMENT_THREADS_CHANGED = 'CommentThreadsChanged',
|
|
34
34
|
COMMENT_MODE_CHANGED = 'CommentModeChanged',
|
|
35
|
+
AGENT_ATTACHED_CHANGED = 'AgentAttachedChanged',
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
export interface EventTypes {
|
|
38
39
|
[Events.COMMENT_THREADS_CHANGED]: CommentThread[];
|
|
39
40
|
[Events.COMMENT_MODE_CHANGED]: boolean;
|
|
41
|
+
[Events.AGENT_ATTACHED_CHANGED]: boolean;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/**
|
|
@@ -45,6 +47,7 @@ export interface EventTypes {
|
|
|
45
47
|
export class CommentManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
|
46
48
|
readonly #commentThreads = new Map<string, CommentThread>();
|
|
47
49
|
#commentMode = false;
|
|
50
|
+
#agentAttached = false;
|
|
48
51
|
|
|
49
52
|
constructor() {
|
|
50
53
|
super();
|
|
@@ -55,6 +58,21 @@ export class CommentManager extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
55
58
|
this.dispatchEventToListeners(Events.COMMENT_THREADS_CHANGED, this.getCommentThreads());
|
|
56
59
|
}
|
|
57
60
|
|
|
61
|
+
setAgentAttached(value: boolean): void {
|
|
62
|
+
if (this.#agentAttached === value) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
this.#agentAttached = value;
|
|
66
|
+
if (!value) {
|
|
67
|
+
this.setCommentMode(false);
|
|
68
|
+
}
|
|
69
|
+
this.dispatchEventToListeners(Events.AGENT_ATTACHED_CHANGED, value);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
isAgentAttached(): boolean {
|
|
73
|
+
return this.#agentAttached;
|
|
74
|
+
}
|
|
75
|
+
|
|
58
76
|
setCommentMode(active: boolean): void {
|
|
59
77
|
if (this.#commentMode === active) {
|
|
60
78
|
return;
|
|
@@ -1586,8 +1586,10 @@ globalThis.injectedExtensionAPI = function(
|
|
|
1586
1586
|
const targetDocument = targetWindowForTest?.document ?? document;
|
|
1587
1587
|
const focused = targetDocument.activeElement;
|
|
1588
1588
|
if (focused) {
|
|
1589
|
-
|
|
1590
|
-
|
|
1589
|
+
// Elements made editable through the EditContext API are not reported as contentEditable.
|
|
1590
|
+
const hasEditContext = 'editContext' in focused && Boolean(focused.editContext);
|
|
1591
|
+
const isInput = focused.nodeName === 'INPUT' || focused.nodeName === 'TEXTAREA' ||
|
|
1592
|
+
(focused as HTMLElement).isContentEditable || hasEditContext;
|
|
1591
1593
|
if (isInput && !(requestPayload.ctrlKey || requestPayload.altKey || requestPayload.metaKey)) {
|
|
1592
1594
|
return;
|
|
1593
1595
|
}
|
|
@@ -306,8 +306,6 @@ export function isCausedByThirdParty(
|
|
|
306
306
|
// site. Only cookies that have their domain also set to this third-party
|
|
307
307
|
// are included in the request. We assume that the cookie was set by the same
|
|
308
308
|
// third-party at some point, so we treat this as a third-party issue.
|
|
309
|
-
//
|
|
310
|
-
// TODO(crbug.com/1080589): Use "First-Party sets" instead of the sites registered domain.
|
|
311
309
|
return !isSubdomainOf(parsedCookieUrl.domain(), outermostFrame.domainAndRegistry());
|
|
312
310
|
}
|
|
313
311
|
|
|
@@ -9,6 +9,7 @@ import * as Root from '../../core/root/root.js';
|
|
|
9
9
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
10
10
|
import * as TextUtils from '../../core/text_utils/text_utils.js';
|
|
11
11
|
import * as Protocol from '../../generated/protocol.js';
|
|
12
|
+
import * as Bindings from '../bindings/bindings.js';
|
|
12
13
|
import * as Breakpoints from '../breakpoints/breakpoints.js';
|
|
13
14
|
import * as Workspace from '../workspace/workspace.js';
|
|
14
15
|
|
|
@@ -431,8 +432,32 @@ export class NetworkPersistenceManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
431
432
|
}
|
|
432
433
|
|
|
433
434
|
isUISourceCodeOverridable(uiSourceCode: Workspace.UISourceCode.UISourceCode): boolean {
|
|
434
|
-
|
|
435
|
-
|
|
435
|
+
if (uiSourceCode.project().type() !== Workspace.Workspace.projectTypes.Network) {
|
|
436
|
+
return false;
|
|
437
|
+
}
|
|
438
|
+
if (NetworkPersistenceManager.isForbiddenNetworkUrl(uiSourceCode.url())) {
|
|
439
|
+
return false;
|
|
440
|
+
}
|
|
441
|
+
// A `//# sourceURL=` annotation is fully controlled by the page and doesn't refer
|
|
442
|
+
// to an actual network resource, so there is nothing to override here. Persisting
|
|
443
|
+
// it would poison the overrides folder with a file that masquerades as a genuine
|
|
444
|
+
// resource (b/553931271).
|
|
445
|
+
if (Bindings.NetworkProject.NetworkProject.isSourceURLSynthesized(uiSourceCode)) {
|
|
446
|
+
return false;
|
|
447
|
+
}
|
|
448
|
+
return true;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Whether the contents of `uiSourceCode` may be written into the overrides folder.
|
|
453
|
+
*
|
|
454
|
+
* Sources that originate from a source map are overridable in the sense that the
|
|
455
|
+
* deployed resource they are mapped from can be overridden (see
|
|
456
|
+
* `PersistenceActions`), but their own URL and content are page controlled and
|
|
457
|
+
* must never be persisted themselves (b/553931271).
|
|
458
|
+
*/
|
|
459
|
+
#canPersistUISourceCodeAsOverride(uiSourceCode: Workspace.UISourceCode.UISourceCode): boolean {
|
|
460
|
+
return this.isUISourceCodeOverridable(uiSourceCode) && !uiSourceCode.contentType().isFromSourceMap();
|
|
436
461
|
}
|
|
437
462
|
|
|
438
463
|
#isUISourceCodeAlreadyOverridden(uiSourceCode: Workspace.UISourceCode.UISourceCode): boolean {
|
|
@@ -445,12 +470,12 @@ export class NetworkPersistenceManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
445
470
|
}
|
|
446
471
|
|
|
447
472
|
#canSaveUISourceCodeForOverrides(uiSourceCode: Workspace.UISourceCode.UISourceCode): boolean {
|
|
448
|
-
return this.#active && this
|
|
473
|
+
return this.#active && this.#canPersistUISourceCodeAsOverride(uiSourceCode) &&
|
|
449
474
|
!this.#isUISourceCodeAlreadyOverridden(uiSourceCode);
|
|
450
475
|
}
|
|
451
476
|
|
|
452
477
|
async setupAndStartLocalOverrides(uiSourceCode: Workspace.UISourceCode.UISourceCode): Promise<boolean> {
|
|
453
|
-
if (!this
|
|
478
|
+
if (!this.#canPersistUISourceCodeAsOverride(uiSourceCode)) {
|
|
454
479
|
return false;
|
|
455
480
|
}
|
|
456
481
|
// No overrides folder, set it up
|
|
@@ -545,6 +545,7 @@ class ScopeWithSourceMappedVariables implements SDK.DebuggerModel.ScopeChainEntr
|
|
|
545
545
|
/** The resolved `this` of the current call frame */
|
|
546
546
|
readonly #thisObject: SDK.RemoteObject.RemoteObject|null;
|
|
547
547
|
readonly #debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding;
|
|
548
|
+
#object?: SDK.RemoteObject.RemoteObject;
|
|
548
549
|
|
|
549
550
|
constructor(scope: SDK.DebuggerModel.ScopeChainEntry, thisObject: SDK.RemoteObject.RemoteObject|null,
|
|
550
551
|
debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding) {
|
|
@@ -574,7 +575,10 @@ class ScopeWithSourceMappedVariables implements SDK.DebuggerModel.ScopeChainEntr
|
|
|
574
575
|
}
|
|
575
576
|
|
|
576
577
|
object(): SDK.RemoteObject.RemoteObject {
|
|
577
|
-
|
|
578
|
+
if (!this.#object) {
|
|
579
|
+
this.#object = resolveScopeInObject(this.#debuggerScope, this.#debuggerWorkspaceBinding);
|
|
580
|
+
}
|
|
581
|
+
return this.#object;
|
|
578
582
|
}
|
|
579
583
|
|
|
580
584
|
description(): string {
|
|
@@ -599,6 +603,8 @@ export class RemoteObject extends SDK.RemoteObject.RemoteObject {
|
|
|
599
603
|
private readonly scope: SDK.DebuggerModel.ScopeChainEntry;
|
|
600
604
|
private readonly object: SDK.RemoteObject.RemoteObject;
|
|
601
605
|
readonly #debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding;
|
|
606
|
+
#allPropertiesPromise?: Promise<SDK.RemoteObject.GetPropertiesResult>;
|
|
607
|
+
#cachedWithPreview = false;
|
|
602
608
|
|
|
603
609
|
constructor(scope: SDK.DebuggerModel.ScopeChainEntry,
|
|
604
610
|
debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding) {
|
|
@@ -650,6 +656,18 @@ export class RemoteObject extends SDK.RemoteObject.RemoteObject {
|
|
|
650
656
|
|
|
651
657
|
override async getAllProperties(accessorPropertiesOnly: boolean, generatePreview: boolean):
|
|
652
658
|
Promise<SDK.RemoteObject.GetPropertiesResult> {
|
|
659
|
+
if (accessorPropertiesOnly) {
|
|
660
|
+
return await this.#resolveAllProperties(true, generatePreview);
|
|
661
|
+
}
|
|
662
|
+
if (!this.#allPropertiesPromise || (generatePreview && !this.#cachedWithPreview)) {
|
|
663
|
+
this.#cachedWithPreview = generatePreview;
|
|
664
|
+
this.#allPropertiesPromise = this.#resolveAllProperties(false, generatePreview);
|
|
665
|
+
}
|
|
666
|
+
return await this.#allPropertiesPromise;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
async #resolveAllProperties(accessorPropertiesOnly: boolean,
|
|
670
|
+
generatePreview: boolean): Promise<SDK.RemoteObject.GetPropertiesResult> {
|
|
653
671
|
const allProperties = await this.object.getAllProperties(accessorPropertiesOnly, generatePreview);
|
|
654
672
|
const {variableMapping} = await resolveDebuggerScope(this.scope, this.#debuggerWorkspaceBinding);
|
|
655
673
|
|
|
@@ -664,6 +682,8 @@ export class RemoteObject extends SDK.RemoteObject.RemoteObject {
|
|
|
664
682
|
|
|
665
683
|
override async setPropertyValue(argumentName: string|Protocol.Runtime.CallArgument, value: string):
|
|
666
684
|
Promise<string|undefined> {
|
|
685
|
+
this.#allPropertiesPromise = undefined;
|
|
686
|
+
this.#cachedWithPreview = false;
|
|
667
687
|
const {variableMapping} = await resolveDebuggerScope(this.scope, this.#debuggerWorkspaceBinding);
|
|
668
688
|
|
|
669
689
|
let name;
|
|
@@ -684,6 +704,8 @@ export class RemoteObject extends SDK.RemoteObject.RemoteObject {
|
|
|
684
704
|
}
|
|
685
705
|
|
|
686
706
|
override async deleteProperty(name: Protocol.Runtime.CallArgument): Promise<string|undefined> {
|
|
707
|
+
this.#allPropertiesPromise = undefined;
|
|
708
|
+
this.#cachedWithPreview = false;
|
|
687
709
|
return await this.object.deleteProperty(name);
|
|
688
710
|
}
|
|
689
711
|
|
|
@@ -21,6 +21,9 @@ import {resolveScopeChain} from './NamesResolver.js';
|
|
|
21
21
|
* This class tracks all that and sends events with the latest scope chain for a specific call frame.
|
|
22
22
|
*/
|
|
23
23
|
export class ScopeChainModel extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
|
24
|
+
static readonly #cachedScopeChainByCallFrame =
|
|
25
|
+
new WeakMap<SDK.DebuggerModel.CallFrame, Promise<SDK.DebuggerModel.ScopeChainEntry[]>>();
|
|
26
|
+
|
|
24
27
|
readonly #callFrame: SDK.DebuggerModel.CallFrame;
|
|
25
28
|
readonly #debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding;
|
|
26
29
|
|
|
@@ -53,13 +56,29 @@ export class ScopeChainModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
53
56
|
this.listeners?.clear();
|
|
54
57
|
}
|
|
55
58
|
|
|
59
|
+
static resolveScopeChain(callFrame: SDK.DebuggerModel.CallFrame,
|
|
60
|
+
debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding):
|
|
61
|
+
Promise<SDK.DebuggerModel.ScopeChainEntry[]> {
|
|
62
|
+
let cachedPromise = ScopeChainModel.#cachedScopeChainByCallFrame.get(callFrame);
|
|
63
|
+
if (!cachedPromise) {
|
|
64
|
+
cachedPromise = resolveScopeChain(callFrame, debuggerWorkspaceBinding);
|
|
65
|
+
ScopeChainModel.#cachedScopeChainByCallFrame.set(callFrame, cachedPromise);
|
|
66
|
+
}
|
|
67
|
+
return cachedPromise;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
resolveScopeChain(): Promise<SDK.DebuggerModel.ScopeChainEntry[]> {
|
|
71
|
+
return ScopeChainModel.resolveScopeChain(this.#callFrame, this.#debuggerWorkspaceBinding);
|
|
72
|
+
}
|
|
73
|
+
|
|
56
74
|
async #update(): Promise<void> {
|
|
57
|
-
const scopeChain = await resolveScopeChain(
|
|
75
|
+
const scopeChain = await this.resolveScopeChain();
|
|
58
76
|
this.dispatchEventToListeners(Events.SCOPE_CHAIN_UPDATED, new ScopeChain(scopeChain));
|
|
59
77
|
}
|
|
60
78
|
|
|
61
79
|
#debugInfoAttached(event: Common.EventTarget.EventTargetEvent<SDK.Script.Script>): void {
|
|
62
80
|
if (event.data === this.#callFrame.script) {
|
|
81
|
+
ScopeChainModel.#cachedScopeChainByCallFrame.delete(this.#callFrame);
|
|
63
82
|
void this.#throttler.schedule(this.#boundUpdate);
|
|
64
83
|
}
|
|
65
84
|
}
|
|
@@ -67,6 +86,7 @@ export class ScopeChainModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
67
86
|
#sourceMapChanged(event: Common.EventTarget
|
|
68
87
|
.EventTargetEvent<{client: SDK.Script.Script, sourceMap: SDK.SourceMap.SourceMap}>): void {
|
|
69
88
|
if (event.data.client === this.#callFrame.script) {
|
|
89
|
+
ScopeChainModel.#cachedScopeChainByCallFrame.delete(this.#callFrame);
|
|
70
90
|
void this.#throttler.schedule(this.#boundUpdate);
|
|
71
91
|
}
|
|
72
92
|
}
|
|
@@ -35,22 +35,18 @@ const UIStrings = {
|
|
|
35
35
|
* the current context.
|
|
36
36
|
*/
|
|
37
37
|
debugWithAi: 'Debug with AI',
|
|
38
|
-
/**
|
|
39
|
-
* @description The title of the Gemini panel.
|
|
40
|
-
*/
|
|
41
|
-
gemini: 'Gemini',
|
|
42
38
|
/**
|
|
43
39
|
* @description The title of the command menu action for showing the Gemini panel.
|
|
44
40
|
*/
|
|
45
|
-
showGemini: 'Show Gemini',
|
|
41
|
+
showGemini: 'Show `Gemini`',
|
|
46
42
|
/**
|
|
47
43
|
* @description The setting title to enable the Gemini via the settings tab.
|
|
48
44
|
*/
|
|
49
|
-
enableGemini: 'Enable Gemini',
|
|
45
|
+
enableGemini: 'Enable `Gemini`',
|
|
50
46
|
/**
|
|
51
47
|
* @description Text of a context menu item to redirect to the Gemini panel with the current context.
|
|
52
48
|
*/
|
|
53
|
-
debugWithGemini: 'Debug with Gemini',
|
|
49
|
+
debugWithGemini: 'Debug with `Gemini`',
|
|
54
50
|
} as const;
|
|
55
51
|
|
|
56
52
|
const str_ = i18n.i18n.registerUIStrings('panels/ai_assistance/ai_assistance-meta.ts', UIStrings);
|
|
@@ -108,7 +104,8 @@ UI.ViewManager.registerViewExtension({
|
|
|
108
104
|
location: UI.ViewManager.ViewLocationValues.DRAWER_VIEW,
|
|
109
105
|
id: 'freestyler',
|
|
110
106
|
commandPrompt: i18nAiBrandedString(UIStrings.showGemini, UIStrings.showAiAssistance),
|
|
111
|
-
title:
|
|
107
|
+
title: () => Root.Runtime.hostConfig.devToolsGeminiRebranding?.enabled ? i18n.i18n.lockedString('Gemini') :
|
|
108
|
+
i18nString(UIStrings.aiAssistance),
|
|
112
109
|
order: 10,
|
|
113
110
|
persistence: UI.ViewManager.ViewPersistence.CLOSEABLE,
|
|
114
111
|
hasToolbar: false,
|