Changeset 53904
- Timestamp:
- 08/18/2022 08:43:19 AM (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/general-template.php
r53888 r53904 3318 3318 ); 3319 3319 3320 /*3321 * Add DNS prefetch for the Emoji CDN.3322 * The path is removed in the foreach loop below.3323 */3324 /** This filter is documented in wp-includes/formatting.php */3325 $hints['dns-prefetch'][] = apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/13.0.0/svg/' );3326 3327 3320 foreach ( $hints as $relation_type => $urls ) { 3328 3321 $unique_urls = array(); -
trunk/tests/phpunit/tests/general/wpResourceHints.php
r52010 r53904 31 31 } 32 32 33 public function test_should_have_defaults_on_frontend() {34 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n";35 36 $this->expectOutputString( $expected );37 38 wp_resource_hints();39 }40 41 33 public function test_dns_prefetching() { 42 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" . 43 "<link rel='dns-prefetch' href='//wordpress.org' />\n" . 34 $expected = "<link rel='dns-prefetch' href='//wordpress.org' />\n" . 44 35 "<link rel='dns-prefetch' href='//google.com' />\n" . 45 36 "<link rel='dns-prefetch' href='//make.wordpress.org' />\n"; … … 71 62 */ 72 63 public function test_preconnect() { 73 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" . 74 "<link rel='preconnect' href='//wordpress.org' />\n" . 64 $expected = "<link rel='preconnect' href='//wordpress.org' />\n" . 75 65 "<link rel='preconnect' href='https://make.wordpress.org' />\n" . 76 66 "<link rel='preconnect' href='http://google.com' />\n" . … … 99 89 100 90 public function test_prerender() { 101 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" . 102 "<link rel='prerender' href='https://make.wordpress.org/great-again' />\n" . 91 $expected = "<link rel='prerender' href='https://make.wordpress.org/great-again' />\n" . 103 92 "<link rel='prerender' href='http://jobs.wordpress.net' />\n" . 104 93 "<link rel='prerender' href='//core.trac.wordpress.org' />\n"; … … 125 114 126 115 public function test_parse_url_dns_prefetch() { 127 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" . 128 "<link rel='dns-prefetch' href='//make.wordpress.org' />\n"; 116 $expected = "<link rel='dns-prefetch' href='//make.wordpress.org' />\n"; 129 117 130 118 add_filter( 'wp_resource_hints', array( $this, 'add_dns_prefetch_long_urls' ), 10, 2 ); … … 146 134 147 135 public function test_dns_prefetch_styles() { 148 $expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com' />\n" . 149 "<link rel='dns-prefetch' href='//s.w.org' />\n"; 136 $expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com' />\n"; 150 137 151 138 $args = array( … … 165 152 166 153 public function test_dns_prefetch_scripts() { 167 $expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com' />\n" . 168 "<link rel='dns-prefetch' href='//s.w.org' />\n"; 154 $expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com' />\n"; 169 155 170 156 $args = array( … … 186 172 */ 187 173 public function test_dns_prefetch_scripts_does_not_include_registered_only() { 188 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n";174 $expected = ''; 189 175 $unexpected = "<link rel='dns-prefetch' href='//wordpress.org' />\n"; 190 176 … … 203 189 */ 204 190 public function test_deregistered_scripts_are_ignored() { 205 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n";191 $expected = ''; 206 192 207 193 wp_enqueue_script( 'test-script', 'http://example.org/script.js' ); … … 216 202 */ 217 203 public function test_malformed_urls() { 218 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n";204 $expected = ''; 219 205 220 206 // Errant colon. … … 251 237 */ 252 238 public function test_custom_attributes() { 253 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" . 254 "<link rel='preconnect' href='https://make.wordpress.org' />\n" . 239 $expected = "<link rel='preconnect' href='https://make.wordpress.org' />\n" . 255 240 "<link crossorigin as='image' pr='0.5' href='https://example.com/foo.jpeg' rel='prefetch' />\n" . 256 241 "<link crossorigin='use-credentials' as='style' href='https://example.com/foo.css' rel='prefetch' />\n" .
Note: See TracChangeset
for help on using the changeset viewer.