performance.now() bypasses Host and uses std::time::Instant (unsupported on wasm32-unknown-unknown)

オープン
#165 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
rust, wasm

調査の方向性

Start with core/src/builtins/global.rs:11 and follow the call to agent::monotonic_ms in core/src/builtins/agent.rs:75; then inspect the Host trait, Host::now_ms, and WebHost. Add a host-provided monotonic clock with a native default and browser implementation. Done when performance.now() uses that clock, native behavior remains available, and the wasm browser path no longer calls unsupported Instant::now().

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

説明

bug

performance.now(), installed by Context::install_qjs_helpers, reads std::time::Instant directly (core/src/builtins/global.rs:11 -> agent::monotonic_ms, core/src/builtins/agent.rs:75) instead of going through the Host.

Consequences:

  • An embedder cannot control or fake the monotonic clock the way Host::now_ms controls Date.now() (reproducible runs, tests).
  • std::time::Instant::now() is unsupported on wasm32-unknown-unknown (std panics, and the web profile is panic = "abort"), so a browser embedder that installs the qjs helpers would abort on the first performance.now() call. Not exercised today because the web binding does not install the helpers.

Suggestion: add a Host method for the monotonic clock (default: Instant on native) and implement it in WebHost with the browser's performance.now().

主要言語
Rust
スター
61
フォーク
2
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

pocket-stack/quickjs-oxide のほかの issue

pocket-stack/quickjs-oxide の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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