i don't know why but it doesn't work
function cookielist(){
var cookies={};
chrome.cookies.getAll({},function (cookie){
for(i=0;i<cookie.length;i++){
if(!cookie[i].domain.startsWith('.')){cookie[i].domain='.'+cookie[i].domain;}
cookies[cookie[i].domain]?'':cookies[cookie[i].domain]=[];
cookies[cookie[i].domain].push(JSON.stringify(cookie[i]));
}
});
return cookies;
}
test=cookielist();console.log(JSON.stringify(test));
i run this from console (i have enough perms from manifest.json no problem)
it returns me
" {}
undefined"
just {} empty object
but when i run
test=cookielist();
and after this command from console when i run
console.log(JSON.stringify(test));
i get the correct result? why it works when executing second command and not at first?