webapp: Improve javascript's handling of longpolling connection failures, by reloading the current page in this case. Works around chromium behavior where ajax connections to urls that were already accessed are denied after navigating back to a previous page.

This commit is contained in:
Joey Hess 2013-09-09 01:24:20 -04:00
parent 9d7bd5d900
commit b5678d74a2
4 changed files with 8 additions and 18 deletions

5
debian/changelog vendored
View file

@ -27,6 +27,11 @@ git-annex (4.20130828) UNRELEASED; urgency=low
* Added gcrypt support. This combines a fully encrypted git
repository (using git-remote-gcrypt) with an encrypted git-annex special
remote.
* webapp: Improve javascript's handling of longpolling connection
failures, by reloading the current page in this case.
Works around chromium behavior where ajax connections to urls
that were already accessed are denied after navigating back to
a previous page.
-- Joey Hess <joeyh@debian.org> Tue, 27 Aug 2013 11:03:00 -0400

View file

@ -19,3 +19,5 @@ When I click on the "back" button in my web browser, I get the following error m
### Please provide any additional information below.
Click "forward" actually brings us back to sanity, and the webapp doesn't actually *crash*. -- [[anarcat]]
> I have applied the page reload fix/hack. [[done]] --[[Joey]]

View file

@ -3,7 +3,7 @@ $(function() {
var f = function() {
longpoll(url, #{ident}
, function() { setTimeout(f, #{delay}); }
, function() { webapp_disconnected(); }
, function() { window.location.reload(true); }
);
};
setTimeout(f, #{startdelay});

View file

@ -1,17 +0,0 @@
connfailed =
'<div id="modal" class="modal fade">' +
' <div class="modal-header">' +
' <h3>git-annex has shut down</h3>' +
' </div>' +
' <div class="modal-body">' +
' You can now close this browser window.' +
' </div>' +
'</div>' ;
function webapp_disconnected () {
$('#modal').replaceWith(connfailed);
$('#modal').modal('show');
// ideal, but blocked by many browsers
window.close();
}