Safari Extension Manifest V3 - Background Script Cookies Not Working After Safari v18 Update
Issue: Safari Extension Manifest V3 - Background Script Cookies Not Working After Safari v18 Update
Description:
Since updating to Safari version 18, I’ve encountered an issue with my extension’s background script accessing cookies. Before this update, everything worked as expected in Safari v17 and below. Now, when my extension tries to retrieve cookies using `chrome.cookies.getAll()`, it returns an empty list. However, if I open the extension’s developer tools and run `chrome.cookies.getAll()` in the console, the cookies appear correctly.
It seems Safari only provides cookie data once the developer tools are opened. But after restarting Safari and launching the extension without opening the dev tools, `chrome.cookies.getAll()` still returns an empty list.
Repro Steps:
1. Start Safari (v18 or later).
2. Open the extension without launching the developer tools.
3. Call `chrome.cookies.getAll()` in the background script.
4. Observe an empty list of cookies.
5. Open developer tools and re-run `chrome.cookies.getAll()` in the console; cookies are retrieved as expected.
Expected Behavior:
The extension should be able to access cookies in the background script without the need to open developer tools.
Actual Behavior:
Cookies are only accessible in the background script when developer tools are open.
Has anyone else experienced this issue or found a solution?
iMac 27″