Skip to content

Conversation

@SpiralP
Copy link
Contributor

@SpiralP SpiralP commented Aug 31, 2025

When executing javascript console.time() using the web_stub feature, we currently get a:

required type std::time::Instant is not present in GothamState container

This is because we never initialize the StartTime state used at:

let start_time = state.borrow::<StartTime>();

op_now() is called from deno_console at:
https://github.com/denoland/deno/blob/v2.4.5/ext/console/01_console.js#L169
(which is used in console.time(), console.timeLog(), and console.timeEnd()

I have a repro repo here:
https://github.com/SpiralP/rustyscript-console-time-bug

Noting I copied the StartTime struct style from upstream deno_web found here:
https://github.com/denoland/deno/blob/v2.4.5/ext/web/timers.rs#L24-L38

@rscarson
Copy link
Owner

rscarson commented Sep 1, 2025

Lgtm, thanks!

@rscarson rscarson merged commit bca5dc8 into rscarson:master Sep 1, 2025
5 checks passed
@SpiralP SpiralP deleted the rustyscript-console-time-bug branch September 2, 2025 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants