Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b9df48395d594c5c0e8519933602e549823331af
      
https://github.com/WebKit/WebKit/commit/b9df48395d594c5c0e8519933602e549823331af
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-10-07 (Wed, 07 Oct 2026)

  Changed paths:
    M Source/WebCore/dom/ScriptExecutionContext.cpp
    M Source/WebCore/dom/ScriptExecutionContext.h

  Log Message:
  -----------
  ScriptExecutionContext::resumeActiveDOMObjects() never clears the suspension 
reason, so a repeated resume resumes running objects
https://bugs.webkit.org/show_bug.cgi?id=326645
rdar://189381929

Reviewed by Chris Dumez.

resumeActiveDOMObjects(why) only checked m_reasonForSuspendingActiveDOMObjects
against `why`, and never reset it after resuming. A second resume with the same
reason therefore passed the check and called resume() again on every
ActiveDOMObject, even though they were already running. The same stale reason
also let Document::resumeScheduledTasks() run twice, restarting the script
runner and pending-task timers and hitting ASSERT(m_scheduledTasksAreSuspended).

This can happen with the Web Inspector debugger: PageDebugger and FrameDebugger
skip suspending a frame when canExecuteScripts() is false at pause time, but
still resume it if canExecuteScripts() is true at unpause time.

Store the reason as std::optional<ReasonForSuspension> instead of the
static_cast<ReasonForSuspension>(-1) placeholder, and clear it on resume. Also
set it before suspending the ActiveDOMObjects rather than after, so
suspendActiveDOMObjectIfNeeded() never reads an empty reason while suspension
is in progress.

No new tests. Web content cannot trigger a repeated resume, so a test would
pass with or without this change.

* Source/WebCore/dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
(WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
(WebCore::ScriptExecutionContext::suspendActiveDOMObjectIfNeeded):
* Source/WebCore/dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::reasonForSuspendingActiveDOMObjects const):

Canonical link: https://commits.webkit.org/323054@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to