Changeset 25874
- Timestamp:
- 10/22/2013 09:26:04 PM (12 years ago)
- Location:
- trunk/src/wp-includes/js
- Files:
-
- 2 edited
-
autosave.js (modified) (1 diff)
-
heartbeat.js (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/autosave.js
r24849 r25874 142 142 143 143 // When connection is lost, keep user from submitting changes. 144 $(document).on('heartbeat-connection-lost.autosave', function( e, error ) {145 if ( 'timeout' === error ) {144 $(document).on('heartbeat-connection-lost.autosave', function( e, error, status ) { 145 if ( 'timeout' === error || 503 == status ) { 146 146 var notice = $('#lost-connection-notice'); 147 147 if ( ! wp.autosave.local.hasStorage ) { -
trunk/src/wp-includes/js/heartbeat.js
r25078 r25874 46 46 winBlurTimeout, 47 47 frameBlurTimeout = -1, 48 hasConnectionError = false;48 hasConnectionError = null; 49 49 50 50 /** … … 54 54 */ 55 55 this.hasConnectionError = function() { 56 return hasConnectionError;56 return !! hasConnectionError; 57 57 }; 58 58 … … 109 109 110 110 // Set error state and fire an event on XHR errors or timeout 111 function errorstate( error ) {111 function errorstate( error, status ) { 112 112 var trigger; 113 113 … … 133 133 } 134 134 135 if ( 503 == status && false === hasConnectionError ) { 136 trigger = true; 137 } 138 135 139 if ( trigger && ! self.hasConnectionError() ) { 136 140 hasConnectionError = true; 137 $(document).trigger( 'heartbeat-connection-lost', [error ] );141 $(document).trigger( 'heartbeat-connection-lost', [error, status] ); 138 142 } 139 143 } else if ( self.hasConnectionError() ) { … … 141 145 hasConnectionError = false; 142 146 $(document).trigger( 'heartbeat-connection-restored' ); 147 } else if ( null === hasConnectionError ) { 148 hasConnectionError = false; 143 149 } 144 150 } … … 214 220 next(); 215 221 }).fail( function( jqXHR, textStatus, error ) { 216 errorstate( textStatus || 'unknown' );222 errorstate( textStatus || 'unknown', jqXHR.status ); 217 223 self.error( jqXHR, textStatus, error ); 218 224 });
Note: See TracChangeset
for help on using the changeset viewer.