New issue
Advanced search Search tips

Issue 637570 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Aug 8
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Cache.put() call fails after deleting the Cache object

Reported by marty...@puronas.me, Aug 13 2016

Issue description

Chrome Version       : 52.0.2743.116 (Official Build) m (32-bit) Windows 8.1
                       52.0.2739.0 (Official Build) unknown (64-bit) Ubuntu 16.04

URLs (if applicable) : https://martynas-p.github.io/chrome-cache-bug/

What steps will reproduce the problem?
(1) Navigate to https://martynas-p.github.io/chrome-cache-bug/ 
(2) Once the service worker is registered, delete the my-cache Cache Storage from the Application tab in the console (that is the actual Cache object, not just the requests stored in it)
(3) Refresh the page

What is the expected result? 
After the page is refreshed, it should create a new Cache object with the name my-cache and store the requests that were put there by the service worker for later retrieval.


What happens instead? 
An exception appears in the console (Uncaught (in promise) DOMException: Entry was not found.undefined:1. Looking at the stacktrace, it seems that the exception was thrown during the cache.put() call) which suggests that it could not find the Cache object with that name even though
a) it appears in the Application tab in the Developers' console
2) the cache.put() is called from a promise which is returned from opening my-cache Cache object (caches.open('my-cache')) 

I tried to make sure that the cache object exists when the page is loaded and before any attempts are made to store it, e.g. on the actual page I have

<script type="text/javascript">
  caches.open('my-cache').then(() => {
    navigator.serviceWorker.register('sw.js');
  });
</script>

and the 'fetch' event handler inside the service worker

self.addEventListener('fetch', (event) => {
  event.respondWith(caches.open('my-cache').
    then(cache =>
      cache.match(event.request).then(response => {
        return response || fetch(event.request).then(response => {
          cache.put(event.request, response.clone());
          return response;
        });
      })
    )
  );
});

as well as in the 'install' event handler

self.addEventListener('install', (event) => {
  event.waitUntil(
    caches.open('my-cache')
      .then((cache) => {
        return cache.addAll([
          '',
          'some-assets.js'
        ]);
      })
  );
});

The exception is not thrown if the individual requests are deleted.

Code of the website which reproduces the issue can be found at https://github.com/Martynas-P/chrome-cache-bug 

Let me know if you need any more details

Thanks!
Martynas
 
Components: Blink>ServiceWorker>Cache
Able to reproduce the issue on Windows-10, Ubuntu 14,04 and Mac OS 10.11.6 using chrome latest stable M52-52.0.2743.116 by following steps mentioned in the original comment, Observed the error saying "Uncaught (in promise) DOMException" in console. 

Tested the same on older versions of chrome M35-35.0.1849.0 and observed different error saying "Uncaught SyntaxError: Unexpected token" .
Owner: jsb...@chromium.org
Status: Assigned (was: Unconfirmed)
I could also reproduce this. 

jsbell@, could you handle this issue?

Comment 4 by jsb...@chromium.org, Aug 24 2016

Cc: jkarlin@chromium.org
Components: -Blink>ServiceWorker>Cache Blink>Storage>CacheStorage
Owner: cmumford@chromium.org
cmumford@ - can you take a look?
Owner: ----
Status: Available (was: Assigned)
Project Member

Comment 6 by sheriffbot@chromium.org, Jun 4 2018

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: WontFix (was: Untriaged)
I attempted to reproduce using the #c0 steps.  It appears to work correctly now.  Please let us know if you see it again.  Thanks.

Sign in to add a comment