Make WordPress Core

Changeset 31885


Ignore:
Timestamp:
03/25/2015 05:25:01 PM (12 years ago)
Author:
ocean90
Message:

Customizer: Avoid SecurityErrors when the Customizer is embedded in an origin other than wp-admin.

props mattwiebe.
fixes #31687.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/customize-controls.js

    r31706 r31885  
    19301930                        this.query = $.extend( params.query || {}, { customize_messenger_channel: this.channel() });
    19311931
     1932                        // This avoids SecurityErrors when setting a window object in x-origin iframe'd scenarios.
     1933                        this.targetWindow.set = function( to ) {
     1934                                var from = this._value;
     1935
     1936                                to = this._setter.apply( this, arguments );
     1937                                to = this.validate( to );
     1938
     1939                                if ( null === to || from === to ) {
     1940                                        return this;
     1941                                }
     1942
     1943                                this._value = to;
     1944                                this._dirty = true;
     1945
     1946                                this.callbacks.fireWith( this, [ to, from ] );
     1947
     1948                                return this;
     1949                        };
     1950
    19321951                        this.run( deferred );
    19331952                },
    … …  
    21192138                title = tmpl.replace( '%s', documentTitle );
    21202139                document.title = title;
    2121                 if ( window !== window.parent ) {
    2122                         window.parent.document.title = document.title;
    2123                 }
     2140                api.trigger( 'title', title );
    21242141        };
    21252142
    … …  
    28002817                });
    28012818
     2819                // Pass titles to the parent
     2820                api.bind( 'title', function( newTitle ) {
     2821                        parent.send( 'title', newTitle );
     2822                });
     2823
    28022824                // Initialize the connection with the parent frame.
    28032825                parent.send( 'ready' );
  • trunk/src/wp-includes/js/customize-loader.js

    r31704 r31885  
    156156                        } );
    157157
     158                        this.messenger.bind( 'title', function( newTitle ){
     159                                window.document.title = newTitle;
     160                        });
     161
    158162                        this.pushState( src );
    159163
Note: See TracChangeset for help on using the changeset viewer.