Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: yury-s/WebKit
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: yury-s/WebKit
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: opfs-in-memory
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 2 commits
  • 74 files changed
  • 1 contributor

Commits on Aug 15, 2026

  1. Put the Origin Private File System behind a backend interface

    FileSystemStorageManager and FileSystemStorageHandle call FileSystem:: directly,
    so the storage medium behind OPFS cannot be swapped without editing the handle
    logic itself. Likewise FileSystemSyncAccessHandle does all of its I/O on a
    FileSystem::FileHandle inline, so there is no seam for a file that is reached
    another way.
    
    Introduce two seams, with only the existing implementation behind each:
    
    FileSystemStorageBackend collects the file operations the storage process needs
    -- existence, type, size, listing, create and remove, move and copy, the scratch
    file for a writable stream, and opening a file. FileSystemStorageDiskBackend
    forwards each of them to the platform file system exactly as before, and
    FileSystemStorageManager owns one.
    
    FileSystemSyncAccessHandle::Delegate collects the read, write, truncate, size and
    flush that the handle performs. FileHandleDelegate keeps the descriptor.
    The file cursor moves out of the descriptor and into FileSystemSyncAccessHandle,
    so the delegate takes absolute offsets and truncate() no longer has to query the
    descriptor for the current offset.
    
    No behavior change: storage/filesystemaccess and the imported fs
    web-platform-tests are unaffected.
    yury-s committed Aug 15, 2026
    Configuration menu
    Copy the full SHA
    04cbe1c View commit details
    Browse the repository at this point in the history
  2. Serve the Origin Private File System from memory when there is no sto…

    …rage directory
    
    An ephemeral session -- WKWebsiteDataStore.nonPersistent(), which is also Safari
    Private Browsing -- has no storage root path, so OriginStorageManager hands
    FileSystemStorageManager an empty path and every OPFS operation fails with
    UnknownError. navigator.storage.getDirectory() therefore does not work at all in
    such a session, while LocalStorage, IndexedDB and CacheStorage all keep working
    because each of them treats an empty path as "use the memory backend".
    
    Give the File System API the same treatment, on the seams the previous commit
    introduced.
    
    FileSystemStorageMemoryBackend keeps a flat map of virtual paths to directory and
    file entries, owned by the FileSystemStorageManager, so it dies with the session
    and nothing is ever written out. An empty root path selects it, mirroring
    IDBStorageManager::createBackingStore().
    
    Sync access handles were the one part that could not be swapped invisibly: they
    hand the web process a file descriptor and then do all I/O on it locally, and a
    file that exists only in RAM has no descriptor to hand over. FileSystemSyncAccessHandle
    gains an IPCDelegate that services the same synchronous JavaScript calls with
    blocking messages to the storage process, reusing the callOnMainThread-plus-semaphore
    pattern that requestNewCapacityForSyncAccessHandle already uses. "Sync" describes
    the JavaScript API, not the transport, and these handles are only exposed on worker
    threads, so blocking one is acceptable. flush() is a no-op because nothing is
    buffered on the web process side.
    
    getFile() likewise cannot hand out a path for a file that has none, so GetFile now
    answers with either a path or the file's bytes, and the web process builds the File
    from a Blob in the second case.
    
    Memory-backed bytes count towards the origin's quota through OriginStorageManager's
    usage function, so a page cannot fill RAM unbounded, and they are reported as
    FileSystem website data like the other in-memory storage types. Clearing that data
    drops the manager, which is what frees the memory.
    
    Two changes outside the ephemeral path are worth calling out: closeWritable() now
    deletes the scratch file it copied from, which previously leaked a file in the
    system temporary directory on every successful writable stream close; and
    WebKitTestRunner gives its ephemeral data store the same quota as its persistent
    one, via the new WKWebsiteDataStoreConfigurationCreateNonPersistent(), so
    quota-dependent tests exercise the same limits in both session types.
    
    Covered by ephemeral variants of every storage/filesystemaccess test plus a new
    opfs-binary-round-trip test that checks byte-exact storage of 0x00 and 0xFF through
    both a writable stream and a sync access handle. The imported fs web-platform-tests
    stay green.
    yury-s committed Aug 15, 2026
    Configuration menu
    Copy the full SHA
    f390029 View commit details
    Browse the repository at this point in the history
Loading