Make WordPress Core

Changeset 20897


Ignore:
Timestamp:
05/25/2012 04:19:18 PM (14 years ago)
Author:
koopersmith
Message:

Theme Customizer: Prevent messengers from binding to the current window when a parent doesn't exist. see #19910.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/customize-base.dev.js

    r20886 r20897  
    483483
    484484                initialize: function( url, targetWindow, options ) {
     485                        // Target the parent frame by default, but only if a parent frame exists.
     486                        var defaultTarget = window.parent == window ? null : window.parent;
     487
    485488                        $.extend( this, options || {} );
    486489
    487490                        url = this.add( 'url', url );
    488                         this.add( 'targetWindow', targetWindow || window.parent );
     491                        this.add( 'targetWindow', targetWindow || defaultTarget );
    489492                        this.add( 'origin', url() ).link( url ).setter( function( to ) {
    490493                                return to.replace( /([^:]+:\/\/[^\/]+).*/, '$1' );
    … …  
    504507                        event = event.originalEvent;
    505508
     509                        if ( ! this.targetWindow() )
     510                                return;
     511
    506512                        // Check to make sure the origin is valid.
    507513                        if ( this.origin() && event.origin !== this.origin() )
    … …  
    519525                        data = typeof data === 'undefined' ? {} : data;
    520526
    521                         if ( ! this.url() )
     527                        if ( ! this.url() || ! this.targetWindow() )
    522528                                return;
    523529
Note: See TracChangeset for help on using the changeset viewer.