Bug 1603484 Comment 14 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

OK, it does reproduce also locally but only if compiled with
```
ac_add_options --disable-debug
ac_add_options --enable-optimize
```
The service worker is basically a wrapper to workbox:
```
/* global importScripts, workbox, serviceWorkerConfig */

importScripts(
  '/sw-data.js?cb=' + Date.now(),
  'https://storage.googleapis.com/workbox-cdn/releases/3.4.1/workbox-sw.js'
);

// Add routes to the cache
serviceWorkerConfig.cache.forEach((route) => {
  workbox.routing.registerRoute(
    new RegExp(route.pattern),
    workbox.strategies[route.cacheStrategy]({
      cacheName: `walmart-grocery-cache-${route.cacheName}`,
      plugins: [
        new workbox.expiration.Plugin({
          maxEntries: 2, // default: keep last two entries per route
          ...route.expiration
        })
      ]
    })
  );
});

// Fetch routes
serviceWorkerConfig.fetch.forEach((route) => {
  fetch(route.url);
});
```
They use a rather outdated workbox release 3.4.1 from Jul 12, 2018. Not sure, if this might cause problems? Still puzzling, why it does not happen in debug builds, though.
OK, it does reproduce also locally but only if compiled with
```
ac_add_options --disable-debug
ac_add_options --enable-optimize
```
The service worker uses workbox:
```
/* global importScripts, workbox, serviceWorkerConfig */

importScripts(
  '/sw-data.js?cb=' + Date.now(),
  'https://storage.googleapis.com/workbox-cdn/releases/3.4.1/workbox-sw.js'
);

// Add routes to the cache
serviceWorkerConfig.cache.forEach((route) => {
  workbox.routing.registerRoute(
    new RegExp(route.pattern),
    workbox.strategies[route.cacheStrategy]({
      cacheName: `walmart-grocery-cache-${route.cacheName}`,
      plugins: [
        new workbox.expiration.Plugin({
          maxEntries: 2, // default: keep last two entries per route
          ...route.expiration
        })
      ]
    })
  );
});

// Fetch routes
serviceWorkerConfig.fetch.forEach((route) => {
  fetch(route.url);
});
```
They use a rather outdated workbox release 3.4.1 from Jul 12, 2018. Not sure, if this might cause problems? Still puzzling, why it does not happen in debug builds, though.

Back to Bug 1603484 Comment 14