chrome-devtools-frontend 1.0.1638082 → 1.0.1640418
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/AidaClientTypes.ts +8 -6
- package/front_end/core/sdk/DOMStorageModel.ts +1 -1
- package/front_end/core/sdk/TargetManager.ts +14 -1
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +147 -0
- package/front_end/generated/ARIAProperties.js +0 -4
- package/front_end/generated/InspectorBackendCommands.ts +7 -3
- package/front_end/generated/protocol-mapping.d.ts +7 -0
- package/front_end/generated/protocol-proxy-api.d.ts +14 -0
- package/front_end/generated/protocol.ts +80 -0
- package/front_end/global_typings/global_defs.d.ts +13 -0
- package/front_end/models/ai_assistance/AiAgent2.ts +116 -0
- package/front_end/models/ai_assistance/AiConversation.ts +22 -28
- package/front_end/models/ai_assistance/AiOrigins.ts +46 -0
- package/front_end/models/ai_assistance/README.md +16 -0
- package/front_end/models/ai_assistance/StorageItem.ts +30 -26
- package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +2 -2
- package/front_end/models/ai_assistance/agents/AiAgent.ts +73 -36
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.snapshot.txt +2 -2
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +25 -10
- package/front_end/models/ai_assistance/agents/ConversationSummaryAgent.ts +1 -1
- package/front_end/models/ai_assistance/agents/FileAgent.ts +2 -2
- package/front_end/models/ai_assistance/agents/GreenDevAgent.ts +1 -1
- package/front_end/models/ai_assistance/agents/NetworkAgent.ts +3 -4
- package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +2 -2
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +41 -12
- package/front_end/models/ai_assistance/agents/StorageAgent.ts +442 -122
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +2 -2
- package/front_end/models/ai_assistance/ai_assistance.ts +4 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +2 -2
- package/front_end/models/ai_assistance/performance/AIContext.ts +7 -8
- package/front_end/models/ai_assistance/skills/README.md +40 -0
- package/front_end/models/ai_assistance/skills/Skill.ts +13 -0
- package/front_end/models/ai_assistance/skills/SkillRegistry.ts +10 -0
- package/front_end/models/ai_assistance/skills/styling.md +6 -0
- package/front_end/models/heap_snapshot/HeapSnapshotModel.ts +20 -0
- package/front_end/models/heap_snapshot/HeapSnapshotProxy.ts +5 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +6 -2
- package/front_end/models/live-metrics/web-vitals-injected/web-vitals-injected.ts +1 -1
- package/front_end/models/stack_trace/StackTraceImpl.ts +29 -9
- package/front_end/models/stack_trace/StackTraceModel.ts +23 -11
- package/front_end/models/stack_trace/Trie.ts +11 -1
- package/front_end/models/trace/extras/TraceTree.ts +20 -1
- package/front_end/models/trace/insights/Common.ts +9 -0
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +8 -0
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +114 -2
- package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +2 -3
- package/front_end/panels/ai_assistance/components/chatMessage.css +27 -0
- package/front_end/panels/application/CookieItemsView.ts +24 -0
- package/front_end/panels/application/DOMStorageItemsView.ts +9 -4
- package/front_end/panels/application/preloading/components/PreloadingString.ts +6 -0
- package/front_end/panels/console/ConsoleViewMessage.ts +13 -12
- package/front_end/panels/elements/StandaloneStylesContainer.ts +10 -0
- package/front_end/panels/elements/StylePropertyTreeElement.ts +30 -1
- package/front_end/panels/elements/StylesContainer.ts +3 -0
- package/front_end/panels/elements/StylesSidebarPane.ts +45 -4
- package/front_end/panels/layer_viewer/layerDetailsView.css +1 -1
- package/front_end/panels/lighthouse/LighthouseController.ts +1 -1
- package/front_end/panels/lighthouse/LighthouseProtocolService.ts +4 -4
- package/front_end/panels/network/NetworkDataGridNode.ts +14 -0
- package/front_end/panels/network/NetworkLogViewColumns.ts +2 -2
- package/front_end/panels/network/networkTimingTable.css +2 -4
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +169 -106
- package/front_end/panels/timeline/components/IgnoreListSetting.ts +1 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/marked/README.chromium +3 -6
- package/front_end/third_party/marked/package/README.md +5 -5
- package/front_end/third_party/marked/package/bin/main.js +27 -22
- package/front_end/third_party/marked/package/bin/marked.js +2 -1
- package/front_end/third_party/marked/package/lib/marked.esm.d.ts +346 -256
- package/front_end/third_party/marked/package/lib/marked.esm.js +67 -2698
- package/front_end/third_party/marked/package/lib/marked.esm.js.map +7 -1
- package/front_end/third_party/marked/package/lib/marked.umd.js +69 -2722
- package/front_end/third_party/marked/package/lib/marked.umd.js.map +7 -1
- package/front_end/third_party/marked/package/man/marked.1 +4 -2
- package/front_end/third_party/marked/package/man/marked.1.md +2 -1
- package/front_end/third_party/marked/package/package.json +49 -57
- package/front_end/tsconfig.json +1 -1
- package/front_end/ui/components/markdown_view/CodeBlock.ts +17 -6
- package/front_end/ui/components/markdown_view/MarkdownView.ts +39 -3
- package/front_end/ui/components/markdown_view/codeBlock.css +11 -0
- package/front_end/ui/components/markdown_view/markdownView.css +17 -0
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +0 -79
- package/front_end/ui/legacy/components/object_ui/RemoteObjectPreviewFormatter.ts +16 -4
- package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
- package/inspector_overlay/testing/InspectorOverlayHelpers.ts +2 -0
- package/mcp/mcp.ts +1 -1
- package/package.json +7 -9
- package/front_end/third_party/marked/package/bin/marked +0 -215
- package/front_end/third_party/marked/package/lib/marked.cjs +0 -2726
- package/front_end/third_party/marked/package/lib/marked.cjs.map +0 -1
- package/front_end/third_party/marked/package/lib/marked.d.cts +0 -670
- package/front_end/third_party/marked/package/lib/marked.js +0 -2780
- package/front_end/third_party/marked/package/man/marked.1.txt +0 -86
- package/front_end/third_party/marked/package/marked.min.js +0 -6
- package/front_end/third_party/marked/package/src/Lexer.js +0 -492
- package/front_end/third_party/marked/package/src/Parser.js +0 -286
- package/front_end/third_party/marked/package/src/Renderer.js +0 -166
- package/front_end/third_party/marked/package/src/Slugger.js +0 -49
- package/front_end/third_party/marked/package/src/TextRenderer.js +0 -42
- package/front_end/third_party/marked/package/src/Tokenizer.js +0 -755
- package/front_end/third_party/marked/package/src/defaults.js +0 -29
- package/front_end/third_party/marked/package/src/helpers.js +0 -249
- package/front_end/third_party/marked/package/src/marked.js +0 -350
- package/front_end/third_party/marked/package/src/rules.js +0 -285
- /package/front_end/third_party/marked/package/{LICENSE.md → LICENSE} +0 -0
|
@@ -17,8 +17,7 @@ const {until} = Lit.Directives;
|
|
|
17
17
|
|
|
18
18
|
export class PerformanceAgentMarkdownRenderer extends MarkdownRendererWithCodeBlock {
|
|
19
19
|
constructor(
|
|
20
|
-
private mainFrameId = '',
|
|
21
|
-
private lookupEvent: (key: Trace.Types.File.SerializableKey) => Trace.Types.Events.Event | null = () => null) {
|
|
20
|
+
private mainFrameId = '', private lookupEvent: (key: string) => Trace.Types.Events.Event | null = () => null) {
|
|
22
21
|
super();
|
|
23
22
|
}
|
|
24
23
|
|
|
@@ -31,7 +30,7 @@ export class PerformanceAgentMarkdownRenderer extends MarkdownRendererWithCodeBl
|
|
|
31
30
|
until(this.#linkifyNode(nodeId, token.text).then(node => node || token.text), token.text)}</span>`;
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
const event = this.lookupEvent(token.href.slice(1)
|
|
33
|
+
const event = this.lookupEvent(token.href.slice(1));
|
|
35
34
|
if (!event) {
|
|
36
35
|
return html`${token.text}`;
|
|
37
36
|
}
|
|
@@ -281,6 +281,10 @@
|
|
|
281
281
|
gap: var(--sys-size-2);
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
+
.show-all-container {
|
|
285
|
+
padding-bottom: 0;
|
|
286
|
+
}
|
|
287
|
+
|
|
284
288
|
.js-code-output {
|
|
285
289
|
devtools-code-block {
|
|
286
290
|
--code-block-max-code-height: 50px;
|
|
@@ -597,4 +601,27 @@
|
|
|
597
601
|
}
|
|
598
602
|
}
|
|
599
603
|
}
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
.source-files-details {
|
|
607
|
+
display: contents;
|
|
608
|
+
|
|
609
|
+
summary {
|
|
610
|
+
list-style: none;
|
|
611
|
+
cursor: pointer;
|
|
612
|
+
padding: 4px 12px;
|
|
613
|
+
border: 1px solid var(--sys-color-neutral-outline);
|
|
614
|
+
border-radius: var(--sys-shape-corner-small);
|
|
615
|
+
color: var(--sys-color-primary);
|
|
616
|
+
width: fit-content;
|
|
617
|
+
|
|
618
|
+
&:hover {
|
|
619
|
+
background-color: var(--sys-color-state-hover-on-subtle);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
&[open] summary {
|
|
624
|
+
display: none;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
600
627
|
}
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
import * as Common from '../../core/common/common.js';
|
|
35
35
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
36
36
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
37
|
+
import * as AiAssistanceModel from '../../models/ai_assistance/ai_assistance.js';
|
|
37
38
|
import * as Geometry from '../../models/geometry/geometry.js';
|
|
38
39
|
import * as IssuesManager from '../../models/issues_manager/issues_manager.js';
|
|
39
40
|
import * as CookieTable from '../../ui/legacy/components/cookie_table/cookie_table.js';
|
|
@@ -260,6 +261,7 @@ export class CookieItemsView extends UI.Widget.VBox {
|
|
|
260
261
|
this.cookieDomain = domain;
|
|
261
262
|
this.refreshItems();
|
|
262
263
|
this.model.addEventListener(SDK.CookieModel.Events.COOKIE_LIST_UPDATED, this.onCookieListUpdate, this);
|
|
264
|
+
this.updateAiAssistanceContext(null);
|
|
263
265
|
}
|
|
264
266
|
|
|
265
267
|
override performUpdate(): void {
|
|
@@ -302,6 +304,7 @@ export class CookieItemsView extends UI.Widget.VBox {
|
|
|
302
304
|
override wasShown(): void {
|
|
303
305
|
super.wasShown();
|
|
304
306
|
this.refreshItems();
|
|
307
|
+
this.updateAiAssistanceContext(this.selectedCookie);
|
|
305
308
|
}
|
|
306
309
|
|
|
307
310
|
private showPreview(cookie: SDK.Cookie.Cookie|null): void {
|
|
@@ -310,6 +313,27 @@ export class CookieItemsView extends UI.Widget.VBox {
|
|
|
310
313
|
}
|
|
311
314
|
this.selectedCookie = cookie;
|
|
312
315
|
this.requestUpdate();
|
|
316
|
+
this.updateAiAssistanceContext(cookie);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
private updateAiAssistanceContext(cookie: SDK.Cookie.Cookie|null): void {
|
|
320
|
+
if (!cookie || cookie.httpOnly()) {
|
|
321
|
+
UI.Context.Context.instance().setFlavor(AiAssistanceModel.StorageItem.StorageItem, null);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const target = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
|
|
326
|
+
const mainPageOrigin =
|
|
327
|
+
target?.inspectedURL() ? Common.ParsedURL.ParsedURL.extractOrigin(target.inspectedURL()) : '';
|
|
328
|
+
|
|
329
|
+
if (!mainPageOrigin) {
|
|
330
|
+
// If we don't have a primary target origin, we shouldn't allow the AI assistance context to be attached.
|
|
331
|
+
UI.Context.Context.instance().setFlavor(AiAssistanceModel.StorageItem.StorageItem, null);
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const storageItem = new AiAssistanceModel.StorageItem.CookieItem(mainPageOrigin, this.cookieDomain, cookie.name());
|
|
336
|
+
UI.Context.Context.instance().setFlavor(AiAssistanceModel.StorageItem.StorageItem, storageItem);
|
|
313
337
|
}
|
|
314
338
|
|
|
315
339
|
private handleCookieSelected(selectedCookie: SDK.Cookie.Cookie|null): void {
|
|
@@ -190,13 +190,18 @@ export class DOMStorageItemsView extends KeyValueStorageItemsView {
|
|
|
190
190
|
const origin = parsedKey.origin;
|
|
191
191
|
const storageType = this.domStorage.isLocalStorage ? 'localStorage' : 'sessionStorage';
|
|
192
192
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
const target = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
|
|
194
|
+
const mainPageOrigin =
|
|
195
|
+
target?.inspectedURL() ? Common.ParsedURL.ParsedURL.extractOrigin(target.inspectedURL()) : '';
|
|
196
|
+
|
|
197
|
+
if (!mainPageOrigin) {
|
|
198
|
+
// If we don't have a primary target origin, we shouldn't allow the AI assistance context to be attached.
|
|
199
|
+
UI.Context.Context.instance().setFlavor(AiAssistanceModel.StorageItem.StorageItem, null);
|
|
196
200
|
return;
|
|
197
201
|
}
|
|
198
202
|
|
|
199
|
-
const storageItem = new AiAssistanceModel.StorageItem.
|
|
203
|
+
const storageItem = new AiAssistanceModel.StorageItem.DOMStorageItem(
|
|
204
|
+
mainPageOrigin, origin, storageKey, storageType, item ? item.key : undefined);
|
|
200
205
|
UI.Context.Context.instance().setFlavor(AiAssistanceModel.StorageItem.StorageItem, storageItem);
|
|
201
206
|
}
|
|
202
207
|
|
|
@@ -454,6 +454,8 @@ export const PrefetchReasonDescription: Record<string, {name: () => Platform.UIS
|
|
|
454
454
|
PrefetchNotEligibleRedirectFromServiceWorker: {name: () => i18n.i18n.lockedString('Unknown')},
|
|
455
455
|
PrefetchNotEligibleRedirectToServiceWorker: {name: () => i18n.i18n.lockedString('Unknown')},
|
|
456
456
|
PrefetchEvictedAfterBrowsingDataRemoved: {name: i18nLazyString(UIStrings.PrefetchEvictedAfterBrowsingDataRemoved)},
|
|
457
|
+
PrefetchNotEligibleBlockedByConnectionAllowlist: {name: () => i18n.i18n.lockedString('Unknown')},
|
|
458
|
+
PrefetchCancelledOnUserNavigation: {name: () => i18n.i18n.lockedString('Unknown')},
|
|
457
459
|
};
|
|
458
460
|
|
|
459
461
|
/** Decoding PrefetchFinalStatus prefetchAttempt to failure description. **/
|
|
@@ -540,6 +542,10 @@ export function prefetchFailureReason(
|
|
|
540
542
|
return PrefetchReasonDescription['PrefetchNotEligibleRedirectToServiceWorker'].name();
|
|
541
543
|
case Protocol.Preload.PrefetchStatus.PrefetchEvictedAfterBrowsingDataRemoved:
|
|
542
544
|
return PrefetchReasonDescription['PrefetchEvictedAfterBrowsingDataRemoved'].name();
|
|
545
|
+
case Protocol.Preload.PrefetchStatus.PrefetchNotEligibleBlockedByConnectionAllowlist:
|
|
546
|
+
return PrefetchReasonDescription['PrefetchNotEligibleBlockedByConnectionAllowlist'].name();
|
|
547
|
+
case Protocol.Preload.PrefetchStatus.PrefetchCancelledOnUserNavigation:
|
|
548
|
+
return PrefetchReasonDescription['PrefetchCancelledOnUserNavigation'].name();
|
|
543
549
|
default:
|
|
544
550
|
// Note that we use switch and exhaustiveness check to prevent to
|
|
545
551
|
// forget updating these strings, but allow to handle unknown
|
|
@@ -512,16 +512,17 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
|
|
|
512
512
|
}
|
|
513
513
|
} else {
|
|
514
514
|
const messageText = this.message.messageText;
|
|
515
|
-
const fragment =
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
515
|
+
const fragment =
|
|
516
|
+
ConsoleViewMessage.linkifyWithCustomLinkifier(messageText, (text, url, lineNumber, columnNumber) => {
|
|
517
|
+
const linkElement = url === request.url() ?
|
|
518
|
+
Components.Linkifier.Linkifier.linkifyRevealable(
|
|
519
|
+
(request), url, request.url(), undefined, undefined, 'network-request') :
|
|
520
|
+
Components.Linkifier.Linkifier.linkifyURL(
|
|
521
|
+
url, ({text, lineNumber, columnNumber} as Components.Linkifier.LinkifyURLOptions));
|
|
522
|
+
linkElement.tabIndex = -1;
|
|
523
|
+
this.selectableChildren.push({element: linkElement, forceSelect: () => linkElement.focus()});
|
|
524
|
+
return linkElement;
|
|
525
|
+
});
|
|
525
526
|
appendOrShow(messageElement, fragment);
|
|
526
527
|
}
|
|
527
528
|
return messageElement;
|
|
@@ -1939,7 +1940,7 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
|
|
|
1939
1940
|
return formattedResult;
|
|
1940
1941
|
}
|
|
1941
1942
|
|
|
1942
|
-
|
|
1943
|
+
static linkifyWithCustomLinkifier(
|
|
1943
1944
|
string: string,
|
|
1944
1945
|
linkifier: (arg0: string, arg1: Platform.DevToolsPath.UrlString, arg2?: number, arg3?: number) => Node):
|
|
1945
1946
|
DocumentFragment|UI.Widget.Widget {
|
|
@@ -1987,7 +1988,7 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
|
|
|
1987
1988
|
}
|
|
1988
1989
|
|
|
1989
1990
|
private linkifyStringAsFragment(string: string): DocumentFragment|UI.Widget.Widget {
|
|
1990
|
-
return
|
|
1991
|
+
return ConsoleViewMessage.linkifyWithCustomLinkifier(string, (text, url, lineNumber, columnNumber) => {
|
|
1991
1992
|
const options = {text, lineNumber, columnNumber};
|
|
1992
1993
|
const linkElement =
|
|
1993
1994
|
Components.Linkifier.Linkifier.linkifyURL(url, (options as Components.Linkifier.LinkifyURLOptions));
|
|
@@ -327,4 +327,14 @@ export class StandaloneStylesContainer extends Common.ObjectWrapper.eventMixin<E
|
|
|
327
327
|
removeStyleUpdateListener(listener: () => void): void {
|
|
328
328
|
this.removeEventListener(Events.STYLES_UPDATE_COMPLETED, listener);
|
|
329
329
|
}
|
|
330
|
+
|
|
331
|
+
trackForLazyRendering(_element: Element, _callback: () => void): void {
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
shouldRenderLazily(): boolean {
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
untrackForLazyRendering(_element: Element): void {
|
|
339
|
+
}
|
|
330
340
|
}
|
|
@@ -2063,6 +2063,8 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2063
2063
|
#gridNames: Set<string>|undefined = undefined;
|
|
2064
2064
|
#tooltipKeyCounts = new Map<string, number>();
|
|
2065
2065
|
|
|
2066
|
+
#lazyRender?: boolean;
|
|
2067
|
+
|
|
2066
2068
|
constructor(
|
|
2067
2069
|
{stylesContainer, section, matchedStyles, property, isShorthand, inherited, overloaded, newProperty}:
|
|
2068
2070
|
StylePropertyTreeElementParams,
|
|
@@ -2080,6 +2082,7 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2080
2082
|
this.#parentSection = section;
|
|
2081
2083
|
this.isShorthand = isShorthand;
|
|
2082
2084
|
this.newProperty = newProperty;
|
|
2085
|
+
this.#lazyRender = stylesContainer.shouldRenderLazily();
|
|
2083
2086
|
if (this.newProperty) {
|
|
2084
2087
|
this.listItemElement.textContent = '';
|
|
2085
2088
|
}
|
|
@@ -2088,6 +2091,8 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2088
2091
|
}
|
|
2089
2092
|
|
|
2090
2093
|
override onunbind(): void {
|
|
2094
|
+
this.#stylesContainer.untrackForLazyRendering(this.listItemElement);
|
|
2095
|
+
this.#lazyRender = false;
|
|
2091
2096
|
this.property.removeEventListener(SDK.CSSProperty.Events.LOCAL_VALUE_UPDATED, this.updateTitle, this);
|
|
2092
2097
|
super.onunbind();
|
|
2093
2098
|
}
|
|
@@ -2371,7 +2376,31 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2371
2376
|
}
|
|
2372
2377
|
|
|
2373
2378
|
override onattach(): void {
|
|
2374
|
-
this
|
|
2379
|
+
if (this.#lazyRender) {
|
|
2380
|
+
this.nameElement = Renderer.renderNameElement(this.name);
|
|
2381
|
+
this.valueElement = Renderer.renderValueElement(this.property, null, []).valueElement;
|
|
2382
|
+
|
|
2383
|
+
// Add a placeholder to maintain alignment with eager rendering.
|
|
2384
|
+
if (this.parent?.root || !this.property.parsedOk) {
|
|
2385
|
+
const placeholder = document.createElement('span');
|
|
2386
|
+
placeholder.classList.add('enabled-button');
|
|
2387
|
+
this.listItemElement.appendChild(placeholder);
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
this.listItemElement.classList.toggle('inactive', !this.property.activeInStyle());
|
|
2391
|
+
this.listItemElement.appendChild(this.nameElement);
|
|
2392
|
+
const lineBreakValue = this.valueElement.firstElementChild?.tagName === 'BR';
|
|
2393
|
+
this.listItemElement.createChild('span', 'styles-name-value-separator').textContent = lineBreakValue ? ':' : ': ';
|
|
2394
|
+
this.listItemElement.appendChild(this.valueElement);
|
|
2395
|
+
this.listItemElement.createChild('span', 'styles-semicolon').textContent = ';';
|
|
2396
|
+
|
|
2397
|
+
this.#stylesContainer.trackForLazyRendering(this.listItemElement, () => {
|
|
2398
|
+
this.#lazyRender = false;
|
|
2399
|
+
this.updateTitle();
|
|
2400
|
+
});
|
|
2401
|
+
} else {
|
|
2402
|
+
this.updateTitle();
|
|
2403
|
+
}
|
|
2375
2404
|
|
|
2376
2405
|
this.listItemElement.addEventListener('mousedown', event => {
|
|
2377
2406
|
if (event.button === 0) {
|
|
@@ -57,4 +57,7 @@ export interface StylesContainer {
|
|
|
57
57
|
setActiveProperty(treeElement: StylePropertyTreeElement|null): void;
|
|
58
58
|
addStyleUpdateListener(listener: () => void): void;
|
|
59
59
|
removeStyleUpdateListener(listener: () => void): void;
|
|
60
|
+
trackForLazyRendering(element: Element, callback: () => void): void;
|
|
61
|
+
untrackForLazyRendering(element: Element): void;
|
|
62
|
+
shouldRenderLazily(): boolean;
|
|
60
63
|
}
|
|
@@ -154,6 +154,8 @@ const lockedString = i18n.i18n.lockedString;
|
|
|
154
154
|
const FILTER_IDLE_PERIOD = 500;
|
|
155
155
|
// Minimum number of @property rules for the @property section block to be folded initially
|
|
156
156
|
const MIN_FOLDED_SECTIONS_COUNT = 5;
|
|
157
|
+
// The number of properties required in a matched styles cascade to trigger IntersectionObserver lazy rendering.
|
|
158
|
+
const LAZY_RENDER_THRESHOLD = 200;
|
|
157
159
|
/** Title of the registered properties section **/
|
|
158
160
|
export const REGISTERED_PROPERTY_SECTION_NAME = '@property';
|
|
159
161
|
/** Title of the function section **/
|
|
@@ -230,6 +232,9 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
|
|
|
230
232
|
aiCodeCompletionProvider?: StylesAiCodeCompletionProvider.StylesAiCodeCompletionProvider;
|
|
231
233
|
#aiCodeCompletionSummaryToolbarContainer?: HTMLElement;
|
|
232
234
|
#aiCodeCompletionSummaryToolbar?: PanelsCommon.AiCodeCompletionSummaryToolbar.AiCodeCompletionSummaryToolbar;
|
|
235
|
+
#shouldRenderLazily = false;
|
|
236
|
+
#lazyRenderObserver?: IntersectionObserver;
|
|
237
|
+
#lazyRenderCallbacks = new WeakMap<Element, () => void>();
|
|
233
238
|
|
|
234
239
|
constructor(computedStyleModel: ComputedStyle.ComputedStyleModel.ComputedStyleModel) {
|
|
235
240
|
super(computedStyleModel, {delegatesFocus: true, useShadowDom: true, classes: ['flex-none']});
|
|
@@ -562,10 +567,9 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
|
|
|
562
567
|
// Hide all popovers when scrolling.
|
|
563
568
|
// Styles and Computed panels both have popover (e.g. imagePreviewPopover),
|
|
564
569
|
// so we need to bind both scroll events.
|
|
565
|
-
const scrollerElementLists =
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
if (scrollerElementLists.length > 0) {
|
|
570
|
+
const scrollerElementLists = this?.contentElement?.enclosingNodeOrSelfWithClass('style-panes-wrapper')
|
|
571
|
+
?.parentElement?.querySelectorAll('.style-panes-wrapper');
|
|
572
|
+
if (scrollerElementLists && scrollerElementLists.length > 0) {
|
|
569
573
|
for (const element of scrollerElementLists) {
|
|
570
574
|
this.scrollerElement = element;
|
|
571
575
|
this.scrollerElement.addEventListener('scroll', this.boundOnScroll, false);
|
|
@@ -1118,6 +1122,14 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
|
|
|
1118
1122
|
const animationsPanelVisible = UI.ViewManager.ViewManager.instance().isViewVisible('animations');
|
|
1119
1123
|
const cssAnimationsOnlyWhenAnimationsTabOpen =
|
|
1120
1124
|
Common.Settings.Settings.instance().moduleSetting('css-animations-only-when-animations-tab-open').get();
|
|
1125
|
+
|
|
1126
|
+
let totalProperties = 0;
|
|
1127
|
+
for (const style of matchedStyles.nodeStyles()) {
|
|
1128
|
+
totalProperties += style.leadingProperties().length;
|
|
1129
|
+
}
|
|
1130
|
+
// Always render eagerly for layout tests.
|
|
1131
|
+
this.#shouldRenderLazily = !Host.InspectorFrontendHost.isUnderTest() && totalProperties > LAZY_RENDER_THRESHOLD;
|
|
1132
|
+
|
|
1121
1133
|
for (const style of matchedStyles.nodeStyles()) {
|
|
1122
1134
|
const isTransitionOrAnimationStyle = style.type === SDK.CSSStyleDeclaration.Type.Transition ||
|
|
1123
1135
|
style.type === SDK.CSSStyleDeclaration.Type.Animation;
|
|
@@ -1619,6 +1631,35 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
|
|
|
1619
1631
|
#onAiCodeCompletionResponseReceived(): void {
|
|
1620
1632
|
this.#aiCodeCompletionSummaryToolbar?.setLoading(false);
|
|
1621
1633
|
}
|
|
1634
|
+
|
|
1635
|
+
trackForLazyRendering(element: Element, callback: () => void): void {
|
|
1636
|
+
if (!this.#lazyRenderObserver) {
|
|
1637
|
+
this.#lazyRenderObserver = new IntersectionObserver(entries => {
|
|
1638
|
+
for (const entry of entries) {
|
|
1639
|
+
if (entry.isIntersecting) {
|
|
1640
|
+
const cb = this.#lazyRenderCallbacks.get(entry.target);
|
|
1641
|
+
if (cb) {
|
|
1642
|
+
cb();
|
|
1643
|
+
this.untrackForLazyRendering(entry.target);
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
}, {rootMargin: '100px'});
|
|
1648
|
+
}
|
|
1649
|
+
this.#lazyRenderCallbacks.set(element, callback);
|
|
1650
|
+
this.#lazyRenderObserver.observe(element);
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
shouldRenderLazily(): boolean {
|
|
1654
|
+
return this.#shouldRenderLazily;
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
untrackForLazyRendering(element: Element): void {
|
|
1658
|
+
if (this.#lazyRenderObserver) {
|
|
1659
|
+
this.#lazyRenderObserver.unobserve(element);
|
|
1660
|
+
}
|
|
1661
|
+
this.#lazyRenderCallbacks.delete(element);
|
|
1662
|
+
}
|
|
1622
1663
|
}
|
|
1623
1664
|
|
|
1624
1665
|
export const enum Events {
|
|
@@ -86,7 +86,9 @@ export class ProtocolService implements ProtocolClient.CDPConnection.CDPConnecti
|
|
|
86
86
|
*/
|
|
87
87
|
readonly #pendingRequests = new Map<number, (reason: Error) => void>();
|
|
88
88
|
|
|
89
|
-
async attach(): Promise<void> {
|
|
89
|
+
async attach(inspectedURL: Platform.DevToolsPath.UrlString): Promise<void> {
|
|
90
|
+
const parsedInitialOrigin = Common.ParsedURL.ParsedURL.extractOrigin(inspectedURL);
|
|
91
|
+
|
|
90
92
|
await SDK.TargetManager.TargetManager.instance().suspendAllTargets();
|
|
91
93
|
const mainTarget = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
|
|
92
94
|
if (!mainTarget) {
|
|
@@ -130,8 +132,6 @@ export class ProtocolService implements ProtocolClient.CDPConnection.CDPConnecti
|
|
|
130
132
|
// To ensure the teardown operations can proceed, we need a dialog handler which lasts until
|
|
131
133
|
// the LighthouseProtocolService detaches.
|
|
132
134
|
|
|
133
|
-
const initialInspectedUrl = mainTarget.inspectedURL();
|
|
134
|
-
const parsedInitialOrigin = Common.ParsedURL.ParsedURL.extractOrigin(initialInspectedUrl);
|
|
135
135
|
const dialogHandler =
|
|
136
136
|
(event: Common.EventTarget.EventTargetEvent<Protocol.Page.JavascriptDialogOpeningEvent>): void => {
|
|
137
137
|
const parsedEventOrigin =
|
|
@@ -139,7 +139,7 @@ export class ProtocolService implements ProtocolClient.CDPConnection.CDPConnecti
|
|
|
139
139
|
if (!parsedInitialOrigin || parsedEventOrigin !== parsedInitialOrigin) {
|
|
140
140
|
// See http://crbug.com/513728809.
|
|
141
141
|
console.warn(`Lighthouse auto-accept for dialog on ${
|
|
142
|
-
event.data.url} blocked as it was not from the original audit origin ${
|
|
142
|
+
event.data.url} blocked as it was not from the original audit origin ${inspectedURL}.`);
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
|
|
@@ -932,6 +932,20 @@ export class NetworkRequestNode extends NetworkNode {
|
|
|
932
932
|
return aValue > bValue ? 1 : -1;
|
|
933
933
|
}
|
|
934
934
|
|
|
935
|
+
static OverrideTypesComparator(a: NetworkNode, b: NetworkNode): number {
|
|
936
|
+
const aRequest = a.requestOrFirstKnownChildRequest();
|
|
937
|
+
const bRequest = b.requestOrFirstKnownChildRequest();
|
|
938
|
+
if (!aRequest || !bRequest) {
|
|
939
|
+
if (!aRequest && !bRequest) {
|
|
940
|
+
return 0;
|
|
941
|
+
}
|
|
942
|
+
return !aRequest ? -1 : 1;
|
|
943
|
+
}
|
|
944
|
+
const aValue = aRequest.overrideTypes.join(', ');
|
|
945
|
+
const bValue = bRequest.overrideTypes.join(', ');
|
|
946
|
+
return aValue.localeCompare(bValue) || aRequest.identityCompare(bRequest);
|
|
947
|
+
}
|
|
948
|
+
|
|
935
949
|
override showingInitiatorChainChanged(): void {
|
|
936
950
|
const showInitiatorChain = this.showingInitiatorChain();
|
|
937
951
|
|
|
@@ -1129,9 +1129,9 @@ const DEFAULT_COLUMNS = [
|
|
|
1129
1129
|
sortingFunction: NetworkRequestNode.ResponseHeaderStringComparator.bind(null, 'etag'),
|
|
1130
1130
|
},
|
|
1131
1131
|
{
|
|
1132
|
-
id: '
|
|
1132
|
+
id: 'has-overrides',
|
|
1133
1133
|
title: i18nLazyString(UIStrings.hasOverrides),
|
|
1134
|
-
sortingFunction: NetworkRequestNode.
|
|
1134
|
+
sortingFunction: NetworkRequestNode.OverrideTypesComparator,
|
|
1135
1135
|
},
|
|
1136
1136
|
{
|
|
1137
1137
|
id: 'response-header-keep-alive',
|
|
@@ -79,7 +79,6 @@ table.network-timing-table > tr:not(.network-timing-table-header, .network-timin
|
|
|
79
79
|
position: absolute;
|
|
80
80
|
min-width: 1px;
|
|
81
81
|
inset: 0 attr(data-right %) 0 attr(data-left %); /* stylelint-disable-line declaration-property-value-no-unknown */
|
|
82
|
-
background-color: attr(data-background <color>); /* stylelint-disable-line declaration-property-value-no-unknown */
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
.network-timing-bar-title {
|
|
@@ -218,9 +217,8 @@ td.throttled {
|
|
|
218
217
|
background: var(--sys-color-surface1);
|
|
219
218
|
}
|
|
220
219
|
|
|
221
|
-
.network-timing-bar.server-timing
|
|
222
|
-
|
|
223
|
-
background-color: var(--sys-color-neutral-container);
|
|
220
|
+
.network-timing-bar.server-timing {
|
|
221
|
+
background-color: attr(data-background type(<color>), var(--sys-color-neutral-container)); /* stylelint-disable-line declaration-property-value-no-unknown */
|
|
224
222
|
}
|
|
225
223
|
|
|
226
224
|
tr.synthetic {
|