diff options
Diffstat (limited to 'Source/WebKit2/Shared/Plugins/Netscape')
4 files changed, 72 insertions, 27 deletions
diff --git a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp index 7bbdaa8..54af967 100644 --- a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp +++ b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp @@ -58,16 +58,6 @@ NetscapePluginModule::~NetscapePluginModule() ASSERT(initializedNetscapePluginModules().find(this) == notFound); } -void NetscapePluginModule::pluginCreated() -{ - incrementLoadCount(); -} - -void NetscapePluginModule::pluginDestroyed() -{ - decrementLoadCount(); -} - Vector<String> NetscapePluginModule::sitesWithData() { Vector<String> sites; @@ -235,8 +225,21 @@ bool NetscapePluginModule::tryLoad() // reversed. Failing to follow this order results in crashes (e.g., in Silverlight on Mac and // in Flash and QuickTime on Windows). #if PLUGIN_ARCHITECTURE(MAC) - if (initializeFuncPtr(netscapeBrowserFuncs()) != NPERR_NO_ERROR || getEntryPointsFuncPtr(&m_pluginFuncs) != NPERR_NO_ERROR) - return false; +#ifndef NP_NO_CARBON + // Plugins (at least QT) require that you call UseResFile on the resource file before loading it. + ResFileRefNum currentResourceFile = CurResFile(); + + ResFileRefNum pluginResourceFile = m_module->bundleResourceMap(); + UseResFile(pluginResourceFile); +#endif + bool result = initializeFuncPtr(netscapeBrowserFuncs()) == NPERR_NO_ERROR && getEntryPointsFuncPtr(&m_pluginFuncs) == NPERR_NO_ERROR; + +#ifndef NP_NO_CARBON + // Restore the resource file. + UseResFile(currentResourceFile); +#endif + + return result; #elif PLUGIN_ARCHITECTURE(WIN) if (getEntryPointsFuncPtr(&m_pluginFuncs) != NPERR_NO_ERROR || initializeFuncPtr(netscapeBrowserFuncs()) != NPERR_NO_ERROR) return false; diff --git a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h index aee26bb..4ec7991 100644 --- a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h +++ b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h @@ -45,9 +45,9 @@ public: ~NetscapePluginModule(); const NPPluginFuncs& pluginFuncs() const { return m_pluginFuncs; } - - void pluginCreated(); - void pluginDestroyed(); + + void incrementLoadCount(); + void decrementLoadCount(); static bool getPluginInfo(const String& pluginPath, PluginInfoStore::Plugin&); @@ -68,9 +68,6 @@ private: void applyX11QuirksBeforeLoad(); #endif - void incrementLoadCount(); - void decrementLoadCount(); - bool tryGetSitesWithData(Vector<String>&); bool tryClearSiteData(const String& site, uint64_t flags, uint64_t maxAge); diff --git a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm index accab46..d290f5b 100644 --- a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm +++ b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm @@ -86,13 +86,35 @@ static bool getPluginArchitecture(CFBundleRef bundle, cpu_type_t& pluginArchitec return false; } + +static RetainPtr<CFDictionaryRef> getMIMETypesFromPluginBundle(CFBundleRef bundle) +{ + CFStringRef propertyListFilename = static_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("WebPluginMIMETypesFilename"))); + if (propertyListFilename) { + RetainPtr<CFStringRef> propertyListPath(AdoptCF, CFStringCreateWithFormat(kCFAllocatorDefault, 0, CFSTR("%@/Library/Preferences/%@"), NSHomeDirectory(), propertyListFilename)); + RetainPtr<CFURLRef> propertyListURL(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, propertyListPath.get(), kCFURLPOSIXPathStyle, FALSE)); + + CFDataRef propertyListData; + CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, propertyListURL.get(), &propertyListData, 0, 0, 0); + RetainPtr<CFPropertyListRef> propertyList(AdoptCF, CFPropertyListCreateWithData(kCFAllocatorDefault, propertyListData, kCFPropertyListImmutable, 0, 0)); + if (propertyListData) + CFRelease(propertyListData); + + // FIXME: Have the plug-in create the MIME types property list if it doesn't exist. + // https://bugs.webkit.org/show_bug.cgi?id=57204 + if (!propertyList || CFGetTypeID(propertyList.get()) != CFDictionaryGetTypeID()) + return 0; + + return static_cast<CFDictionaryRef>(CFDictionaryGetValue(static_cast<CFDictionaryRef>(propertyList.get()), CFSTR("WebPluginMIMETypes"))); + } + + return static_cast<CFDictionaryRef>(CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("WebPluginMIMETypes"))); +} static bool getPluginInfoFromPropertyLists(CFBundleRef bundle, PluginInfo& pluginInfo) { - // FIXME: Handle WebPluginMIMETypesFilenameKey. - - CFDictionaryRef mimeTypes = static_cast<CFDictionaryRef>(CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("WebPluginMIMETypes"))); - if (!mimeTypes || CFGetTypeID(mimeTypes) != CFDictionaryGetTypeID()) + RetainPtr<CFDictionaryRef> mimeTypes = getMIMETypesFromPluginBundle(bundle); + if (!mimeTypes || CFGetTypeID(mimeTypes.get()) != CFDictionaryGetTypeID()) return false; // Get the plug-in name. @@ -106,10 +128,10 @@ static bool getPluginInfoFromPropertyLists(CFBundleRef bundle, PluginInfo& plugi pluginInfo.desc = pluginDescription; // Get the MIME type mapping dictionary. - CFIndex numMimeTypes = CFDictionaryGetCount(mimeTypes); + CFIndex numMimeTypes = CFDictionaryGetCount(mimeTypes.get()); Vector<CFStringRef> mimeTypesVector(numMimeTypes); Vector<CFDictionaryRef> mimeTypeInfoVector(numMimeTypes); - CFDictionaryGetKeysAndValues(mimeTypes, reinterpret_cast<const void**>(mimeTypesVector.data()), reinterpret_cast<const void**>(mimeTypeInfoVector.data())); + CFDictionaryGetKeysAndValues(mimeTypes.get(), reinterpret_cast<const void**>(mimeTypesVector.data()), reinterpret_cast<const void**>(mimeTypeInfoVector.data())); for (CFIndex i = 0; i < numMimeTypes; ++i) { MimeClassInfo mimeClassInfo; @@ -142,8 +164,15 @@ static bool getPluginInfoFromPropertyLists(CFBundleRef bundle, PluginInfo& plugi CFStringRef extension = static_cast<CFStringRef>(CFArrayGetValueAtIndex(extensionsArray, i)); if (!extension || CFGetTypeID(extension) != CFStringGetTypeID()) continue; - - mimeClassInfo.extensions.append(String(extension).lower()); + + // The DivX plug-in lists multiple extensions in a comma separated string instead of using + // multiple array elements in the property list. Work around this here by splitting the + // extension string into components. + Vector<String> extensionComponents; + String(extension).lower().split(',', extensionComponents); + + for (size_t i = 0; i < extensionComponents.size(); ++i) + mimeClassInfo.extensions.append(extensionComponents[i]); } // Add this MIME type. @@ -333,8 +362,24 @@ void NetscapePluginModule::determineQuirks() if (plugin.bundleIdentifier == "com.macromedia.Flash Player.plugin") { // Flash requires that the return value of getprogname() be "WebKitPluginHost". m_pluginQuirks.add(PluginQuirks::PrognameShouldBeWebKitPluginHost); + + // Flash supports snapshotting. m_pluginQuirks.add(PluginQuirks::SupportsSnapshotting); } + + if (plugin.bundleIdentifier == "com.microsoft.SilverlightPlugin") { + // Silverlight doesn't explicitly opt into transparency, so we'll do it whenever + // there's a 'background' attribute. + m_pluginQuirks.add(PluginQuirks::MakeTransparentIfBackgroundAttributeExists); + } + +#ifndef NP_NO_QUICKDRAW + if (plugin.bundleIdentifier == "com.apple.ist.ds.appleconnect.webplugin") { + // The AppleConnect plug-in uses QuickDraw but doesn't paint or receive events + // so we'll allow it to be instantiated even though we don't support QuickDraw. + m_pluginQuirks.add(PluginQuirks::AllowHalfBakedQuickDrawSupport); + } +#endif } } // namespace WebKit diff --git a/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp b/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp index b5e3aad..76ecda7 100644 --- a/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp +++ b/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp @@ -40,7 +40,7 @@ namespace WebKit { #if PLATFORM(QT) static void initializeGTK() { - QLibrary library("libgtk-x11-2.0.so.0"); + QLibrary library(QLatin1String("libgtk-x11-2.0.so.0")); if (library.load()) { typedef void *(*gtk_init_check_ptr)(int*, char***); gtk_init_check_ptr gtkInitCheck = reinterpret_cast<gtk_init_check_ptr>(library.resolve("gtk_init_check")); |