Make WordPress Core

Ticket #49558: 49558.3.diff

File 49558.3.diff, 32.2 KB (added by Mista-Flo, 4 years ago)

Fix unit test

  • src/wp-admin/includes/class-wp-site-health.php

    diff --git a/src/wp-admin/includes/class-wp-site-health.php b/src/wp-admin/includes/class-wp-site-health.php
    index de698d7a30..2dbd722bc9 100644
    a b class WP_Site_Health { 
    729729                                )
    730730                        ),
    731731                        'actions'     => sprintf(
    732                                 '<p><a href="%s" target="_blank" rel="noopener noreferrer">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
     732                                '<p><a href="%s" target="_blank" rel="noopener">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
    733733                                esc_url( wp_get_update_php_url() ),
    734734                                __( 'Learn more about updating PHP' ),
    735735                                /* translators: Accessibility text. */
    class WP_Site_Health { 
    841841                                        __( 'The WordPress Hosting Team maintains a list of those modules, both recommended and required, in <a href="%1$s" %2$s>the team handbook%3$s</a>.' ),
    842842                                        /* translators: Localized team handbook, if one exists. */
    843843                                        esc_url( __( 'https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions' ) ),
    844                                         'target="_blank" rel="noopener noreferrer"',
     844                                        'target="_blank" rel="noopener"',
    845845                                        sprintf(
    846846                                                ' <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span>',
    847847                                                /* translators: Accessibility text. */
    class WP_Site_Health { 
    11581158                                __( 'The SQL server is a required piece of software for the database WordPress uses to store all your site&#8217;s content and settings.' )
    11591159                        ),
    11601160                        'actions'     => sprintf(
    1161                                 '<p><a href="%s" target="_blank" rel="noopener noreferrer">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
     1161                                '<p><a href="%s" target="_blank" rel="noopener">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
    11621162                                /* translators: Localized version of WordPress requirements if one exists. */
    11631163                                esc_url( __( 'https://wordpress.org/about/requirements/' ) ),
    11641164                                __( 'Learn more about what WordPress requires to run.' ),
    class WP_Site_Health { 
    13951395                        );
    13961396
    13971397                        $result['actions'] = sprintf(
    1398                                 '<p><a href="%s" target="_blank" rel="noopener noreferrer">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
     1398                                '<p><a href="%s" target="_blank" rel="noopener">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
    13991399                                /* translators: Localized Support reference. */
    14001400                                esc_url( __( 'https://wordpress.org/support' ) ),
    14011401                                __( 'Get help resolving this issue.' ),
    class WP_Site_Health { 
    14331433                                __( 'Debug mode is often enabled to gather more details about an error or site failure, but may contain sensitive information which should not be available on a publicly available website.' )
    14341434                        ),
    14351435                        'actions'     => sprintf(
    1436                                 '<p><a href="%s" target="_blank" rel="noopener noreferrer">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
     1436                                '<p><a href="%s" target="_blank" rel="noopener">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
    14371437                                /* translators: Documentation explaining debugging in WordPress. */
    14381438                                esc_url( __( 'https://wordpress.org/support/article/debugging-in-wordpress/' ) ),
    14391439                                __( 'Learn more about debugging in WordPress.' ),
    class WP_Site_Health { 
    15021502                                __( 'An HTTPS connection is a more secure way of browsing the web. Many services now have HTTPS as a requirement. HTTPS allows you to take advantage of new features that can increase site speed, improve search rankings, and gain the trust of your visitors by helping to protect their online privacy.' )
    15031503                        ),
    15041504                        'actions'     => sprintf(
    1505                                 '<p><a href="%s" target="_blank" rel="noopener noreferrer">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
     1505                                '<p><a href="%s" target="_blank" rel="noopener">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
    15061506                                /* translators: Documentation explaining HTTPS and why it should be used. */
    15071507                                esc_url( __( 'https://wordpress.org/support/article/why-should-i-use-https/' ) ),
    15081508                                __( 'Learn more about why you should use HTTPS' ),
  • src/wp-admin/includes/dashboard.php

    diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php
    index edc30cda2c..ff91fdfa8a 100644
    a b function wp_dashboard_php_nag() { 
    17491749        <p class="button-container">
    17501750                <?php
    17511751                printf(
    1752                         '<a class="button button-primary" href="%1$s" target="_blank" rel="noopener noreferrer">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
     1752                        '<a class="button button-primary" href="%1$s" target="_blank" rel="noopener">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
    17531753                        esc_url( wp_get_update_php_url() ),
    17541754                        __( 'Learn more about updating PHP' ),
    17551755                        /* translators: Accessibility text. */
  • src/wp-admin/includes/media.php

    diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php
    index 94cc216df5..9efb611aea 100644
    a b function edit_form_image_editor( $post ) { 
    31943194                        /* translators: 1: Link to tutorial, 2: Additional link attributes, 3: Accessibility text. */
    31953195                        __( '<a href="%1$s" %2$s>Describe the purpose of the image%3$s</a>. Leave empty if the image is purely decorative.' ),
    31963196                        esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ),
    3197                         'target="_blank" rel="noopener noreferrer"',
     3197                        'target="_blank" rel="noopener"',
    31983198                        sprintf(
    31993199                                '<span class="screen-reader-text"> %s</span>',
    32003200                                /* translators: Accessibility text. */
  • src/wp-includes/class-walker-nav-menu.php

    diff --git a/src/wp-includes/class-walker-nav-menu.php b/src/wp-includes/class-walker-nav-menu.php
    index 5f4a53691c..f9c94e16fb 100644
    a b class Walker_Nav_Menu extends Walker { 
    173173                $atts['title']  = ! empty( $item->attr_title ) ? $item->attr_title : '';
    174174                $atts['target'] = ! empty( $item->target ) ? $item->target : '';
    175175                if ( '_blank' === $item->target && empty( $item->xfn ) ) {
    176                         $atts['rel'] = 'noopener noreferrer';
     176                        $atts['rel'] = 'noopener';
    177177                } else {
    178178                        $atts['rel'] = $item->xfn;
    179179                }
  • src/wp-includes/comment.php

    diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php
    index 10e9d864ad..70d2621a7e 100644
    a b function wp_comments_personal_data_exporter( $email_address, $page = 1 ) { 
    36283628                                case 'comment_link':
    36293629                                        $value = get_comment_link( $comment->comment_ID );
    36303630                                        $value = sprintf(
    3631                                                 '<a href="%s" target="_blank" rel="noreferrer noopener">%s</a>',
     3631                                                '<a href="%s" target="_blank" rel="noopener">%s</a>',
    36323632                                                esc_url( $value ),
    36333633                                                esc_html( $value )
    36343634                                        );
  • src/wp-includes/formatting.php

    diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php
    index 494c1b3e61..647bcb185c 100644
    a b function wp_rel_ugc( $text ) { 
    31533153}
    31543154
    31553155/**
    3156  * Adds rel noreferrer and noopener to all HTML A elements that have a target.
     3156 * Adds rel noopener to all HTML A elements that have a target.
    31573157 *
    31583158 * @since 5.1.0
     3159 * @since 5.6.0 Removed noreferrer relationship.
    31593160 *
    31603161 * @param string $text Content that may contain HTML A elements.
    31613162 * @return string Converted content.
    function wp_targeted_link_rel( $text ) { 
    31883189}
    31893190
    31903191/**
    3191  * Callback to add rel="noreferrer noopener" string to HTML A element.
     3192 * Callback to add rel="noopener" string to HTML A element.
    31923193 *
    3193  * Will not duplicate existing noreferrer and noopener values
    3194  * to prevent from invalidating the HTML.
     3194 * Will not duplicate existing noopener value to prevent from invalidating the HTML.
    31953195 *
    31963196 * @since 5.1.0
     3197 * @since 5.6.0 Removed noreferrer relationship.
    31973198 *
    31983199 * @param array $matches Single Match
    3199  * @return string HTML A Element with rel noreferrer noopener in addition to any existing values
     3200 * @return string HTML A Element with rel noopener in addition to any existing values
    32003201 */
    32013202function wp_targeted_link_rel_callback( $matches ) {
    32023203        $link_html          = $matches[1];
    function wp_targeted_link_rel_callback( $matches ) { 
    32193220         * @param string $rel       The rel values.
    32203221         * @param string $link_html The matched content of the link tag including all HTML attributes.
    32213222         */
    3222         $rel = apply_filters( 'wp_targeted_link_rel', 'noopener noreferrer', $link_html );
     3223        $rel = apply_filters( 'wp_targeted_link_rel', 'noopener', $link_html );
    32233224
    32243225        // Return early if no rel values to be added or if no actual target attribute.
    32253226        if ( ! $rel || ! isset( $atts['target'] ) ) {
  • src/wp-includes/functions.php

    diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
    index fe68d7f760..7446203ed0 100644
    a b function wp_direct_php_update_button() { 
    75017501
    75027502        echo '<p class="button-container">';
    75037503        printf(
    7504                 '<a class="button button-primary" href="%1$s" target="_blank" rel="noopener noreferrer">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
     7504                '<a class="button button-primary" href="%1$s" target="_blank" rel="noopener">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
    75057505                esc_url( $direct_update_url ),
    75067506                __( 'Update PHP' ),
    75077507                /* translators: Accessibility text. */
  • src/wp-includes/media-template.php

    diff --git a/src/wp-includes/media-template.php b/src/wp-includes/media-template.php
    index 47204f31b7..6cc577ba22 100644
    a b function wp_print_media_templates() { 
    160160                /* translators: 1: Link to tutorial, 2: Additional link attributes, 3: Accessibility text. */
    161161                __( '<a href="%1$s" %2$s>Describe the purpose of the image%3$s</a>. Leave empty if the image is purely decorative.' ),
    162162                esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ),
    163                 'target="_blank" rel="noopener noreferrer"',
     163                'target="_blank" rel="noopener"',
    164164                sprintf(
    165165                        '<span class="screen-reader-text"> %s</span>',
    166166                        /* translators: Accessibility text. */
  • src/wp-includes/widgets/class-wp-widget-custom-html.php

    diff --git a/src/wp-includes/widgets/class-wp-widget-custom-html.php b/src/wp-includes/widgets/class-wp-widget-custom-html.php
    index b9140e65e8..8db6d7d492 100644
    a b class WP_Widget_Custom_HTML extends WP_Widget { 
    146146                /** This filter is documented in wp-includes/widgets/class-wp-widget-text.php */
    147147                $content = apply_filters( 'widget_text', $instance['content'], $simulated_text_widget_instance, $this );
    148148
    149                 // Adds noreferrer and noopener relationships, without duplicating values, to all HTML A elements that have a target.
     149                // Adds noopener relationship, without duplicating values, to all HTML A elements that have a target.
    150150                $content = wp_targeted_link_rel( $content );
    151151
    152152                /**
  • src/wp-includes/widgets/class-wp-widget-text.php

    diff --git a/src/wp-includes/widgets/class-wp-widget-text.php b/src/wp-includes/widgets/class-wp-widget-text.php
    index 8cac1b9185..d035f8e7bc 100644
    a b class WP_Widget_Text extends WP_Widget { 
    331331
    332332                $text = preg_replace_callback( '#<(video|iframe|object|embed)\s[^>]*>#i', array( $this, 'inject_video_max_width_style' ), $text );
    333333
    334                 // Adds noreferrer and noopener relationships, without duplicating values, to all HTML A elements that have a target.
     334                // Adds noopener relationship, without duplicating values, to all HTML A elements that have a target.
    335335                $text = wp_targeted_link_rel( $text );
    336336
    337337                ?>
  • src/wp-login.php

    diff --git a/src/wp-login.php b/src/wp-login.php
    index 0135ecffb7..c40cf54d78 100644
    a b switch ( $action ) { 
    689689                                $accessibility_text = sprintf( '<span class="screen-reader-text"> %s</span>', __( '(opens in a new tab)' ) );
    690690
    691691                                printf(
    692                                         '<a href="%s" rel="noopener noreferrer" target="_blank">%s%s</a>',
     692                                        '<a href="%s" rel="noopener" target="_blank">%s%s</a>',
    693693                                        esc_url( $admin_email_help_url ),
    694694                                        __( 'Why is this important?' ),
    695695                                        $accessibility_text
    switch ( $action ) { 
    15271527                                        for ( i in links ) {
    15281528                                                if ( links[i].href ) {
    15291529                                                        links[i].target = '_blank';
    1530                                                         links[i].rel = 'noreferrer noopener';
     1530                                                        links[i].rel = 'noopener';
    15311531                                                }
    15321532                                        }
    15331533                                } catch( er ) {}
  • tests/phpunit/tests/formatting/WPTargetedLinkRel.php

    diff --git a/tests/phpunit/tests/formatting/WPTargetedLinkRel.php b/tests/phpunit/tests/formatting/WPTargetedLinkRel.php
    index bc58dfe9cc..932100c1cd 100644
    a b class Tests_Targeted_Link_Rel extends WP_UnitTestCase { 
    88
    99        public function test_add_to_links_with_target_blank() {
    1010                $content  = '<p>Links: <a href="/" target="_blank">No rel</a></p>';
    11                 $expected = '<p>Links: <a href="/" target="_blank" rel="noopener noreferrer">No rel</a></p>';
     11                $expected = '<p>Links: <a href="/" target="_blank" rel="noopener">No rel</a></p>';
    1212                $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    1313        }
    1414
    1515        public function test_add_to_links_with_target_foo() {
    1616                $content  = '<p>Links: <a href="/" target="foo">No rel</a></p>';
    17                 $expected = '<p>Links: <a href="/" target="foo" rel="noopener noreferrer">No rel</a></p>';
     17                $expected = '<p>Links: <a href="/" target="foo" rel="noopener">No rel</a></p>';
    1818                $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    1919        }
    2020
    2121        public function test_target_as_first_attribute() {
    2222                $content  = '<p>Links: <a target="_blank" href="#">No rel</a></p>';
    23                 $expected = '<p>Links: <a target="_blank" href="#" rel="noopener noreferrer">No rel</a></p>';
     23                $expected = '<p>Links: <a target="_blank" href="#" rel="noopener">No rel</a></p>';
    2424                $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    2525        }
    2626
    2727        public function test_add_to_existing_rel() {
    2828                $content  = '<p>Links: <a href="/" rel="existing values" target="_blank">Existing rel</a></p>';
    29                 $expected = '<p>Links: <a href="/" rel="existing values noopener noreferrer" target="_blank">Existing rel</a></p>';
     29                $expected = '<p>Links: <a href="/" rel="existing values noopener" target="_blank">Existing rel</a></p>';
    3030                $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    3131        }
    3232
    3333        public function test_no_duplicate_values_added() {
    3434                $content  = '<p>Links: <a href="/" rel="existing noopener values" target="_blank">Existing rel</a></p>';
    35                 $expected = '<p>Links: <a href="/" rel="existing noopener values noreferrer" target="_blank">Existing rel</a></p>';
     35                $expected = '<p>Links: <a href="/" rel="existing noopener values" target="_blank">Existing rel</a></p>';
    3636                $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    3737        }
    3838
    3939        public function test_rel_with_single_quote_delimiter() {
    4040                $content  = '<p>Links: <a href="/" rel=\'existing values\' target="_blank">Existing rel</a></p>';
    41                 $expected = '<p>Links: <a href="/" rel="existing values noopener noreferrer" target="_blank">Existing rel</a></p>';
     41                $expected = '<p>Links: <a href="/" rel="existing values noopener" target="_blank">Existing rel</a></p>';
    4242                $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    4343        }
    4444
    4545        public function test_rel_with_no_delimiter() {
    4646                $content  = '<p>Links: <a href="/" rel=existing target="_blank">Existing rel</a></p>';
    47                 $expected = '<p>Links: <a href="/" rel="existing noopener noreferrer" target="_blank">Existing rel</a></p>';
     47                $expected = '<p>Links: <a href="/" rel="existing noopener" target="_blank">Existing rel</a></p>';
    4848                $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    4949        }
    5050
    5151        public function test_rel_value_spaced_and_no_delimiter() {
    5252                $content  = '<p>Links: <a href="/" rel = existing target="_blank">Existing rel</a></p>';
    53                 $expected = '<p>Links: <a href="/" rel="existing noopener noreferrer" target="_blank">Existing rel</a></p>';
     53                $expected = '<p>Links: <a href="/" rel="existing noopener" target="_blank">Existing rel</a></p>';
    5454                $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    5555        }
    5656
    5757        public function test_escaped_quotes() {
    5858                $content  = '<p>Links: <a href=\"/\" rel=\"existing values\" target=\"_blank\">Existing rel</a></p>';
    59                 $expected = '<p>Links: <a href=\"/\" rel=\"existing values noopener noreferrer\" target=\"_blank\">Existing rel</a></p>';
     59                $expected = '<p>Links: <a href=\"/\" rel=\"existing values noopener\" target=\"_blank\">Existing rel</a></p>';
    6060                $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    6161        }
    6262
    6363        public function test_ignore_links_with_no_target() {
    6464                $content  = '<p>Links: <a href="/" target="_blank">Change me</a> <a href="/">Do not change me</a></p>';
    65                 $expected = '<p>Links: <a href="/" target="_blank" rel="noopener noreferrer">Change me</a> <a href="/">Do not change me</a></p>';
     65                $expected = '<p>Links: <a href="/" target="_blank" rel="noopener">Change me</a> <a href="/">Do not change me</a></p>';
    6666                $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    6767        }
    6868
    class Tests_Targeted_Link_Rel extends WP_UnitTestCase { 
    8585         */
    8686        public function test_wp_targeted_link_rel_filters_run() {
    8787                $content  = '<p>Links: <a href="/" target="_blank">No rel</a></p>';
    88                 $expected = '<p>Links: <a href="/" target="_blank" rel="noopener noreferrer">No rel</a></p>';
     88                $expected = '<p>Links: <a href="/" target="_blank" rel="noopener">No rel</a></p>';
    8989
    9090                $post = $this->factory()->post->create_and_get(
    9191                        array(
    class Tests_Targeted_Link_Rel extends WP_UnitTestCase { 
    103103         */
    104104        public function test_wp_targeted_link_rel_should_preserve_json() {
    105105                $content  = '<p>Links: <a href=\"\/\" target=\"_blank\">No rel<\/a><\/p>';
    106                 $expected = '<p>Links: <a href=\"\/\" target=\"_blank\" rel=\"noopener noreferrer\">No rel<\/a><\/p>';
     106                $expected = '<p>Links: <a href=\"\/\" target=\"_blank\" rel=\"noopener\">No rel<\/a><\/p>';
    107107                $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    108108        }
    109109
    class Tests_Targeted_Link_Rel extends WP_UnitTestCase { 
    114114         */
    115115        public function test_wp_targeted_link_rel_skips_style_and_scripts() {
    116116                $content  = '<style><a href="/" target=a></style><p>Links: <script>console.log("<a href=\'/\' target=a>hi</a>");</script><script>alert(1);</script>here <a href="/" target=_blank>aq</a></p><script>console.log("<a href=\'last\' target=\'_blank\'")</script>';
    117                 $expected = '<style><a href="/" target=a></style><p>Links: <script>console.log("<a href=\'/\' target=a>hi</a>");</script><script>alert(1);</script>here <a href="/" target="_blank" rel="noopener noreferrer">aq</a></p><script>console.log("<a href=\'last\' target=\'_blank\'")</script>';
     117                $expected = '<style><a href="/" target=a></style><p>Links: <script>console.log("<a href=\'/\' target=a>hi</a>");</script><script>alert(1);</script>here <a href="/" target="_blank" rel="noopener">aq</a></p><script>console.log("<a href=\'last\' target=\'_blank\'")</script>';
    118118                $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    119119        }
    120120
    class Tests_Targeted_Link_Rel extends WP_UnitTestCase { 
    131131
    132132        public function test_wp_targeted_link_rel_tab_separated_values_are_split() {
    133133                $content  = "<p>Links: <a href=\"/\" target=\"_blank\" rel=\"ugc\t\tnoopener\t\">No rel</a></p>";
    134                 $expected = '<p>Links: <a href="/" target="_blank" rel="ugc noopener noreferrer">No rel</a></p>';
     134                $expected = '<p>Links: <a href="/" target="_blank" rel="ugc noopener">No rel</a></p>';
    135135                $this->assertSame( $expected, wp_targeted_link_rel( $content ) );
    136136        }
    137137
  • tests/phpunit/tests/menu/walker-nav-menu.php

    diff --git a/tests/phpunit/tests/menu/walker-nav-menu.php b/tests/phpunit/tests/menu/walker-nav-menu.php
    index 25e6aba510..9b63d63d54 100644
    a b class Tests_Menu_Walker_Nav_Menu extends WP_UnitTestCase { 
    3737        }
    3838
    3939        /**
    40          * Tests when an item's target is _blank, that rel="noopener noreferrer" is added.
     40         * Tests when an item's target is _blank, that rel="noopener" is added.
    4141         *
    4242         * @ticket 43290
    4343         */
    class Tests_Menu_Walker_Nav_Menu extends WP_UnitTestCase { 
    6464
    6565                $this->walker->start_el( $expected, (object) $item, 0, (object) $args );
    6666
    67                 $this->assertSame( "<li id=\"menu-item-{$post_id}\" class=\"menu-item-{$post_id}\"><a target=\"_blank\" rel=\"noopener noreferrer\">{$post_title}</a>", $expected );
     67                $this->assertSame( "<li id=\"menu-item-{$post_id}\" class=\"menu-item-{$post_id}\"><a target=\"_blank\" rel=\"noopener\">{$post_title}</a>", $expected );
    6868        }
    6969
    7070        /**
  • tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php

    diff --git a/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php b/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php
    index 75bd6aefc2..2288124c84 100644
    a b class Tests_Privacy_WpPrivacyGeneratePersonalDataExportFile extends WP_UnitTestC 
    478478                                                ),
    479479                                                array(
    480480                                                        'name'  => 'Comment URL',
    481                                                         'value' => '<a href="http://localhost:8888/46894/2020/01/31/hello-world/#comment-2" target="_blank" rel="noreferrer noopener">http://localhost:8888/46894/2020/01/31/hello-world/#comment-2</a>',
     481                                                        'value' => '<a href="http://localhost:8888/46894/2020/01/31/hello-world/#comment-2" target="_blank" rel="noopener">http://localhost:8888/46894/2020/01/31/hello-world/#comment-2</a>',
    482482                                                ),
    483483                                        ),
    484484                                        'comment-3' => array(
    class Tests_Privacy_WpPrivacyGeneratePersonalDataExportFile extends WP_UnitTestC 
    508508                                                ),
    509509                                                array(
    510510                                                        'name'  => 'Comment URL',
    511                                                         'value' => '<a href="http://localhost:8888/46894/2020/01/31/hello-world/#comment-3" target="_blank" rel="noreferrer noopener">http://localhost:8888/46894/2020/01/31/hello-world/#comment-3</a>',
     511                                                        'value' => '<a href="http://localhost:8888/46894/2020/01/31/hello-world/#comment-3" target="_blank" rel="noopener">http://localhost:8888/46894/2020/01/31/hello-world/#comment-3</a>',
    512512                                                ),
    513513                                        ),
    514514                                ),
    class Tests_Privacy_WpPrivacyGeneratePersonalDataExportFile extends WP_UnitTestC 
    620620                                                ),
    621621                                                array(
    622622                                                        'name'  => 'Comment URL',
    623                                                         'value' => '<a href="http://localhost:8888/46894/2020/01/31/hello-world/#comment-2" target="_blank" rel="noreferrer noopener">http://localhost:8888/46894/2020/01/31/hello-world/#comment-2</a>',
     623                                                        'value' => '<a href="http://localhost:8888/46894/2020/01/31/hello-world/#comment-2" target="_blank" rel="noopener">http://localhost:8888/46894/2020/01/31/hello-world/#comment-2</a>',
    624624                                                ),
    625625                                        ),
    626626                                ),
  • tests/phpunit/tests/rest-api/rest-attachments-controller.php

    diff --git a/tests/phpunit/tests/rest-api/rest-attachments-controller.php b/tests/phpunit/tests/rest-api/rest-attachments-controller.php
    index b4115d41e7..b70663788b 100644
    a b class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control 
    11621162                                                'rendered' => '<a href="#">link</a>',
    11631163                                        ),
    11641164                                        'description' => array(
    1165                                                 'raw'      => '<a href="#" target="_blank" rel="noopener noreferrer">link</a>',
    1166                                                 'rendered' => '<p><a href="#" target="_blank" rel="noopener noreferrer">link</a></p>',
     1165                                                'raw'      => '<a href="#" target="_blank" rel="noopener">link</a>',
     1166                                                'rendered' => '<p><a href="#" target="_blank" rel="noopener">link</a></p>',
    11671167                                        ),
    11681168                                        'caption'     => array(
    1169                                                 'raw'      => '<a href="#" target="_blank" rel="noopener noreferrer">link</a>',
    1170                                                 'rendered' => '<p><a href="#" target="_blank" rel="noopener noreferrer">link</a></p>',
     1169                                                'raw'      => '<a href="#" target="_blank" rel="noopener">link</a>',
     1170                                                'rendered' => '<p><a href="#" target="_blank" rel="noopener">link</a></p>',
    11711171                                        ),
    11721172                                ),
    11731173                        ),
  • tests/phpunit/tests/rest-api/rest-posts-controller.php

    diff --git a/tests/phpunit/tests/rest-api/rest-posts-controller.php b/tests/phpunit/tests/rest-api/rest-posts-controller.php
    index 9831bb0aab..31e9a2788b 100644
    a b class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    36963696                                                'rendered' => '<a href="#">link</a>',
    36973697                                        ),
    36983698                                        'content' => array(
    3699                                                 'raw'      => '<a href="#" target="_blank" rel="noopener noreferrer">link</a>',
    3700                                                 'rendered' => '<p><a href="#" target="_blank" rel="noopener noreferrer">link</a></p>',
     3699                                                'raw'      => '<a href="#" target="_blank" rel="noopener">link</a>',
     3700                                                'rendered' => '<p><a href="#" target="_blank" rel="noopener">link</a></p>',
    37013701                                        ),
    37023702                                        'excerpt' => array(
    3703                                                 'raw'      => '<a href="#" target="_blank" rel="noopener noreferrer">link</a>',
    3704                                                 'rendered' => '<p><a href="#" target="_blank" rel="noopener noreferrer">link</a></p>',
     3703                                                'raw'      => '<a href="#" target="_blank" rel="noopener">link</a>',
     3704                                                'rendered' => '<p><a href="#" target="_blank" rel="noopener">link</a></p>',
    37053705                                        ),
    37063706                                ),
    37073707                        ),
  • tests/phpunit/tests/widgets/custom-html-widget.php

    diff --git a/tests/phpunit/tests/widgets/custom-html-widget.php b/tests/phpunit/tests/widgets/custom-html-widget.php
    index ad6a39b464..6447f5ec2d 100644
    a b class Test_WP_Widget_Custom_HTML extends WP_UnitTestCase { 
    304304        }
    305305
    306306        /**
    307          * Ensure that rel="noopener noreferrer" is added to links with a target.
     307         * Ensure that rel="noopener" is added to links with a target.
    308308         *
    309309         * @ticket 46421
    310310         */
    class Test_WP_Widget_Custom_HTML extends WP_UnitTestCase { 
    326326                );
    327327
    328328                $output = get_echo( array( $widget, 'widget' ), array( $args, $instance ) );
    329                 $this->assertContains( 'rel="noopener noreferrer"', $output );
     329                $this->assertContains( 'rel="noopener"', $output );
    330330        }
    331331
    332332        /**
    333          * Ensure that rel="noopener noreferrer" is not added to links without a target.
     333         * Ensure that rel="noopener" is not added to links without a target.
    334334         *
    335335         * @ticket 46421
    336336         */
    class Test_WP_Widget_Custom_HTML extends WP_UnitTestCase { 
    352352                );
    353353
    354354                $output = get_echo( array( $widget, 'widget' ), array( $args, $instance ) );
    355                 $this->assertNotContains( 'rel="noopener noreferrer"', $output );
     355                $this->assertNotContains( 'rel="noopener"', $output );
    356356        }
    357357
    358358}
  • tests/phpunit/tests/widgets/media-image-widget.php

    diff --git a/tests/phpunit/tests/widgets/media-image-widget.php b/tests/phpunit/tests/widgets/media-image-widget.php
    index fc04e9adcc..64d02803c0 100644
    a b class Test_WP_Widget_Media_Image extends WP_UnitTestCase { 
    542542
    543543                $this->assertContains( '<a href="https://example.org"', $output );
    544544                $this->assertContains( 'target="_blank"', $output );
    545                 $this->assertContains( 'rel="noopener noreferrer"', $output );
     545                $this->assertContains( 'rel="noopener"', $output );
    546546
    547547                // Populate caption in attachment.
    548548                wp_update_post(
  • tests/phpunit/tests/widgets/text-widget.php

    diff --git a/tests/phpunit/tests/widgets/text-widget.php b/tests/phpunit/tests/widgets/text-widget.php
    index 42ca86d709..3e8c7b7d8c 100644
    a b class Test_WP_Widget_Text extends WP_UnitTestCase { 
    10031003        }
    10041004
    10051005        /**
    1006          * Ensure that rel="noopener noreferrer" is added to links with a target.
     1006         * Ensure that rel="noopener" is added to links with a target.
    10071007         *
    10081008         * @ticket 46421
    10091009         */
    class Test_WP_Widget_Text extends WP_UnitTestCase { 
    10261026
    10271027                $output = get_echo( array( $widget, 'widget' ), array( $args, $instance ) );
    10281028
    1029                 $this->assertContains( 'rel="noopener noreferrer"', $output );
     1029                $this->assertContains( 'rel="noopener"', $output );
    10301030        }
    10311031
    10321032        /**
    1033          * Ensure that rel="noopener noreferrer" is not added to links without a target.
     1033         * Ensure that rel="noopener" is not added to links without a target.
    10341034         *
    10351035         * @ticket 46421
    10361036         */
    class Test_WP_Widget_Text extends WP_UnitTestCase { 
    10531053
    10541054                $output = get_echo( array( $widget, 'widget' ), array( $args, $instance ) );
    10551055
    1056                 $this->assertNotContains( 'rel="noopener noreferrer"', $output );
     1056                $this->assertNotContains( 'rel="noopener"', $output );
    10571057        }
    10581058}
  • tests/qunit/index.html

    diff --git a/tests/qunit/index.html b/tests/qunit/index.html
    index f0fb32d49d..fbce482b68 100644
    a b  
    11661166                                                <span class="name">Alternative Text</span>
    11671167                                                <input type="text" value="{{ data.alt }}" aria-describedby="alt-text-description" {{ maybeReadOnly }} />
    11681168                                        </label>
    1169                                         <p class="description" id="alt-text-description"><a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener noreferrer">Describe the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
     1169                                        <p class="description" id="alt-text-description"><a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener">Describe the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
    11701170                                <# } #>
    11711171                                                                <label class="setting" data-setting="title">
    11721172                                        <span class="name">Title</span>
     
    13311331                                <span class="name">Alt Text</span>
    13321332                                <input type="text" value="{{ data.alt }}" aria-describedby="alt-text-description" {{ maybeReadOnly }} />
    13331333                        </label>
    1334                         <p class="description" id="alt-text-description"><a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener noreferrer">Describe the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
     1334                        <p class="description" id="alt-text-description"><a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener">Describe the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
    13351335                <# } #>
    13361336                                <label class="setting" data-setting="title">
    13371337                        <span class="name">Title</span>
     
    16231623                        <span>Alternative Text</span>
    16241624                        <input type="text" data-setting="alt" aria-describedby="alt-text-description" />
    16251625                </label>
    1626                 <p class="description" id="alt-text-description"><a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener noreferrer">Describe the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
     1626                <p class="description" id="alt-text-description"><a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener">Describe the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
    16271627
    16281628                                        <label class="setting caption">
    16291629                                <span>Caption</span>
     
    16781678                                                <span>Alternative Text</span>
    16791679                                                <input type="text" data-setting="alt" value="{{ data.model.alt }}" aria-describedby="alt-text-description" />
    16801680                                        </label>
    1681                                         <p class="description" id="alt-text-description"><a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener noreferrer">Describe the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
     1681                                        <p class="description" id="alt-text-description"><a href="https://www.w3.org/WAI/tutorials/images/decision-tree" target="_blank" rel="noopener">Describe the purpose of the image<span class="screen-reader-text"> (opens in a new tab)</span></a>. Leave empty if the image is purely decorative.</p>
    16821682
    16831683                                                                                        <label class="setting caption">
    16841684                                                        <span>Caption</span>