Diff
Modified: trunk/ChangeLog (122805 => 122806)
--- trunk/ChangeLog 2012-07-17 04:33:25 UTC (rev 122805)
+++ trunk/ChangeLog 2012-07-17 04:37:29 UTC (rev 122806)
@@ -1,3 +1,12 @@
+2012-07-16 Pete Williamson <[email protected]>
+
+ Expose an export for the iconUrl list so Internals can use it
+ https://bugs.webkit.org/show_bug.cgi?id=88665
+
+ Reviewed by Kent Tamura.
+
+ * Source/autotools/symbols.filter: export iconURLs
+
2012-07-16 Hajime Morrita <[email protected]>
WebCore needs WEBCORE_TESTING macro to mark methods being exported for testing.
Modified: trunk/LayoutTests/ChangeLog (122805 => 122806)
--- trunk/LayoutTests/ChangeLog 2012-07-17 04:33:25 UTC (rev 122805)
+++ trunk/LayoutTests/ChangeLog 2012-07-17 04:37:29 UTC (rev 122806)
@@ -1,3 +1,18 @@
+2012-07-16 Pete Williamson <[email protected]>
+
+ Add some new unit tests to test the favicon changing dynamically
+ https://bugs.webkit.org/show_bug.cgi?id=88665
+
+ Reviewed by Kent Tamura.
+
+ * fast/dom/icon-url-change-expected.txt: Added.
+ * fast/dom/icon-url-change.html: Added a new test for changing the favicon dynamically
+ * fast/dom/icon-url-list-expected.txt: Added.
+ * fast/dom/icon-url-list.html: Added a new test for multiple favicons in the HTML header
+ * fast/dom/icon-url-property-expected.txt: update unit test expectations
+ * fast/dom/icon-url-property.html: update and enable existing favicon test
+ * platform/chromium/TestExpectations: reenable the url-property test
+
2012-07-16 Kiran Muppala <[email protected]>
REGRESSION: RenderInline::absoluteQuads produces incorrect results for fixed position.
Added: trunk/LayoutTests/fast/dom/icon-url-change-expected.txt (0 => 122806)
--- trunk/LayoutTests/fast/dom/icon-url-change-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/icon-url-change-expected.txt 2012-07-17 04:37:29 UTC (rev 122806)
@@ -0,0 +1,7 @@
+Original iconURL is: http://test.com/oldfavicon.ico
+Setting new icon URL to: http://test.com/newfavicon.ico
+New iconURL is: http://test.com/newfavicon.ico
+Setting icon URL back to: http://test.com/oldfavicon.ico
+Original iconURL is still: http://test.com/oldfavicon.ico
+PASS URL list matches expected
+
Added: trunk/LayoutTests/fast/dom/icon-url-change.html (0 => 122806)
--- trunk/LayoutTests/fast/dom/icon-url-change.html (rev 0)
+++ trunk/LayoutTests/fast/dom/icon-url-change.html 2012-07-17 04:37:29 UTC (rev 122806)
@@ -0,0 +1,60 @@
+<html>
+<head>
+<title>Original Title</title>
+<link rel="shortcut icon" type="image/x-icon" href=""
+<script src=""
+<script>
+
+function setFavIcon(iconURL) {
+ var docHead = document.getElementsByTagName("head")[0];
+ var links = docHead.getElementsByTagName("link");
+ for (var i = 0; i < links.length; ++i) {
+ var link = links[i];
+ if (link.type=="image/x-icon" && link.rel=="shortcut icon") {
+ docHead.removeChild(link);
+ break; // Assuming only one match at most.
+ }
+ }
+ var link = document.createElement("link");
+ link.type = "image/x-icon";
+ link.rel = "shortcut icon";
+ link.href = ""
+ docHead.appendChild(link);
+}
+
+function runTests() {
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ iconURL = document.getElementsByTagName("head")[0].getElementsByTagName("link")[0].href;
+ debug('Original iconURL is: ' + iconURL);
+
+ // change icon to new icon
+ newURL = 'http://test.com/newfavicon.ico';
+ debug('Setting new icon URL to: ' + newURL);
+ setFavIcon(newURL);
+ iconURL = document.getElementsByTagName("link")[0].href;
+ debug('New iconURL is: ' + iconURL);
+
+ // change icon back to old icon and ensure it changes properly
+ oldURL = 'http://test.com/oldfavicon.ico';
+ debug('Setting icon URL back to: ' + oldURL);
+ setFavIcon(oldURL);
+ iconURL = document.getElementsByTagName("link")[0].href;
+ debug('Original iconURL is still: ' + iconURL);
+
+ // check that the URL list in the document is as we expect
+ var expectedURLs = "http://test.com/oldfavicon.ico";
+ var iconURLs = window.internals.iconURLs(document);
+ if (expectedURLs == iconURLs[0])
+ testPassed('URL list matches expected');
+ else
+ testFailed('URL list does not match expected');
+}
+
+</script>
+</head>
+<body _onload_='runTests();'>
+</div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/dom/icon-url-list-expected.txt (0 => 122806)
--- trunk/LayoutTests/fast/dom/icon-url-list-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/icon-url-list-expected.txt 2012-07-17 04:37:29 UTC (rev 122806)
@@ -0,0 +1,5 @@
+Original iconURL is: http://test.com/oldfavicon.ico
+Setting new icon URL to: http://test.com/newfavicon.ico
+New iconURL is: http://test.com/newfavicon.ico
+PASS URL list matches expected
+
Added: trunk/LayoutTests/fast/dom/icon-url-list.html (0 => 122806)
--- trunk/LayoutTests/fast/dom/icon-url-list.html (rev 0)
+++ trunk/LayoutTests/fast/dom/icon-url-list.html 2012-07-17 04:37:29 UTC (rev 122806)
@@ -0,0 +1,63 @@
+<html>
+<head>
+<title>Original Title</title>
+<link rel="shortcut icon" type="image/x-icon" href=""
+<link rel="shortcut icon" type="image/x-icon" href=""
+<link rel="shortcut icon" type="image/x-icon" href=""
+<script src=""
+<script>
+
+function setFavIcon(iconURL) {
+ var docHead = document.getElementsByTagName("head")[0];
+
+ // set up a new node for the new iconURL
+ var newLink = document.createElement("link");
+ newLink.type = "image/x-icon";
+ newLink.rel = "shortcut icon";
+ newLink.href = ""
+
+ var links = docHead.getElementsByTagName("link");
+ for (var i = 0; i < links.length; ++i) {
+ var oldLink = links[i];
+ if (oldLink.type=="image/x-icon" && oldLink.rel=="shortcut icon") {
+ // if we find the child, replace it with the new node.
+ docHead.replaceChild(newLink, oldLink);
+ return; // Assuming only one match at most.
+ }
+ }
+
+ // if we didn't find the icon URL link, add it now.
+ docHead.appendChild(newLink);
+}
+
+function runTests() {
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ iconURL = document.getElementsByTagName("link")[0].href;
+ debug('Original iconURL is: ' + iconURL);
+
+ // change icon to new icon
+ newURL = 'http://test.com/newfavicon.ico';
+ debug('Setting new icon URL to: ' + newURL);
+ setFavIcon(newURL);
+ iconURL = document.getElementsByTagName("link")[0].href
+ debug('New iconURL is: ' + iconURL);
+
+ // check that the URL list in the document is as we expect
+ var expectedURL0 = "http://test.com/barfavicon.ico";
+ var expectedURL1 = "http://test.com/foofavicon.ico";
+ var expectedURL2 = "http://test.com/newfavicon.ico";
+ var iconURLs = window.internals.iconURLs(document);
+ if (expectedURL0 == iconURLs[0] && expectedURL1 == iconURLs[1] && expectedURL2 == iconURLs[2])
+ testPassed('URL list matches expected');
+ else
+ testFailed('URL list does not match expected');
+}
+
+</script>
+</head>
+<body _onload_='runTests();'>
+</div>
+</body>
+</html>
Modified: trunk/LayoutTests/fast/dom/icon-url-property-expected.txt (122805 => 122806)
--- trunk/LayoutTests/fast/dom/icon-url-property-expected.txt 2012-07-17 04:33:25 UTC (rev 122805)
+++ trunk/LayoutTests/fast/dom/icon-url-property-expected.txt 2012-07-17 04:37:29 UTC (rev 122806)
@@ -1,4 +1,4 @@
-main frame - didChangeIcons
Original iconURL is: http://test.com/oldfavicon.ico
-Setting new icon URL to: http://test.com/newfavion.ico
-New iconURL is: http://test.com/newfavion.ico
+Setting new icon URL to: http://test.com/newfavicon.ico
+New iconURL is: http://test.com/newfavicon.ico
+PASS - URL list matches expected
Modified: trunk/LayoutTests/fast/dom/icon-url-property.html (122805 => 122806)
--- trunk/LayoutTests/fast/dom/icon-url-property.html 2012-07-17 04:33:25 UTC (rev 122805)
+++ trunk/LayoutTests/fast/dom/icon-url-property.html 2012-07-17 04:37:29 UTC (rev 122806)
@@ -29,18 +29,26 @@
}
function runTests() {
- if (window.testRunner) {
+ if (window.testRunner)
testRunner.dumpAsText();
- testRunner.dumpIconChanges();
- }
+
iconURL = document.getElementsByTagName("head")[0].getElementsByTagName("link")[0].href;
debugOutput ('Original iconURL is: ' + iconURL);
- newURL = 'http://test.com/newfavion.ico';
+ newURL = 'http://test.com/newfavicon.ico';
debugOutput ('Setting new icon URL to: ' + newURL);
setFavIcon(newURL);
iconURL = document.getElementsByTagName("head")[0].getElementsByTagName("link")[0].href;
debugOutput ('New iconURL is: ' + iconURL);
+
+ // check that the URL list in the document is as we expect
+ var expectedURLs = "http://test.com/newfavicon.ico";
+ var iconURLs = window.internals.iconURLs(document);
+ if (expectedURLs == iconURLs[0])
+ debugOutput('PASS - URL list matches expected');
+ else
+ debugOutput('FAIL - URL list does not match expected');
+
}
</script>
Modified: trunk/LayoutTests/platform/chromium/TestExpectations (122805 => 122806)
--- trunk/LayoutTests/platform/chromium/TestExpectations 2012-07-17 04:33:25 UTC (rev 122805)
+++ trunk/LayoutTests/platform/chromium/TestExpectations 2012-07-17 04:37:29 UTC (rev 122806)
@@ -1874,8 +1874,6 @@
// // Started failing at r58152
// BUGWK38038 : fast/url/file-http-base.html = TEXT
-BUGWK33812 SKIP : fast/dom/icon-url-property.html = PASS
-
// New layoutTestController function added at r57993
BUGCR42696 : http/tests/xmlhttprequest/cross-origin-authorization-with-embedder.html = TIMEOUT
Modified: trunk/Source/WebCore/ChangeLog (122805 => 122806)
--- trunk/Source/WebCore/ChangeLog 2012-07-17 04:33:25 UTC (rev 122805)
+++ trunk/Source/WebCore/ChangeLog 2012-07-17 04:37:29 UTC (rev 122806)
@@ -1,3 +1,38 @@
+2012-07-16 Pete Williamson <[email protected]>
+
+ Changed the behavior of iconURLs to always recalculate the list.
+ https://bugs.webkit.org/show_bug.cgi?id=88665
+
+ Reviewed by Kent Tamura.
+
+ As it turns out, it can contain stale URLs in the case that some script
+ manipulates the DOM, which breaks scripts trying to reset the favicon
+ URL. Also added a method in Internals to allow tests to get the list of
+ icon
+
+ Tests: fast/dom/icon-url-change.html
+ fast/dom/icon-url-list.html
+
+ * WebCore.exp.in: export Document::iconURLs on the mac for the Internals class
+ * dom/Document.cpp:
+ (WebCore::Document::iconURLs): Changed the method to recalculate the iconURL list every time
+ (WebCore::Document::addIconURL): we no longer need to add to the internal list since we recalculate it
+ (WebCore::Document::setUseSecureKeyboardEntryWhenActive): removed extra whitespace
+ * dom/Document.h:
+ (Document): removed the addIconURL method which is no longer used
+ * html/HTMLLinkElement.cpp:
+ (WebCore::HTMLLinkElement::iconType): exposed the icon type with an accessor
+ (WebCore):
+ (WebCore::HTMLLinkElement::iconSizes): exposed the icon sizes with an accessor
+ * html/HTMLLinkElement.h:
+ (HTMLLinkElement): declared the icon type and size accessors
+ * testing/Internals.cpp:
+ (WebCore::Internals::iconURLs): made a method to be used by unit tests for inspecting the icon URL list
+ (WebCore):
+ * testing/Internals.h:
+ (Internals): declared the method for unit testing the icon URL list
+ * testing/Internals.idl: exported the Document::iconURLs function
+
2012-07-16 Hajime Morrita <[email protected]>
WebCore needs WEBCORE_TESTING macro to mark methods being exported for testing.
Modified: trunk/Source/WebCore/WebCore.exp.in (122805 => 122806)
--- trunk/Source/WebCore/WebCore.exp.in 2012-07-17 04:33:25 UTC (rev 122805)
+++ trunk/Source/WebCore/WebCore.exp.in 2012-07-17 04:37:29 UTC (rev 122806)
@@ -834,6 +834,7 @@
__ZN7WebCore8Document27removeMediaCanStartListenerEPNS_21MediaCanStartListenerE
__ZN7WebCore8Document36updateLayoutIgnorePendingStylesheetsEv
__ZN7WebCore8Document4headEv
+__ZN7WebCore8Document8iconURLsEv
__ZN7WebCore8FormData6createEPKvm
__ZN7WebCore8FormDataD1Ev
__ZN7WebCore8Gradient12addColorStopEfRKNS_5ColorE
Modified: trunk/Source/WebCore/dom/Document.cpp (122805 => 122806)
--- trunk/Source/WebCore/dom/Document.cpp 2012-07-17 04:33:25 UTC (rev 122805)
+++ trunk/Source/WebCore/dom/Document.cpp 2012-07-17 04:37:29 UTC (rev 122806)
@@ -4894,8 +4894,31 @@
return m_xpathEvaluator->evaluate(_expression_, contextNode, resolver, type, result, ec);
}
-const Vector<IconURL>& Document::iconURLs() const
+const Vector<IconURL>& Document::iconURLs()
{
+ m_iconURLs.clear();
+
+ if (!head() || !(head()->children()))
+ return m_iconURLs;
+
+ // Include any icons where type = link, rel = "shortcut icon".
+ RefPtr<HTMLCollection> children = head()->children();
+ unsigned int length = children->length();
+ for (unsigned int i = 0; i < length; ++i) {
+ Node* child = children->item(i);
+ if (!child->hasTagName(linkTag))
+ continue;
+ HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(child);
+ if (linkElement->iconType() != Favicon)
+ continue;
+ if (linkElement->href().isEmpty())
+ continue;
+
+ // Put it at the front to ensure that icons seen later take precedence as required by the spec.
+ IconURL newURL(linkElement->href(), linkElement->iconSizes(), linkElement->type(), linkElement->iconType());
+ m_iconURLs.prepend(newURL);
+ }
+
return m_iconURLs;
}
@@ -4906,7 +4929,6 @@
// FIXME - <rdar://problem/4727645> - At some point in the future, we might actually honor the "mimeType"
IconURL newURL(KURL(ParsedURLString, url), sizes, mimeType, iconType);
- m_iconURLs.append(newURL);
if (Frame* f = frame()) {
IconURL iconURL = f->loader()->icon()->iconURL(iconType);
@@ -4919,7 +4941,7 @@
{
if (m_useSecureKeyboardEntryWhenActive == usesSecureKeyboard)
return;
-
+
m_useSecureKeyboardEntryWhenActive = usesSecureKeyboard;
m_frame->selection()->updateSecureKeyboardEntryIfActive();
}
Modified: trunk/Source/WebCore/dom/Document.h (122805 => 122806)
--- trunk/Source/WebCore/dom/Document.h 2012-07-17 04:33:25 UTC (rev 122805)
+++ trunk/Source/WebCore/dom/Document.h 2012-07-17 04:37:29 UTC (rev 122806)
@@ -952,7 +952,7 @@
void setHasNodesWithPlaceholderStyle() { m_hasNodesWithPlaceholderStyle = true; }
- const Vector<IconURL>& iconURLs() const;
+ const Vector<IconURL>& iconURLs();
void addIconURL(const String& url, const String& mimeType, const String& size, IconType);
void setUseSecureKeyboardEntryWhenActive(bool);
Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (122805 => 122806)
--- trunk/Source/WebCore/html/HTMLLinkElement.cpp 2012-07-17 04:33:25 UTC (rev 122805)
+++ trunk/Source/WebCore/html/HTMLLinkElement.cpp 2012-07-17 04:37:29 UTC (rev 122806)
@@ -418,6 +418,16 @@
return getAttribute(typeAttr);
}
+IconType HTMLLinkElement::iconType() const
+{
+ return m_relAttribute.m_iconType;
+}
+
+String HTMLLinkElement::iconSizes() const
+{
+ return m_sizes->toString();
+}
+
void HTMLLinkElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
{
HTMLElement::addSubresourceAttributeURLs(urls);
Modified: trunk/Source/WebCore/html/HTMLLinkElement.h (122805 => 122806)
--- trunk/Source/WebCore/html/HTMLLinkElement.h 2012-07-17 04:33:25 UTC (rev 122805)
+++ trunk/Source/WebCore/html/HTMLLinkElement.h 2012-07-17 04:37:29 UTC (rev 122806)
@@ -55,6 +55,11 @@
String type() const;
+ IconType iconType() const;
+
+ // the icon size string as parsed from the HTML attribute
+ String iconSizes() const;
+
CSSStyleSheet* sheet() const { return m_sheet.get(); }
bool styleSheetIsLoading() const;
Modified: trunk/Source/WebCore/testing/Internals.cpp (122805 => 122806)
--- trunk/Source/WebCore/testing/Internals.cpp 2012-07-17 04:33:25 UTC (rev 122805)
+++ trunk/Source/WebCore/testing/Internals.cpp 2012-07-17 04:37:29 UTC (rev 122806)
@@ -1076,6 +1076,18 @@
return counterValueForElement(element);
}
+PassRefPtr<DOMStringList> Internals::iconURLs(Document* document) const
+{
+ Vector<IconURL> iconURLs = document->iconURLs();
+ RefPtr<DOMStringList> stringList = DOMStringList::create();
+
+ Vector<IconURL>::const_iterator iter(iconURLs.begin());
+ for (; iter != iconURLs.end(); ++iter)
+ stringList->append(iter->m_iconURL.string());
+
+ return stringList.release();
+}
+
#if ENABLE(FULLSCREEN_API)
void Internals::webkitWillEnterFullScreenForElement(Document* document, Element* element)
{
Modified: trunk/Source/WebCore/testing/Internals.h (122805 => 122806)
--- trunk/Source/WebCore/testing/Internals.h 2012-07-17 04:33:25 UTC (rev 122805)
+++ trunk/Source/WebCore/testing/Internals.h 2012-07-17 04:37:29 UTC (rev 122806)
@@ -185,6 +185,7 @@
#endif
String counterValue(Element*);
+ PassRefPtr<DOMStringList> iconURLs(Document*) const;
#if ENABLE(FULLSCREEN_API)
void webkitWillEnterFullScreenForElement(Document*, Element*);
Modified: trunk/Source/WebCore/testing/Internals.idl (122805 => 122806)
--- trunk/Source/WebCore/testing/Internals.idl 2012-07-17 04:33:25 UTC (rev 122805)
+++ trunk/Source/WebCore/testing/Internals.idl 2012-07-17 04:37:29 UTC (rev 122806)
@@ -165,6 +165,7 @@
[Conditional=INSPECTOR] sequence<String> consoleMessageArgumentCounts(in Document document);
DOMString counterValue(in Element element);
+ DOMString[] iconURLs(in Document document);
#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API
void webkitWillEnterFullScreenForElement(in Document document, in Element element);
Modified: trunk/Source/WebKit2/ChangeLog (122805 => 122806)
--- trunk/Source/WebKit2/ChangeLog 2012-07-17 04:33:25 UTC (rev 122805)
+++ trunk/Source/WebKit2/ChangeLog 2012-07-17 04:37:29 UTC (rev 122806)
@@ -1,3 +1,12 @@
+2012-07-16 Pete Williamson <[email protected]>
+
+ Export the iconURL list to make it available to the Internals class for testing
+ https://bugs.webkit.org/show_bug.cgi?id=88665
+
+ Reviewed by Kent Tamura.
+
+ * win/WebKit2.def: export the DocumentL::iconURLs function
+
2012-07-16 Hajime Morrita <[email protected]>
WebCore needs WEBCORE_TESTING macro to mark methods being exported for testing.
Modified: trunk/Source/WebKit2/win/WebKit2.def (122805 => 122806)
--- trunk/Source/WebKit2/win/WebKit2.def 2012-07-17 04:33:25 UTC (rev 122805)
+++ trunk/Source/WebKit2/win/WebKit2.def 2012-07-17 04:37:29 UTC (rev 122806)
@@ -273,3 +273,4 @@
?jsStringSlowCase@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@AAV?$HashMap@PAVStringImpl@WTF@@V?$Weak@VJSString@JSC@@@JSC@@U?$PtrHash@PAVStringImpl@WTF@@@2@U?$HashTraits@PAVStringImpl@WTF@@@2@U?$HashTraits@V?$Weak@VJSString@JSC@@@JSC@@@2@@WTF@@PAVStringImpl@6@@Z
?registerURLSchemeAsBypassingContentSecurityPolicy@SchemeRegistry@WebCore@@SAXABVString@WTF@@@Z
?removeURLSchemeRegisteredAsBypassingContentSecurityPolicy@SchemeRegistry@WebCore@@SAXABVString@WTF@@@Z
+ ?iconURLs@Document@WebCore@@QAEABV?$Vector@UIconURL@WebCore@@$0A@@WTF@@XZ
\ No newline at end of file
Modified: trunk/Source/autotools/symbols.filter (122805 => 122806)
--- trunk/Source/autotools/symbols.filter 2012-07-17 04:33:25 UTC (rev 122805)
+++ trunk/Source/autotools/symbols.filter 2012-07-17 04:37:29 UTC (rev 122806)
@@ -37,6 +37,7 @@
_ZN7WebCore5Range6createEN3WTF10PassRefPtrINS_8DocumentEEENS2_INS_4NodeEEEiS6_i;
_ZN7WebCore5RangeD1Ev;
_ZN7WebCore8Document36updateLayoutIgnorePendingStylesheetsEv;
+_ZN7WebCore8Document8iconURLsEv;
_ZN7WebCore9HTMLNames8inputTagE;
_ZN7WebCore9HTMLNames11textareaTagE;
_ZN7WebCore10JSDocument10putVirtualEPN3JSC9ExecStateERKNS1_10IdentifierENS1_7JSValueERNS1_15PutPropertySlotE;