Skip to content

Symbol.{ dispose, asyncDispose } have incorrect descriptors #48699

Description

@zloirock

Version

20.4.0

Platform

All

Subsystem

No response

What steps will reproduce the bug?

`Object.getOwnPropertyDescriptor(Symbol, 'dispose');

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

No response

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

Object.getOwnPropertyDescriptor(Symbol, 'dispose'); // => {value: Symbol(Symbol.dispose), writable: false, enumerable: false, configurable: false}

All well-known symbols should be non-writable, non-enumerable, and non-configurable to avoid patching and breaking things.

What do you see instead?

Object.getOwnPropertyDescriptor(Symbol, 'dispose'); // => {value: Symbol(Symbol.dispose), writable: true, enumerable: true, configurable: true}

Additional information

No response

Activity

  1. zloirock commented on Jul 7, 2023

    @zloirock
    Author
  2. MoLow commented on Jul 8, 2023

    @MoLow
    Member

    this is a polyfill until V8 implements explicit resource management, but perhaps we can solve this until than

  3. ljharb commented on Jul 8, 2023

    @ljharb
    SponsorMember

    @MoLow it's not actually a polyfill if it doesn't match the spec :-p fixing the descriptors should be trivial, so i filed #48703 for that.

    Fixing it so that Symbol.keyFor(Symbol.dispose) === undefined and Symbol.for('Symbol(Symbol.dispose)') !== Symbol.dispose is unfortunately trickier :-/

  4. benjamingr commented on Jul 9, 2023

    @benjamingr
    Member

    @ljharb your fix looks good, open a PR?

  5. benjamingr commented on Jul 9, 2023

    @benjamingr
    Member

    oh I just saw #48703 nvm :D

  6. added a commit that references this issue on Jul 12, 2023
    c2c7260
  7. added a commit that references this issue on Jul 13, 2023
    eb0aba5
  8. added 2 commits that reference this issue on Aug 14, 2023
    8396660
    9c52644
  9. added a commit that references this issue on Nov 27, 2023
    e08fd98
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions