Can't get Firefox extension logs to show up
Solution 1:
Firefox console has been divided into different areas. The result of console.log()
can be viewed in the relative area.
- Multiprocess Browser Console Ctrl+Shift+J
Mostly logs by Firefox itself - Web Developer Tools Ctrl+Shift+I or F12
Logs by Tab/Webpage and Content scripts of addons - Extension Toolbox about:debugging#/runtime/this-firefox ➜ XYZaddon ➜ Inspect
Logs by background scripts of XYZaddon
Update
Based on comments, here is a tested simplified code that you can work on. The log shows on Extension Toolbox.
async function showCookiesForTab() {
// get the first tab object in the array
const tabs = await browser.tabs.query({currentWindow: true, active: true});
// get all cookies in the domain
const cookies = await browser.cookies.getAll({url: tabs[0].url});
console.log(cookies);
// Array(6) [ {…}, {…}, {…}, {…}, {…}, {…} ]
}
showCookiesForTab();