WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/21/2016 04:55:20 PM (4 years ago)
Author:
westonruter
Message:

Customize: Remove iframe-specific behaviors from customize preview when previewing on frontend and not contained inside iframe.

  • Strip out customize_messenger_channel from preview window URL when not contained in iframe.
  • Allow interacting with unpreviewable links and forms when previewing customized state on frontend.

See #30937.
Fixes #38867.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/customize/manager.php

    r39320 r39332  
    461461
    462462        $this->assertEquals( 10, has_action( 'wp_head', 'wp_no_robots' ) );
     463        $this->assertEquals( 10, has_action( 'wp_head', array( $wp_customize, 'remove_frameless_preview_messenger_channel' ) ) );
    463464        $this->assertEquals( 10, has_filter( 'wp_headers', array( $wp_customize, 'filter_iframe_security_headers' ) ) );
    464465        $this->assertEquals( 10, has_filter( 'wp_redirect', array( $wp_customize, 'add_state_query_params' ) ) );
     
    20372038
    20382039    /**
     2040     * Test remove_frameless_preview_messenger_channel.
     2041     *
     2042     * @ticket 38867
     2043     * @covers WP_Customize_Manager::remove_frameless_preview_messenger_channel()
     2044     */
     2045    function test_remove_frameless_preview_messenger_channel() {
     2046        wp_set_current_user( self::$admin_user_id );
     2047        $manager = new WP_Customize_Manager( array( 'messenger_channel' => null ) );
     2048        ob_start();
     2049        $manager->remove_frameless_preview_messenger_channel();
     2050        $output = ob_get_clean();
     2051        $this->assertEmpty( $output );
     2052
     2053        $manager = new WP_Customize_Manager( array( 'messenger_channel' => 'preview-0' ) );
     2054        ob_start();
     2055        $manager->remove_frameless_preview_messenger_channel();
     2056        $output = ob_get_clean();
     2057        $this->assertContains( '<script>', $output );
     2058    }
     2059
     2060    /**
    20392061     * Test customize_preview_settings() method.
    20402062     *
Note: See TracChangeset for help on using the changeset viewer.