Changeset 183015 in webkit
- Timestamp:
- Apr 20, 2015 9:49:43 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r183014 r183015 1 2015-04-20 Per Arne Vollan <peavo@outlook.com> 2 3 Favicons are not always loaded. 4 https://bugs.webkit.org/show_bug.cgi?id=143880 5 6 Reviewed by Darin Adler. 7 8 Added new test for icon link elements without mime type. 9 10 * fast/dom/icon-url-without-mimetype-expected.txt: Added. 11 * fast/dom/icon-url-without-mimetype.html: Added. 12 1 13 2015-04-20 Alexey Proskuryakov <ap@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r183012 r183015 1 2015-04-20 Per Arne Vollan <peavo@outlook.com> 2 3 Favicons are not always loaded. 4 https://bugs.webkit.org/show_bug.cgi?id=143880 5 6 Reviewed by Darin Adler. 7 8 If the favicon link element(s) in the document does not have a mime type, 9 the favicon is loaded from the domain root (/favicon.ico). If no favicon 10 exists at this location, the favicon loading will fail. This can be solved 11 by not demanding that the link element has a mime type. 12 13 Test: fast/dom/icon-url-without-mimetype.html 14 15 * loader/icon/IconController.cpp: 16 (WebCore::iconFromLinkElements): Return the chosen icon URL instead of a vector of URLs. 17 (WebCore::IconController::url): 18 (WebCore::iconsFromLinkElements): Deleted. 19 1 20 2015-04-20 Martin Robinson <mrobinson@igalia.com> 2 21 -
trunk/Source/WebCore/loader/icon/IconController.cpp
r182352 r183015 53 53 namespace WebCore { 54 54 55 enum class LinkElementSelector { All, WithMIMEType };56 57 55 IconController::IconController(Frame& frame) 58 56 : m_frame(frame) … … 64 62 } 65 63 66 // FIXME: Given how this is used, there's no real need to use a vector here. 67 // Should straighten this out and tighten up the code. 68 static Vector<URL> iconsFromLinkElements(Frame& frame, LinkElementSelector selector) 69 { 70 Vector<URL> result; 64 static URL iconFromLinkElements(Frame& frame) 65 { 66 // This function returns the first icon with a mime type. 67 // If no icon with mime type exists, the last icon is returned. 68 // It may make more sense to always return the last icon, 69 // but this implementation is consistent with previous behavior. 70 71 URL result; 71 72 72 73 auto* document = frame.document(); … … 83 84 if (linkElement.href().isEmpty()) 84 85 continue; 85 if (selector == LinkElementSelector::WithMIMEType && linkElement.type().isEmpty()) 86 continue; 87 result.append(linkElement.href()); 88 } 89 90 // Put last icon seen at the front. This helps us implement a rule that says that icons seen later should take precedence. 91 result.reverse(); 86 result = linkElement.href(); 87 if (!linkElement.type().isEmpty()) 88 break; 89 } 92 90 93 91 return result; … … 99 97 return URL(); 100 98 101 // FIXME: This implements a rule that says "first icon seen with a MIME type wins". 102 // But that is not consistent with the comment in iconsFromLinkElements that says 103 // that icons seen *later* should take precedence. 104 URL icon; 105 for (auto& candidate : iconsFromLinkElements(m_frame, LinkElementSelector::WithMIMEType)) 106 icon = candidate; 99 auto icon = iconFromLinkElements(m_frame); 107 100 if (!icon.isEmpty()) 108 101 return icon; … … 116 109 return icon; 117 110 } 118 119 for (auto& candidate : iconsFromLinkElements(m_frame, LinkElementSelector::All))120 return candidate;121 111 122 112 return URL();
Note: See TracChangeset
for help on using the changeset viewer.