title: Why "Failed to execute 'delete' on 'Cache': Illegal invocation" when cachel.delete is assigned to variable?
body: <p>I'm trying to pass <code>cache.delete</code> native function as an argument in order to make my code more easily testable.</p>
  <p>But when I do this:</p>
  <pre class="lang-js prettyprint-override"><code>const cacheDeleteFunction = cache.delete;
  await cacheDeleteFunction(request);
  </code></pre>
  <p>it fails with <code>Failed to execute 'delete' on 'Cache': Illegal invocation</code> error.</p>
  <p>Same code, but with a direct call to <code>await cache.delete(request)</code> works.</p>
  <p>Also, if I do this:</p>
  <pre class="lang-js prettyprint-override"><code>const cacheDeleteFunction = (x) =&gt; cache.delete(x);
  await cacheDeleteFunction(request);
  </code></pre>
  <p>then it also works!</p>
  <p>I've tried playing with <code>.apply()</code> and <code>.call()</code> but they didn't make any difference.</p>
  <pre class="lang-js prettyprint-override"><code>(async () =&gt; {
      const cache = await caches.open('1');
      try {
          await cache.add(new Request('?apple'));
          await cache.add(new Request('?google'));
      } catch (e) {}
      const keys = await cache.keys();
      for (const request of keys) {
          if (request.url.includes('apple')) {
              // Failed to execute 'delete' on 'Cache': Illegal invocation
              // const cacheDeleteFunction = cache.delete;
              // await cacheDeleteFunction(request);
  
  
              // Works
              await cache.delete(request);
  
              // Also works
              // const cacheDeleteFunction = (x) =&gt; cache.delete(x);
              // await cacheDeleteFunction(request);
          }
      }
  })();
  </code></pre>
  <p>What am I missing? Why <code>const cacheDeleteFunction = cache.delete;</code> doesn't work?</p>
  <p>Related issue: <a href="https://github.com/noahjohn9259/react-clear-cache/pull/36/files" rel="nofollow noreferrer">https://github.com/noahjohn9259/react-clear-cache/pull/36/files</a></p>