I have a Chrome extension that is using the following code:
chrome.tabs.onUpdated.addListener(
function(tabId, changeInfo, tab) {
if (changeInfo.status === 'complete') {
chrome.tabs.executeScript(null, {file: "js/content.js"});
}
}
);
If I close my browser whilst a webpage is loading, the extension will crash. I believe this is because of the following error:
Unchecked runtime.lastError while running tabs.executeScript: The tab was closed.
Does anyone know how I can avoid this error?