summaryrefslogtreecommitdiffstats
path: root/core/js/js.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-03-22 18:28:54 +0100
committerVincent Petry <pvince81@owncloud.com>2016-03-22 18:29:19 +0100
commitd00f95578bc6812a10fa991c6df315a77ede38fb (patch)
treecaf793ef0da35e19e3d2440422929c1d1903aeb7 /core/js/js.js
parent6ed8acb15d4d2eb6178ba552a6cae92e548f6641 (diff)
downloadnextcloud-server-d00f95578bc6812a10fa991c6df315a77ede38fb.tar.gz
nextcloud-server-d00f95578bc6812a10fa991c6df315a77ede38fb.zip
Stronger fix for navigate away detection
Diffstat (limited to 'core/js/js.js')
-rw-r--r--core/js/js.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/core/js/js.js b/core/js/js.js
index 1a3b532ed4c..f4e0fa464d8 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -740,15 +740,23 @@ var OC={
* if an error/auth error status was returned.
*/
_processAjaxError: function(xhr) {
+ var self = this;
// purposefully aborted request ?
// this._userIsNavigatingAway needed to distinguish ajax calls cancelled by navigating away
// from calls cancelled by failed cross-domain ajax due to SSO redirect
- if (xhr.status === 0 && (xhr.statusText === 'abort' || xhr.statusText === 'timeout' || this._userIsNavigatingAway)) {
+ if (xhr.status === 0 && (xhr.statusText === 'abort' || xhr.statusText === 'timeout' || self._reloadCalled)) {
return;
}
if (_.contains([0, 302, 303, 307, 401], xhr.status)) {
- OC.reload();
+ // sometimes "beforeunload" happens later, so need to defer the reload a bit
+ setTimeout(function() {
+ if (!self._userIsNavigatingAway && !self._reloadCalled) {
+ OC.reload();
+ // only call reload once
+ self._reloadCalled = true;
+ }
+ }, 100);
}
},