I am developing a chrome extension and I need to get all cookies (at least in the current CookieStore). First pass i use
chrome.cookies.getAll({}, function (cookies) { chrome.cookies.onChanged.addListener(function (changeInfo) {
But now I think there might be a flaw here: the getAll call asks the browser to list all existing cookies. The browser then calls the getAll callback with an array of these existing cookies. The extension is then registered to receive updates for any added / deleted / modified cookies. It looks like any cookie that is added by the browser after creating an array of cookies (for example, using active tabs), but before calling addListener will be lost before the update.
Does anyone have any suggestions for a better approach?
I started looking at the source of the chrome dev tools for examples, but it looks like the Resources> Cookies table does not use this API.
source share