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

Đang mở Phù hợp với người mới
#2,052 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
70/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
cpp, javascript
Lĩnh vực
web-dev

Hướng nghiên cứu

Bắt đầu từ các khai báo hằng số trong Polyfills/WebSocket/Source/WebSocket.cpp (khoảng dòng 16-19) và Polyfills/XMLHttpRequest/Source/XMLHttpRequest.cpp (khoảng dòng 72-76), sau đó so sánh chúng với mẫu kép StaticValue/InstanceValue trong Polyfills/File/Source/FileReader.cpp. Hoàn thành khi mỗi hằng số có một mục tương ứng ở cấp instance, để new WebSocket(...).OPEN và hằng số DONE của XHR trên một instance trả về giá trị của chúng thay vì undefined. Công việc tiếp theo về các macro hỗ trợ được loại khỏi thay đổi này.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
C++
Star
931
Fork
169
Merge trung bình
2 ngày 17 giờ
Pull request đã merge (30 ngày)
66

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của BabylonJS/BabylonNative

Tất cả issue của BabylonJS/BabylonNative

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.