the chrome.cookies API is not clear to me. I want to getAll cookies for 3 different Domains, then delete those and wait for this process to finish, afterwards I want to set some cookies.
If I understand cookies chrome.cookies.getAll does not return a promise, only I can define a callback. Now its clear to me that I can write callbacks for all three getAll cookies commands but in there I am removing several cookies again this process goes asynchronously. So I am totally lost on how I can identify when all cookies of 3 domains have been completely removed.
One option that I could think of is that I run the 3 cookie.getAlls one time ahead and count the number of cookies, then with every remove I increase a counter and in a callback of remove I check whether I have reached the total number. This seems very strange so I can not believe that this is the correct way to do it.
Thanks