Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bff32498c2d9ad936c05a27899b5f794aacb2563
      
https://github.com/WebKit/WebKit/commit/bff32498c2d9ad936c05a27899b5f794aacb2563
  Author: Chris Dumez <[email protected]>
  Date:   2026-07-28 (Tue, 28 Jul 2026)

  Changed paths:
    M Source/WebKit/NetworkProcess/cache/AsyncRevalidation.cpp

  Log Message:
  -----------
  Cancel the in-flight SpeculativeLoad when a stale-while-revalidate 
revalidation times out
https://bugs.webkit.org/show_bug.cgi?id=320350

Reviewed by Youenn Fablet.

AsyncRevalidation::staleWhileRevalidateEnding() fires when the 
stale-while-revalidate
window elapses, which is precisely the case where the revalidation network load 
may still
be in flight. It only invoked the completion handler (reporting 
Result::Timeout), which
removes the AsyncRevalidation from Cache::m_pendingAsyncRevalidations and, once 
the timer's
protecting reference is released, destroys it along with its owned 
SpeculativeLoad.

Destroying a SpeculativeLoad whose load is still outstanding is not a clean 
teardown:
~SpeculativeLoad asserts that m_networkLoad is null, and its 
RevalidationCompletionHandler
is destroyed without ever being called (CompletionHandler asserts it must 
always be
called). In debug this is a pair of assertion failures; in release the in-flight
NetworkLoad is orphaned and the completion handler's captured state leaks.

Cancel the load on this path, matching AsyncRevalidation::cancel(). We move the 
completion
handler out before calling SpeculativeLoad::cancel() so that cancel()'s own 
callback does
not re-enter our handler and report Result::Failure before we report 
Result::Timeout.

* Source/WebKit/NetworkProcess/cache/AsyncRevalidation.cpp:
(WebKit::NetworkCache::AsyncRevalidation::staleWhileRevalidateEnding):

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



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

Reply via email to