Skip to content

Copy WAL and SHM files in legacy fallback for Firefox#237

Open
shakeyourbunny wants to merge 1 commit into
borisbabic:masterfrom
luducat:fix-firefox-wal-copy
Open

Copy WAL and SHM files in legacy fallback for Firefox#237
shakeyourbunny wants to merge 1 commit into
borisbabic:masterfrom
luducat:fix-firefox-wal-copy

Conversation

@shakeyourbunny

Copy link
Copy Markdown

When Firefox is running, its cookies.sqlite uses WAL (Write-Ahead Logging) mode. Recent cookies may only exist in the -wal file, not yet checkpointed back to the main database.

The legacy copy fallback currently only copies the main .sqlite file, so recently-set cookies are missing from the copy. On Windows this is the primary issue — the readonly/immutable URI modes fail due to mandatory file locking, the legacy copy runs, but returns stale data.

This change copies all three files (cookies.sqlite, cookies.sqlite-wal, cookies.sqlite-shm) to the temp directory so SQLite can replay the WAL journal on the temp copy. The -wal and -shm copies are best-effort — if they can't be read, the fallback still works as before with just the main db.

Cleanup in close() also removes the extra files.

When Firefox is running, its cookies.sqlite uses WAL mode.
Recent cookies may only exist in the -wal file, not the main
database. The legacy copy fallback now copies all three files
(main db, WAL, SHM) so SQLite can replay the journal on the
temp copy. Cleanup removes the extra files too.

Fixes cookie reading from running Firefox on Windows where
the readonly/immutable URI modes fail due to mandatory file
locking.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant