Fixes #154
Unified · Split
| @@ -132,6 +132,10 @@ · 131 unmodified lines | |||
| 132 | @hideLoading() | 132 | @hideLoading() |
| 133 | return | 133 | return |
| 134 | 134 | ||
| 135 | onQuotaExceeded: -> | ||
| 136 | new app.views.Notif 'QuotaExceeded', autoHide: null | ||
| 137 | Raven.captureMessage 'QuotaExceededError' | ||
| 138 | |||
| 135 | onWindowError: (args...) -> | 139 | onWindowError: (args...) -> |
| 136 | if @isInjectionError args... | 140 | if @isInjectionError args... |
| 137 | @onInjectionError() | 141 | @onInjectionError() |
| @@ -8,7 +8,7 @@ class app.DB · 7 unmodified lines | |||
| 8 | 8 | ||
| 9 | db: (fn) -> | 9 | db: (fn) -> |
| 10 | return fn() unless @useIndexedDB | 10 | return fn() unless @useIndexedDB |
| 11 | @callbacks.push(fn) | 11 | @callbacks.push(fn) if fn |
| 12 | return if @open | 12 | return if @open |
| 13 | 13 | ||
| 14 | try | 14 | try |
| @@ -39,8 +39,15 @@ class app.DB · 24 unmodified lines | |||
| 39 | 39 | ||
| 40 | onOpenError: (event) => | 40 | onOpenError: (event) => |
| 41 | event?.preventDefault() | 41 | event?.preventDefault() |
| 42 | @useIndexedDB = @open = false | 42 | @open = false |
| 43 | @runCallbacks() | 43 | |
| 44 | if event?.target?.error?.name is 'QuotaExceededError' | ||
| 45 | @reset() | ||
| 46 | @db() | ||
| 47 | app.onQuotaExceeded() | ||
| 48 | else | ||
| 49 | @useIndexedDB = false | ||
| 50 | @runCallbacks() | ||
| 44 | return | 51 | return |
| 45 | 52 | ||
| 46 | runCallbacks: (db) -> | 53 | runCallbacks: (db) -> |
| @@ -15,6 +15,10 @@ app.templates.notifError = -> · 14 unmodified lines | |||
| 15 | <a href="javascript:if(confirm('Are you sure you want to reset DevDocs?'))app.reset()">resetting the app</a>.<br> | 15 | <a href="javascript:if(confirm('Are you sure you want to reset DevDocs?'))app.reset()">resetting the app</a>.<br> |
| 16 | You can also report this issue on <a href="https://github.com/Thibaut/devdocs/issues/new" target="_blank">GitHub</a>. """ | 16 | You can also report this issue on <a href="https://github.com/Thibaut/devdocs/issues/new" target="_blank">GitHub</a>. """ |
| 17 | 17 | ||
| 18 | app.templates.notifQuotaExceeded = -> | ||
| 19 | textNotif """ Oops, the offline database has exceeded its size limitation. """, | ||
| 20 | """ Unfortunately this quota can't be detected programmatically, and the database can't be opened while over the quota, so it had to be reset. """ | ||
| 21 | |||
| 18 | app.templates.notifInvalidLocation = -> | 22 | app.templates.notifInvalidLocation = -> |
| 19 | textNotif """ DevDocs must be loaded from #{app.config.production_host} """, | 23 | textNotif """ DevDocs must be loaded from #{app.config.production_host} """, |
| 20 | """ Otherwise things are likely to break. """ | 24 | """ Otherwise things are likely to break. """ |