Stop API error dialog popping up if you navigate away from the page while Parsoid loads

By checking response.status per this page:
http://stackoverflow.com/questions/9229005/how-to-handle-jquery-ajax-post-error-when-navigating-away-from-a-page

Bug: 51546
Change-Id: I80830b4af1f950369b73497c767cdee4806e7ce6
This commit is contained in:
Krenair 2014-01-29 00:15:51 +00:00
parent 4c3da1b017
commit ff95f88e58

View file

@ -248,7 +248,8 @@ ve.init.mw.ViewPageTarget.prototype.deactivate = function ( override ) {
*/
ve.init.mw.ViewPageTarget.prototype.onLoadError = function ( response, status ) {
// Don't show an error if the load was manually aborted
if ( status !== 'abort' && confirm( ve.msg( 'visualeditor-loadwarning', status ) ) ) {
// The response.status check here is to catch aborts triggered by navigation away from the page
if ( status !== 'abort' && response.status !== 0 && confirm( ve.msg( 'visualeditor-loadwarning', status ) ) ) {
this.load();
} else {
this.activating = false;