Logged out warnings:

- Close the iframe immediately on successful login.
- Catch iframe origin exceptions in WebKit when there is a server error or another page is loaded in the iframe.
See #23295.

git-svn-id: http://core.svn.wordpress.org/trunk@24655 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2013-07-11 00:44:37 +00:00
parent 9602a29c5d
commit 682de58eb5

View File

@ -1,6 +1,6 @@
// Interim login dialog
(function($){
var wrap, check, scheduleTimeout, hideTimeout;
var wrap, check, scheduleTimeout;
function show() {
var parent = $('#wp-auth-check'), form = $('#wp-auth-check-form'), noframe = wrap.find('.wp-auth-fallback-expired'), frame, loaded = false;
@ -22,20 +22,23 @@
height = body.height();
} catch(e) {
wrap.addClass('fallback');
parent.css( 'max-height', '' );
form.remove();
noframe.focus();
return;
}
if ( height ) {
if ( body && body.hasClass('interim-login-success') ) {
height += 35;
parent.find('.wp-auth-check-close').show();
wrap.data('logged-in', 1);
hideTimeout = setTimeout( function() { hide(); }, 3000 );
}
parent.css( 'max-height', height + 60 + 'px' );
if ( body && body.hasClass('interim-login-success') )
hide();
else
parent.css( 'max-height', height + 60 + 'px' );
} else if ( ! body || ! body.length ) {
// Catch "silent" iframe origin exceptions in WebKit after another page is loaded in the iframe
wrap.addClass('fallback');
parent.css( 'max-height', '' );
form.remove();
noframe.focus();
}
}).attr( 'src', form.data('src') );
@ -47,14 +50,14 @@
if ( frame ) {
frame.focus();
// WebKit doesn't throw an error if the iframe fails to load because of "X-Frame-Options: DENY" header.
// Wait for 5 sec. and switch to the fallback text.
// Wait for 10 sec. and switch to the fallback text.
setTimeout( function() {
if ( ! loaded ) {
wrap.addClass('fallback');
form.remove();
noframe.focus();
}
}, 5000 );
}, 10000 );
} else {
noframe.focus();
}
@ -62,7 +65,6 @@
function hide() {
$(window).off( 'beforeunload.wp-auth-check' );
window.clearTimeout( hideTimeout );
// When on the Edit Post screen, speed up heartbeat after the user logs in to quickly refresh nonces
if ( typeof adminpage != 'undefined' && ( adminpage == 'post-php' || adminpage == 'post-new-php' )
@ -89,12 +91,12 @@
if ( data['wp-auth-check'] && wrap.hasClass('hidden') ) {
show();
} else if ( ! data['wp-auth-check'] && ! wrap.hasClass('hidden') && ! wrap.data('logged-in') ) {
} else if ( ! data['wp-auth-check'] && ! wrap.hasClass('hidden') ) {
hide();
}
}).ready( function() {
schedule();
wrap = $('#wp-auth-check-wrap').data( 'logged-in', 0 );
wrap = $('#wp-auth-check-wrap');
wrap.find('.wp-auth-check-close').on( 'click', function(e) {
hide();
});