From 9a695d70bf8d680eee7b77c1904e26f8b46af132 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Fri, 15 Mar 2013 06:15:14 +0000 Subject: [PATCH] Local autosave: remove the temp cookie after first use. Prevents false negative if the browser crashes. Add some temp logging to aid testing. See #23220 git-svn-id: http://core.svn.wordpress.org/trunk@23705 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/js/autosave.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/wp-includes/js/autosave.js b/wp-includes/js/autosave.js index b71a02bc61..d1914d190b 100644 --- a/wp-includes/js/autosave.js +++ b/wp-includes/js/autosave.js @@ -487,6 +487,10 @@ wp.autosave.local = { post_data['status'] = $('#post_status').val() || ''; result = this.setData( post_data ); + // temp logging + if ( this.debug ) + console.log( 'saved, post content = %s', post_data.content ); + if ( result ) this.lastsaveddata = post_data.post_title + ': ' + post_data.content; @@ -583,10 +587,17 @@ wp.autosave.local = { if ( ! post_data ) return; + if ( cookie ) + wpCookies.remove( 'wp-saving-post-' + post_id ); + // There is a newer autosave. Don't show two "restore" notices at the same time. if ( $('#has-newer-autosave').length ) return; + // temp logging + if ( typeof console != 'undefined' ) + console.log( 'checkPost, post content = %s', post_data.content ); + if ( cookie == 'saved' ) { return; } else if ( cookie != 'check' ) {