diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2013-01-28 20:24:59 +0100 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2013-01-28 20:27:27 +0100 |
commit | 72e24b7a632b7f713082d9100176064814cf2f61 (patch) | |
tree | e827c7a39c7442506cbb791a01a3d9a79526b690 /program/js | |
parent | 66d30994853ba9282c1d8f9cc189a195e79e8b9a (diff) |
Catch connection timeouts on message sending form submissions
Diffstat (limited to 'program/js')
-rw-r--r-- | program/js/app.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/program/js/app.js b/program/js/app.js index c2456ac4f..6d5bdfe74 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3119,6 +3119,13 @@ function rcube_webmail() form._draft.value = draft ? '1' : ''; form.action = this.add_url(form.action, '_unlock', msgid); form.action = this.add_url(form.action, '_lang', lang); + + // register timer to notify about connection timeout + this.submit_timer = setTimeout(function(){ + ref.set_busy(false, null, msgid); + ref.display_message(ref.get_label('requesttimedout'), 'error'); + }, this.env.request_timeout * 1000); + form.submit(); }; @@ -6345,7 +6352,7 @@ function rcube_webmail() // redirect to url specified in location header if not empty var location_url = request.getResponseHeader("Location"); - if (location_url) + if (location_url && this.env.action != 'compose') // don't redirect on compose screen, contents might get lost (#1488926) this.redirect(location_url); // re-send keep-alive requests after 30 seconds @@ -6353,6 +6360,15 @@ function rcube_webmail() setTimeout(function(){ ref.keep_alive(); ref.start_keepalive(); }, 30000); }; + // callback when an iframe finished loading + this.iframe_loaded = function(unlock) + { + this.set_busy(false, null, unlock); + + if (this.submit_timer) + clearTimeout(this.submit_timer); + }; + // post the given form to a hidden iframe this.async_upload_form = function(form, action, onload) { |