title: Chrome Extension onCreatedNavigationTarget Listener stops working
body: <p>I added a listener with <code>chrome.webNavigation.onCreatedNavigationTarget.addListener</code> to the background.js with <code>webNavigation</code> in permissions into the manifest.json it worked fine when I tested it. </p>
  
  <p>I skipped work on it for a few days and tried to continue after but the listener doesn't run the callback function at all. If I refresh it from the <code>chrome//extensions</code> it works again.
  I didn't switch off this extension and didn't refresh before. It looks like this subscription has a timeout.</p>
  
  <p><strong>Update:</strong>
  The code.</p>
  
  <p>The permissions and background section from manifest.json</p>
  
  <pre><code>"permissions": [
      "activeTab",
      "webNavigation",
      "downloads",
      "storage",
      "unlimitedStorage"
    ],
  "background": {
      "scripts": [
        "background.js"
      ]
    }
  </code></pre>
  
  <p>And part of the background.js</p>
  
  <pre><code>chrome.webNavigation.onCreatedNavigationTarget.addListener(async (details) =&gt; {
      const url = new URL(details.url);
      const params = new URLSearchParams(url.search.substr(1));
  
      chrome.tabs.remove(details.tabId);
      await startDownload(params);
    }, { url: [{ urlContains: 'localhost/formats' }] });
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>I've found how to reproduce this issue.
  If I close Chrome and reopen it the listener is not added at all. I need to refresh the extension from the <code>chrome//extensions</code> and it works after that. background.js is not run after reopening Chrome. </p>