Customizer: Prevent a race condition when attempting to publish too soon after updating widget form fields with multiple edits.

props westonruter.
fixes #31501.
Built from https://develop.svn.wordpress.org/trunk@31706


git-svn-id: http://core.svn.wordpress.org/trunk@31687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2015-03-10 22:45:27 +00:00
parent b96a624cb9
commit 9250d59e6a
5 changed files with 13 additions and 8 deletions

View File

@ -2445,9 +2445,6 @@
save: function() { save: function() {
var self = this, var self = this,
query = $.extend( this.query(), {
nonce: this.nonce.save
} ),
processing = api.state( 'processing' ), processing = api.state( 'processing' ),
submitWhenDoneProcessing, submitWhenDoneProcessing,
submit; submit;
@ -2455,7 +2452,11 @@
body.addClass( 'saving' ); body.addClass( 'saving' );
submit = function () { submit = function () {
var request = wp.ajax.post( 'customize_save', query ); var request, query;
query = $.extend( self.query(), {
nonce: self.nonce.save
} );
request = wp.ajax.post( 'customize_save', query );
api.trigger( 'save', request ); api.trigger( 'save', request );

File diff suppressed because one or more lines are too long

View File

@ -1028,7 +1028,11 @@
} }
data += '&' + $widgetContent.find( '~ :input' ).serialize(); data += '&' + $widgetContent.find( '~ :input' ).serialize();
if ( this._previousUpdateRequest ) {
this._previousUpdateRequest.abort();
}
jqxhr = $.post( wp.ajax.settings.url, data ); jqxhr = $.post( wp.ajax.settings.url, data );
this._previousUpdateRequest = jqxhr;
jqxhr.done( function( r ) { jqxhr.done( function( r ) {
var message, sanitizedForm, $sanitizedInputs, hasSameInputsInResponse, var message, sanitizedForm, $sanitizedInputs, hasSameInputsInResponse,

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.2-alpha-31705'; $wp_version = '4.2-alpha-31706';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.