Issue #2452 - Handle re-entrant Microtask checkpoints from Events dispatched by StableState callbacks

This commit is contained in:
Martok 2024-01-16 11:04:58 +01:00 committed by roytam1
commit a2c28b4268
2 changed files with 27 additions and 4 deletions

View file

@ -695,9 +695,10 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
// Events shall not be fired while we are in stable state to prevent anything
// visible from the scripts.
MOZ_ASSERT(!nsContentUtils::IsInStableOrMetaStableState());
NS_ENSURE_TRUE(!nsContentUtils::IsInStableOrMetaStableState(),
NS_ERROR_DOM_INVALID_STATE_ERR);
// See comment in CycleCollectedJSContext::AfterProcessMicrotasks for why we allow it anyway.
// MOZ_ASSERT(!nsContentUtils::IsInStableOrMetaStableState());
// NS_ENSURE_TRUE(!nsContentUtils::IsInStableOrMetaStableState(),
// NS_ERROR_DOM_INVALID_STATE_ERR);
#ifdef MOZ_TASK_TRACER
{