File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -342,6 +342,11 @@ class PageEventSubscriber {
342342
343343 #onIssueAdded = ( inspectorIssue : Issue ) => {
344344 try {
345+ // DevTools currently defines this protocol issue code but has no
346+ // IssuesManager handler for it, so calling into the mapper only warns.
347+ if ( String ( inspectorIssue . code ) === 'PerformanceIssue' ) {
348+ return ;
349+ }
345350 const issue = DevTools . createIssuesFromProtocolIssue (
346351 null ,
347352 // @ts -expect-error Protocol types diverge.
Original file line number Diff line number Diff line change @@ -358,6 +358,35 @@ describe('ConsoleCollector', () => {
358358 assert . equal ( data . length , 2 ) ;
359359 } ) ;
360360
361+ it ( 'silently ignores unmapped PerformanceIssue events' , async ( ) => {
362+ const browser = getMockBrowser ( ) ;
363+ const page = ( await browser . pages ( ) ) [ 0 ] ;
364+ const warnStub = sinon . stub ( console , 'warn' ) ;
365+
366+ const collector = new ConsoleCollector ( browser , collect => {
367+ return {
368+ devtoolsAggregatedIssue : issue => {
369+ collect ( issue ) ;
370+ } ,
371+ } as ListenerMap ;
372+ } ) ;
373+ await collector . init ( [ page ] ) ;
374+
375+ const performanceIssue = {
376+ code : 'PerformanceIssue' ,
377+ details : {
378+ performanceIssueDetails : {
379+ performanceIssueType : 'DocumentCookie' ,
380+ } ,
381+ } ,
382+ } as unknown as Protocol . Audits . InspectorIssue ;
383+
384+ page . emit ( 'issue' , performanceIssue ) ;
385+
386+ assert . equal ( collector . getData ( page ) . length , 0 ) ;
387+ sinon . assert . notCalled ( warnStub ) ;
388+ } ) ;
389+
361390 it ( 'filters duplicated issues' , async ( ) => {
362391 const browser = getMockBrowser ( ) ;
363392 const page = ( await browser . pages ( ) ) [ 0 ] ;
You can’t perform that action at this time.
0 commit comments