Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#38377 closed defect (bug) (fixed)

Empty favicons cause extra HTTP requests to customizer when history.replaceState() used

Reported by: westonruter's profile westonruter Owned by: westonruter's profile westonruter
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.3
Component: Customize Keywords: has-patch
Focuses: Cc:


In Chrome, at least, when sing history.replaceState() an HTTP request to fetch the favicon is made, of some reason. When there is no site icon specified in WP, then wp_site_icon() outputs the link tags but with empty href. Since an empty href resolves to the current URL, this means in the customizer every time history.replaceState() is called an HTTP request is made back to fetch customize.php over and over again. This will slam the server in the case of #28536 where replaceState is used to update the URL to match the previewed URL and the focused panel/section/control.

Attachments (3)

38377.0.diff (2.7 KB) - added by westonruter 7 years ago.
demo.png (244.8 KB) - added by westonruter 7 years ago.
38377.1.diff (5.7 KB) - added by westonruter 7 years ago.

Download all attachments as: .zip

Change History (7)

7 years ago

7 years ago

#1 @westonruter
7 years ago

  • Keywords has-patch added
  • Owner set to westonruter
  • Status changed from new to accepted

#2 @swissspidy
7 years ago

  • Keywords needs-unit-tests added

#3 @westonruter
7 years ago

  • Keywords needs-unit-tests removed

#4 @westonruter
7 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 38901:

Customize: Prevent absent site icon link from outputting an empty string as href in customizer; use /favicon.ico as fallback.

An empty string causes some browsers to use the current URL as the href. When using history.replaceState() Chrome will re-fetch the favicon with each call, meaning that customize.php gets hit with wasted requests which tax the server.

Fixes #38377.

Note: See TracTickets for help on using tickets.