Skip to content

[JsRuntimeHost] Web polyfill constants: add missing InstanceValue exposure on WebSocket and XMLHttpRequest #2052

Open

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 JsRuntimeHost#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:

Activity

  1. added this to the Future milestone on Jun 9, 2026
  2. changed the title [-]Web polyfill constants: add missing InstanceValue exposure on WebSocket and XMLHttpRequest[/-] [+][JsRuntimeHost] Web polyfill constants: add missing InstanceValue exposure on WebSocket and XMLHttpRequest[/+] on Nov 9, 2026
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions