mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
LibWeb: Perform a microtask checkpoint - VERIFY after reentrancy return
The HTML event loop spec explicitly provides guidance for reentrancy in the "perform a microtask checkpoint" algorithm, so we cannot VERIFY for empty execution context before this early exit (as much as we'd like to). https://html.spec.whatwg.org/multipage/webappapis.html#perform-a-microtask-checkpoint See the microtask-checkpoint-reentrancy-via-responsexml-script test for an example of how this can happen from user scripts.
This commit is contained in:
committed by
Shannon Booth
parent
a19db375b5
commit
d065f6bf00
Notes:
github-actions[bot]
2026-02-19 07:13:44 +00:00
Author: https://github.com/jonbgamble Commit: https://github.com/LadybirdBrowser/ladybird/commit/d065f6bf00f Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7991 Reviewed-by: https://github.com/shannonbooth ✅
@@ -610,14 +610,14 @@ void EventLoop::perform_a_microtask_checkpoint()
|
||||
if (execution_paused())
|
||||
return;
|
||||
|
||||
// NOTE: This assertion is per requirement 9.5 of the ECMA-262 spec, see: https://tc39.es/ecma262/#sec-jobs
|
||||
// > At some future point in time, when there is no running context in the agent for which the job is scheduled and that agent's execution context stack is empty...
|
||||
VERIFY(vm().execution_context_stack().is_empty());
|
||||
|
||||
// 1. If the event loop's performing a microtask checkpoint is true, then return.
|
||||
if (m_performing_a_microtask_checkpoint)
|
||||
return;
|
||||
|
||||
// NOTE: This assertion is per requirement 9.5 of the ECMA-262 spec, see: https://tc39.es/ecma262/#sec-jobs
|
||||
// > At some future point in time, when there is no running context in the agent for which the job is scheduled and that agent's execution context stack is empty...
|
||||
VERIFY(vm().execution_context_stack().is_empty());
|
||||
|
||||
// 2. Set the event loop's performing a microtask checkpoint to true.
|
||||
m_performing_a_microtask_checkpoint = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user