I’m in the process of converting my Userscripts into an Addon/Extension for Firefox & Chrome.
However, I’m stuck on a particular issue.
In my Userscript, I can access the 's properties via Object.values() that the website puts in.
In my Addon/Extension content_script, I cannot access the 's properties via Object.values() that the website puts in.
Sample code:
function hasCategory(theDiv, theCategory) {
let foundTheCategory = false;
let objValues = Object.values(theDiv);
if (objValues.length > 1) {
if (objValues[1].children?.props?.category === theCategory) {
foundTheCategory = true;
break;
}
}
return foundTheCategory;
}
The above code works in the Userscript (i.e. found some Object.values()/properties to work with).
The above code does not work in the Addon/Extension content_script (i.e. did not find any Object.values()/properties to work with).
Is there a reason for this? Is there a workaround for Addon/Extension content_script to access the 's properties that the website puts in?
nb: manifest.json permissions are: “storage”, “unlimitedStorage” and “activeTab”.