Unified · Split
| @@ -75,6 +75,7 @@ · 74 unmodified lines | |||
| 75 | .install() | 75 | .install() |
| 76 | @previousErrorHandler = onerror | 76 | @previousErrorHandler = onerror |
| 77 | window.onerror = @onWindowError.bind(@) | 77 | window.onerror = @onWindowError.bind(@) |
| 78 | CookieStore.onBlocked = @onCookieBlocked | ||
| 78 | return | 79 | return |
| 79 | 80 | ||
| 80 | bootOne: -> | 81 | bootOne: -> |
| @@ -207,8 +208,17 @@ · 126 unmodified lines | |||
| 207 | @quotaExceeded = true | 208 | @quotaExceeded = true |
| 208 | new app.views.Notif 'QuotaExceeded', autoHide: null | 209 | new app.views.Notif 'QuotaExceeded', autoHide: null |
| 209 | Raven.captureMessage 'QuotaExceededError', level: 'warning' | 210 | Raven.captureMessage 'QuotaExceededError', level: 'warning' |
| 211 | return | ||
| 212 | |||
| 213 | onCookieBlocked: (key, value, actual) -> | ||
| 214 | return if @cookieBlocked | ||
| 215 | @cookieBlocked = true | ||
| 216 | new app.views.Notif 'CookieBlocked', autoHide: null | ||
| 217 | Raven.captureMessage "CookieBlocked/#{key}", level: 'warning', extra: {value, actual} | ||
| 218 | return | ||
| 210 | 219 | ||
| 211 | onWindowError: (args...) -> | 220 | onWindowError: (args...) -> |
| 221 | return if @cookieBlocked | ||
| 212 | if @isInjectionError args... | 222 | if @isInjectionError args... |
| 213 | @onInjectionError() | 223 | @onInjectionError() |
| 214 | else if @isAppError args... | 224 | else if @isAppError args... |
| @@ -1,6 +1,8 @@ | |||
| 1 | class @CookieStore | 1 | class @CookieStore |
| 2 | INT = /^\d+$/ | 2 | INT = /^\d+$/ |
| 3 | 3 | ||
| 4 | @onBlocked: -> | ||
| 5 | |||
| 4 | get: (key) -> | 6 | get: (key) -> |
| 5 | value = Cookies.get(key) | 7 | value = Cookies.get(key) |
| 6 | value = parseInt(value, 10) if value? and INT.test(value) | 8 | value = parseInt(value, 10) if value? and INT.test(value) |
| @@ -13,7 +15,7 @@ class @CookieStore · 6 unmodified lines | |||
| 13 | 15 | ||
| 14 | value = 1 if value == true | 16 | value = 1 if value == true |
| 15 | Cookies.set(key, '' + value, path: '/', expires: 1e8) | 17 | Cookies.set(key, '' + value, path: '/', expires: 1e8) |
| 16 | throw new Error("Failed to set cookie '#{key}'") unless @get(key) == value | 18 | @constructor.onBlocked(key, value, @get(key)) if @get(key) != value |
| 17 | return | 19 | return |
| 18 | 20 | ||
| 19 | del: (key) -> | 21 | del: (key) -> |
| @@ -23,6 +23,9 @@ app.templates.bootError = -> · 22 unmodified lines | |||
| 23 | If you keep seeing this, you're likely behind a proxy or firewall that blocks cross-domain requests. """ | 23 | If you keep seeing this, you're likely behind a proxy or firewall that blocks cross-domain requests. """ |
| 24 | 24 | ||
| 25 | app.templates.offlineError = (reason) -> | 25 | app.templates.offlineError = (reason) -> |
| 26 | if reason is 'cookie_blocked' | ||
| 27 | return error """ Cookies must be enabled to use offline mode. """ | ||
| 28 | |||
| 26 | reason = switch reason | 29 | reason = switch reason |
| 27 | when 'not_supported' | 30 | when 'not_supported' |
| 28 | """ Unfortunately your browser either doesn't support IndexedDB or does not make it available. """ | 31 | """ Unfortunately your browser either doesn't support IndexedDB or does not make it available. """ |
| @@ -19,6 +19,10 @@ app.templates.notifQuotaExceeded = -> · 18 unmodified lines | |||
| 19 | textNotif """ The offline database has exceeded its size limitation. """, | 19 | textNotif """ 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. """ | 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 | 21 | ||
| 22 | app.templates.notifCookieBlocked = -> | ||
| 23 | textNotif """ Please enable cookies. """, | ||
| 24 | """ DevDocs will not work properly if cookies are disabled. """ | ||
| 25 | |||
| 22 | app.templates.notifInvalidLocation = -> | 26 | app.templates.notifInvalidLocation = -> |
| 23 | textNotif """ DevDocs must be loaded from #{app.config.production_host} """, | 27 | textNotif """ DevDocs must be loaded from #{app.config.production_host} """, |
| 24 | """ Otherwise things are likely to break. """ | 28 | """ Otherwise things are likely to break. """ |
| @@ -11,6 +11,10 @@ class app.views.OfflinePage extends app.View · 10 unmodified lines | |||
| 11 | return | 11 | return |
| 12 | 12 | ||
| 13 | render: -> | 13 | render: -> |
| 14 | if app.cookieBlocked | ||
| 15 | @html @tmpl('offlineError', 'cookie_blocked') | ||
| 16 | return | ||
| 17 | |||
| 14 | app.docs.getInstallStatuses (statuses) => | 18 | app.docs.getInstallStatuses (statuses) => |
| 15 | return unless @activated | 19 | return unless @activated |
| 16 | if statuses is false | 20 | if statuses is false |