Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 19e5a5c4f14d419285a898a62089a32546834b77
      
https://github.com/WebKit/WebKit/commit/19e5a5c4f14d419285a898a62089a32546834b77
  Author: Basuke Suzuki <[email protected]>
  Date:   2026-03-07 (Sat, 07 Mar 2026)

  Changed paths:
    M Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm

  Log Message:
  -----------
  ResourceLoadStatisticsStore::hasStorageAccess drops completionHandler when 
domainID lookup fails.
https://bugs.webkit.org/show_bug.cgi?id=309424
rdar://171987676

Reviewed by Wenson Hsieh and Anne van Kesteren.

ResourceLoadStatisticsStore::hasStorageAccess() drops its completionHandler when
ensureResourceStatisticsForRegistrableDomain() returns std::nullopt, leaving the
document.hasStorageAccess() JS Promise permanently unresolved.

Fix two issues:

1. In hasStorageAccess(), call completionHandler(false) before the early return
   when ensureResourceStatisticsForRegistrableDomain() fails. This matches the
   pattern already used by requestStorageAccess() and 
grantStorageAccessInternal().

2. In ensureResourceStatisticsForRegistrableDomain(), the bind-failure error 
path
   returned { AddedRecord::No, 0 } instead of { AddedRecord::No, std::nullopt }.
   The implicit conversion from 0 to std::optional<unsigned>(0) masked the error
   — callers checking !result.second would see a "valid" domain ID of 0 rather
   than a failure. Change it to return std::nullopt for consistency with the 
other
   error paths in the same function.

Test: Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm
* Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::hasStorageAccess):
(WebKit::ResourceLoadStatisticsStore::ensureResourceStatisticsForRegistrableDomain):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm:
(TEST(ResourceLoadStatistics, HasStorageAccessWithDatabaseError)):

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



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

Reply via email to