mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 23:34:08 +02:00
Revert "Abort pending AJAX requests before page unload"
This reverts commit 94bdb8b4b072c9fadac77830325f727a14f93f85. After the patch, Firefox shows an error message on each reload for an unknown reason. refs #7759
This commit is contained in:
parent
94bdb8b4b0
commit
54207d3427
@ -100,7 +100,7 @@
|
|||||||
|
|
||||||
// Destroy Icinga, clean up and interrupt pending requests on unload
|
// Destroy Icinga, clean up and interrupt pending requests on unload
|
||||||
$( window ).on('unload', { self: this }, this.onUnload);
|
$( 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
|
// We catch scroll events in our containers
|
||||||
$('.container').on('scroll', { self: this }, this.icinga.events.onContainerScroll);
|
$('.container').on('scroll', { self: this }, this.icinga.events.onContainerScroll);
|
||||||
@ -153,15 +153,6 @@
|
|||||||
icinga.destroy();
|
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
|
* A scroll event happened in one of our containers
|
||||||
*/
|
*/
|
||||||
@ -569,7 +560,7 @@
|
|||||||
$(window).off('resize', this.onWindowResize);
|
$(window).off('resize', this.onWindowResize);
|
||||||
$(window).off('load', this.onLoad);
|
$(window).off('load', this.onLoad);
|
||||||
$(window).off('unload', this.onUnload);
|
$(window).off('unload', this.onUnload);
|
||||||
$(window).off('beforeunload', this.onBeforeUnload);
|
$(window).off('beforeunload', this.onUnload);
|
||||||
$(document).off('scroll', '.container', this.onContainerScroll);
|
$(document).off('scroll', '.container', this.onContainerScroll);
|
||||||
$(document).off('click', 'a', this.linkClicked);
|
$(document).off('click', 'a', this.linkClicked);
|
||||||
$(document).off('click', 'table.action tr[href]', this.rowSelected);
|
$(document).off('click', 'table.action tr[href]', this.rowSelected);
|
||||||
|
@ -793,22 +793,16 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel and dereference all pending requests and dereference this object
|
* On shutdown we kill all pending requests
|
||||||
*/
|
*/
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
this.icinga.loader.cancelRequests();
|
|
||||||
this.icinga = null;
|
|
||||||
this.requests = {};
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cancel all pendings ajax requests
|
|
||||||
*/
|
|
||||||
cancelRequests: function() {
|
|
||||||
$.each(this.requests, function(id, request) {
|
$.each(this.requests, function(id, request) {
|
||||||
request.abort();
|
request.abort();
|
||||||
});
|
});
|
||||||
|
this.icinga = null;
|
||||||
|
this.requests = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}(Icinga, jQuery));
|
}(Icinga, jQuery));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user