openlayers/openlayers — pull request #388 by tschaub (2012-04-04 02:55:44+00:00)
Title: Make cache writing work when cross-origin.

The `makeSameOrigin` method is called with every `tileloadstart`, however it only adds an entry to `Control.CacheWrite.urlMap` if `!tile.crossOriginKeyword`. Later (on `tileloaded`) the `cache` method always tries to get a url from the `urlMap`. This results in an `olCache_undefined` entry being written in the cache whenever `tile.crossOriginKeyword` is truthy. This can be seen (on Chrome) using the [offline-storage.html](http://openlayers.org/dev/examples/offline-storage.html) example. Click "write to cache" and see that there is never more than one entry in `localStorage`.

I'm not sure I totally understand the logic of `makeSameOrigin`, but cache writing works for me if I use the tile URL when there is not an entry in the URL map.