Summary
On Safari, cookies.getAll() returns an empty array on the first call for a given tab/site, even though cookies exist. This is not the "Cookie Store API experimental feature" problem described in #355 — it's caused by querying with an unresolved storeId.
Root cause
Safari's WebExtension tabs API never populates tab.cookieStoreId (unlike Firefox). Code that calls cookies.getAll({ url, storeId: tab.cookieStoreId }) therefore always sends storeId: undefined. Safari 18+ has a documented regression where cookies.getAll() returns [] on the first invocation whenever the query resolves its cookie store implicitly instead of via an explicit, real store id.
Confirmed with instrumented logging on a Safari popup's first open:
storeId: undefined
count: 0
Confirmed against Apple's own developer forum reports of the same regression:
Suggested fix
Instead of the temporary-cookie workaround in #357 (which writes a zcookie-editor cookie into every site as a side effect), resolve real store ids first:
- Call
cookies.getAllCookieStores().
- Call
cookies.getAll({ ...query, storeId: store.id }) once per real store id returned, then merge the results.
This never passes an undefined storeId, and avoids creating a cookie as a side effect just to work around the bug.
Related
Summary
On Safari,
cookies.getAll()returns an empty array on the first call for a given tab/site, even though cookies exist. This is not the "Cookie Store API experimental feature" problem described in #355 — it's caused by querying with an unresolvedstoreId.Root cause
Safari's WebExtension
tabsAPI never populatestab.cookieStoreId(unlike Firefox). Code that callscookies.getAll({ url, storeId: tab.cookieStoreId })therefore always sendsstoreId: undefined. Safari 18+ has a documented regression wherecookies.getAll()returns[]on the first invocation whenever the query resolves its cookie store implicitly instead of via an explicit, real store id.Confirmed with instrumented logging on a Safari popup's first open:
Confirmed against Apple's own developer forum reports of the same regression:
Suggested fix
Instead of the temporary-cookie workaround in #357 (which writes a
zcookie-editorcookie into every site as a side effect), resolve real store ids first:cookies.getAllCookieStores().cookies.getAll({ ...query, storeId: store.id })once per real store id returned, then merge the results.This never passes an undefined
storeId, and avoids creating a cookie as a side effect just to work around the bug.Related