Revert "Abort pending AJAX requests before page unload"

This reverts commit 94bdb8b4b0. After the patch, Firefox shows an error message on each reload for an unknown reason.

refs #7759
This commit is contained in:
Matthias Jentsch 2015-05-19 17:05:04 +02:00
parent 94bdb8b4b0
commit 54207d3427
2 changed files with 6 additions and 21 deletions

View File

@ -100,7 +100,7 @@
// Destroy Icinga, clean up and interrupt pending requests on unload
$( window ).on('unload', { self: this }, this.onUnload);
$( window ).on('beforeunload', { self: this }, this.onBeforeUnload);
$( window ).on('beforeunload', { self: this }, this.onUnload);
// We catch scroll events in our containers
$('.container').on('scroll', { self: this }, this.icinga.events.onContainerScroll);
@ -153,15 +153,6 @@
icinga.destroy();
},
onBeforeUnload: function (event) {
var icinga = event.data.self.icinga;
// Browsers may call the error handler on all pending AJAX requests, when the page is reloaded,
// which could in turn cause needless error messages to show up in the frontend until the page is loaded.
// To circumvent this cancel all pending requests.
icinga.loader.cancelRequests();
},
/**
* A scroll event happened in one of our containers
*/
@ -569,7 +560,7 @@
$(window).off('resize', this.onWindowResize);
$(window).off('load', this.onLoad);
$(window).off('unload', this.onUnload);
$(window).off('beforeunload', this.onBeforeUnload);
$(window).off('beforeunload', this.onUnload);
$(document).off('scroll', '.container', this.onContainerScroll);
$(document).off('click', 'a', this.linkClicked);
$(document).off('click', 'table.action tr[href]', this.rowSelected);

View File

@ -793,22 +793,16 @@
},
/**
* Cancel and dereference all pending requests and dereference this object
* On shutdown we kill all pending requests
*/
destroy: function() {
this.icinga.loader.cancelRequests();
this.icinga = null;
this.requests = {};
},
/**
* Cancel all pendings ajax requests
*/
cancelRequests: function() {
$.each(this.requests, function(id, request) {
request.abort();
});
this.icinga = null;
this.requests = {};
}
};
}(Icinga, jQuery));