Changeset 88735 in webkit


Ignore:
Timestamp:
Jun 13, 2011 5:10:23 PM (13 years ago)
Author:
andersca@apple.com
Message:

2011-06-13 Anders Carlsson <andersca@apple.com>

Reviewed by Sam Weinig.

Crash when trying to use Netflix Watch Instantly with Silverlight 3
https://bugs.webkit.org/show_bug.cgi?id=62611
<rdar://problem/9058370>

  • Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm: (WebKit::NetscapePluginModule::getPluginInfo): Get the plug-in version string instead of the version number.

(WebKit::PluginVersion::isValid):
(WebKit::PluginVersion::PluginVersion):
(WebKit::PluginVersion::parse):
(WebKit::PluginVersion::isLessThan):
Add a new PluginVersion class that represents a plug-in version. The idea is
that this class be made cross platform.

(WebKit::NetscapePluginModule::determineQuirks):
Add the ReturnsNonRetainedScriptableNPObject quirk for versions of Silverlight less than 4.

  • Shared/Plugins/PluginQuirks.h: Add the ReturnsNonRetainedScriptableNPObject quirk.
  • UIProcess/Plugins/PluginInfoStore.h: Use a version string. Eventually this should hold the PluginVersion class we added.
  • WebProcess/Plugins/Netscape/NetscapePlugin.cpp: (WebKit::NetscapePlugin::pluginScriptableNPObject): If the plug-in has the ReturnsNonRetainedScriptableNPObject quirk, do an extra retain.
Location:
trunk/Source/WebKit2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r88722 r88735  
     12011-06-13  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Crash when trying to use Netflix Watch Instantly with Silverlight 3
     6        https://bugs.webkit.org/show_bug.cgi?id=62611
     7        <rdar://problem/9058370>
     8
     9        * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
     10        (WebKit::NetscapePluginModule::getPluginInfo):
     11        Get the plug-in version string instead of the version number.
     12
     13        (WebKit::PluginVersion::isValid):
     14        (WebKit::PluginVersion::PluginVersion):
     15        (WebKit::PluginVersion::parse):
     16        (WebKit::PluginVersion::isLessThan):
     17        Add a new PluginVersion class that represents a plug-in version. The idea is
     18        that this class be made cross platform.
     19
     20        (WebKit::NetscapePluginModule::determineQuirks):
     21        Add the ReturnsNonRetainedScriptableNPObject quirk for versions of Silverlight less than 4.
     22
     23        * Shared/Plugins/PluginQuirks.h:
     24        Add the ReturnsNonRetainedScriptableNPObject quirk.
     25
     26        * UIProcess/Plugins/PluginInfoStore.h:
     27        Use a version string. Eventually this should hold the PluginVersion class we added.
     28
     29        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
     30        (WebKit::NetscapePlugin::pluginScriptableNPObject):
     31        If the plug-in has the ReturnsNonRetainedScriptableNPObject quirk, do an extra retain.
     32
    1332011-06-13  Ryuan Choi  <ryuan.choi@samsung.com>
    234
  • trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm

    r88677 r88735  
    365365    plugin.path = pluginPath;
    366366    plugin.bundleIdentifier = CFBundleGetIdentifier(bundle.get());
    367     plugin.versionNumber = CFBundleGetVersionNumber(bundle.get());
     367    if (CFTypeRef versionTypeRef = CFBundleGetValueForInfoDictionaryKey(bundle.get(), kCFBundleVersionKey)) {
     368        if (CFGetTypeID(versionTypeRef) == CFStringGetTypeID())
     369            plugin.versionString = static_cast<CFStringRef>(versionTypeRef);
     370    }
    368371   
    369372    // Check that there's valid info for this plug-in.
     
    399402    if (!createPluginMIMETypesPreferences)
    400403        return false;
    401    
     404
    402405    createPluginMIMETypesPreferences();
    403406    return true;
     407}
     408
     409// FIXME: This doesn't need to be platform-specific.
     410class PluginVersion {
     411public:
     412    static PluginVersion parse(const String& versionString);
     413
     414    bool isLessThan(unsigned componentA) const;
     415    bool isValid() const { return !m_versionComponents.isEmpty(); }
     416
     417private:
     418    PluginVersion()
     419    {
     420    }
     421
     422    Vector<unsigned, 4> m_versionComponents;
     423};
     424
     425PluginVersion PluginVersion::parse(const String& versionString)
     426{
     427    PluginVersion version;
     428
     429    Vector<String> versionStringComponents;
     430    versionString.split(".", versionStringComponents);
     431    for (size_t i = 0; i < versionStringComponents.size(); ++i) {
     432        bool successfullyParsed = false;
     433        unsigned versionComponent = versionStringComponents[i].toUInt(&successfullyParsed);
     434        if (!successfullyParsed)
     435            return PluginVersion();
     436
     437        version.m_versionComponents.append(versionComponent);
     438    }
     439
     440    return version;
     441}
     442
     443bool PluginVersion::isLessThan(unsigned componentA) const
     444{
     445    ASSERT(isValid());
     446
     447    return m_versionComponents[0] < componentA;
    404448}
    405449
     
    428472        // there's a 'background' attribute.
    429473        m_pluginQuirks.add(PluginQuirks::MakeTransparentIfBackgroundAttributeExists);
     474
     475        PluginVersion pluginVersion = PluginVersion::parse(plugin.versionString);
     476        if (pluginVersion.isValid()) {
     477            if (pluginVersion.isLessThan(4)) {
     478                // Versions of Silverlight prior to 4 don't retain the scriptable NPObject.
     479                m_pluginQuirks.add(PluginQuirks::ReturnsNonRetainedScriptableNPObject);
     480            }
     481        }
    430482    }
    431483
  • trunk/Source/WebKit2/Shared/Plugins/PluginQuirks.h

    r87945 r88735  
    6060        ReturnsRetainedCoreAnimationLayer,
    6161
     62        // Whether NPP_GetValue with NPPVpluginScriptableNPObject returns a non-retained NPObject or not.
     63        // Versions of Silverlight prior to 4 never retained the returned NPObject.
     64        ReturnsNonRetainedScriptableNPObject,
     65
    6266#ifndef NP_NO_QUICKDRAW
    6367        // Allow the plug-in to use the QuickDraw drawing model, since we know that the plug-in
  • trunk/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h

    r85983 r88735  
    4848        cpu_type_t pluginArchitecture;
    4949        String bundleIdentifier;
    50         unsigned versionNumber;
     50        String versionString;
    5151#elif PLATFORM(WIN)
    5252        uint64_t fileVersion;
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp

    r88171 r88735  
    2828
    2929#include "NPRuntimeObjectMap.h"
     30#include "NPRuntimeUtilities.h"
    3031#include "NetscapePluginStream.h"
    3132#include "PluginController.h"
     
    738739    if (NPP_GetValue(NPPVpluginScriptableNPObject, &scriptableNPObject) != NPERR_NO_ERROR)
    739740        return 0;
    740    
     741
     742#if PLUGIN_ARCHITECTURE(MAC)
     743    if (m_pluginModule->pluginQuirks().contains(PluginQuirks::ReturnsNonRetainedScriptableNPObject))
     744        retainNPObject(scriptableNPObject);       
     745#endif   
     746
    741747    return scriptableNPObject;
    742748}
Note: See TracChangeset for help on using the changeset viewer.