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

オープン 初心者向け
#2,052 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
cpp, javascript
領域
web-dev

調査の方向性

まず Polyfills/WebSocket/Source/WebSocket.cpp の定数宣言(16〜19行目付近)と Polyfills/XMLHttpRequest/Source/XMLHttpRequest.cpp の定数宣言(72〜76行目付近)を確認し、次に Polyfills/File/Source/FileReader.cpp の StaticValue/InstanceValue の二重パターンと比較してください。各定数にインスタンスレベルの対応するエントリがあり、new WebSocket(...).OPEN やインスタンス上の XHR の DONE 定数が undefined ではなく値を返せば完了です。ヘルパーマクロの後続作業はこの変更には含めないでください。

索引モデルが issue の本文から書いたものです。

説明

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:

主要言語
C++
スター
931
フォーク
169
平均マージ
2日 17時間
マージ済み PR(30日)
66

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

BabylonJS/BabylonNative のほかの issue

BabylonJS/BabylonNative の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。