Ok. I have never seen anything like this before and I am quite confused... On a website I am working on, there are two JavaScript includes. (Well, many more, but the problem occurs with only two). We'll call these A.js
and B.js
.
A.js
defines a JavaScript singleton A
. Likewise B.js
defines a JavaScript singleton B
. The B
class depends on methods from A
.
I have almost all my code wrapped up in try { ... } catch { ... }
blocks, and on error, the system generates an AJAX request to email me the details of the error.
On one system here in my office (Firefox 3.0 for Mac) I am seeing the strangest behavior. Once in a while, maybe once every hour or two, but with no specific pattern, I get an error email from class B
: "ReferenceError: A is undefined."
I have no idea why/how A
would be undefined sometimes. When I look in the apache logs, during the times I receive the error, the client is requesting /A.js
, before requesting /B.js
, and the server is responding with a 304
(Not Modified)
I somehow suspect the issue is that the file has expired from the client cache however the server doesnt send the file thus it is never executed and A
is undefined. But that's just a guess and I don't understand why that would happen. And if I am guessing right, how do I fix it???
If it matters, mod_disk_cache
was enabled on the server, and I have disabled it to see if that was causing the problem. If so, maybe this belongs on ServerFault...
Any suggestions very welcome!!
If you have the Webdevelopers toolbar installed in Firefox, activate "Disable Cache" it helps a lot on debugging.