Unified · Split
| @@ -22,17 +22,24 @@ class app.DB · 21 unmodified lines | ||
| 22 | 22 | return |
| 23 | 23 | |
| 24 | 24 | onOpenSuccess: (event) => |
| 25 | − try | |
| 26 | − db = event.target.result | |
| 27 | − unless @checkedBuggyIDB | |
| 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 | |
| 25 | + db = event.target.result | |
| 26 | + | |
| 27 | + if db.objectStoreNames.length is 0 | |
| 31 | 28 | try db.close() |
| 32 | − @reason = 'apple' | |
| 29 | + @reason = 'empty' | |
| 33 | 30 | @onOpenError() |
| 34 | 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 | 43 | @runCallbacks(db) |
| 37 | 44 | @open = false |
| 38 | 45 | db.close() |
| @@ -25,10 +25,13 @@ app.templates.bootError = -> · 24 unmodified lines | ||
| 25 | 25 | app.templates.offlineError = (reason) -> |
| 26 | 26 | reason = switch reason |
| 27 | 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 | 29 | when 'cant_open' |
| 30 | − """ Although your browser appears to support it, 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. """ | |
| 30 | + """ Although your browser supports IndexedDB, DevDocs couldn't open the database.<br> | |
| 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 | 35 | when 'apple' |
| 33 | 36 | """ Unfortunately Safari's implementation of IndexedDB is <a href="https://bugs.webkit.org/show_bug.cgi?id=136937">badly broken</a>.<br> |
| 34 | 37 | This message will automatically go away when Apple fix their code. """ |