summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/Plugins
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-08-12 09:27:39 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-08-12 09:27:39 +0200
commit3749d61e1f7a59f5ec5067e560af1eb610c82015 (patch)
tree73dc228333948738bbe02976cacca8cd382bc978 /Source/WebKit2/UIProcess/Plugins
parentb32b4dcd9a51ab8de6afc53d9e17f8707e1f7a5e (diff)
downloadqtwebkit-3749d61e1f7a59f5ec5067e560af1eb610c82015.tar.gz
Imported WebKit commit a77350243e054f3460d1137301d8b3faee3d2052 (http://svn.webkit.org/repository/webkit/trunk@125365)
New snapshot with build fixes for latest API changes in Qt and all WK1 Win MSVC fixes upstream
Diffstat (limited to 'Source/WebKit2/UIProcess/Plugins')
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp2
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h2
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp19
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h2
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in2
-rw-r--r--Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm40
-rw-r--r--Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm3
7 files changed, 58 insertions, 12 deletions
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
index 37ff06030..bff8fa941 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
@@ -187,7 +187,7 @@ static inline String pathExtension(const KURL& url)
}
#if !PLATFORM(MAC)
-bool PluginInfoStore::shouldBlockPlugin(const PluginModuleInfo&) const
+bool PluginInfoStore::shouldBlockPlugin(const PluginModuleInfo&)
{
return false;
}
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h
index 42df69b09..1b2082dbb 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h
+++ b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h
@@ -56,7 +56,7 @@ public:
// Return whether this plug-in should be blocked from being instantiated.
// Note that the plug-in will still be seen by e.g. navigator.plugins
- bool shouldBlockPlugin(const PluginModuleInfo&) const;
+ static bool shouldBlockPlugin(const PluginModuleInfo&);
private:
PluginModuleInfo findPluginForMIMEType(const String& mimeType) const;
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
index 43fa2f4cb..12abf6dc2 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
@@ -67,6 +67,9 @@ PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManage
#if PLATFORM(MAC)
launchOptions.architecture = pluginInfo.pluginArchitecture;
launchOptions.executableHeap = PluginProcessProxy::pluginNeedsExecutableHeap(pluginInfo);
+#if HAVE(XPC)
+ launchOptions.useXPC = false;
+#endif
#endif
m_processLauncher = ProcessLauncher::create(this, launchOptions);
@@ -137,9 +140,9 @@ void PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch()
RefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply = m_pendingConnectionReplies.takeFirst();
#if PLATFORM(MAC)
- reply->send(CoreIPC::Attachment(0, MACH_MSG_TYPE_MOVE_SEND));
+ reply->send(CoreIPC::Attachment(0, MACH_MSG_TYPE_MOVE_SEND), false);
#elif USE(UNIX_DOMAIN_SOCKETS)
- reply->send(CoreIPC::Attachment());
+ reply->send(CoreIPC::Attachment(), false);
#else
notImplemented();
#endif
@@ -190,14 +193,16 @@ void PluginProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connectio
{
ASSERT(!m_connection);
- if (!connectionIdentifier) {
+ if (CoreIPC::Connection::identifierIsNull(connectionIdentifier)) {
pluginProcessCrashedOrFailedToLaunch();
return;
}
-
+
m_connection = CoreIPC::Connection::createServerConnection(connectionIdentifier, this, RunLoop::main());
#if PLATFORM(MAC)
m_connection->setShouldCloseConnectionOnMachExceptions();
+#elif PLATFORM(QT)
+ m_connection->setShouldCloseConnectionOnProcessTermination(m_processLauncher->processIdentifier());
#endif
m_connection->open();
@@ -228,7 +233,7 @@ void PluginProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connectio
m_numPendingConnectionRequests = 0;
}
-void PluginProcessProxy::didCreateWebProcessConnection(const CoreIPC::Attachment& connectionIdentifier)
+void PluginProcessProxy::didCreateWebProcessConnection(const CoreIPC::Attachment& connectionIdentifier, bool supportsAsynchronousPluginInitialization)
{
ASSERT(!m_pendingConnectionReplies.isEmpty());
@@ -236,9 +241,9 @@ void PluginProcessProxy::didCreateWebProcessConnection(const CoreIPC::Attachment
RefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply = m_pendingConnectionReplies.takeFirst();
#if PLATFORM(MAC)
- reply->send(CoreIPC::Attachment(connectionIdentifier.port(), MACH_MSG_TYPE_MOVE_SEND));
+ reply->send(CoreIPC::Attachment(connectionIdentifier.port(), MACH_MSG_TYPE_MOVE_SEND), supportsAsynchronousPluginInitialization);
#elif USE(UNIX_DOMAIN_SOCKETS)
- reply->send(connectionIdentifier);
+ reply->send(connectionIdentifier, supportsAsynchronousPluginInitialization);
#else
notImplemented();
#endif
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h
index 0a51d9b27..e0fe15ff0 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h
@@ -108,7 +108,7 @@ private:
// Message handlers
void didReceivePluginProcessProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
- void didCreateWebProcessConnection(const CoreIPC::Attachment&);
+ void didCreateWebProcessConnection(const CoreIPC::Attachment&, bool supportsAsynchronousPluginInitialization);
void didGetSitesWithData(const Vector<String>& sites, uint64_t callbackID);
void didClearSiteData(uint64_t callbackID);
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in
index 7b59aefec..183cb0c68 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in
@@ -23,7 +23,7 @@
#if ENABLE(PLUGIN_PROCESS)
messages -> PluginProcessProxy {
- DidCreateWebProcessConnection(CoreIPC::Attachment connectionIdentifier)
+ DidCreateWebProcessConnection(CoreIPC::Attachment connectionIdentifier, bool supportsAsynchronousPluginInitialization)
DidGetSitesWithData(Vector<WTF::String> sites, uint64_t callbackID)
DidClearSiteData(uint64_t callbackID)
diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm
index 8688cfa79..9b86aaed3 100644
--- a/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm
+++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm
@@ -82,6 +82,33 @@ bool PluginInfoStore::getPluginInfo(const String& pluginPath, PluginModuleInfo&
#endif
}
+static size_t findPluginWithBundleIdentifier(const Vector<PluginModuleInfo>& plugins, const String& bundleIdentifier)
+{
+ for (size_t i = 0; i < plugins.size(); ++i) {
+ if (plugins[i].bundleIdentifier == bundleIdentifier)
+ return i;
+ }
+
+ return notFound;
+}
+
+// Returns true if the given plug-in should be loaded, false otherwise.
+static bool checkForPreferredPlugin(Vector<PluginModuleInfo>& alreadyLoadedPlugins, const PluginModuleInfo& plugin, const String& oldPluginBundleIdentifier, const String& newPluginBundleIdentifier)
+{
+ if (plugin.bundleIdentifier == oldPluginBundleIdentifier) {
+ // If we've already found the new plug-in, we don't want to load the old plug-in.
+ if (findPluginWithBundleIdentifier(alreadyLoadedPlugins, newPluginBundleIdentifier) != notFound)
+ return false;
+ } else if (plugin.bundleIdentifier == newPluginBundleIdentifier) {
+ // If we've already found the old plug-in, remove it from the list of loaded plug-ins.
+ size_t oldPluginIndex = findPluginWithBundleIdentifier(alreadyLoadedPlugins, oldPluginBundleIdentifier);
+ if (oldPluginIndex != notFound)
+ alreadyLoadedPlugins.remove(oldPluginIndex);
+ }
+
+ return true;
+}
+
bool PluginInfoStore::shouldUsePlugin(Vector<PluginModuleInfo>& alreadyLoadedPlugins, const PluginModuleInfo& plugin)
{
for (size_t i = 0; i < alreadyLoadedPlugins.size(); ++i) {
@@ -92,10 +119,21 @@ bool PluginInfoStore::shouldUsePlugin(Vector<PluginModuleInfo>& alreadyLoadedPlu
return false;
}
+ // Prefer the Oracle Java plug-in over the Apple java plug-in.
+ if (!checkForPreferredPlugin(alreadyLoadedPlugins, plugin, "com.apple.java.JavaAppletPlugin", "com.oracle.java.JavaAppletPlugin"))
+ return false;
+
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
+ if (plugin.bundleIdentifier == "com.apple.java.JavaAppletPlugin" && shouldBlockPlugin(plugin) && !WKJLIsRuntimeAndWebComponentsInstalled()) {
+ // If the Apple Java plug-in is blocked and there's no Java runtime installed, just pretend that the plug-in doesn't exist.
+ return false;
+ }
+#endif
+
return true;
}
-bool PluginInfoStore::shouldBlockPlugin(const PluginModuleInfo& plugin) const
+bool PluginInfoStore::shouldBlockPlugin(const PluginModuleInfo& plugin)
{
return WKShouldBlockPlugin(plugin.bundleIdentifier, plugin.versionString);
}
diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
index 3486de437..d4b4ba3c8 100644
--- a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
+++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
@@ -118,6 +118,9 @@ bool PluginProcessProxy::createPropertyListFile(const PluginModuleInfo& plugin)
void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationParameters& parameters)
{
+ // For know only Flash is known to behave with asynchronous plug-in initialization.
+ parameters.supportsAsynchronousPluginInitialization = m_pluginInfo.bundleIdentifier == "com.macromedia.Flash Player.plugin";
+
#if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION)
parameters.parentProcessName = [[NSProcessInfo processInfo] processName];
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070