Skip to content

performance.mark() throws error 'The "name" argument must be specified' #47097

New issue

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

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

Already on GitHub? # to your account

Closed
danielroe opened this issue Mar 14, 2023 · 2 comments · Fixed by #47102
Closed

performance.mark() throws error 'The "name" argument must be specified' #47097

danielroe opened this issue Mar 14, 2023 · 2 comments · Fixed by #47102
Labels
doc Issues and PRs related to the documentations. perf_hooks Issues and PRs related to the implementation of the Performance Timing API.

Comments

@danielroe
Copy link
Contributor

Version

19.7.0

Platform

Darwin midnight.local 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:06:26 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T8112 arm64

Subsystem

perf_hooks

What steps will reproduce the bug?

node -e "require('perf_hooks').performance.mark()"

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

This works fine in Node <19 but throws an error in Node 19.

What is the expected behavior? Why is that the expected behavior?

name is marked as an optional parameter in the docs. I expect no error when calling mark() without a name parameter.

What do you see instead?

❯ node -e "require('perf_hooks').performance.mark()"
node:internal/perf/performance:125
      throw new ERR_MISSING_ARGS('name');
      ^

TypeError [ERR_MISSING_ARGS]: The "name" argument must be specified
    at new NodeError (node:internal/errors:399:5)
    at Performance.mark (node:internal/perf/performance:125:13)
    at [eval]:1:35
    at Script.runInThisContext (node:vm:128:12)
    at Object.runInThisContext (node:vm:306:38)
    at node:internal/process/execution:83:21
    at [eval]-wrapper:6:24
    at runScript (node:internal/process/execution:82:62)
    at evalScript (node:internal/process/execution:104:10)
    at node:internal/main/eval_string:50:3 {
  code: 'ERR_MISSING_ARGS'
}

Node.js v19.7.0

Additional information

No response

@targos
Copy link
Member

targos commented Mar 15, 2023

/cc @legendecas

@legendecas legendecas added the perf_hooks Issues and PRs related to the implementation of the Performance Timing API. label Mar 15, 2023
@legendecas
Copy link
Member

legendecas commented Mar 15, 2023

Thanks for reporting the issue!

This is a document inconsistency with the web spec. The spec defines the first parameter name as a required argument: https://www.w3.org/TR/user-timing/#ref-for-dom-performance-mark-1.

Since #44483 is tagged as semver-major, I think the documents should be fixed respectively.

@legendecas legendecas added the doc Issues and PRs related to the documentations. label Mar 15, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
doc Issues and PRs related to the documentations. 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