Bug 18680

Summary: Favicon won't load when link tag preceded by script tag
Product: WebKit Reporter: Ross Simpson <simpsora>
Component: New BugsAssignee: Brady Eidson <beidson>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac (Intel)   
OS: OS X 10.5   
Attachments:
Description Flags
Simple testcase exhibiting broken favicon none

Description Ross Simpson 2008-04-22 13:24:48 PDT
When referencing a favorite icon (favicon) via a link tag, Webkit doesn't display the icon in the URL bar (or even try to load the icon) when the link tag is preceded by a script tag in the source.  Instead, it reverts to the default behavior of  requesting /favicon.ico.

This only happens when the script tag references an external resource with the href attribute.  If it's a script block with inline script, the problem doesn't occur.  It does not occur when the same script tag appears after the link tag instead of before it.  It also does not occur when preceded by a style tag referencing an external resource.

I've tested on the following platforms; they all exhibit the problem:
OS X 10.4.10 (PPC), Safari 2.0.4 (419.3)
OS X 10.5.2 (Intel), Safari 3.1.1 (5525.18)
OS X 10.5.2 (Intel), Nightly r32364

My test case uses XHTML 1.0 Transitional, whose DTD specifies that the order of elements in the head section does not matter:

(from http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd)
<!ENTITY % head.misc "(script|style|meta|link|object|isindex)*">

<!-- content model is %head.misc; combined with a single
     title and an optional base element in any order -->

<!ELEMENT head (%head.misc;,
     ((title, %head.misc;, (base, %head.misc;)?) |
      (base, %head.misc;, (title, %head.misc;))))>
Comment 1 Ross Simpson 2008-04-22 13:28:18 PDT
Created attachment 20754 [details]
Simple testcase exhibiting broken favicon

Steps to reproduce:
1.  Open favicon_testcase in a affected browser.
2.  Note that no favicon appears in URL bar.
3.  Edit the testcase, remove the script tag, and save.
4.  Refresh the testcase, noting that the favicon now appears in the URL bar.
Comment 2 Mark Rowe (bdash) 2008-04-22 13:47:55 PDT
<rdar://problem/5881376>
Comment 3 Brady Eidson 2008-04-22 13:50:32 PDT
This is in Radar already, as an example of a real-world site
<rdar://problem/5733282> No favicon at washingtonindependent.com
Comment 4 Brady Eidson 2008-04-23 19:06:20 PDT
This was fixed in r32413
Comment 5 Ross Simpson 2008-04-23 19:21:21 PDT
I confirm r32416 fixes both my testcase and my real-world page (and washingtonindependent.com too :))

Thanks.