Error if there are pending items on the event queue#277
Conversation
jianghong
left a comment
There was a problem hiding this comment.
For when we release: Would you consider this a major change?
| testFile: "upstream/encoding/replacement-encodings.any.js", | ||
| }, | ||
| // { // FIXME requires the event loop | ||
| // testFile: "upstream/encoding/replacement-encodings.any.js", |
There was a problem hiding this comment.
It's unclear to me why this was needed to be commented out, could you clarify?
There was a problem hiding this comment.
This actually doesn't need to be commented out any more since I disabled the error message with pending jobs. Technically the tests aren't completing properly but I can't figure out a way to have these tests error but have the suite setup to not cause a panic.
There was a problem hiding this comment.
So this does need to continue to be commented out or we get unhandled promise rejections due to Javy not implementing XMLHttpRequest when we run with the event loop enabled. I've updated the comment.
wpt/package.json
Outdated
| "bundle": "rollup -c rollup.config.js runner.js", | ||
| "javy": "../target/release/javy compile -o bundle.wasm bundle.js", | ||
| "wasmtime": "wasmtime bundle.wasm", | ||
| "wasmtime": "wasmtime --env JAVY_WPT=1 bundle.wasm", |
There was a problem hiding this comment.
I don't know much about how the wpt stuff is built and ran yet but could we run it with the experimental_event_loop feature turned on? Would that help avoid needing to pass and checking this JAVY_WPT?
There was a problem hiding this comment.
Tried to address that in #277 (comment). The short answer is yes, but I'd prefer to not do that because WPT would be testing something that doesn't behave like Javy would without the feature enabled.
We can bump the minor version since we're 0.x. JS code that was working could stop working if it created pending jobs. |
saulecabrera
left a comment
There was a problem hiding this comment.
LGTM; thanks for all your patience iterating on this!
We've received feedback that the current behaviour of successfully exiting when items there are items enqueued on to the event loop that will never be executed is unexpected and they would prefer if the execution trapped with a helpful error message instead. This PR:
is_pendingtoContextto return whether there are pending jobs on the event queueThe check if we're running the WPT suite is done through a WASI environment variable. I opted to use this approach because:
I did take a look at the benchmarks to see if the WASI call to retrieve the env var value would have a performance impact and the results indicated no change in performance between main and this branch.