Skip to content

Web polyfill constants: add missing InstanceValue exposure on WebSocket and XMLHttpRequest #173

@bghgary

Description

@bghgary

Per WHATWG IDL, class const members are exposed on both the constructor (static) and instances (via the prototype). JRH polyfills currently do this inconsistently:

  • Polyfills/WebSocket/Source/WebSocket.cpp (L16–19) — CONNECTING / OPEN / CLOSING / CLOSED are StaticValue only. new WebSocket(...).OPEN returns undefined.
  • Polyfills/XMLHttpRequest/Source/XMLHttpRequest.cpp (L72–76) — UNSENT / OPENED / HEADERS_RECEIVED / LOADING / DONE are StaticValue only. Same gap.
  • Polyfills/File/Source/FileReader.cpp (new in Add File / FileReader polyfill #169) — exposes both, conformant.

Fix: add an InstanceValue entry alongside each StaticValue for both polyfills. Going forward, web polyfill classes with IDL const members should define one of each.

Follow-up: investigate whether a helper function/macro can emit both descriptors from a single declaration so authors don't have to remember the dual exposure (and constants can't silently drift between static and instance values).

References:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions