async function sendMessageRetry(payload, maxDuration = 10e3) {
  for (let start = performance.now(); performance.now() - start < maxDuration;) {
    try {
      const data = await sendMessage(payload);
      if (data !== undefined) {
        return data;
      }
    } catch (e) {
      if (!PORT_ERROR_RE.exec(e)[1]) {
        throw e;
      }
    }
    // Not using setTimeout which may be cleared by the web page
    await browser.storage.local.get(VIOLENTMONKEY);
  }
  throw new Error(VIOLENTMONKEY + ' cannot connect to the background page.');
}
Used by `injected`
The active tab page and its [content] scripts load before the extension's
persistent background script when Chrome starts with a URL via command line
or when configured to restore the session, https://crbug.com/314686