Changeset 31458 in webkit


Ignore:
Timestamp:
Mar 31, 2008 9:52:09 AM (16 years ago)
Author:
Adam Roben
Message:

Fix Bug 18214: WebKit will sometimes load duplicate plugins

<http://bugs.webkit.org/show_bug.cgi?id=18214>

We now compare 3 things to determine if two PluginPackages are equal:

1) Name
2) Description
3) Supported MIME types

This matches Gecko's equality logic for plugins (implemented in
nsPluginTag::Equals).

Reviewed by Darin Adler.

  • plugins/win/PluginPackageWin.cpp: (WebCore::PluginPackage::hash): Use the above-mentioned 3 criteria to calculate the hash. (WebCore::PluginPackage::equal): Use the above-mentioned 3 criteria to determine equality.
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r31457 r31458  
     12008-03-29  Adam Roben  <aroben@apple.com>
     2
     3        Fix Bug 18214: WebKit will sometimes load duplicate plugins
     4
     5        <http://bugs.webkit.org/show_bug.cgi?id=18214>
     6
     7        We now compare 3 things to determine if two PluginPackages are equal:
     8          1) Name
     9          2) Description
     10          3) Supported MIME types
     11
     12        This matches Gecko's equality logic for plugins (implemented in
     13        nsPluginTag::Equals).
     14
     15        Reviewed by Darin Adler.
     16
     17        * plugins/win/PluginPackageWin.cpp:
     18        (WebCore::PluginPackage::hash): Use the above-mentioned 3 criteria to
     19        calculate the hash.
     20        (WebCore::PluginPackage::equal): Use the above-mentioned 3 criteria to
     21        determine equality.
     22
    1232008-03-31  Simon Hausmann  <hausmann@webkit.org>
    224
  • trunk/WebCore/plugins/win/PluginPackageWin.cpp

    r30698 r31458  
    361361unsigned PluginPackage::hash() const
    362362{
    363     const unsigned hashCodes[3] = {
     363    const unsigned hashCodes[] = {
     364        m_name.impl()->hash(),
    364365        m_description.impl()->hash(),
    365         m_lastModified.dwLowDateTime,
    366         m_lastModified.dwHighDateTime
     366        m_mimeToExtensions.size()
    367367    };
    368368
    369     return StringImpl::computeHash(reinterpret_cast<const UChar*>(hashCodes), 3 * sizeof(unsigned) / sizeof(UChar));
     369    return StringImpl::computeHash(reinterpret_cast<const UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar));
    370370}
    371371
    372372bool PluginPackage::equal(const PluginPackage& a, const PluginPackage& b)
    373373{
    374     return a.m_description == b.m_description && (CompareFileTime(&a.m_lastModified, &b.m_lastModified) == 0);
    375 }
    376 
    377 }
     374    if (a.m_name != b.m_name)
     375        return false;
     376
     377    if (a.m_description != b.m_description)
     378        return false;
     379
     380    if (a.m_mimeToExtensions.size() != b.m_mimeToExtensions.size())
     381        return false;
     382
     383    MIMEToExtensionsMap::const_iterator::Keys end = a.m_mimeToExtensions.end().keys();
     384    for (MIMEToExtensionsMap::const_iterator::Keys it = a.m_mimeToExtensions.begin().keys(); it != end; ++it) {
     385        if (!b.m_mimeToExtensions.contains(*it))
     386            return false;
     387    }
     388
     389    return true;
     390}
     391
     392}
Note: See TracChangeset for help on using the changeset viewer.