true when chrome.cookies is available, otherwise false
isCookiesApiAvailable() // true inside the extension, false in unit tests
export function isCookiesApiAvailable(): boolean {
return typeof chrome !== "undefined" && Boolean(chrome.cookies);
}
Reports whether the
chrome.cookiesAPI is usable in the current context. It isundefinedunless the extension has the "cookies" permission and the host permission for the origin, so callers guard with this to degrade gracefully (dev fallback, or when a user hasn't accepted the upgraded permission set yet).