mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
LibWeb: Run queued promise jobs after callbacks
We now run queued promise jobs after calling event handler, timer, and requestAnimationFrame() callbacks - this is a bit ad-hoc, but I don't want to switch LibWeb to use an event loop right now - this works just fine, too. We might want to revisit this at a later point and do tasks and microtasks properly.
This commit is contained in:
parent
f418115f1b
commit
ade3adcc7a
3 changed files with 12 additions and 2 deletions
|
@ -543,8 +543,12 @@ Color Document::visited_link_color() const
|
|||
|
||||
JS::Interpreter& Document::interpreter()
|
||||
{
|
||||
if (!m_interpreter)
|
||||
m_interpreter = JS::Interpreter::create<Bindings::WindowObject>(Bindings::main_thread_vm(), *m_window);
|
||||
if (!m_interpreter) {
|
||||
auto& vm = Bindings::main_thread_vm();
|
||||
// TODO: Hook up vm.on_promise_unhandled_rejection and vm.on_promise_rejection_handled
|
||||
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#promise_rejection_events
|
||||
m_interpreter = JS::Interpreter::create<Bindings::WindowObject>(vm, *m_window);
|
||||
}
|
||||
return *m_interpreter;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue