TypeError in Line 4

On a Github project I work on, one of the developers added a new js file and it gives out a error everytime it runs.

self.addEventListener('fetch', function(e) { e.respondWith( caches.match(e.request).then(function(response) {

return response || fetch(e.request);

}) ); });

The error is “TypeError: Failed to execute ‘fetch’ on ‘ServiceWorkerGlobalScope’: ‘only-if-cached’ can be set only with ‘same-origin’ mode” Please help.