Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
meixg opened this issue Feb 17, 2022 · 6 comments · Fixed by #42104
Closed

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

meixg opened this issue Feb 17, 2022 · 6 comments · Fixed by #42104
Assignees
Labels
perf_hooks Issues and PRs related to the implementation of the Performance Timing API.

Comments

@meixg
Copy link
Member

meixg commented Feb 17, 2022

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

@meixg
Copy link
Member Author

meixg commented Feb 17, 2022

Also, .getEntriesByType(undefined) works different too.

@Mesteery Mesteery added the perf_hooks Issues and PRs related to the implementation of the Performance Timing API. label Feb 17, 2022
@benjamingr
Copy link
Member

@meixg is this something you would be interesting in contributing a fix for?

@meixg
Copy link
Member Author

meixg commented Feb 18, 2022

@meixg is this something you would be interesting in contributing a fix for?

Sure, leave it to me.

@benjamingr
Copy link
Member

@meixg working on this?

@Mesteery Mesteery changed the title performance.getEntriesByType(undefined) returns all the entries performance.getEntriesBy[Name|Type](undefined) returns all the entries Feb 23, 2022
@Mesteery Mesteery changed the title performance.getEntriesBy[Name|Type](undefined) returns all the entries performance.getEntriesByName(undefined) returns all the entries Feb 23, 2022
@Mesteery Mesteery changed the title performance.getEntriesByName(undefined) returns all the entries performance.getEntriesBy[Name|Type[(undefined) returns all the entries Feb 23, 2022
@Mesteery Mesteery changed the title performance.getEntriesBy[Name|Type[(undefined) returns all the entries performance.getEntriesBy[Name|Type](undefined) returns all the entries Feb 23, 2022
@meixg
Copy link
Member Author

meixg commented Feb 24, 2022

@meixg working on this?

Yeah, just had a few busy days, made a PR for this :).

nodejs-github-bot pushed a commit that referenced this issue Feb 26, 2022
Fix: #42028

PR-URL: #42104
Fixes: #42028
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
@benjamingr
Copy link
Member

Thanks @meixg keep it up!

sxa pushed a commit to sxa/node that referenced this issue Mar 7, 2022
Fix: nodejs#42028

PR-URL: nodejs#42104
Fixes: nodejs#42028
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
danielleadams pushed a commit that referenced this issue Apr 21, 2022
Fix: #42028

PR-URL: #42104
Fixes: #42028
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
danielleadams pushed a commit that referenced this issue Apr 24, 2022
Fix: #42028

PR-URL: #42104
Fixes: #42028
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
danielleadams pushed a commit that referenced this issue Apr 24, 2022
Fix: #42028

PR-URL: #42104
Fixes: #42028
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
danielleadams pushed a commit that referenced this issue Apr 24, 2022
Fix: #42028

PR-URL: #42104
Fixes: #42028
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
xtx1130 pushed a commit to xtx1130/node that referenced this issue Apr 25, 2022
Fix: nodejs#42028

PR-URL: nodejs#42104
Fixes: nodejs#42028
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf_hooks Issues and PRs related to the implementation of the Performance Timing API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants