@@ -252,6 +252,10 @@ const UIStrings = {
252
252
*@description Label for the link(s) to the ad script(s) that led to this frame's creation.
253
253
*/
254
254
creatorAdScriptAncestry : 'Creator Ad Script Ancestry' ,
255
+ /**
256
+ *@description Label for the filterlist rule that identified the root script in 'Creator Ad Script Ancestry' as an ad.
257
+ */
258
+ rootScriptFilterlistRule : 'Root Script Filterlist Rule' ,
255
259
/**
256
260
*@description Text describing the absence of a value.
257
261
*/
@@ -269,7 +273,7 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
269
273
export interface FrameDetailsReportViewData {
270
274
frame : SDK . ResourceTreeModel . ResourceTreeFrame ;
271
275
target ?: SDK . Target . Target ;
272
- adScriptAncestryIds : Protocol . Page . AdScriptId [ ] | null ;
276
+ adScriptAncestry : Protocol . Page . AdScriptAncestry | null ;
273
277
}
274
278
275
279
export class FrameDetailsReportView extends LegacyWrapper . LegacyWrapper . WrappableComponent {
@@ -281,7 +285,7 @@ export class FrameDetailsReportView extends LegacyWrapper.LegacyWrapper.Wrappabl
281
285
#permissionsPolicySectionData: PermissionsPolicySectionData = { policies : [ ] , showDetails : false } ;
282
286
#originTrialTreeView: OriginTrialTreeView = new OriginTrialTreeView ( ) ;
283
287
#linkifier = new Components . Linkifier . Linkifier ( ) ;
284
- #adScriptAncestryIds : Protocol . Page . AdScriptId [ ] | null = null ;
288
+ #adScriptAncestry : Protocol . Page . AdScriptAncestry | null = null ;
285
289
286
290
constructor ( frame : SDK . ResourceTreeModel . ResourceTreeFrame ) {
287
291
super ( ) ;
@@ -295,15 +299,15 @@ export class FrameDetailsReportView extends LegacyWrapper.LegacyWrapper.Wrappabl
295
299
}
296
300
297
301
override async render ( ) : Promise < void > {
298
- const results = await this . #frame?. parentFrame ( ) ?. getAdScriptAncestryIds ( this . #frame?. id ) ;
299
- if ( Array . isArray ( results ) && results . length > 0 ) {
300
- this . #adScriptAncestryIds = results ;
302
+ const result = await this . #frame?. parentFrame ( ) ?. getAdScriptAncestry ( this . #frame?. id ) ;
303
+ if ( result && result . ancestryChain . length > 0 ) {
304
+ this . #adScriptAncestry = result ;
301
305
302
306
// Obtain the Target associated with the first ad script, because in most scenarios all
303
307
// scripts share the same debuggerId. However, discrepancies might arise when content scripts
304
308
// from browser extensions are involved. We will monitor the debugging experiences and revisit
305
309
// this approach if it proves problematic.
306
- const firstScript = this . #adScriptAncestryIds [ 0 ] ;
310
+ const firstScript = this . #adScriptAncestry . ancestryChain [ 0 ] ;
307
311
const debuggerModel = firstScript ?. debuggerId ?
308
312
await SDK . DebuggerModel . DebuggerModel . modelForDebuggerId ( firstScript . debuggerId ) :
309
313
null ;
@@ -600,11 +604,11 @@ export class FrameDetailsReportView extends LegacyWrapper.LegacyWrapper.Wrappabl
600
604
return Lit . nothing ;
601
605
}
602
606
603
- if ( ! this . #target || ! this . #adScriptAncestryIds || this . #adScriptAncestryIds . length === 0 ) {
607
+ if ( ! this . #target || ! this . #adScriptAncestry || this . #adScriptAncestry . ancestryChain . length === 0 ) {
604
608
return Lit . nothing ;
605
609
}
606
610
607
- const rows = this . #adScriptAncestryIds . map ( adScriptId => {
611
+ const rows = this . #adScriptAncestry . ancestryChain . map ( adScriptId => {
608
612
const adScriptLinkElement = this . #linkifier. linkifyScriptLocation (
609
613
this . #target,
610
614
adScriptId . scriptId || null ,
@@ -618,6 +622,8 @@ export class FrameDetailsReportView extends LegacyWrapper.LegacyWrapper.Wrappabl
618
622
return html `< div > ${ adScriptLinkElement } </ div > ` ;
619
623
} ) ;
620
624
625
+ const shouldRenderFilterlistRule = ( this . #adScriptAncestry. rootScriptFilterlistRule !== undefined ) ;
626
+
621
627
// Disabled until https://crbug.com/1079231 is fixed.
622
628
// clang-format off
623
629
return html `
@@ -627,6 +633,10 @@ export class FrameDetailsReportView extends LegacyWrapper.LegacyWrapper.Wrappabl
627
633
{ rows, title : i18nString ( UIStrings . creatorAdScriptAncestry ) } as ExpandableList . ExpandableList . ExpandableListData } >
628
634
</ devtools-expandable-list >
629
635
</ devtools-report-value >
636
+ ${ shouldRenderFilterlistRule ? html `
637
+ < devtools-report-key > ${ i18nString ( UIStrings . rootScriptFilterlistRule ) } </ devtools-report-key >
638
+ < devtools-report-value jslog =${ VisualLogging . section ( 'root-script-filterlist-rule' ) } > ${ this . #adScriptAncestry. rootScriptFilterlistRule } </ devtools-report-value >
639
+ ` : Lit . nothing }
630
640
` ;
631
641
// clang-format on
632
642
}
0 commit comments