Kristián Filo
Kristián Filo

Reputation: 865

"Uncaught (in promise) ReferenceError: FILES is not defined" (newtab-serviceworker.js)

I have a page with HTML form and some basic jQuery/AJAX. No warnings, no errors, everything works fine. However, when I leave my tab opened, I am getting plenty of these errors as time passes by:

VM15 newtab-serviceworker.js:16
Uncaught (in promise) ReferenceError: FILES is not defined

This is the beginning of newtab-serviceworker.js (including line 16 (14 in the preview below)):

var EXTRA_FILES = ["/xjs/_/js/k=xjs.ntp.en.BHgEJkq1PQM.O/m=sx,jsa,ntp,d,csi/am=AEAMAI5MJQ/rt=j/d=1/rs=ACT90oGgBiwQpyhfkvk6s0qgYagIFi8yXQ",];
var CHECKSUM = "o9h2ps";

var BLACKLIST = [
  '/gen_204\?',
  '/async/',
  '/complete/',
];

var CACHENAME = 'newtab-static-' + CHECKSUM;

self.addEventListener('install', function(event) {
  event.waitUntil(caches.open(CACHENAME).then(function(cache) {
    return cache.addAll(FILES);
  }));
});  

Is that even code-related problem? Sounds like browser side stuff to me. I wasn't able to find some relevant information about this.

Upvotes: 3

Views: 1614

Answers (3)

Fluxlicious
Fluxlicious

Reputation: 82

This is related to Google's reCAPTCHA. I started receiving the same error in Chrome once i added Google's reCAPTCHA v3 to my page.

The only thing I noticed is that the reCAPTCHA expired-callback is not calling my function, so this might be related.

Otherwise you can safely ignore this error.

Upvotes: 1

Jake Crouchley
Jake Crouchley

Reputation: 1

Looks like this is a Chrome service worker that runs when you open a new tab, a quick search led me to the source code here.

I'm running into the same issue after opening a new tab, running Chrome Version 71.0.3578.98 on MacOS.

Seems to be safe to ignore and shouldn't impact your code, but I've reported to Chrome Devs anyway. Hopefully it's just a mislaid variable and they can fix it easy enough.

Upvotes: 0

André Kelling
André Kelling

Reputation: 1746

You have defined a variable EXTRA_FILES:

var EXTRA_FILES = ["/xjs/_/js/k=xjs.ntp.en.BHgEJkq1PQM.O/m=sx,jsa,ntp,d,csi/am=AEAMAI5MJQ/rt=j/d=1/rs=ACT90oGgBiwQpyhfkvk6s0qgYagIFi8yXQ",];

In your caching code you do use FILES variable:

self.addEventListener('install', function(event) {
  event.waitUntil(caches.open(CACHENAME).then(function(cache) {
    return cache.addAll(FILES);
  }));
});  

Think you will just need to correct this..

Upvotes: 0

Related Questions