Make WordPress Core

Changeset 24655


Ignore:
Timestamp:
07/11/2013 12:44:37 AM (11 years ago)
Author:
azaozz
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/wp-auth-check.js

    r24528 r24655  
    11// Interim login dialog
    22(function($){
    3     var wrap, check, scheduleTimeout, hideTimeout;
     3    var wrap, check, scheduleTimeout;
    44
    55    function show() {
     
    2323                } catch(e) {
    2424                    wrap.addClass('fallback');
     25                    parent.css( 'max-height', '' );
    2526                    form.remove();
    2627                    noframe.focus();
     
    2930
    3031                if ( height ) {
    31                     if ( body && body.hasClass('interim-login-success') ) {
    32                         height += 35;
    33                         parent.find('.wp-auth-check-close').show();
    34                         wrap.data('logged-in', 1);
    35                         hideTimeout = setTimeout( function() { hide(); }, 3000 );
    36                     }
    37 
    38                     parent.css( 'max-height', height + 60 + 'px' );
     32                    if ( body && body.hasClass('interim-login-success') )
     33                        hide();
     34                    else
     35                        parent.css( 'max-height', height + 60 + 'px' );
     36                } else if ( ! body || ! body.length ) {
     37                    // Catch "silent" iframe origin exceptions in WebKit after another page is loaded in the iframe
     38                    wrap.addClass('fallback');
     39                    parent.css( 'max-height', '' );
     40                    form.remove();
     41                    noframe.focus();
    3942                }
    4043            }).attr( 'src', form.data('src') );
     
    4851            frame.focus();
    4952            // WebKit doesn't throw an error if the iframe fails to load because of "X-Frame-Options: DENY" header.
    50             // Wait for 5 sec. and switch to the fallback text.
     53            // Wait for 10 sec. and switch to the fallback text.
    5154            setTimeout( function() {
    5255                if ( ! loaded ) {
     
    5558                    noframe.focus();
    5659                }
    57             }, 5000 );
     60            }, 10000 );
    5861        } else {
    5962            noframe.focus();
     
    6366    function hide() {
    6467        $(window).off( 'beforeunload.wp-auth-check' );
    65         window.clearTimeout( hideTimeout );
    6668
    6769        // When on the Edit Post screen, speed up heartbeat after the user logs in to quickly refresh nonces
     
    9092        if ( data['wp-auth-check'] && wrap.hasClass('hidden') ) {
    9193            show();
    92         } else if ( ! data['wp-auth-check'] && ! wrap.hasClass('hidden') && ! wrap.data('logged-in') ) {
     94        } else if ( ! data['wp-auth-check'] && ! wrap.hasClass('hidden') ) {
    9395            hide();
    9496        }
    9597    }).ready( function() {
    9698        schedule();
    97         wrap = $('#wp-auth-check-wrap').data( 'logged-in', 0 );
     99        wrap = $('#wp-auth-check-wrap');
    98100        wrap.find('.wp-auth-check-close').on( 'click', function(e) {
    99101            hide();
Note: See TracChangeset for help on using the changeset viewer.