I understand from Chrome Development Tool: [VM] file from javascript that the code executed inside a [VM]
file in Google Chrome is code that is not directly tied to a file.
A client recently reported that a geocoding feature is no longer working on their website. It's a Joomla site, so it uses MooTools. The geocoding is done through the Google Maps API v3. I wrote the code years ago, and it just recently started acting up. I've determined exactly where the bug is occurring in my code, but the end of the stack-trace ends up in one of the [VM]
files that is obfuscated.
Where the error crops up in my code:
var pf_map = {
geocoder: new google.maps.Geocoder(),
geocode: function() {
var address = '123 Fake St, Nowhere, USA'; // actually a valid address
// The error occurs somewhere between here
console.log('This message makes it to the console');
pf_map.geocoder.geocode({ 'address': address }, function(results, status) {
// and here
console.log('This message does not make it to the console');
});
}
}
The error that is reported in the console is:
Uncaught TypeError: Cannot read property 'charAt' of undefined
The stack trace looks like this:
It looks to me like MooTools is causing the problem, but I have no clue how to debug this. Clicking on the top of the stack I get something like this:
Very pleasant. I've stepped through the script and this is what the scope looks like when the error is thrown:
Well, I can see that b
is indeed undefined
, but I already knew that.
I'm pretty sure that the Google geocoder is working just fine. In my frustration I repeatedly clicked on the "Map my Address" button enough to cause a separate Geocode was not successful for the following reason: OVER_QUERY_LIMIT
error, on which I'm basing my that particular assumption.
What would you try next in this situation?