Skip to content

performance.getEntriesBy[Name|Type](undefined) returns all the entries #42028

@meixg

Description

@meixg

Version

v16.13.2、v17.5.0

Platform

Linux meixg-desktop 5.11.0-43-generic #47~20.04.2-Ubuntu SMP Mon Dec 13 11:06:56 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

perf_hooks

What steps will reproduce the bug?

performance.mark(undefined);
performance.mark('a');
const entries = performance.getEntriesByName(undefined);

console.log(entries);

How often does it reproduce? Is there a required condition?

consistently

What is the expected behavior?

[
  PerformanceMark {
    name: 'undefined',
    entryType: 'mark',
    startTime: 74.92072999477386,
    duration: 0,
    detail: null
  }
]

What do you see instead?

[
  PerformanceMark {
    name: 'undefined',
    entryType: 'mark',
    startTime: 74.92072999477386,
    duration: 0,
    detail: null
  },
  PerformanceMark {
    name: 'a',
    entryType: 'mark',
    startTime: 75.06349003314972,
    duration: 0,
    detail: null
  }
]

Additional information

Chrome、Safari will only output the 'undefined' one:

[PerformanceMark]

To retrieve all entries, we need to use .getEntries().

This may be related to #42024 and #42004

Metadata

Metadata

Assignees

Labels

perf_hooksIssues and PRs related to the implementation of the Performance Timing API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions