I have been trying to list all browser cookies in my extension with browser.cookies.getAll()
. At first, I thought it was a permissions issue, but my permissions appear to be set correctly. Here is my code:
manifest.json
{
"manifest_version": 2,
"name": "CookieExample",
"version": "0.1",
"applications": {
"gecko": {
"id": "[email protected]"
}
},
"permissions": [
"cookies",
"webNavigation",
"webRequest",
"webRequestBlocking",
"<all_urls>"
],
"background": {
"scripts": ["cookies.js"]
}
}
cookies.js
browser.cookies.getAll({}, function(cookies) {
console.log(cookies);
});
The console simply logs []
as the return value. I don't know where I've gone wrong or if it's a problem with the browser. Cookie Manager works just fine and lists all browser cookies without a hitch. Looking into its source code, the only difference is that it uses a cookie store ID to query for cookies, whereas I used nothing.