How to reproduce: $ run-webkit-httpd $ TEST_RUNNER_TEST_PLUGIN_PATH=this_env_var_is_no_longer_used_and_shouldnt_be_required_but_that_is_work_for_another_patch \ webkit-flatpak --gtk --debug -c \ /app/webkit/WebKitBuild/Debug/bin/WebKitTestRunner --show-window http://localhost:8000/media-resources/media-source/media-source-seek-unbuffered.html [...] ERROR: writeOriginToFile: Failed to open origin file '/home/ntrrgc/.local/share/WebKitTestRunner/storage/4NoLZrGDXutAmUUf2IXlV4GkA_dI4PpgaXiB2xqjhow/4NoLZrGDXutAmUUf2IXlV4GkA_dI4PpgaXiB2xqjhow/origin' /app/webkit/Source/WebKit/NetworkProcess/storage/StorageUtilities.h(73) : bool WebKit::writeOriginToFile(const WTF::String &, const WebCore::ClientOrigin &) There is nothing wrong about the path above. This is the call that is being made: auto originFileHandle = FileSystem::openFile(filePath, FileSystem::FileOpenMode::ReadWrite[, failIfFileExists = false]); The problem is openFile() is using g_file_open_readwrite() in this code path, which fails if the file doesn't exist. The following is a table of valid GIO functions for creating an stream with permissions requested by WebKit: +-----------+-------------------------+----------------------------+ | Mode | failIfFileExists | Call | +-----------+-------------------------+----------------------------+ | Read | (any, will always fail) | g_file_read() | | Truncate | true | g_file_create() | | Truncate | false | g_file_replace() | | ReadWrite | true | g_file_create_readwrite() | | ReadWrite | false | g_file_replace_readwrite() | +-----------+-------------------------+----------------------------+
I'm working on a fix.
This turned out to be a bigger rabbit hole than I expected. I'm not very happy with GIO's API. The previous table I made is incorrect, as g_file_replace_readwrite() followed by a close() effectively truncates the file.
Pull request: https://github.com/WebKit/WebKit/pull/12511
Committed 263367@main (78d2561b2bf7): <https://commits.webkit.org/263367@main> Reviewed commits have been landed. Closing PR #12511 and removing active labels.