Changeset 122806 in webkit


Ignore:
Timestamp:
Jul 16, 2012 9:37:29 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

.: Expose an export for the iconUrl list so Internals can use it
https://bugs.webkit.org/show_bug.cgi?id=88665

Patch by Pete Williamson <petewil@google.com> on 2012-07-16
Reviewed by Kent Tamura.

  • Source/autotools/symbols.filter: export iconURLs

Source/WebCore: Changed the behavior of iconURLs to always recalculate the list.
https://bugs.webkit.org/show_bug.cgi?id=88665

Patch by Pete Williamson <petewil@google.com> on 2012-07-16
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

Source/WebKit2: Export the iconURL list to make it available to the Internals class for testing
https://bugs.webkit.org/show_bug.cgi?id=88665

Patch by Pete Williamson <petewil@google.com> on 2012-07-16
Reviewed by Kent Tamura.

  • win/WebKit2.def: export the DocumentL::iconURLs function

LayoutTests: Add some new unit tests to test the favicon changing dynamically
https://bugs.webkit.org/show_bug.cgi?id=88665

Patch by Pete Williamson <petewil@google.com> on 2012-07-16
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
Location:
trunk
Files:
4 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r122805 r122806  
     12012-07-16  Pete Williamson  <petewil@google.com>
     2
     3        Expose an export for the iconUrl list so Internals can use it
     4        https://bugs.webkit.org/show_bug.cgi?id=88665
     5
     6        Reviewed by Kent Tamura.
     7
     8        * Source/autotools/symbols.filter: export iconURLs
     9
    1102012-07-16  Hajime Morrita  <morrita@chromium.org>
    211
  • trunk/LayoutTests/ChangeLog

    r122802 r122806  
     12012-07-16  Pete Williamson  <petewil@google.com>
     2
     3        Add some new unit tests to test the favicon changing dynamically
     4        https://bugs.webkit.org/show_bug.cgi?id=88665
     5
     6        Reviewed by Kent Tamura.
     7
     8        * fast/dom/icon-url-change-expected.txt: Added.
     9        * fast/dom/icon-url-change.html: Added a new test for changing the favicon dynamically
     10        * fast/dom/icon-url-list-expected.txt: Added.
     11        * fast/dom/icon-url-list.html: Added a new test for multiple favicons in the HTML header
     12        * fast/dom/icon-url-property-expected.txt: update unit test expectations
     13        * fast/dom/icon-url-property.html: update and enable existing favicon test
     14        * platform/chromium/TestExpectations: reenable the url-property test
     15
    1162012-07-16  Kiran Muppala  <cmuppala@apple.com>
    217
  • trunk/LayoutTests/fast/dom/icon-url-property-expected.txt

    r122205 r122806  
    1 main frame - didChangeIcons
    21Original iconURL is: http://test.com/oldfavicon.ico
    3 Setting new icon URL to: http://test.com/newfavion.ico
    4 New iconURL is: http://test.com/newfavion.ico
     2Setting new icon URL to: http://test.com/newfavicon.ico
     3New iconURL is: http://test.com/newfavicon.ico
     4PASS - URL list matches expected
  • trunk/LayoutTests/fast/dom/icon-url-property.html

    r122205 r122806  
    3030
    3131function runTests() {
    32     if (window.testRunner) {
     32    if (window.testRunner)
    3333        testRunner.dumpAsText();
    34         testRunner.dumpIconChanges();
    35     }
     34
    3635    iconURL = document.getElementsByTagName("head")[0].getElementsByTagName("link")[0].href;
    3736    debugOutput ('Original iconURL is: ' + iconURL);
    38     newURL = 'http://test.com/newfavion.ico';
     37    newURL = 'http://test.com/newfavicon.ico';
    3938    debugOutput ('Setting new icon URL to: ' + newURL);
    4039    setFavIcon(newURL);
     
    4241
    4342    debugOutput ('New iconURL is: ' + iconURL);
     43
     44    // check that the URL list in the document is as we expect
     45    var expectedURLs = "http://test.com/newfavicon.ico";
     46    var iconURLs = window.internals.iconURLs(document);
     47    if (expectedURLs == iconURLs[0])
     48        debugOutput('PASS - URL list matches expected');
     49    else
     50        debugOutput('FAIL - URL list does not match expected');
     51
    4452}
    4553
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r122778 r122806  
    18751875// BUGWK38038 : fast/url/file-http-base.html = TEXT
    18761876
    1877 BUGWK33812 SKIP : fast/dom/icon-url-property.html = PASS
    1878 
    18791877// New layoutTestController function added at r57993
    18801878BUGCR42696 : http/tests/xmlhttprequest/cross-origin-authorization-with-embedder.html = TIMEOUT
  • trunk/Source/WebCore/ChangeLog

    r122805 r122806  
     12012-07-16  Pete Williamson  <petewil@google.com>
     2
     3        Changed the behavior of iconURLs to always recalculate the list.
     4        https://bugs.webkit.org/show_bug.cgi?id=88665
     5
     6        Reviewed by Kent Tamura.
     7
     8        As it turns out, it can contain stale URLs in the case that some script
     9        manipulates the DOM, which breaks scripts trying to reset the favicon
     10        URL. Also added a method in Internals to allow tests to get the list of
     11        icon
     12
     13        Tests: fast/dom/icon-url-change.html
     14               fast/dom/icon-url-list.html
     15
     16        * WebCore.exp.in: export Document::iconURLs on the mac for the Internals class
     17        * dom/Document.cpp:
     18        (WebCore::Document::iconURLs): Changed the method to recalculate the iconURL list every time
     19        (WebCore::Document::addIconURL): we no longer need to add to the internal list since we recalculate it
     20        (WebCore::Document::setUseSecureKeyboardEntryWhenActive): removed extra whitespace
     21        * dom/Document.h:
     22        (Document): removed the addIconURL method which is no longer used
     23        * html/HTMLLinkElement.cpp:
     24        (WebCore::HTMLLinkElement::iconType): exposed the icon type with an accessor
     25        (WebCore):
     26        (WebCore::HTMLLinkElement::iconSizes): exposed the icon sizes with an accessor
     27        * html/HTMLLinkElement.h:
     28        (HTMLLinkElement): declared the icon type and size accessors
     29        * testing/Internals.cpp:
     30        (WebCore::Internals::iconURLs): made a method to be used by unit tests for inspecting the icon URL list
     31        (WebCore):
     32        * testing/Internals.h:
     33        (Internals): declared the method for unit testing the icon URL list
     34        * testing/Internals.idl: exported the Document::iconURLs function
     35
    1362012-07-16  Hajime Morrita  <morrita@chromium.org>
    237
  • trunk/Source/WebCore/WebCore.exp.in

    r122670 r122806  
    835835__ZN7WebCore8Document36updateLayoutIgnorePendingStylesheetsEv
    836836__ZN7WebCore8Document4headEv
     837__ZN7WebCore8Document8iconURLsEv
    837838__ZN7WebCore8FormData6createEPKvm
    838839__ZN7WebCore8FormDataD1Ev
  • trunk/Source/WebCore/dom/Document.cpp

    r122787 r122806  
    48954895}
    48964896
    4897 const Vector<IconURL>& Document::iconURLs() const
    4898 {
     4897const Vector<IconURL>& Document::iconURLs()
     4898{
     4899    m_iconURLs.clear();
     4900
     4901    if (!head() || !(head()->children()))
     4902        return m_iconURLs;
     4903
     4904    // Include any icons where type = link, rel = "shortcut icon".
     4905    RefPtr<HTMLCollection> children = head()->children();
     4906    unsigned int length = children->length();
     4907    for (unsigned int i = 0; i < length; ++i) {
     4908        Node* child = children->item(i);
     4909        if (!child->hasTagName(linkTag))
     4910            continue;
     4911        HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(child);
     4912        if (linkElement->iconType() != Favicon)
     4913            continue;
     4914        if (linkElement->href().isEmpty())
     4915            continue;
     4916
     4917        // Put it at the front to ensure that icons seen later take precedence as required by the spec.
     4918        IconURL newURL(linkElement->href(), linkElement->iconSizes(), linkElement->type(), linkElement->iconType());
     4919        m_iconURLs.prepend(newURL);
     4920    }
     4921
    48994922    return m_iconURLs;
    49004923}
     
    49074930    // FIXME - <rdar://problem/4727645> - At some point in the future, we might actually honor the "mimeType"
    49084931    IconURL newURL(KURL(ParsedURLString, url), sizes, mimeType, iconType);
    4909     m_iconURLs.append(newURL);
    49104932
    49114933    if (Frame* f = frame()) {
     
    49204942    if (m_useSecureKeyboardEntryWhenActive == usesSecureKeyboard)
    49214943        return;
    4922        
     4944
    49234945    m_useSecureKeyboardEntryWhenActive = usesSecureKeyboard;
    49244946    m_frame->selection()->updateSecureKeyboardEntryIfActive();
  • trunk/Source/WebCore/dom/Document.h

    r122787 r122806  
    953953    void setHasNodesWithPlaceholderStyle() { m_hasNodesWithPlaceholderStyle = true; }
    954954
    955     const Vector<IconURL>& iconURLs() const;
     955    const Vector<IconURL>& iconURLs();
    956956    void addIconURL(const String& url, const String& mimeType, const String& size, IconType);
    957957
  • trunk/Source/WebCore/html/HTMLLinkElement.cpp

    r122205 r122806  
    419419}
    420420
     421IconType HTMLLinkElement::iconType() const
     422{
     423    return m_relAttribute.m_iconType;
     424}
     425
     426String HTMLLinkElement::iconSizes() const
     427{
     428    return m_sizes->toString();
     429}
     430
    421431void HTMLLinkElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
    422432{
  • trunk/Source/WebCore/html/HTMLLinkElement.h

    r122205 r122806  
    5555
    5656    String type() const;
     57
     58    IconType iconType() const;
     59
     60    // the icon size string as parsed from the HTML attribute
     61    String iconSizes() const;
    5762
    5863    CSSStyleSheet* sheet() const { return m_sheet.get(); }
  • trunk/Source/WebCore/testing/Internals.cpp

    r122761 r122806  
    10771077}
    10781078
     1079PassRefPtr<DOMStringList> Internals::iconURLs(Document* document) const
     1080{
     1081    Vector<IconURL> iconURLs = document->iconURLs();
     1082    RefPtr<DOMStringList> stringList = DOMStringList::create();
     1083
     1084    Vector<IconURL>::const_iterator iter(iconURLs.begin());
     1085    for (; iter != iconURLs.end(); ++iter)
     1086        stringList->append(iter->m_iconURL.string());
     1087
     1088    return stringList.release();
     1089}
     1090
    10791091#if ENABLE(FULLSCREEN_API)
    10801092void Internals::webkitWillEnterFullScreenForElement(Document* document, Element* element)
  • trunk/Source/WebCore/testing/Internals.h

    r122761 r122806  
    186186
    187187    String counterValue(Element*);
     188    PassRefPtr<DOMStringList> iconURLs(Document*) const;
    188189
    189190#if ENABLE(FULLSCREEN_API)
  • trunk/Source/WebCore/testing/Internals.idl

    r122761 r122806  
    166166
    167167        DOMString counterValue(in Element element);
     168        DOMString[] iconURLs(in Document document);
    168169
    169170#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API
  • trunk/Source/WebKit2/ChangeLog

    r122805 r122806  
     12012-07-16  Pete Williamson  <petewil@google.com>
     2
     3        Export the iconURL list to make it available to the Internals class for testing
     4        https://bugs.webkit.org/show_bug.cgi?id=88665
     5
     6        Reviewed by Kent Tamura.
     7
     8        * win/WebKit2.def: export the DocumentL::iconURLs function
     9
    1102012-07-16  Hajime Morrita  <morrita@chromium.org>
    211
  • trunk/Source/WebKit2/win/WebKit2.def

    r122805 r122806  
    274274        ?registerURLSchemeAsBypassingContentSecurityPolicy@SchemeRegistry@WebCore@@SAXABVString@WTF@@@Z
    275275        ?removeURLSchemeRegisteredAsBypassingContentSecurityPolicy@SchemeRegistry@WebCore@@SAXABVString@WTF@@@Z
     276        ?iconURLs@Document@WebCore@@QAEABV?$Vector@UIconURL@WebCore@@$0A@@WTF@@XZ
  • trunk/Source/autotools/symbols.filter

    r122805 r122806  
    3838_ZN7WebCore5RangeD1Ev;
    3939_ZN7WebCore8Document36updateLayoutIgnorePendingStylesheetsEv;
     40_ZN7WebCore8Document8iconURLsEv;
    4041_ZN7WebCore9HTMLNames8inputTagE;
    4142_ZN7WebCore9HTMLNames11textareaTagE;
Note: See TracChangeset for help on using the changeset viewer.