diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-03-06 12:50:35 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-03-07 11:27:39 +0100 |
commit | bf02072a86d4b0d06c246ecbea4f980523983941 (patch) | |
tree | aa4ea5c13122d3131384fbacd98d55456ee8d4e9 | |
parent | e916f1c295050ef26aef7b309843df6a8cac158e (diff) | |
download | gitlab-ce-bf02072a86d4b0d06c246ecbea4f980523983941.tar.gz |
Properly handle autosave local storage exceptions.
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/assets/javascripts/autosave.js.coffee | 12 |
2 files changed, 10 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG index 37aee53bc0a..f6079092f55 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -20,6 +20,7 @@ v 7.9.0 (unreleased) - Add brakeman (security scanner for Ruby on Rails) - Slack username and channel options - Add grouped milestones from all projects to dashboard. + - Properly handle autosave local storage exceptions. v 7.8.1 - Fix run of custom post receive hooks diff --git a/app/assets/javascripts/autosave.js.coffee b/app/assets/javascripts/autosave.js.coffee index 3450f4b55f7..5d3fe81da74 100644 --- a/app/assets/javascripts/autosave.js.coffee +++ b/app/assets/javascripts/autosave.js.coffee @@ -14,7 +14,11 @@ class @Autosave restore: -> 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.trigger "input" @@ -23,11 +27,13 @@ class @Autosave text = @field.val() if text?.length > 0 - window.localStorage.setItem @key, text + try + window.localStorage.setItem @key, text else @reset() reset: -> return unless window.localStorage? - window.localStorage.removeItem @key
\ No newline at end of file + try + window.localStorage.removeItem @key |