You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the last task for the browser extension lesson, background.js has the following code segment:
`chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
if (msg.action === 'updateIcon') {
chrome.browserAction.setIcon({ imageData: drawIcon(msg.value) });
}
});
//borrowed from energy lollipop extension, nice feature!
function drawIcon(value) {
let canvas = document.createElement('canvas');
let context = canvas.getContext('2d');
However when trying to run, the following error message is produced:
Error in event handler: TypeError: Cannot read properties of undefined (reading 'setIcon') at chrome-extension://fkcocajhgcibghcihihlnilegapombkl/background.js:3:24
I've tried debugging this on my own for hours, as well as going online to find answers for this bug. Apparently this code was written for Manifest V2, however the manifest.json supplied to us was written for Manifest V3, which means this code segment, and probably the whole file, is outdated. Please fix this issue to prevent more people from getting stuck on this step in the browser extension lesson.
The text was updated successfully, but these errors were encountered:
On the last task for the browser extension lesson, background.js has the following code segment:
`chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
if (msg.action === 'updateIcon') {
chrome.browserAction.setIcon({ imageData: drawIcon(msg.value) });
}
});
//borrowed from energy lollipop extension, nice feature!
function drawIcon(value) {
let canvas = document.createElement('canvas');
let context = canvas.getContext('2d');
}`
However when trying to run, the following error message is produced:
Error in event handler: TypeError: Cannot read properties of undefined (reading 'setIcon') at chrome-extension://fkcocajhgcibghcihihlnilegapombkl/background.js:3:24
I've tried debugging this on my own for hours, as well as going online to find answers for this bug. Apparently this code was written for Manifest V2, however the manifest.json supplied to us was written for Manifest V3, which means this code segment, and probably the whole file, is outdated. Please fix this issue to prevent more people from getting stuck on this step in the browser extension lesson.
The text was updated successfully, but these errors were encountered: