Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibJS: Only run queued promise jobs if there is no embedder #3231

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shannonbooth
Copy link
Contributor

This has no functional difference as run_queued_promise jobs does nothing when LibWeb is used as it has a different implementation of enqueuing and running promise jobs. But this change makes it more obvious that run_queued_promise jobs does nothing when there is an embedder, and adjusts the comment to reflect what the code is actually achieving.

if (auto* custom_data = vm.custom_data()) {
// Embedder case (i.e. LibWeb).
custom_data->spin_event_loop_until(GC::create_function(vm.heap(), [success] {
Copy link
Contributor Author

@shannonbooth shannonbooth Jan 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spinning the event loop like this technically also runs all promise jobs, but I'm not 100% sure if the spin itself is fully correct for all cases and interleaving other potential stuff to happen.

Copy link
Contributor Author

@shannonbooth shannonbooth Jan 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The running of queued promise jobs in non-embedder case below is definitely less correct than spinning the event loop in the sense it doesn't do the clear of the execution context stack, but I haven't quite figured out the normative impact of that yet

@shannonbooth shannonbooth force-pushed the clarify-completion-await branch from e853020 to a8ffb78 Compare January 12, 2025 00:59
This has no functional difference as run_queued_promise jobs does
nothing when LibWeb is used as it has a different implementation of
enqueuing and running promise jobs. But this change makes it more
obvious that run_queued_promise jobs does nothing when there is an
embedder, and adjusts the comment to reflect what the code is
actually achieving.
@shannonbooth shannonbooth force-pushed the clarify-completion-await branch from a8ffb78 to a043ba8 Compare January 12, 2025 01:00
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.

1 participant