chrome-devtools-frontend 1.0.1536371 → 1.0.1537268
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/host/AidaClient.ts +64 -5
- package/front_end/core/host/DispatchHttpRequestClient.ts +62 -0
- package/front_end/core/host/GdpClient.ts +8 -57
- package/front_end/core/host/host.ts +2 -0
- package/front_end/core/protocol_client/CDPConnection.ts +10 -8
- package/front_end/core/protocol_client/InspectorBackend.ts +36 -42
- package/front_end/core/sdk/EnhancedTracesParser.ts +20 -5
- package/front_end/core/sdk/RehydratingConnection.ts +112 -4
- package/front_end/core/sdk/RehydratingObject.ts +8 -0
- package/front_end/core/sdk/TraceObject.ts +5 -1
- package/front_end/models/javascript_metadata/NativeFunctions.js +1 -1
- package/front_end/models/trace/types/File.ts +9 -0
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +5 -9
- package/front_end/panels/ai_assistance/components/ChatView.ts +58 -70
- package/front_end/panels/application/BackForwardCacheTreeElement.ts +2 -6
- package/front_end/panels/application/components/BackForwardCacheView.ts +74 -69
- package/front_end/panels/application/components/FrameDetailsView.ts +8 -11
- package/front_end/panels/application/components/OriginTrialTreeView.ts +65 -69
- package/front_end/panels/application/components/backForwardCacheView.css +4 -0
- package/front_end/panels/application/components/badge.css +1 -1
- package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +44 -53
- package/front_end/panels/recorder/RecorderController.ts +1 -2
- package/front_end/panels/recorder/components/CreateRecordingView.ts +153 -129
- package/front_end/panels/settings/AISettingsTab.ts +162 -171
- package/front_end/panels/settings/SettingsScreen.ts +3 -7
- package/front_end/panels/settings/aiSettingsTab.css +151 -148
- package/front_end/panels/settings/settings-meta.ts +1 -2
- package/front_end/panels/sources/AddSourceMapURLDialog.ts +23 -26
- package/front_end/panels/timeline/TimelinePanel.ts +60 -11
- package/front_end/panels/timeline/components/ExportTraceOptions.ts +33 -34
- package/front_end/third_party/chromium/README.chromium +2 -2
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts +9 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BrowserContext.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts +13 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.js +5 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js +3 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Realm.d.ts +1 -12
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Realm.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.d.ts +6 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js +6 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.d.ts +2 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js +3 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/disposable.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/disposable.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/disposable.js +3 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/disposable.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/util.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/util.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/util.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/util.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +28 -3
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +21 -10
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts +9 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BrowserContext.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts +13 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.js +5 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js +3 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Realm.d.ts +1 -12
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Realm.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.d.ts +6 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js +6 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.d.ts +2 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js +3 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/disposable.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/disposable.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/disposable.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/disposable.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/util.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/util.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/util.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/util.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +28 -3
- package/front_end/third_party/puppeteer/package/package.json +2 -2
- package/front_end/third_party/puppeteer/package/src/api/Browser.ts +13 -1
- package/front_end/third_party/puppeteer/package/src/api/BrowserContext.ts +7 -2
- package/front_end/third_party/puppeteer/package/src/api/Page.ts +14 -1
- package/front_end/third_party/puppeteer/package/src/bidi/BrowserContext.ts +8 -5
- package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +5 -2
- package/front_end/third_party/puppeteer/package/src/cdp/Accessibility.ts +8 -0
- package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +11 -2
- package/front_end/third_party/puppeteer/package/src/cdp/BrowserContext.ts +3 -2
- package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +5 -5
- package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/util/disposable.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/util/util.ts +1 -0
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +280 -0
- package/front_end/ui/components/text_editor/text_editor.ts +1 -0
- package/front_end/ui/components/tooltips/Tooltip.ts +1 -1
- package/front_end/ui/legacy/Dialog.ts +0 -1
- package/front_end/ui/legacy/SettingsUI.ts +0 -14
- package/front_end/ui/legacy/XLink.ts +0 -3
- package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +9 -0
- package/front_end/ui/legacy/components/utils/Linkifier.ts +9 -3
- package/front_end/ui/visual_logging/KnownContextValues.ts +1 -1
- package/mcp/mcp.ts +5 -0
- package/package.json +1 -1
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatterBounds.snapshot.txt +0 -4
- package/front_end/ui/components/docs/breadcrumbs_perf/initial-breadcrumb-perf.html +0 -20
- package/front_end/ui/components/docs/breadcrumbs_perf/initial-breadcrumb-perf.ts +0 -25
- package/front_end/ui/components/docs/breadcrumbs_perf/nested-breadcrumbs-perf.html +0 -20
- package/front_end/ui/components/docs/breadcrumbs_perf/nested-breadcrumbs-perf.ts +0 -36
|
@@ -32,8 +32,8 @@ import * as Root from '../root/root.js';
|
|
|
32
32
|
|
|
33
33
|
import * as EnhancedTraces from './EnhancedTracesParser.js';
|
|
34
34
|
import type {
|
|
35
|
-
ProtocolMessage, RehydratingExecutionContext, RehydratingScript, RehydratingTarget,
|
|
36
|
-
'./RehydratingObject.js';
|
|
35
|
+
ProtocolMessage, RehydratingExecutionContext, RehydratingResource, RehydratingScript, RehydratingTarget,
|
|
36
|
+
ServerMessage} from './RehydratingObject.js';
|
|
37
37
|
import {TraceObject} from './TraceObject.js';
|
|
38
38
|
|
|
39
39
|
const UIStrings = {
|
|
@@ -157,6 +157,7 @@ export class RehydratingConnection implements ProtocolClient.ConnectionTransport
|
|
|
157
157
|
const target = hydratingDataPerTarget.target;
|
|
158
158
|
const executionContexts = hydratingDataPerTarget.executionContexts;
|
|
159
159
|
const scripts = hydratingDataPerTarget.scripts;
|
|
160
|
+
const resources = hydratingDataPerTarget.resources;
|
|
160
161
|
this.postToFrontend({
|
|
161
162
|
method: 'Target.targetCreated',
|
|
162
163
|
params: {
|
|
@@ -172,7 +173,7 @@ export class RehydratingConnection implements ProtocolClient.ConnectionTransport
|
|
|
172
173
|
});
|
|
173
174
|
|
|
174
175
|
sessionId += 1;
|
|
175
|
-
const session = new RehydratingSession(sessionId, target, executionContexts, scripts, this);
|
|
176
|
+
const session = new RehydratingSession(sessionId, target, executionContexts, scripts, resources, this);
|
|
176
177
|
this.sessions.set(sessionId, session);
|
|
177
178
|
session.declareSessionAttachedToTarget();
|
|
178
179
|
}
|
|
@@ -267,15 +268,17 @@ export class RehydratingSession extends RehydratingSessionBase {
|
|
|
267
268
|
target: RehydratingTarget;
|
|
268
269
|
executionContexts: RehydratingExecutionContext[] = [];
|
|
269
270
|
scripts: RehydratingScript[] = [];
|
|
271
|
+
resources: RehydratingResource[] = [];
|
|
270
272
|
|
|
271
273
|
constructor(
|
|
272
274
|
sessionId: number, target: RehydratingTarget, executionContexts: RehydratingExecutionContext[],
|
|
273
|
-
scripts: RehydratingScript[], connection: RehydratingConnectionInterface) {
|
|
275
|
+
scripts: RehydratingScript[], resources: RehydratingResource[], connection: RehydratingConnectionInterface) {
|
|
274
276
|
super(connection);
|
|
275
277
|
this.sessionId = sessionId;
|
|
276
278
|
this.target = target;
|
|
277
279
|
this.executionContexts = executionContexts;
|
|
278
280
|
this.scripts = scripts;
|
|
281
|
+
this.resources = resources;
|
|
279
282
|
}
|
|
280
283
|
|
|
281
284
|
override sendMessageToFrontend(payload: ServerMessage, attachSessionId = true): void {
|
|
@@ -294,12 +297,31 @@ export class RehydratingSession extends RehydratingSessionBase {
|
|
|
294
297
|
case 'Debugger.enable':
|
|
295
298
|
this.handleDebuggerEnable(data.id);
|
|
296
299
|
break;
|
|
300
|
+
case 'CSS.enable':
|
|
301
|
+
this.sendMessageToFrontend({
|
|
302
|
+
id: data.id,
|
|
303
|
+
result: {},
|
|
304
|
+
});
|
|
305
|
+
break;
|
|
297
306
|
case 'Debugger.getScriptSource':
|
|
298
307
|
if (data.params) {
|
|
299
308
|
const params = data.params as Protocol.Debugger.GetScriptSourceRequest;
|
|
300
309
|
this.handleDebuggerGetScriptSource(data.id, params.scriptId);
|
|
301
310
|
}
|
|
302
311
|
break;
|
|
312
|
+
case 'Page.getResourceTree':
|
|
313
|
+
this.handleGetResourceTree(data.id);
|
|
314
|
+
break;
|
|
315
|
+
case 'Page.getResourceContent': {
|
|
316
|
+
const request = data.params as unknown as Protocol.Page.GetResourceContentRequest;
|
|
317
|
+
this.handleGetResourceContent(request.frameId, request.url, data.id);
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
case 'CSS.getStyleSheetText': {
|
|
321
|
+
const request = data.params as unknown as Protocol.CSS.GetStyleSheetTextRequest;
|
|
322
|
+
this.handleGetStyleSheetText(request.styleSheetId, data.id);
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
303
325
|
default:
|
|
304
326
|
this.sendMessageToFrontend({
|
|
305
327
|
id: data.id,
|
|
@@ -368,7 +390,22 @@ export class RehydratingSession extends RehydratingSessionBase {
|
|
|
368
390
|
// script parsed event to communicate the current script state and respond with a mock
|
|
369
391
|
// debugger id.
|
|
370
392
|
private handleDebuggerEnable(id: number): void {
|
|
393
|
+
const htmlResourceUrls = new Set(this.resources.filter(r => r.mimeType === 'text/html').map(r => r.url));
|
|
394
|
+
|
|
371
395
|
for (const script of this.scripts) {
|
|
396
|
+
// Handle inline scripts.
|
|
397
|
+
if (htmlResourceUrls.has(script.url)) {
|
|
398
|
+
script.embedderName = script.url;
|
|
399
|
+
// We don't have the actual embedded offset from this trace event. Non-zero
|
|
400
|
+
// values are important though: that is what `Script.isInlineScript()`
|
|
401
|
+
// checks. Otherwise these scripts would try to show individually within the
|
|
402
|
+
// Sources panel.
|
|
403
|
+
script.startColumn = 1;
|
|
404
|
+
script.startLine = 1;
|
|
405
|
+
script.endColumn = 1;
|
|
406
|
+
script.endLine = 1;
|
|
407
|
+
}
|
|
408
|
+
|
|
372
409
|
this.sendMessageToFrontend({
|
|
373
410
|
method: 'Debugger.scriptParsed',
|
|
374
411
|
params: script,
|
|
@@ -383,4 +420,75 @@ export class RehydratingSession extends RehydratingSessionBase {
|
|
|
383
420
|
},
|
|
384
421
|
});
|
|
385
422
|
}
|
|
423
|
+
|
|
424
|
+
private handleGetResourceTree(id: number): void {
|
|
425
|
+
const resources = this.resources.filter(r => r.mimeType === 'text/html' || r.mimeType === 'text/css');
|
|
426
|
+
if (!resources.length) {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
const frameTree = {
|
|
431
|
+
frame: {
|
|
432
|
+
id: this.target.targetId,
|
|
433
|
+
url: this.target.url,
|
|
434
|
+
},
|
|
435
|
+
childFrames: [],
|
|
436
|
+
resources: resources.map(r => ({
|
|
437
|
+
url: r.url,
|
|
438
|
+
type: r.mimeType === 'text/html' ? 'Document' : 'Stylesheet',
|
|
439
|
+
mimeType: r.mimeType,
|
|
440
|
+
contentSize: r.content.length,
|
|
441
|
+
})),
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
this.sendMessageToFrontend({
|
|
445
|
+
id,
|
|
446
|
+
result: {
|
|
447
|
+
frameTree,
|
|
448
|
+
},
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
const stylesheets = this.resources.filter(r => r.mimeType === 'text/css');
|
|
452
|
+
for (const stylesheet of stylesheets) {
|
|
453
|
+
this.sendMessageToFrontend({
|
|
454
|
+
method: 'CSS.styleSheetAdded',
|
|
455
|
+
params: {
|
|
456
|
+
header: {
|
|
457
|
+
styleSheetId: `sheet.${stylesheet.frame}.${stylesheet.url}`,
|
|
458
|
+
frameId: stylesheet.frame,
|
|
459
|
+
sourceURL: stylesheet.url,
|
|
460
|
+
},
|
|
461
|
+
},
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
private handleGetResourceContent(frame: string, url: string, id: number): void {
|
|
467
|
+
const resource = this.resources.find(r => r.frame === frame && r.url === url);
|
|
468
|
+
if (!resource) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
this.sendMessageToFrontend({
|
|
473
|
+
id,
|
|
474
|
+
result: {
|
|
475
|
+
content: resource.content,
|
|
476
|
+
base64Encoded: false,
|
|
477
|
+
},
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
private handleGetStyleSheetText(stylesheetId: string, id: number): void {
|
|
482
|
+
const resource = this.resources.find(r => `sheet.${r.frame}.${r.url}` === stylesheetId);
|
|
483
|
+
if (!resource) {
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
this.sendMessageToFrontend({
|
|
488
|
+
id,
|
|
489
|
+
result: {
|
|
490
|
+
text: resource.content,
|
|
491
|
+
},
|
|
492
|
+
});
|
|
493
|
+
}
|
|
386
494
|
}
|
|
@@ -14,6 +14,13 @@ export interface RehydratingScript extends Protocol.Debugger.ScriptParsedEvent {
|
|
|
14
14
|
pid: number;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
export interface RehydratingResource {
|
|
18
|
+
url: string;
|
|
19
|
+
content: string;
|
|
20
|
+
frame: string;
|
|
21
|
+
mimeType: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
17
24
|
export interface RehydratingExecutionContextAuxData {
|
|
18
25
|
frameId?: Protocol.Page.FrameId;
|
|
19
26
|
isDefault?: boolean;
|
|
@@ -39,6 +46,7 @@ export interface HydratingDataPerTarget {
|
|
|
39
46
|
target: RehydratingTarget;
|
|
40
47
|
executionContexts: RehydratingExecutionContext[];
|
|
41
48
|
scripts: RehydratingScript[];
|
|
49
|
+
resources: RehydratingResource[];
|
|
42
50
|
}
|
|
43
51
|
|
|
44
52
|
export interface ProtocolMessage {
|
|
@@ -7,13 +7,17 @@ import type * as Platform from '../../core/platform/platform.js';
|
|
|
7
7
|
import type * as Protocol from '../../generated/protocol.js';
|
|
8
8
|
|
|
9
9
|
import type {NetworkRequest} from './NetworkRequest.js';
|
|
10
|
+
import type {RehydratingResource} from './RehydratingObject.js';
|
|
10
11
|
import {ResourceTreeModel} from './ResourceTreeModel.js';
|
|
11
12
|
import type {SourceMapV3} from './SourceMap.js';
|
|
12
13
|
|
|
13
14
|
/** A thin wrapper class, mostly to enable instanceof-based revealing of traces to open in Timeline. **/
|
|
14
15
|
export class TraceObject {
|
|
15
16
|
readonly traceEvents: Protocol.Tracing.DataCollectedEvent['value'];
|
|
16
|
-
readonly metadata: {
|
|
17
|
+
readonly metadata: {
|
|
18
|
+
sourceMaps?: Array<{sourceMapUrl: string, sourceMap: SourceMapV3, url: string}>,
|
|
19
|
+
resources?: RehydratingResource[],
|
|
20
|
+
};
|
|
17
21
|
constructor(payload: Protocol.Tracing.DataCollectedEvent['value']|TraceObject, meta?: Object) {
|
|
18
22
|
if (Array.isArray(payload)) {
|
|
19
23
|
this.traceEvents = payload;
|
|
@@ -219,6 +219,8 @@ export interface MetaData {
|
|
|
219
219
|
cruxFieldData?: CrUXManager.PageResult[];
|
|
220
220
|
/** Currently only stores JS maps, not CSS. This never stores data url source maps. */
|
|
221
221
|
sourceMaps?: MetadataSourceMap[];
|
|
222
|
+
/** Currently only stores HTML and CSS resources. */
|
|
223
|
+
resources?: MetadataResource[];
|
|
222
224
|
visualTrackConfig?: PersistedTraceVisualConfig;
|
|
223
225
|
hostDPR?: number;
|
|
224
226
|
}
|
|
@@ -230,6 +232,13 @@ export interface MetadataSourceMap {
|
|
|
230
232
|
sourceMap: SDK.SourceMap.SourceMapV3;
|
|
231
233
|
}
|
|
232
234
|
|
|
235
|
+
export interface MetadataResource {
|
|
236
|
+
url: string;
|
|
237
|
+
frame: string;
|
|
238
|
+
content: string;
|
|
239
|
+
mimeType: string;
|
|
240
|
+
}
|
|
241
|
+
|
|
233
242
|
export type Contents = TraceFile|Event[];
|
|
234
243
|
|
|
235
244
|
export function traceEventKeyToValues(key: SerializableKey): SerializableKeyValues {
|
|
@@ -531,13 +531,9 @@ export class AiAssistancePanel extends UI.Panel.Panel {
|
|
|
531
531
|
#getChatUiState(): ChatViewState {
|
|
532
532
|
const blockedByAge = Root.Runtime.hostConfig.aidaAvailability?.blockedByAge === true;
|
|
533
533
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
return ChatViewState.
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
if (!this.#aiAssistanceEnabledSetting?.getIfNotDisabled() || blockedByAge) {
|
|
540
|
-
return ChatViewState.CONSENT_VIEW;
|
|
534
|
+
if (this.#aidaAvailability !== Host.AidaClient.AidaAccessPreconditions.AVAILABLE ||
|
|
535
|
+
!this.#aiAssistanceEnabledSetting?.getIfNotDisabled() || blockedByAge) {
|
|
536
|
+
return ChatViewState.DISABLED_VIEW;
|
|
541
537
|
}
|
|
542
538
|
|
|
543
539
|
if (this.#conversation?.type) {
|
|
@@ -986,7 +982,7 @@ export class AiAssistancePanel extends UI.Panel.Panel {
|
|
|
986
982
|
|
|
987
983
|
#getChatInputPlaceholder(): Platform.UIString.LocalizedString {
|
|
988
984
|
const state = this.#getChatUiState();
|
|
989
|
-
if (state === ChatViewState.
|
|
985
|
+
if (state === ChatViewState.DISABLED_VIEW || !this.#conversation) {
|
|
990
986
|
return i18nString(UIStrings.followTheSteps);
|
|
991
987
|
}
|
|
992
988
|
|
|
@@ -1019,7 +1015,7 @@ export class AiAssistancePanel extends UI.Panel.Panel {
|
|
|
1019
1015
|
|
|
1020
1016
|
#getDisclaimerText(): Platform.UIString.LocalizedString {
|
|
1021
1017
|
const state = this.#getChatUiState();
|
|
1022
|
-
if (state === ChatViewState.
|
|
1018
|
+
if (state === ChatViewState.DISABLED_VIEW || !this.#conversation || this.#conversation.isReadOnly) {
|
|
1023
1019
|
return i18nString(UIStrings.inputDisclaimerForEmptyState);
|
|
1024
1020
|
}
|
|
1025
1021
|
|
|
@@ -204,10 +204,6 @@ const UIStringsNotTranslate = {
|
|
|
204
204
|
* @description Title for the add image button.
|
|
205
205
|
*/
|
|
206
206
|
addImageButtonTitle: 'Add image',
|
|
207
|
-
/**
|
|
208
|
-
* @description Disclaimer text right after the chat input.
|
|
209
|
-
*/
|
|
210
|
-
inputDisclaimerForEmptyState: 'This is an experimental AI feature and won\'t always get it right.',
|
|
211
207
|
} as const;
|
|
212
208
|
|
|
213
209
|
const str_ = i18n.i18n.registerUIStrings('panels/ai_assistance/components/ChatView.ts', UIStrings);
|
|
@@ -264,7 +260,7 @@ export interface ModelChatMessage {
|
|
|
264
260
|
export type ChatMessage = UserChatMessage|ModelChatMessage;
|
|
265
261
|
|
|
266
262
|
export const enum State {
|
|
267
|
-
|
|
263
|
+
DISABLED_VIEW = 'disabled-view',
|
|
268
264
|
CHAT_VIEW = 'chat-view',
|
|
269
265
|
EXPLORE_VIEW = 'explore-view'
|
|
270
266
|
}
|
|
@@ -517,6 +513,10 @@ export class ChatView extends HTMLElement {
|
|
|
517
513
|
|
|
518
514
|
#render(): void {
|
|
519
515
|
const renderFooter = (): Lit.LitTemplate => {
|
|
516
|
+
if (this.#props.state !== State.CHAT_VIEW) {
|
|
517
|
+
return Lit.nothing;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
520
|
const classes = Lit.Directives.classMap({
|
|
521
521
|
'chat-view-footer': true,
|
|
522
522
|
'has-conversation': !!this.#props.conversationType,
|
|
@@ -524,35 +524,58 @@ export class ChatView extends HTMLElement {
|
|
|
524
524
|
});
|
|
525
525
|
|
|
526
526
|
// clang-format off
|
|
527
|
-
const footerContents = this.#props.conversationType
|
|
528
|
-
? renderRelevantDataDisclaimer({
|
|
529
|
-
isLoading: this.#props.isLoading,
|
|
530
|
-
blockedByCrossOrigin: this.#props.blockedByCrossOrigin,
|
|
531
|
-
tooltipId: RELEVANT_DATA_LINK_FOOTER_ID,
|
|
532
|
-
disclaimerText: this.#props.disclaimerText,
|
|
533
|
-
})
|
|
534
|
-
: html`<p>
|
|
535
|
-
${lockedString(UIStringsNotTranslate.inputDisclaimerForEmptyState)}
|
|
536
|
-
<button
|
|
537
|
-
class="link"
|
|
538
|
-
role="link"
|
|
539
|
-
jslog=${VisualLogging.link('open-ai-settings').track({
|
|
540
|
-
click: true,
|
|
541
|
-
})}
|
|
542
|
-
@click=${() => {
|
|
543
|
-
void UI.ViewManager.ViewManager.instance().showView(
|
|
544
|
-
'chrome-ai',
|
|
545
|
-
);
|
|
546
|
-
}}
|
|
547
|
-
>${i18nString(UIStrings.learnAbout)}</button>
|
|
548
|
-
</p>`;
|
|
549
|
-
|
|
550
527
|
return html`
|
|
551
528
|
<footer class=${classes} jslog=${VisualLogging.section('footer')}>
|
|
552
|
-
${
|
|
529
|
+
${renderRelevantDataDisclaimer({
|
|
530
|
+
isLoading: this.#props.isLoading,
|
|
531
|
+
blockedByCrossOrigin: this.#props.blockedByCrossOrigin,
|
|
532
|
+
tooltipId: RELEVANT_DATA_LINK_FOOTER_ID,
|
|
533
|
+
disclaimerText: this.#props.disclaimerText
|
|
534
|
+
})}
|
|
553
535
|
</footer>
|
|
554
536
|
`;
|
|
537
|
+
// clang-format on
|
|
555
538
|
};
|
|
539
|
+
|
|
540
|
+
const renderInputOrReadOnlySection = (): Lit.LitTemplate => {
|
|
541
|
+
if (this.#props.state !== State.CHAT_VIEW) {
|
|
542
|
+
return Lit.nothing;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
if (this.#props.conversationType && this.#props.isReadOnly) {
|
|
546
|
+
return renderReadOnlySection({
|
|
547
|
+
conversationType: this.#props.conversationType,
|
|
548
|
+
onNewConversation: this.#props.onNewConversation,
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
return renderChatInput({
|
|
553
|
+
isLoading: this.#props.isLoading,
|
|
554
|
+
blockedByCrossOrigin: this.#props.blockedByCrossOrigin,
|
|
555
|
+
isTextInputDisabled: this.#props.isTextInputDisabled,
|
|
556
|
+
inputPlaceholder: this.#props.inputPlaceholder,
|
|
557
|
+
disclaimerText: this.#props.disclaimerText,
|
|
558
|
+
selectedContext: this.#props.selectedContext,
|
|
559
|
+
inspectElementToggled: this.#props.inspectElementToggled,
|
|
560
|
+
multimodalInputEnabled: this.#props.multimodalInputEnabled,
|
|
561
|
+
conversationType: this.#props.conversationType,
|
|
562
|
+
imageInput: this.#props.imageInput,
|
|
563
|
+
aidaAvailability: this.#props.aidaAvailability,
|
|
564
|
+
isTextInputEmpty: this.#props.isTextInputEmpty,
|
|
565
|
+
uploadImageInputEnabled: this.#props.uploadImageInputEnabled,
|
|
566
|
+
onContextClick: this.#props.onContextClick,
|
|
567
|
+
onInspectElementClick: this.#props.onInspectElementClick,
|
|
568
|
+
onSubmit: this.#handleSubmit,
|
|
569
|
+
onTextAreaKeyDown: this.#handleTextAreaKeyDown,
|
|
570
|
+
onCancel: this.#handleCancel,
|
|
571
|
+
onNewConversation: this.#props.onNewConversation,
|
|
572
|
+
onTakeScreenshot: this.#props.onTakeScreenshot,
|
|
573
|
+
onRemoveImageInput: this.#props.onRemoveImageInput,
|
|
574
|
+
onTextInputChange: this.#props.onTextInputChange,
|
|
575
|
+
onImageUpload: this.#handleImageUpload
|
|
576
|
+
});
|
|
577
|
+
};
|
|
578
|
+
|
|
556
579
|
// clang-format off
|
|
557
580
|
Lit.render(html`
|
|
558
581
|
<style>${chatViewStyles}</style>
|
|
@@ -577,38 +600,7 @@ export class ChatView extends HTMLElement {
|
|
|
577
600
|
onMessageContainerRef: this.#handleMessageContainerRef,
|
|
578
601
|
onCopyResponseClick: this.#props.onCopyResponseClick,
|
|
579
602
|
})}
|
|
580
|
-
${
|
|
581
|
-
? renderReadOnlySection({
|
|
582
|
-
conversationType: this.#props.conversationType,
|
|
583
|
-
onNewConversation: this.#props.onNewConversation,
|
|
584
|
-
})
|
|
585
|
-
: renderChatInput({
|
|
586
|
-
isLoading: this.#props.isLoading,
|
|
587
|
-
blockedByCrossOrigin: this.#props.blockedByCrossOrigin,
|
|
588
|
-
isTextInputDisabled: this.#props.isTextInputDisabled,
|
|
589
|
-
inputPlaceholder: this.#props.inputPlaceholder,
|
|
590
|
-
state: this.#props.state,
|
|
591
|
-
disclaimerText: this.#props.disclaimerText,
|
|
592
|
-
selectedContext: this.#props.selectedContext,
|
|
593
|
-
inspectElementToggled: this.#props.inspectElementToggled,
|
|
594
|
-
multimodalInputEnabled: this.#props.multimodalInputEnabled,
|
|
595
|
-
conversationType: this.#props.conversationType,
|
|
596
|
-
imageInput: this.#props.imageInput,
|
|
597
|
-
isTextInputEmpty: this.#props.isTextInputEmpty,
|
|
598
|
-
aidaAvailability: this.#props.aidaAvailability,
|
|
599
|
-
uploadImageInputEnabled: this.#props.uploadImageInputEnabled,
|
|
600
|
-
onContextClick: this.#props.onContextClick,
|
|
601
|
-
onInspectElementClick: this.#props.onInspectElementClick,
|
|
602
|
-
onSubmit: this.#handleSubmit,
|
|
603
|
-
onTextAreaKeyDown: this.#handleTextAreaKeyDown,
|
|
604
|
-
onCancel: this.#handleCancel,
|
|
605
|
-
onNewConversation: this.#props.onNewConversation,
|
|
606
|
-
onTakeScreenshot: this.#props.onTakeScreenshot,
|
|
607
|
-
onRemoveImageInput: this.#props.onRemoveImageInput,
|
|
608
|
-
onTextInputChange: this.#props.onTextInputChange,
|
|
609
|
-
onImageUpload: this.#handleImageUpload,
|
|
610
|
-
})
|
|
611
|
-
}
|
|
603
|
+
${renderInputOrReadOnlySection()}
|
|
612
604
|
</main>
|
|
613
605
|
${renderFooter()}
|
|
614
606
|
</div>
|
|
@@ -1412,7 +1404,6 @@ function renderChatInput({
|
|
|
1412
1404
|
blockedByCrossOrigin,
|
|
1413
1405
|
isTextInputDisabled,
|
|
1414
1406
|
inputPlaceholder,
|
|
1415
|
-
state,
|
|
1416
1407
|
selectedContext,
|
|
1417
1408
|
inspectElementToggled,
|
|
1418
1409
|
multimodalInputEnabled,
|
|
@@ -1437,7 +1428,6 @@ function renderChatInput({
|
|
|
1437
1428
|
blockedByCrossOrigin: boolean,
|
|
1438
1429
|
isTextInputDisabled: boolean,
|
|
1439
1430
|
inputPlaceholder: Platform.UIString.LocalizedString,
|
|
1440
|
-
state: State,
|
|
1441
1431
|
selectedContext: AiAssistanceModel.AiAgent.ConversationContext<unknown>|null,
|
|
1442
1432
|
inspectElementToggled: boolean,
|
|
1443
1433
|
isTextInputEmpty: boolean,
|
|
@@ -1462,8 +1452,7 @@ function renderChatInput({
|
|
|
1462
1452
|
return Lit.nothing;
|
|
1463
1453
|
}
|
|
1464
1454
|
|
|
1465
|
-
const shouldShowMultiLine =
|
|
1466
|
-
aidaAvailability === Host.AidaClient.AidaAccessPreconditions.AVAILABLE && selectedContext;
|
|
1455
|
+
const shouldShowMultiLine = aidaAvailability === Host.AidaClient.AidaAccessPreconditions.AVAILABLE && selectedContext;
|
|
1467
1456
|
const chatInputContainerCls = Lit.Directives.classMap({
|
|
1468
1457
|
'chat-input-container': true,
|
|
1469
1458
|
'single-line-layout': !shouldShowMultiLine,
|
|
@@ -1618,11 +1607,10 @@ function renderMainContents({
|
|
|
1618
1607
|
conversationType?: AiAssistanceModel.AiHistoryStorage.ConversationType,
|
|
1619
1608
|
changeSummary?: string,
|
|
1620
1609
|
}): Lit.LitTemplate {
|
|
1621
|
-
if (state === State.
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
if (aidaAvailability !== Host.AidaClient.AidaAccessPreconditions.AVAILABLE) {
|
|
1610
|
+
if (state === State.DISABLED_VIEW) {
|
|
1611
|
+
if (aidaAvailability === Host.AidaClient.AidaAccessPreconditions.AVAILABLE) {
|
|
1612
|
+
return renderDisabledState(renderConsentViewContents());
|
|
1613
|
+
}
|
|
1626
1614
|
return renderDisabledState(renderAidaUnavailableContents(aidaAvailability));
|
|
1627
1615
|
}
|
|
1628
1616
|
|
|
@@ -6,8 +6,6 @@ import * as Host from '../../core/host/host.js';
|
|
|
6
6
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
7
7
|
import type * as Platform from '../../core/platform/platform.js';
|
|
8
8
|
import * as IconButton from '../../ui/components/icon_button/icon_button.js';
|
|
9
|
-
import * as LegacyWrapper from '../../ui/components/legacy_wrapper/legacy_wrapper.js';
|
|
10
|
-
import * as UI from '../../ui/legacy/legacy.js';
|
|
11
9
|
|
|
12
10
|
import {ApplicationPanelTreeElement} from './ApplicationPanelTreeElement.js';
|
|
13
11
|
import * as ApplicationComponents from './components/components.js';
|
|
@@ -23,8 +21,7 @@ const str_ = i18n.i18n.registerUIStrings('panels/application/BackForwardCacheTre
|
|
|
23
21
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
24
22
|
|
|
25
23
|
export class BackForwardCacheTreeElement extends ApplicationPanelTreeElement {
|
|
26
|
-
private view?:
|
|
27
|
-
.LegacyWrapper<UI.Widget.Widget, ApplicationComponents.BackForwardCacheView.BackForwardCacheView>;
|
|
24
|
+
private view?: ApplicationComponents.BackForwardCacheView.BackForwardCacheView;
|
|
28
25
|
|
|
29
26
|
constructor(resourcesPanel: ResourcesPanel) {
|
|
30
27
|
super(resourcesPanel, i18nString(UIStrings.backForwardCache), false, 'bfcache');
|
|
@@ -39,8 +36,7 @@ export class BackForwardCacheTreeElement extends ApplicationPanelTreeElement {
|
|
|
39
36
|
override onselect(selectedByUser?: boolean): boolean {
|
|
40
37
|
super.onselect(selectedByUser);
|
|
41
38
|
if (!this.view) {
|
|
42
|
-
this.view =
|
|
43
|
-
UI.Widget.Widget, new ApplicationComponents.BackForwardCacheView.BackForwardCacheView());
|
|
39
|
+
this.view = new ApplicationComponents.BackForwardCacheView.BackForwardCacheView();
|
|
44
40
|
}
|
|
45
41
|
this.showView(this.view);
|
|
46
42
|
Host.userMetrics.panelShown('back-forward-cache');
|