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

Aperta
#165 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust, wasm

Direzione di ricerca

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().

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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().

Lingua principale
Rust
Stelle
61
Fork
2
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pocket-stack/quickjs-oxide

Tutte le issue di pocket-stack/quickjs-oxide

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.