[webkit-changes] [WebKit/WebKit] cc8a26: Safari periodically erasing LocalStorage and Index...

Charlie Wolfe noreply at github.com
Thu Jan 11 18:01:40 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cc8a261932c7e35fa313249d0d2d173874c0dcdb
      https://github.com/WebKit/WebKit/commit/cc8a261932c7e35fa313249d0d2d173874c0dcdb
  Author: Charlie Wolfe <charliew at apple.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M Source/WebKit/NetworkProcess/storage/NetworkStorageManager.cpp
    M Source/WebKit/NetworkProcess/storage/NetworkStorageManager.h

  Log Message:
  -----------
  Safari periodically erasing LocalStorage and IndexedDB for all websites
https://bugs.webkit.org/show_bug.cgi?id=266559
rdar://119818267

Reviewed by Sihui Liu.

Data eviction will delete website data for all origins if the total disk usage exceeds the total quota.
`m_totalQuota` is set in `NetworkStorageManager::spaceGrantedForOrigin()`, and will only be set if
`m_totalQuota` is zero. However, `m_totalQuota` is never initialized, so it's possible for it to have a
non-zero value which is less than the current disk usage. This situation prevents the variable from ever
being initialized in `NetworkStorageManager::spaceGrantedForOrigin()` and results in the deletion of all
website data.

This change addresses the issue by making `m_totalQuota` optional, ensuring the value is always null when
`NetworkStorageManager::spaceGrantedForOrigin()` is initially called.

* Source/WebKit/NetworkProcess/storage/NetworkStorageManager.cpp:
(WebKit::NetworkStorageManager::spaceGrantedForOrigin):
(WebKit::NetworkStorageManager::performEviction):
* Source/WebKit/NetworkProcess/storage/NetworkStorageManager.h:

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




More information about the webkit-changes mailing list