title: How to persist data in memory after closing popup extension
body: <p>I'm building a chrome extension, and I'd like to have some sensitive data stored in memory (not disk) while the user has their browser open. The data should persist in the chrome extension even if the user closes the extension popup and re-opens the popup.
  How can I do this?</p>
  <p>I believe this is possible because both Metamask and Bitwarden ask you for your password when you first open their extension after opening the browser. Then no matter how many times you close their extension and re-open it, the data persists, but I doubt that they are saving decrypted data to disk, so it must be kept in memory. I'd like to do the same, but whenever I try to save anything in the popup.html's JS file to memory, it never persists after closing the popup.</p>
  <pre><code>{
    &quot;manifest_version&quot;: 3,
    &quot;name&quot;: &quot;TEST&quot;,
    &quot;version&quot;: &quot;1.0.0&quot;,
    &quot;permissions&quot;: [
      &quot;storage&quot;,
      &quot;activeTab&quot;,
      &quot;cookies&quot;,
      &quot;tabs&quot;
    ],
    &quot;action&quot;: {
      &quot;default_popup&quot;: &quot;popup.html&quot;,
      &quot;default_title&quot;: &quot;TEST&quot;,
      &quot;default_icon&quot;: {
        &quot;16&quot;: &quot;./assets/images/icon16.png&quot;,
        &quot;19&quot;: &quot;./assets/images/icon19.png&quot;,
        &quot;32&quot;: &quot;./assets/images/icon32.png&quot;,
        &quot;38&quot;: &quot;./assets/images/icon38.png&quot;,
        &quot;48&quot;: &quot;./assets/images/icon48.png&quot;,
        &quot;128&quot;: &quot;./assets/images/icon128.png&quot;
      }
    },
    &quot;icons&quot;: {
      &quot;16&quot;: &quot;./assets/images/icon16.png&quot;,
      &quot;19&quot;: &quot;./assets/images/icon19.png&quot;,
      &quot;32&quot;: &quot;./assets/images/icon32.png&quot;,
      &quot;38&quot;: &quot;./assets/images/icon38.png&quot;,
      &quot;48&quot;: &quot;./assets/images/icon48.png&quot;,
      &quot;128&quot;: &quot;./assets/images/icon128.png&quot;
    },
    &quot;background&quot;: {
      &quot;service_worker&quot;: &quot;service-worker-loader.js&quot;,
      &quot;type&quot;: &quot;module&quot;
    }
  </code></pre>