mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 10:07:15 +02:00
LibWeb: Restore skip flag to its original value in EventLoop
Before, we could re-enter into this method and it would clear the skip flag once the innermost call would finish. Instead, remember what the flag's original value was and restore that.
This commit is contained in:
committed by
Tim Flynn
parent
a25fc5ad8a
commit
e80e2fb4b8
Notes:
github-actions[bot]
2026-03-15 13:05:14 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/e80e2fb4b80 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8397 Reviewed-by: https://github.com/trflynn89 ✅
@@ -5,6 +5,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibJS/Runtime/VM.h>
|
||||
#include <LibWeb/Bindings/MainThreadVM.h>
|
||||
@@ -124,8 +125,9 @@ void EventLoop::spin_processing_tasks_with_source_until(Task::Source source, GC:
|
||||
|
||||
perform_a_microtask_checkpoint();
|
||||
|
||||
// NOTE: HTML event loop processing steps could run a task with arbitrary source
|
||||
m_skip_event_loop_processing_steps = true;
|
||||
// NOTE: HTML event loop processing steps could run a task with arbitrary source. We could end up re-entering into
|
||||
// this method; this makes sure we restore the skip value to its original value.
|
||||
TemporaryChange saved_skip(m_skip_event_loop_processing_steps, true);
|
||||
|
||||
Platform::EventLoopPlugin::the().spin_until(GC::create_function(heap(), [this, source, goal_condition] {
|
||||
if (goal_condition->function()())
|
||||
@@ -147,8 +149,6 @@ void EventLoop::spin_processing_tasks_with_source_until(Task::Source source, GC:
|
||||
return goal_condition->function()();
|
||||
}));
|
||||
|
||||
m_skip_event_loop_processing_steps = false;
|
||||
|
||||
schedule();
|
||||
|
||||
vm.restore_execution_context_stack();
|
||||
|
||||
Reference in New Issue
Block a user