Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open Beginner friendly
#173 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
cpp
Domain
api, web-dev

Research direction

Read Polyfills/WebSocket/Source/WebSocket.cpp and Polyfills/XMLHttpRequest/Source/XMLHttpRequest.cpp, comparing their constant descriptors with Polyfills/File/Source/FileReader.cpp. Add the missing instance exposure alongside each listed static constant, then verify that the constants are available from both constructors and instances; treat the helper or macro idea as a separate follow-up.

Written by the indexing model from the issue text.

Description

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

Dominant language
C++
Stars
22
Forks
23
Avg merge
4d 8h
Merged PRs (30d)
3

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from BabylonJS/JsRuntimeHost

All issues in BabylonJS/JsRuntimeHost

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.