Check chrome.runtime.lastError to fix error in chrome.runtime.lastError

This is proposed as an alternative to #1184, preventing errors in the background page on `chrome://`, `chrome-extension://`, `about:`, `data:`, etc.