Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#38377 closed defect (bug) (fixed)

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

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

Description

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 10 years ago.
demo.png​ (244.8 KB ) - added by westonruter 10 years ago.
38377.1.diff​ (5.7 KB ) - added by westonruter 10 years ago.
​https://github.com/xwp/wordpress-develop/pull/183

Download all attachments as: .zip

Change History (7)

#1 @westonruter
10 years ago

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

#2 @swissspidy
10 years ago

  • Keywords needs-unit-tests added

#3 @westonruter
10 years ago

  • Keywords needs-unit-tests removed

#4 @westonruter
10 years ago

  • Resolution → fixed
  • Status accepted → 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.