reload: Fix tracebacks on browsers without local storage.

This fixes an issue where browsers without local storage (aka the
Zulip ancient QT-based desktop app) would throw an exception trying to
reload in modern Zulip.
This commit is contained in:
Tim Abbott 2017-05-04 16:21:58 -07:00
parent a493694e10
commit e219dda071
1 changed files with 13 additions and 0 deletions

View File

@ -15,6 +15,19 @@ exports.is_in_progress = function () {
}; };
function preserve_state(send_after_reload, save_pointer, save_narrow, save_compose) { function preserve_state(send_after_reload, save_pointer, save_narrow, save_compose) {
if (!localstorage.supported()) {
// If local storage is not supported by the browser, we can't
// save the browser's position across reloads (since there's
// no secure way to pass that state in a signed fashion to the
// next instance of the browser client).
//
// So we jure return here and let the reload proceed without
// having preserved state. We keep the hash the same so we'll
// at least save their narrow state.
blueslip.log("Can't preserve state; no local storage.");
return;
}
if (send_after_reload === undefined) { if (send_after_reload === undefined) {
send_after_reload = 0; send_after_reload = 0;
} }