[JsRuntimeHost] Web polyfill constants: add missing InstanceValue exposure on WebSocket and XMLHttpRequest
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 70/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- cpp, javascript
- Domain
- web-dev
Research direction
Start with the constant declarations in Polyfills/WebSocket/Source/WebSocket.cpp (around lines 16-19) and Polyfills/XMLHttpRequest/Source/XMLHttpRequest.cpp (around lines 72-76), then compare them with the dual StaticValue/InstanceValue pattern in Polyfills/File/Source/FileReader.cpp. Done means each constant has a matching instance-level entry, so new WebSocket(...).OPEN and the XHR DONE constant on an instance return their values instead of undefined. Leave the helper-macro follow-up out of this change.
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/CLOSEDareStaticValueonly.new WebSocket(...).OPENreturnsundefined.Polyfills/XMLHttpRequest/Source/XMLHttpRequest.cpp(L72–76) —UNSENT/OPENED/HEADERS_RECEIVED/LOADING/DONEareStaticValueonly. Same gap.Polyfills/File/Source/FileReader.cpp(new in BabylonJS/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:
- Dominant language
- C++
- Stars
- 931
- Forks
- 169
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 66
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from BabylonJS/BabylonNative
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
BabylonJS/BabylonNative#2138 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
BabylonJS/BabylonNative#2042 ·
Maintainers usually reply within 1 day
-
testing
Difficulty 4/5 3-5 days Newbie friendliness 45/100
BabylonJS/BabylonNative#2136 ·
Maintainers usually reply within 1 day
-
Support useNDCHalfZRange (half-range NDC depth) so Babylon.js half-range depth visual tests can runOpen
Difficulty 4/5 3-5 days Newbie friendliness 48/100
BabylonJS/BabylonNative#2134 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
BabylonJS/BabylonNative#2129 ·
Maintainers usually reply within 1 day
All issues in BabylonJS/BabylonNative
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
simnJS/AnyPS5#735 · 1 comment ·
Maintainers usually reply within 1 day
-
needs-format
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Niko1221/Strata#7719 · 1 comment ·
Maintainers usually reply within 4 days
-
area:tests kind:test
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day