diff --git a/wp-includes/js/wp-auth-check.js b/wp-includes/js/wp-auth-check.js index 44ff15a153..ff64573639 100644 --- a/wp-includes/js/wp-auth-check.js +++ b/wp-includes/js/wp-auth-check.js @@ -159,12 +159,23 @@ setShowTimeout(); }); }).on( 'heartbeat-tick.wp-auth-check', function( e, data ) { - if ( 'wp-auth-check' in data ) { + if ( ! ( 'wp-auth-check' in data ) ) { + return; + } + + var showOrHide = function () { if ( ! data['wp-auth-check'] && wrap.hasClass( 'hidden' ) && ! tempHidden ) { show(); } else if ( data['wp-auth-check'] && ! wrap.hasClass( 'hidden' ) ) { hide(); } + }; + + // This is necessary due to a race condition where the heartbeat-tick event may fire before DOMContentLoaded. + if ( wrap ) { + showOrHide(); + } else { + $( showOrHide ); } }); diff --git a/wp-includes/js/wp-auth-check.min.js b/wp-includes/js/wp-auth-check.min.js index 9ebdb6c5fd..849ae3a356 100644 --- a/wp-includes/js/wp-auth-check.min.js +++ b/wp-includes/js/wp-auth-check.min.js @@ -1,2 +1,2 @@ /*! This file is auto-generated */ -!function(i){var h,d,e;function r(){var e=window.adminpage,a=window.wp;i(window).off("beforeunload.wp-auth-check"),("post-php"===e||"post-new-php"===e)&&a&&a.heartbeat&&a.heartbeat.connectNow(),h.fadeOut(200,function(){h.addClass("hidden").css("display",""),i("#wp-auth-check-frame").remove(),i("body").removeClass("modal-open")})}i(function(){(h=i("#wp-auth-check-wrap")).find(".wp-auth-check-close").on("click",function(){r(),d=!0,window.clearTimeout(e),e=window.setTimeout(function(){d=!1},3e5)})}).on("heartbeat-tick.wp-auth-check",function(e,a){var o,t,n,c,s;"wp-auth-check"in a&&(a["wp-auth-check"]||!h.hasClass("hidden")||d?a["wp-auth-check"]&&!h.hasClass("hidden")&&r():(t=i("#wp-auth-check"),n=i("#wp-auth-check-form"),c=h.find(".wp-auth-fallback-expired"),s=!1,n.length&&(i(window).on("beforeunload.wp-auth-check",function(e){e.originalEvent.returnValue=window.wp.i18n.__("Your session has expired. You can log in again from this page or go to the login page.")}),(o=i('