Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix for issue #95 - localStorage errors #100

Merged
merged 1 commit into from Apr 17, 2012
Jump to file or symbol
Failed to load files and symbols.
+7 −4
Split
View
@@ -577,16 +577,19 @@ clearFileRegistry = (version = schemaVersion) ->
_internal_ Clears the internal file registry at `version`
clearing all local storage keys that relate to the fileStorageToken and version
###
+
+ if ! ('localStorage' in context) then return
+
token = "#{fileStorageToken}#{version}"
- keys = []
`
for (var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(i);
- if (key.indexOf(token) !== -1) keys.push(key)
+ if (key.indexOf(token) !== -1) {
+ localStorage.removeItem(key)
+ }
}
`
- for key in keys
- localStorage.removeItem(key)
+
if version is schemaVersion then db.module.clearAllFiles()
createIframe = () ->