Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix for issue #95 - localStorage errors #100

Merged
merged 1 commit into from

3 participants

@mattpowell
Owner

This is an initial fix for the errors in IE 6/7 when trying to iterate over localStorage (issue #95). I would prefer to fix this by flushing localStorage using lscache; however, lscache doesn't currently support removing a subset of it's entries. I've got a patch in the works and will try to submit a PR over the weekend (for lscache). If you can wait, I'd suggest holding off until that's done :)

@Jakobo Jakobo merged commit e893eab into linkedin:master
@Iheartweb

Did the interim fix for this make it into 0.2.4?

@Jakobo
Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 14, 2012
  1. @mattpowell

    checks for localStorage support before trying to clear the file regis…

    mattpowell authored
    …try. Initial fix for issue #95
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 4 deletions.
  1. +7 −4 src/inject.coffee
View
11 src/inject.coffee
@@ -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 = () ->
Something went wrong with that request. Please try again.