I am trying to make a super tiny extension to wait 30 seconds and reload a page in case for any unspecific reason page couldn't load (timeouts, network instability...)
I am following Mozilla's Your first extension. So far, so good. I did that work.
However, when I am using their methods, specifically onErrorOccurred, I can't register that event instead of following the guide.
I tried disconnecting my own wifi network and try accessing a random site. I couldn't see any logging.
What am I doing wrong?
If my approach is not correct, How should I do it?
manifest.json
{
"manifest_version": 2,
"name": "ElEspia",
"version": "0.0.1",
"description": "Watchdog for kiosk-like systems browser based",
"icons": {
"48": "icons/icon.png"
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["watchdog.js"]
}
]
}
watchdog.js
document.body.style.border = "5px solid red";
function logOnErrorOccurred(details) {
console.log(`onErrorOccurred: ${details.url}`);
console.log(details.error);
}
console.log("Registered");
browser.webNavigation.onErrorOccurred.addListener(logOnErrorOccurred);