Make WordPress Core

Ticket #34698: 34698.3.diff

File 34698.3.diff, 1.9 KB (added by peterwilsoncc, 10 years ago)
  • src/wp-includes/js/wp-embed.js

    diff --git a/src/wp-includes/js/wp-embed.js b/src/wp-includes/js/wp-embed.js
    index 8223102..50471c7 100644
    a b  
    11(function ( window, document ) {
    22        'use strict';
    33
    4         var supportedBrowser = ( document.querySelector && window.addEventListener ),
     4        var supportedBrowser = false,
    55                loaded = false;
    66
     7                if ( document.querySelector ) {
     8                        if ( window.addEventListener ) {
     9                                supportedBrowser = true;
     10                        }
     11                }
     12
    713        window.wp = window.wp || {};
    814
    915        if ( !! window.wp.receiveEmbedMessage ) {
     
    5056                                targetURL.href = data.value;
    5157
    5258                                /* Only continue if link hostname matches iframe's hostname. */
    53                                 if ( targetURL.host === sourceURL.host && document.activeElement === source ) {
    54                                         window.top.location.href = data.value;
     59                                if ( targetURL.host === sourceURL.host ) {
     60                                        if ( document.activeElement === source ) {
     61                                                window.top.location.href = data.value;
     62                                        }
    5563                                }
    5664                        }
    5765                }
     
    7785                        source = iframes[ i ];
    7886                        source.style.display = '';
    7987
    80                         if ( !source.getAttribute( 'data-secret' ) ) {
    81                                 /* Add secret to iframe */
    82                                 secret = Math.random().toString( 36 ).substr( 2, 10 );
    83                                 source.src += '#?secret=' + secret;
    84                                 source.setAttribute( 'data-secret', secret );
     88                        if ( source.getAttribute( 'data-secret' ) ) {
     89                                continue;
    8590                        }
    8691
     92                        /* Add secret to iframe */
     93                        secret = Math.random().toString( 36 ).substr( 2, 10 );
     94                        source.src += '#?secret=' + secret;
     95                        source.setAttribute( 'data-secret', secret );
     96
    8797                        /* Remove security attribute from iframes in IE10 and IE11. */
    88                         if ( ( isIE10 || isIE11 ) && !!source.getAttribute( 'security' ) ) {
     98                        if ( ( isIE10 || isIE11 ) ) {
    8999                                iframeClone = source.cloneNode( true );
    90100                                iframeClone.removeAttribute( 'security' );
    91101                                source.parentNode.replaceChild( iframeClone, source );