title: Does Google Maps Javascript API v3 Geocoding Library overwrite localStorage keys with keys starting with "geocode:"?
body: <p>I have Google Maps Javascript API v3 on a page and am using the Geocoding Library:
  <a href="https://developers.google.com/maps/documentation/javascript/geocoding" rel="nofollow">https://developers.google.com/maps/documentation/javascript/geocoding</a></p>
  
  <p><strong>The Code</strong>
  In my <code>google.maps.Geocoder.geocode</code> callback function I am saving the lat,lng as JSON into the Chrome browser's <code>window.localStorage</code> like this:</p>
  
  <pre><code>if (localStorage.getItem('geocode:'+job.url) === null) {
      geocoder.geocode({'address': job.address}, function(results, status) {
          var json = JSON.stringify({
              address: job.address,
              lat: results[0].geometry.location.lat(),
              lng: results[0].geometry.location.lng()
          });
          console.log('Set key:"geocode:'+job.url+'", value: '+json);
          localStorage.setItem('geocode:'+job.url, json);
          console.log('Get key:"geocode:'+job.url+'", value: '+localStorage.getItem('geocode:'+job.url));
      });
  }
  </code></pre>
  
  <p><strong>The problem</strong> is my key is getting set to null outside the callback function.
  After the above code runs and prints the two log messages, typing this in the Console shows the problem:</p>
  
  <pre><code>&gt; localStorage.length;
    1
  &gt; localStorage.key(0);
    "geocode:123 street San Francisco CA USA"
  &gt; localStorage.getItem("geocode:123 street San Francisco CA USA");
    null
  </code></pre>
  
  <p>Changing my localStorage key prefix to 'blah:' fixes the problem!</p>
  
  <p>Does this mean the Google Maps Javascript API v3 Geocoding Library overwrites localStorage keys with a prefix "geocode:" after the callback function returns?</p>
  
  <p><strong>Extra background info:</strong></p>
  
  <p>I am including this script code on the page from a Chrome extension url like:</p>
  
  <pre><code>&lt;script src="chrome:///blah" type="text/javascript"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>The call to <code>google.maps.Geocoder.geocode</code> and the callback function are called from a <code>window.setTimeout</code> handler.</p>