Commit bf02072a authored by Douwe Maan's avatar Douwe Maan

Properly handle autosave local storage exceptions.

parent e916f1c2
...@@ -20,6 +20,7 @@ v 7.9.0 (unreleased) ...@@ -20,6 +20,7 @@ v 7.9.0 (unreleased)
- Add brakeman (security scanner for Ruby on Rails) - Add brakeman (security scanner for Ruby on Rails)
- Slack username and channel options - Slack username and channel options
- Add grouped milestones from all projects to dashboard. - Add grouped milestones from all projects to dashboard.
- Properly handle autosave local storage exceptions.
v 7.8.1 v 7.8.1
- Fix run of custom post receive hooks - Fix run of custom post receive hooks
......
...@@ -14,7 +14,11 @@ class @Autosave ...@@ -14,7 +14,11 @@ class @Autosave
restore: -> restore: ->
return unless window.localStorage? return unless window.localStorage?
text = window.localStorage.getItem @key try
text = window.localStorage.getItem @key
catch
return
@field.val text if text?.length > 0 @field.val text if text?.length > 0
@field.trigger "input" @field.trigger "input"
...@@ -23,11 +27,13 @@ class @Autosave ...@@ -23,11 +27,13 @@ class @Autosave
text = @field.val() text = @field.val()
if text?.length > 0 if text?.length > 0
window.localStorage.setItem @key, text try
window.localStorage.setItem @key, text
else else
@reset() @reset()
reset: -> reset: ->
return unless window.localStorage? return unless window.localStorage?
window.localStorage.removeItem @key try
\ No newline at end of file window.localStorage.removeItem @key
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment