Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2cce60119e858731f8018bdb692ea20843133c37
      
https://github.com/WebKit/WebKit/commit/2cce60119e858731f8018bdb692ea20843133c37
  Author: Chris Dumez <[email protected]>
  Date:   2026-04-22 (Wed, 22 Apr 2026)

  Changed paths:
    M Source/WebCore/html/parser/HTMLParserScheduler.cpp
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ParserYieldTokenPlugIn.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ParserYieldTokenTests.h
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ParserYieldTokenTests.mm

  Log Message:
  -----------
  HTMLParserScheduler resume timer should not fire while parser yield tokens 
are active
https://bugs.webkit.org/show_bug.cgi?id=312867

Reviewed by Ryosuke Niwa.

When a DocumentParserYieldToken is released and immediately retaken,
didEndYieldingParser() schedules a 0s resume timer, and then
didBeginYieldingParser() sets yield tokens active again. When the timer
fires, continueNextChunkTimerFired() calls pumpTokenizer() which asserts
!isScheduledForResume() — but that returns true because yield tokens are
active, causing an assertion failure. In release builds, this leads to a
busy-loop through the event loop until the yield tokens are cleared.

Fix this by checking m_documentHasActiveParserYieldTokens in
continueNextChunkTimerFired() and returning early, letting
didEndYieldingParser() handle scheduling the resume when tokens are
eventually released.

Tests: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ParserYieldTokenPlugIn.mm
       Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ParserYieldTokenTests.h
       Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ParserYieldTokenTests.mm

* Source/WebCore/html/parser/HTMLParserScheduler.cpp:
(WebCore::HTMLParserScheduler::continueNextChunkTimerFired):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ParserYieldTokenPlugIn.mm:
(-[ParserYieldTokenPlugIn releaseAndRetakeDocumentParserToken]):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ParserYieldTokenTests.h:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ParserYieldTokenTests.mm:
(TEST(ParserYieldTokenTests, ReleaseAndRetakeYieldTokenDoesNotCrash)):

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



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

Reply via email to