Changeset 86380 in webkit


Ignore:
Timestamp:
May 12, 2011 2:17:06 PM (13 years ago)
Author:
bweinstein@apple.com
Message:

WebKit2: Implement plugin quirk for Mozilla user agent for older Flash
https://bugs.webkit.org/show_bug.cgi?id=60726
<rdar://problem/8470824>

Reviewed by Adam Roben.

Implement the quirk for versions of Flash before v10 that only request windowless plugins
if we use a Mozilla user agent.

  • Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp:

(WebKit::NetscapePluginModule::determineQuirks): If we have a plugin that handles the

"application/x-shockwave-flash" MIME type with a version less than 10, tell it to use
the Mozilla user agent.

  • Shared/Plugins/PluginQuirks.h:
  • WebProcess/Plugins/Netscape/NetscapePlugin.cpp:

(WebKit::NetscapePlugin::userAgent): Add an early return if the plugin uses the Mozilla user

agent.

  • win/WebKit2.vcproj: Add PluginQuirks.h.
Location:
trunk/Source/WebKit2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r86379 r86380  
     12011-05-12  Brian Weinstein  <bweinstein@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        WebKit2: Implement plugin quirk for Mozilla user agent for older Flash
     6        https://bugs.webkit.org/show_bug.cgi?id=60726
     7        <rdar://problem/8470824>
     8       
     9        Implement the quirk for versions of Flash before v10 that only request windowless plugins
     10        if we use a Mozilla user agent.
     11
     12        * Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp:
     13        (WebKit::NetscapePluginModule::determineQuirks): If we have a plugin that handles the
     14            "application/x-shockwave-flash" MIME type with a version less than 10, tell it to use
     15            the Mozilla user agent.
     16        * Shared/Plugins/PluginQuirks.h:
     17        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
     18        (WebKit::NetscapePlugin::userAgent): Add an early return if the plugin uses the Mozilla user
     19            agent.
     20        * win/WebKit2.vcproj: Add PluginQuirks.h.
     21
    1222011-05-12  Anders Carlsson  <andersca@apple.com>
    223
  • trunk/Source/WebKit2/Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp

    r77785 r86380  
    117117void NetscapePluginModule::determineQuirks()
    118118{
     119    PluginInfoStore::Plugin plugin;
     120    getPluginInfo(m_pluginPath, plugin);
     121
     122    Vector<MimeClassInfo> mimeTypes = plugin.info.mimes;
     123    for (size_t i = 0; i < mimeTypes.size(); ++i) {
     124        // FIXME: It seems strange to assume that any plugin that handles this MIME type needs this quirk. Should
     125        // we be be checking the plugin's name instead?
     126        if (mimeTypes[i].type == "application/x-shockwave-flash") {
     127            uint64_t flashTenVersion = fileVersion(0x00000000, 0x000a0000);
     128            uint64_t version = plugin.fileVersion;
     129
     130            // Pre Flash v10 only requests windowless plugins if we use a Mozilla user agent.
     131            // For testing information, see: https://bugs.webkit.org/show_bug.cgi?id=60726.
     132            if (version < flashTenVersion)
     133                m_pluginQuirks.add(PluginQuirks::WantsMozillaUserAgent);
     134
     135            break;
     136        }
     137    }
    119138}
    120139
  • trunk/Source/WebKit2/Shared/Plugins/PluginQuirks.h

    r82796 r86380  
    6262        RequiresGTKToolKit,
    6363#endif
     64   
     65        WantsMozillaUserAgent,
     66
    6467        NumPluginQuirks
    6568    };
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp

    r86169 r86380  
    133133}
    134134
     135static const char* MozillaUserAgent = "Mozilla/5.0 ("
     136#if PLUGIN_ARCHITECTURE(MAC)
     137        "Macintosh; U; Intel Mac OS X;"
     138#elif PLUGIN_ARCHITECTURE(WIN)
     139        "Windows; U; Windows NT 5.1;"
     140#elif PLUGIN_ARCHITECTURE(X11)
     141// The Gtk port uses X11 plugins in Mac.
     142#if OS(DARWIN) && PLATFORM(GTK)
     143    "X11; U; Intel Mac OS X;"
     144#else
     145    "X11; U; Linux i686;"
     146#endif
     147#endif
     148        " en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0";
     149
    135150const char* NetscapePlugin::userAgent()
    136151{
     152    if (quirks().contains(PluginQuirks::WantsMozillaUserAgent))
     153        return MozillaUserAgent;
     154
    137155    if (m_userAgent.isNull()) {
    138156        m_userAgent = m_pluginController->userAgent().utf8();
  • trunk/Source/WebKit2/win/WebKit2.vcproj

    r85958 r86380  
    14021402                                Name="Plugins"
    14031403                                >
     1404                                <File
     1405                                        RelativePath="..\Shared\Plugins\PluginQuirks.h"
     1406                                        >
     1407                                </File>
    14041408                                <Filter
    14051409                                        Name="Netscape"
Note: See TracChangeset for help on using the changeset viewer.