Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #95 - localStorage errors #100

Merged
merged 1 commit into from Apr 17, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/inject.coffee
Expand Up @@ -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 = () ->
Expand Down