Message info
 
To:wp-svn@lists.automattic.com From:m@wordpress.org Subject:[wp-svn] [21029] trunk: Customizer: fix stuck urls and preview white screens after repeated save and activates . Date:Fri, 8 Jun 2012 18:52:45 +0000 (UTC)
 

Revision
21029
Author
ryan
Date
2012-06-08 18:52:44 +0000 (Fri, 08 Jun 2012)

Log Message

Customizer: fix stuck urls and preview white screens after repeated save and activates. Props koopersmith. fixes #20868

Modified Paths

Diff

Modified: trunk/wp-admin/js/customize-controls.dev.js (21028 => 21029)


--- trunk/wp-admin/js/customize-controls.dev.js	2012-06-08 18:45:12 UTC (rev 21028)
+++ trunk/wp-admin/js/customize-controls.dev.js	2012-06-08 18:52:44 UTC (rev 21029)
@@ -694,11 +694,6 @@
 			api.state = state;
 		}());
 
-		api.bind( 'activated', function() {
-			if ( api.settings.url.activated )
-				window.location = api.settings.url.activated;
-		});
-
 		// Temporary accordion code.
 		$('.customize-section-title').click( function( event ) {
 			var clicked = $( this ).parents( '.customize-section' );
@@ -738,12 +733,19 @@
 		});
 
 		// Pass events through to the parent.
-		$.each([ 'saved', 'activated' ], function( i, id ) {
-			api.bind( id, function() {
-				parent.send( id );
-			});
+		api.bind( 'saved', function() {
+			parent.send( 'saved' );
 		});
 
+		// When activated, let the loader handle redirecting the page.
+		// If no loader exists, redirect the page ourselves (if a url exists).
+		api.bind( 'activated', function() {
+			if ( parent.targetWindow() )
+				parent.send( 'activated', api.settings.url.activated );
+			else if ( api.settings.url.activated )
+				window.location = api.settings.url.activated;
+		});
+
 		// Initialize the connection with the parent frame.
 		parent.send( 'ready' );
 

Modified: trunk/wp-includes/js/customize-base.dev.js (21028 => 21029)


--- trunk/wp-includes/js/customize-base.dev.js	2012-06-08 18:45:12 UTC (rev 21028)
+++ trunk/wp-includes/js/customize-base.dev.js	2012-06-08 18:52:44 UTC (rev 21029)
@@ -547,7 +547,7 @@
 		send: function( id, data ) {
 			var message;
 
-			data = typeof data === 'undefined' ? {} : data;
+			data = typeof data === 'undefined' ? null : data;
 
 			if ( ! this.url() || ! this.targetWindow() )
 				return;

Modified: trunk/wp-includes/js/customize-loader.dev.js (21028 => 21029)


--- trunk/wp-includes/js/customize-loader.dev.js	2012-06-08 18:45:12 UTC (rev 21028)
+++ trunk/wp-includes/js/customize-loader.dev.js	2012-06-08 18:52:44 UTC (rev 21029)
@@ -98,6 +98,11 @@
 					Loader.close();
 			});
 
+			this.messenger.bind( 'activated', function( location ) {
+				if ( location )
+					window.location = location;
+			});
+
 			hash = src.split('?')[1];
 
 			// Ensure we don't call pushState if the user hit the forward button.