diff options
| author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
| commit | cfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch) | |
| tree | 24d68c6f61c464ecba1e05670b80390ea3b0e50c /Source/WebKit2/UIProcess/Plugins | |
| parent | 69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff) | |
| download | qtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz | |
Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733)
New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes.
Diffstat (limited to 'Source/WebKit2/UIProcess/Plugins')
9 files changed, 112 insertions, 11 deletions
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp index 804455490..95f589b5f 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp +++ b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp @@ -189,7 +189,12 @@ static inline String pathExtension(const KURL& url) } #if !PLATFORM(MAC) -bool PluginInfoStore::shouldBlockPlugin(const PluginModuleInfo&) +PluginModuleLoadPolicy PluginInfoStore::policyForPlugin(const PluginModuleInfo&) +{ + return PluginModuleLoadNormally; +} + +bool PluginInfoStore::reactivateInactivePlugin(const PluginModuleInfo&) { return false; } diff --git a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h index 287ec9262..9a6bd9f5c 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h +++ b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h @@ -56,9 +56,8 @@ public: // Returns the info for the plug-in with the given path. PluginModuleInfo infoForPluginWithPath(const String& pluginPath) const; - // 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 - static bool shouldBlockPlugin(const PluginModuleInfo&); + static PluginModuleLoadPolicy policyForPlugin(const PluginModuleInfo&); + static bool reactivateInactivePlugin(const PluginModuleInfo&); private: PluginModuleInfo findPluginForMIMEType(const String& mimeType) const; diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h index 37824c4aa..5e519427b 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h @@ -56,6 +56,10 @@ public: void getSitesWithData(const PluginModuleInfo&, WebPluginSiteDataManager*, uint64_t callbackID); void clearSiteData(const PluginModuleInfo&, WebPluginSiteDataManager*, const Vector<String>& sites, uint64_t flags, uint64_t maxAgeInSeconds, uint64_t callbackID); +#if PLATFORM(MAC) + void setApplicationIsOccluded(bool); +#endif + private: PluginProcessManager(); diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp index e51eed7df..0c2e8689e 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp @@ -179,7 +179,7 @@ void PluginProcessProxy::didClose(CoreIPC::Connection*) pluginProcessCrashedOrFailedToLaunch(); } -void PluginProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) +void PluginProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference, CoreIPC::StringReference) { } @@ -228,6 +228,11 @@ void PluginProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connectio m_connection->send(Messages::PluginProcess::CreateWebProcessConnection(), 0); m_numPendingConnectionRequests = 0; + +#if PLATFORM(MAC) + if (WebContext::applicationIsOccluded()) + m_connection->send(Messages::PluginProcess::SetApplicationIsOccluded(true), 0); +#endif } void PluginProcessProxy::didCreateWebProcessConnection(const CoreIPC::Attachment& connectionIdentifier, bool supportsAsynchronousPluginInitialization) diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h index bdade27e5..1357e6c7f 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h @@ -80,7 +80,11 @@ public: // Terminates the plug-in process. void terminate(); + bool isValid() const { return m_connection; } + #if PLATFORM(MAC) + void setApplicationIsOccluded(bool); + // Returns whether the plug-in needs the heap to be marked executable. static bool pluginNeedsExecutableHeap(const PluginModuleInfo&); @@ -100,7 +104,7 @@ private: // CoreIPC::Connection::Client virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE; virtual void didClose(CoreIPC::Connection*) OVERRIDE; - virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) OVERRIDE; + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) OVERRIDE; // ProcessLauncher::Client virtual void didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier); diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm index 5bacc2c2a..6ebde6476 100644 --- a/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm +++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm @@ -36,6 +36,8 @@ using namespace WebCore; +static const char* const oracleJavaAppletPluginBundleIdentifier = "com.oracle.java.JavaAppletPlugin"; + namespace WebKit { Vector<String> PluginInfoStore::pluginsDirectories() @@ -105,6 +107,11 @@ static bool checkForPreferredPlugin(Vector<PluginModuleInfo>& alreadyLoadedPlugi return true; } +static bool shouldBlockPlugin(const PluginModuleInfo& plugin) +{ + return PluginInfoStore::policyForPlugin(plugin) == PluginModuleBlocked; +} + bool PluginInfoStore::shouldUsePlugin(Vector<PluginModuleInfo>& alreadyLoadedPlugins, const PluginModuleInfo& plugin) { for (size_t i = 0; i < alreadyLoadedPlugins.size(); ++i) { @@ -122,11 +129,11 @@ bool PluginInfoStore::shouldUsePlugin(Vector<PluginModuleInfo>& alreadyLoadedPlu } // Prefer the Oracle Java plug-in over the Apple java plug-in. - if (!checkForPreferredPlugin(alreadyLoadedPlugins, plugin, "com.apple.java.JavaAppletPlugin", "com.oracle.java.JavaAppletPlugin")) + if (!checkForPreferredPlugin(alreadyLoadedPlugins, plugin, "com.apple.java.JavaAppletPlugin", oracleJavaAppletPluginBundleIdentifier)) return false; #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - if (plugin.bundleIdentifier == "com.apple.java.JavaAppletPlugin" && shouldBlockPlugin(plugin) && !WKJLIsRuntimeAndWebComponentsInstalled()) { + if (plugin.bundleIdentifier == "com.apple.java.JavaAppletPlugin" && shouldBlockPlugin(plugin) && !WKIsJavaPlugInActive()) { // 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; } @@ -135,9 +142,27 @@ bool PluginInfoStore::shouldUsePlugin(Vector<PluginModuleInfo>& alreadyLoadedPlu return true; } -bool PluginInfoStore::shouldBlockPlugin(const PluginModuleInfo& plugin) +PluginModuleLoadPolicy PluginInfoStore::policyForPlugin(const PluginModuleInfo& plugin) { - return WKShouldBlockPlugin(plugin.bundleIdentifier, plugin.versionString); + if (WKShouldBlockPlugin(plugin.bundleIdentifier, plugin.versionString)) + return PluginModuleBlocked; + + if (plugin.bundleIdentifier == oracleJavaAppletPluginBundleIdentifier && !WKIsJavaPlugInActive()) + return PluginModuleInactive; + + return PluginModuleLoadNormally; +} + +bool PluginInfoStore::reactivateInactivePlugin(const PluginModuleInfo& plugin) +{ +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 + if (plugin.bundleIdentifier == oracleJavaAppletPluginBundleIdentifier) { + WKActivateJavaPlugIn(); + return true; + } +#endif + + return false; } String PluginInfoStore::getMIMETypeForExtension(const String& extension) diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessManagerMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessManagerMac.mm new file mode 100644 index 000000000..6a974dad7 --- /dev/null +++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessManagerMac.mm @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" +#import "PluginProcessManager.h" + +#if ENABLE(PLUGIN_PROCESS) + +#import "PluginProcessProxy.h" + +namespace WebKit { + +void PluginProcessManager::setApplicationIsOccluded(bool applicationIsOccluded) +{ + size_t processCount = m_pluginProcesses.size(); + for (size_t i = 0; i < processCount; ++i) + m_pluginProcesses[i]->setApplicationIsOccluded(applicationIsOccluded); +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm index 207eca2c9..e92ef9e76 100644 --- a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm +++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm @@ -30,6 +30,7 @@ #import "EnvironmentVariables.h" #import "PluginProcessCreationParameters.h" +#import "PluginProcessMessages.h" #import "WebKitSystemInterface.h" #import <WebCore/FileSystem.h> #import <spawn.h> @@ -315,6 +316,13 @@ void PluginProcessProxy::applicationDidBecomeActive() makePluginProcessTheFrontProcess(); } +void PluginProcessProxy::setApplicationIsOccluded(bool applicationIsOccluded) +{ + if (!isValid()) + return; + + m_connection->send(Messages::PluginProcess::SetApplicationIsOccluded(applicationIsOccluded), 0); +} } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp b/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp index 64c7bc485..189e21379 100644 --- a/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp +++ b/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp @@ -43,8 +43,15 @@ using namespace WebCore; namespace WebKit { -void PluginProcessProxy::platformInitializeLaunchOptions(ProcessLauncher::LaunchOptions&, const PluginModuleInfo&) +void PluginProcessProxy::platformInitializeLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions, const PluginModuleInfo&) { +#if PLATFORM(EFL) && !defined(NDEBUG) + const char* commandPrefix = getenv("PLUGIN_PROCESS_COMMAND_PREFIX"); + if (commandPrefix && *commandPrefix) + launchOptions.processCmdPrefix = String::fromUTF8(commandPrefix); +#else + UNUSED_PARAM(launchOptions); +#endif } void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationParameters&) |
