Commit c025c0d5 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'webstorage-exception' into 'master'

Properly handle autosave local storage exceptions.

Addresses https://gitlab.com/gitlab-org/gitlab-ce/issues/1182.

See merge request !1643
parents cec2be2d bf02072a
...@@ -40,6 +40,7 @@ v 7.8.2 ...@@ -40,6 +40,7 @@ v 7.8.2
- Fix check if user is allowed to view the file attachment - Fix check if user is allowed to view the file attachment
- Fix import check for case sensetive namespaces - Fix import check for case sensetive namespaces
- Increase timeout for Git-over-HTTP requests to 1 hour since large pulls/pushes can take a long time. - Increase timeout for Git-over-HTTP requests to 1 hour since large pulls/pushes can take a long time.
- 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?
try
text = window.localStorage.getItem @key 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,6 +27,7 @@ class @Autosave ...@@ -23,6 +27,7 @@ class @Autosave
text = @field.val() text = @field.val()
if text?.length > 0 if text?.length > 0
try
window.localStorage.setItem @key, text window.localStorage.setItem @key, text
else else
@reset() @reset()
...@@ -30,4 +35,5 @@ class @Autosave ...@@ -30,4 +35,5 @@ class @Autosave
reset: -> reset: ->
return unless window.localStorage? return unless window.localStorage?
try
window.localStorage.removeItem @key 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