I have a Chrome extension that makes some cookie management and uses the Cookies API.
The extension is allowed to run in incognito. When the following code runs in an incognito window it obtains the cookies from the non-incognito context instead of the incognito one.
chrome.cookies.getAll({}, function(cookies) {
console.log(cookies);
});
According to the docs, if no storeId
is specified in the options object, it should target the one from the context:
The cookie store to retrieve cookies from. If omitted, the current execution context's cookie store will be used.
Since the extension is running in incognito why then is considering other context as the default one?
I could manage querying the Cookie Store and specifying the appropriate id using getAllCookieStores
, however with this I still cannot determine which is the store from the current context.