Unified · Split
| @@ -22,17 +22,24 @@ class app.DB · 21 unmodified lines | |||
| 22 | return | 22 | return |
| 23 | 23 | ||
| 24 | onOpenSuccess: (event) => | 24 | onOpenSuccess: (event) => |
| 25 | try | 25 | db = event.target.result |
| 26 | db = event.target.result | 26 | |
| 27 | unless @checkedBuggyIDB | 27 | if db.objectStoreNames.length is 0 |
| 28 | @checkedBuggyIDB = true | ||
| 29 | @idbTransaction(db, stores: $.makeArray(db.objectStoreNames)[0..1], mode: 'readwrite').abort() # https://bugs.webkit.org/show_bug.cgi?id=136937 | ||
| 30 | catch | ||
| 31 | try db.close() | 28 | try db.close() |
| 32 | @reason = 'apple' | 29 | @reason = 'empty' |
| 33 | @onOpenError() | 30 | @onOpenError() |
| 34 | return | 31 | return |
| 35 | 32 | ||
| 33 | unless @checkedBuggyIDB | ||
| 34 | @checkedBuggyIDB = true | ||
| 35 | try | ||
| 36 | @idbTransaction(db, stores: $.makeArray(db.objectStoreNames)[0..1], mode: 'readwrite').abort() # https://bugs.webkit.org/show_bug.cgi?id=136937 | ||
| 37 | catch | ||
| 38 | try db.close() | ||
| 39 | @reason = 'apple' | ||
| 40 | @onOpenError() | ||
| 41 | return | ||
| 42 | |||
| 36 | @runCallbacks(db) | 43 | @runCallbacks(db) |
| 37 | @open = false | 44 | @open = false |
| 38 | db.close() | 45 | db.close() |
| @@ -25,10 +25,13 @@ app.templates.bootError = -> · 24 unmodified lines | |||
| 25 | app.templates.offlineError = (reason) -> | 25 | app.templates.offlineError = (reason) -> |
| 26 | reason = switch reason | 26 | reason = switch reason |
| 27 | when 'not_supported' | 27 | when 'not_supported' |
| 28 | """ Unfortunately your browser either doesn't support it or does not make it available. """ | 28 | """ Unfortunately your browser either doesn't support IndexedDB or does not make it available. """ |
| 29 | when 'cant_open' | 29 | when 'cant_open' |
| 30 | """ Although your browser appears to support it, DevDocs couldn't open the database.<br> | 30 | """ Although your browser supports IndexedDB, DevDocs couldn't open the database.<br> |
| 31 | This could be because you're browsing in private mode and have disallowed offline storage on the domain. """ | 31 | This could be because you're browsing in private mode or have disallowed offline storage on the domain. """ |
| 32 | when 'empty' | ||
| 33 | """ Although your browser supports IndexedDB, DevDocs couldn't properly set up the database.<br> | ||
| 34 | This could be because the database is corrupted. Try <a href="#" data-behavior="reset">resetting the app</a>. """ | ||
| 32 | when 'apple' | 35 | when 'apple' |
| 33 | """ Unfortunately Safari's implementation of IndexedDB is <a href="https://bugs.webkit.org/show_bug.cgi?id=136937">badly broken</a>.<br> | 36 | """ Unfortunately Safari's implementation of IndexedDB is <a href="https://bugs.webkit.org/show_bug.cgi?id=136937">badly broken</a>.<br> |
| 34 | This message will automatically go away when Apple fix their code. """ | 37 | This message will automatically go away when Apple fix their code. """ |