Skip to content

bug: opfs broken on linux #482

Description

@a2f0

I've reviewed the contributing guidelines and submitting this issue in the spirit of the language there. Happy to submit a PR for this but it would basically be AI generated.

The issue I am seeing is that OPFS persistent storage doesn't work in Linux, in particular a call to FileSystemSyncAccessHandle In WebKitGTK's source i.e. L31 here returns null for non Cocoa (Linux) ports. Since I want to be able to use OPFS persistent storage in Linux, I am using Electrobun with CEF Chromium. But, to get it working, I had to modify partition_context.h with the following code, which is commented by an AI agent. I've confirmed the fix and also confirmed MacOS works without CEF or needing any fix whatsoever.

Obviously free to close this issue if you think it's junk, the proposed fix below works for me and I don't need help resolving it.

@@ inline CefRefPtr<CefRequestContext> getOrCreateRequestContextForPartition(
         return ctx;
     }
 
+    // The default persistent partition ("persist:default") maps to the global
+    // context, which already persists at root_cache_path (<...>/CEF). Creating a
+    // separate persistent CefRequestContext whose cache_path is a *subdirectory*
+    // of an already-open profile's root_cache_path (i.e. <...>/CEF/partitions/
+    // default) is rejected by the Chrome runtime ("Cannot create profile at
+    // path ..."), leaving the webview without working storage — which breaks
+    // OPFS / FileSystemSyncAccessHandle (e.g. persistent SQLite). Use the global
+    // context so the default partition persists in the root profile instead.
+    if (isPersistent && identifier == "persist:default") {
+        CefRefPtr<CefRequestContext> ctx = CefRequestContext::GetGlobalContext();
+        registerScheme(ctx);
+        return ctx;
+    }
+
     // Reuse cached context for persist:* partitions only.
     if (isPersistent) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions