summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/UIProcess/Plugins
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/UIProcess/Plugins')
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp24
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h32
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in5
-rw-r--r--Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp12
-rw-r--r--Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm138
-rw-r--r--Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp34
6 files changed, 196 insertions, 49 deletions
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
index c63d500..f167747 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
@@ -38,16 +38,6 @@
#include "WebProcessProxy.h"
namespace WebKit {
-
-#if PLATFORM(MAC)
-static bool pluginNeedsExecutableHeap(const PluginInfoStore::Plugin& pluginInfo)
-{
- if (pluginInfo.bundleIdentifier == "com.apple.QuickTime Plugin.plugin")
- return false;
-
- return true;
-}
-#endif
PassOwnPtr<PluginProcessProxy> PluginProcessProxy::create(PluginProcessManager* PluginProcessManager, const PluginInfoStore::Plugin& pluginInfo)
{
@@ -58,12 +48,16 @@ PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManage
: m_pluginProcessManager(PluginProcessManager)
, m_pluginInfo(pluginInfo)
, m_numPendingConnectionRequests(0)
+#if PLATFORM(MAC)
+ , m_modalWindowIsShowing(false)
+ , m_fullscreenWindowIsShowing(false)
+#endif
{
ProcessLauncher::LaunchOptions launchOptions;
launchOptions.processType = ProcessLauncher::PluginProcess;
#if PLATFORM(MAC)
launchOptions.architecture = pluginInfo.pluginArchitecture;
- launchOptions.executableHeap = pluginNeedsExecutableHeap(pluginInfo);
+ launchOptions.executableHeap = PluginProcessProxy::pluginNeedsExecutableHeap(pluginInfo);
#endif
m_processLauncher = ProcessLauncher::create(this, launchOptions);
@@ -153,6 +147,14 @@ void PluginProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, Core
void PluginProcessProxy::didClose(CoreIPC::Connection*)
{
+#if PLATFORM(MAC)
+ if (m_modalWindowIsShowing)
+ endModal();
+
+ if (m_fullscreenWindowIsShowing)
+ exitFullscreen();
+#endif
+
pluginProcessCrashedOrFailedToLaunch();
}
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h
index 2ea2573..e285d64 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h
@@ -33,6 +33,12 @@
#include "ProcessLauncher.h"
#include <wtf/Deque.h>
+#if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
+OBJC_CLASS NSObject;
+OBJC_CLASS WKPlaceholderModalWindow;
+#endif
+
// FIXME: This is platform specific.
namespace CoreIPC {
class MachPort;
@@ -47,6 +53,9 @@ struct PluginProcessCreationParameters;
class PluginProcessProxy : CoreIPC::Connection::Client, ProcessLauncher::Client {
public:
+#if PLATFORM(MAC)
+ static bool pluginNeedsExecutableHeap(const PluginInfoStore::Plugin&);
+#endif
static PassOwnPtr<PluginProcessProxy> create(PluginProcessManager*, const PluginInfoStore::Plugin&);
~PluginProcessProxy();
@@ -81,6 +90,22 @@ private:
void didGetSitesWithData(const Vector<String>& sites, uint64_t callbackID);
void didClearSiteData(uint64_t callbackID);
+#if PLATFORM(MAC)
+ bool getPluginProcessSerialNumber(ProcessSerialNumber&);
+ void makePluginProcessTheFrontProcess();
+ void makeUIProcessTheFrontProcess();
+
+ void setFullscreenWindowIsShowing(bool);
+ void enterFullscreen();
+ void exitFullscreen();
+
+ void setModalWindowIsShowing(bool);
+ void beginModal();
+ void endModal();
+
+ void applicationDidBecomeActive();
+#endif
+
void platformInitializePluginProcess(PluginProcessCreationParameters& parameters);
// The plug-in host process manager.
@@ -112,6 +137,13 @@ private:
// If createPluginConnection is called while the process is still launching we'll keep count of it and send a bunch of requests
// when the process finishes launching.
unsigned m_numPendingConnectionRequests;
+
+#if PLATFORM(MAC)
+ RetainPtr<NSObject> m_activationObserver;
+ RetainPtr<WKPlaceholderModalWindow *> m_placeholderWindow;
+ bool m_modalWindowIsShowing;
+ bool m_fullscreenWindowIsShowing;
+#endif
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in
index a504f9a..5fcbe71 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in
@@ -28,6 +28,11 @@ messages -> PluginProcessProxy {
DidGetSitesWithData(Vector<WTF::String> sites, uint64_t callbackID)
DidClearSiteData(uint64_t callbackID)
+
+#if PLATFORM(MAC)
+ SetModalWindowIsShowing(bool modalWindowIsShowing)
+ SetFullscreenWindowIsShowing(bool fullscreenWindowIsShowing)
+#endif
}
#endif
diff --git a/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp b/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp
index dfa0806..5f56d0b 100644
--- a/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp
@@ -163,11 +163,7 @@ void WebPluginSiteDataManager::getSitesWithData(PassRefPtr<ArrayCallback> prpCal
m_pendingGetSitesWithData.set(callbackID, state);
state->getSitesWithDataForNextPlugin();
#else
- if (!m_webContext->hasValidProcess()) {
- RefPtr<ArrayCallback> callback = m_arrayCallbacks.take(callbackID);
- callback->invalidate();
- return;
- }
+ m_webContext->relaunchProcessIfNecessary();
Vector<String> pluginPaths;
m_webContext->pluginInfoStore()->getPluginPaths(pluginPaths);
@@ -227,11 +223,7 @@ void WebPluginSiteDataManager::clearSiteData(ImmutableArray* sites, uint64_t fla
state->clearSiteDataForNextPlugin();
#else
- if (!m_webContext->hasValidProcess()) {
- RefPtr<VoidCallback> callback = m_voidCallbacks.take(callbackID);
- callback->invalidate();
- return;
- }
+ m_webContext->relaunchProcessIfNecessary();
Vector<String> pluginPaths;
m_webContext->pluginInfoStore()->getPluginPaths(pluginPaths);
m_webContext->ensureWebProcess();
diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
index 2adc473..8375fd2 100644
--- a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
+++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
@@ -31,7 +31,33 @@
#import "PluginProcessCreationParameters.h"
#import "WebKitSystemInterface.h"
+@interface WKPlaceholderModalWindow : NSWindow
+@end
+
+@implementation WKPlaceholderModalWindow
+
+// Prevent NSApp from calling requestUserAttention: when the window is shown
+// modally, even if the app is inactive. See 6823049.
+- (BOOL)_wantsUserAttention
+{
+ return NO;
+}
+
+@end
+
namespace WebKit {
+
+bool PluginProcessProxy::pluginNeedsExecutableHeap(const PluginInfoStore::Plugin& pluginInfo)
+{
+ static bool forceNonexecutableHeapForPlugins = [[NSUserDefaults standardUserDefaults] boolForKey:@"ForceNonexecutableHeapForPlugins"];
+ if (forceNonexecutableHeapForPlugins)
+ return false;
+
+ if (pluginInfo.bundleIdentifier == "com.apple.QuickTime Plugin.plugin")
+ return false;
+
+ return true;
+}
void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationParameters& parameters)
{
@@ -41,7 +67,117 @@ void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationPa
if (renderServerPort != MACH_PORT_NULL)
parameters.acceleratedCompositingPort = CoreIPC::MachPort(renderServerPort, MACH_MSG_TYPE_COPY_SEND);
#endif
-}
+}
+
+bool PluginProcessProxy::getPluginProcessSerialNumber(ProcessSerialNumber& pluginProcessSerialNumber)
+{
+ pid_t pluginProcessPID = m_processLauncher->processIdentifier();
+ return GetProcessForPID(pluginProcessPID, &pluginProcessSerialNumber) == noErr;
+}
+
+void PluginProcessProxy::makePluginProcessTheFrontProcess()
+{
+ ProcessSerialNumber pluginProcessSerialNumber;
+ if (!getPluginProcessSerialNumber(pluginProcessSerialNumber))
+ return;
+
+ SetFrontProcess(&pluginProcessSerialNumber);
+}
+
+void PluginProcessProxy::makeUIProcessTheFrontProcess()
+{
+ ProcessSerialNumber processSerialNumber;
+ GetCurrentProcess(&processSerialNumber);
+ SetFrontProcess(&processSerialNumber);
+}
+
+void PluginProcessProxy::setFullscreenWindowIsShowing(bool fullscreenWindowIsShowing)
+{
+ if (m_fullscreenWindowIsShowing == fullscreenWindowIsShowing)
+ return;
+
+ m_fullscreenWindowIsShowing = fullscreenWindowIsShowing;
+ if (m_fullscreenWindowIsShowing)
+ enterFullscreen();
+ else
+ exitFullscreen();
+}
+
+void PluginProcessProxy::enterFullscreen()
+{
+ [NSMenu setMenuBarVisible:NO];
+
+ makePluginProcessTheFrontProcess();
+}
+
+void PluginProcessProxy::exitFullscreen()
+{
+ [NSMenu setMenuBarVisible:YES];
+
+ // If the plug-in host is the current application then we should bring ourselves to the front when it exits full-screen mode.
+
+ ProcessSerialNumber frontProcessSerialNumber;
+ GetFrontProcess(&frontProcessSerialNumber);
+ Boolean isSameProcess = 0;
+
+ ProcessSerialNumber pluginProcessSerialNumber;
+ if (!getPluginProcessSerialNumber(pluginProcessSerialNumber))
+ return;
+
+ SameProcess(&frontProcessSerialNumber, &pluginProcessSerialNumber, &isSameProcess);
+ if (!isSameProcess)
+ return;
+
+ makeUIProcessTheFrontProcess();
+}
+
+void PluginProcessProxy::setModalWindowIsShowing(bool modalWindowIsShowing)
+{
+ if (modalWindowIsShowing == m_modalWindowIsShowing)
+ return;
+
+ m_modalWindowIsShowing = modalWindowIsShowing;
+
+ if (m_modalWindowIsShowing)
+ beginModal();
+ else
+ endModal();
+}
+
+void PluginProcessProxy::beginModal()
+{
+ ASSERT(!m_placeholderWindow);
+ ASSERT(!m_activationObserver);
+
+ m_placeholderWindow.adoptNS([[WKPlaceholderModalWindow alloc] initWithContentRect:NSMakeRect(0, 0, 1, 1) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
+
+ m_activationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSApplicationWillBecomeActiveNotification object:NSApp queue:nil
+ usingBlock:^(NSNotification *){ applicationDidBecomeActive(); }];
+
+ [NSApp runModalForWindow:m_placeholderWindow.get()];
+
+ [m_placeholderWindow.get() orderOut:nil];
+ m_placeholderWindow = nullptr;
+}
+
+void PluginProcessProxy::endModal()
+{
+ ASSERT(m_placeholderWindow);
+ ASSERT(m_activationObserver);
+
+ [[NSNotificationCenter defaultCenter] removeObserver:m_activationObserver.get()];
+ m_activationObserver = nullptr;
+
+ [NSApp stopModal];
+
+ makeUIProcessTheFrontProcess();
+}
+
+void PluginProcessProxy::applicationDidBecomeActive()
+{
+ makePluginProcessTheFrontProcess();
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp b/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp
index 2138131..f695969 100644
--- a/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp
@@ -27,6 +27,7 @@
#include "PluginInfoStore.h"
#include "NetscapePluginModule.h"
+#include <WebCore/PathWalker.h>
#include <shlwapi.h>
using namespace WebCore;
@@ -254,37 +255,11 @@ Vector<String> PluginInfoStore::pluginsDirectories()
return directories;
}
-class PathWalker {
- WTF_MAKE_NONCOPYABLE(PathWalker);
-public:
- PathWalker(const String& directory)
- {
- String pattern = directory + "\\*";
- m_handle = ::FindFirstFileW(pattern.charactersWithNullTermination(), &m_data);
- }
-
- ~PathWalker()
- {
- if (!isValid())
- return;
- ::FindClose(m_handle);
- }
-
- bool isValid() const { return m_handle != INVALID_HANDLE_VALUE; }
- const WIN32_FIND_DATAW& data() const { return m_data; }
-
- bool step() { return ::FindNextFileW(m_handle, &m_data); }
-
-private:
- HANDLE m_handle;
- WIN32_FIND_DATAW m_data;
-};
-
Vector<String> PluginInfoStore::pluginPathsInDirectory(const String& directory)
{
Vector<String> paths;
- PathWalker walker(directory);
+ PathWalker walker(directory, "*");
if (!walker.isValid())
return paths;
@@ -385,6 +360,11 @@ bool PluginInfoStore::shouldUsePlugin(const Plugin& plugin)
return false;
}
+ if (equalIgnoringCase(plugin.info.file, "npwpf.dll")) {
+ // Bug 57119: Microsoft Windows Presentation Foundation (WPF) plug-in complains about missing xpcom.dll
+ return false;
+ }
+
if (plugin.info.name == "Yahoo Application State Plugin") {
// https://bugs.webkit.org/show_bug.cgi?id=26860
// Bug in Yahoo Application State plug-in earlier than 1.0.0.6 leads to heap corruption.