[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
andersca at apple.com
andersca at apple.com
Wed Dec 22 11:18:24 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit db268862a421fef2ed02ea78f09b5e759f8e2820
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sun Jul 18 01:39:36 2010 +0000
WebKit2: WebKitTestRunner should load the test plug-in
https://bugs.webkit.org/show_bug.cgi?id=42509
Reviewed by Maciej Stachowiak.
* UIProcess/API/C/WKContext.cpp:
(_WKContextSetAdditionalPluginPath):
Add a private function for setting a single additional plug-in path. the WebKit1 SPI that does the
same thing takes an array of paths, but this is good enough for now.
* UIProcess/Plugins/PluginInfoStore.cpp:
(WebKit::PluginInfoStore::setAdditionalPluginPaths):
Set the additional plug-in paths vector and refresh the database.
(WebKit::PluginInfoStore::loadPluginsIfNecessary):
First try to load plug-ins in the additional plug-in paths.
* UIProcess/WebContext.cpp:
(WebKit::WebContext::setAdditionalPluginPath):
Call PluginInfoStore::setAdditionalPluginPaths.
* UIProcess/WebContext.h:
(WebKit::WebContext::pluginInfoStore):
Make the plug-in info store per context instead of having a single shared info store.
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::getPlugins):
(WebKit::WebProcessProxy::getPluginHostConnection):
* UIProcess/WebProcessProxy.h:
Get the plug-in info store from the context.
WebKitTools: * WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
Get the test plug-in path and set it on the context.
Reviewed by Maciej Stachowiak.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::initializeInjectedBundlePath):
Simplify this code by using NSBundle.
(WTR::TestController::testPluginPath):
Return the test plug-in path.
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::testPluginPath):
Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63621 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 8b191c5..e646798 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,38 @@
2010-07-17 Anders Carlsson <andersca at apple.com>
+ Reviewed by Maciej Stachowiak.
+
+ WebKitTestRunner should load the test plug-in
+ https://bugs.webkit.org/show_bug.cgi?id=42509
+
+ * UIProcess/API/C/WKContext.cpp:
+ (_WKContextSetAdditionalPluginPath):
+ Add a private function for setting a single additional plug-in path. the WebKit1 SPI that does the
+ same thing takes an array of paths, but this is good enough for now.
+
+ * UIProcess/Plugins/PluginInfoStore.cpp:
+ (WebKit::PluginInfoStore::setAdditionalPluginPaths):
+ Set the additional plug-in paths vector and refresh the database.
+
+ (WebKit::PluginInfoStore::loadPluginsIfNecessary):
+ First try to load plug-ins in the additional plug-in paths.
+
+ * UIProcess/WebContext.cpp:
+ (WebKit::WebContext::setAdditionalPluginPath):
+ Call PluginInfoStore::setAdditionalPluginPaths.
+
+ * UIProcess/WebContext.h:
+ (WebKit::WebContext::pluginInfoStore):
+ Make the plug-in info store per context instead of having a single shared info store.
+
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::getPlugins):
+ (WebKit::WebProcessProxy::getPluginHostConnection):
+ * UIProcess/WebProcessProxy.h:
+ Get the plug-in info store from the context.
+
+2010-07-17 Anders Carlsson <andersca at apple.com>
+
Reviewed by Dan Bernstein.
Stop all NPStreams before destroying a plug-in
diff --git a/WebKit2/UIProcess/API/C/WKContext.cpp b/WebKit2/UIProcess/API/C/WKContext.cpp
index 7d7416a..7308fee 100644
--- a/WebKit2/UIProcess/API/C/WKContext.cpp
+++ b/WebKit2/UIProcess/API/C/WKContext.cpp
@@ -93,3 +93,8 @@ void WKContextRelease(WKContextRef contextRef)
{
toWK(contextRef)->deref();
}
+
+void _WKContextSetAdditionalPluginPath(WKContextRef contextRef, WKStringRef pluginPath)
+{
+ toWK(contextRef)->setAdditionalPluginPath(toWK(pluginPath));
+}
diff --git a/WebKit2/UIProcess/API/C/WKContextPrivate.h b/WebKit2/UIProcess/API/C/WKContextPrivate.h
index 3156699..c99a140 100644
--- a/WebKit2/UIProcess/API/C/WKContextPrivate.h
+++ b/WebKit2/UIProcess/API/C/WKContextPrivate.h
@@ -44,6 +44,8 @@ WK_EXPORT void WKContextGetStatistics(WKContextRef context, WKContextStatistics*
WK_EXPORT WKContextRef WKContextGetSharedThreadContext();
+WK_EXPORT void _WKContextSetAdditionalPluginPath(WKContextRef context, WKStringRef pluginPath);
+
#ifdef __cplusplus
}
#endif
diff --git a/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp b/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
index b3ad15d..f32b504 100644
--- a/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
+++ b/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
@@ -34,15 +34,15 @@ using namespace WebCore;
namespace WebKit {
-PluginInfoStore& PluginInfoStore::shared()
+PluginInfoStore::PluginInfoStore()
+ : m_pluginListIsUpToDate(false)
{
- DEFINE_STATIC_LOCAL(PluginInfoStore, pluginInfoStore, ());
- return pluginInfoStore;
}
-PluginInfoStore::PluginInfoStore()
- : m_pluginListIsUpToDate(false)
+void PluginInfoStore::setAdditionalPluginPaths(const Vector<WebCore::String>& paths)
{
+ m_additionalPluginPaths = paths;
+ refresh();
}
void PluginInfoStore::refresh()
@@ -57,6 +57,10 @@ void PluginInfoStore::loadPluginsIfNecessary()
m_plugins.clear();
+ // First, load plug-ins from the additional plug-in paths specified.
+ for (size_t i = 0; i < m_additionalPluginPaths.size(); ++i)
+ loadPluginsInDirectory(m_additionalPluginPaths[i]);
+
Vector<String> directories = pluginDirectories();
for (size_t i = 0; i < directories.size(); ++i)
loadPluginsInDirectory(directories[i]);
diff --git a/WebKit2/UIProcess/Plugins/PluginInfoStore.h b/WebKit2/UIProcess/Plugins/PluginInfoStore.h
index d1e2fc7..7b13395 100644
--- a/WebKit2/UIProcess/Plugins/PluginInfoStore.h
+++ b/WebKit2/UIProcess/Plugins/PluginInfoStore.h
@@ -36,8 +36,10 @@ namespace WebKit {
class PluginInfoStore {
public:
- static PluginInfoStore& shared();
-
+ PluginInfoStore();
+
+ void setAdditionalPluginPaths(const Vector<WebCore::String>& paths);
+
void refresh();
void getPlugins(Vector<WebCore::PluginInfo>& plugins);
@@ -58,7 +60,6 @@ public:
Plugin findPlugin(WebCore::String& mimeType, const WebCore::KURL& url);
private:
- PluginInfoStore();
Plugin findPluginForMIMEType(const WebCore::String& mimeType);
Plugin findPluginForExtension(const WebCore::String& extension, WebCore::String& mimeType);
@@ -74,6 +75,7 @@ private:
static bool shouldUsePlugin(const Plugin& plugin, const Vector<Plugin>& loadedPlugins);
static WebCore::String mimeTypeFromExtension(const WebCore::String& extension);
+ Vector<WebCore::String> m_additionalPluginPaths;
Vector<Plugin> m_plugins;
bool m_pluginListIsUpToDate;
};
diff --git a/WebKit2/UIProcess/WebContext.cpp b/WebKit2/UIProcess/WebContext.cpp
index e76b8bd..0d2ea80 100644
--- a/WebKit2/UIProcess/WebContext.cpp
+++ b/WebKit2/UIProcess/WebContext.cpp
@@ -172,4 +172,12 @@ void WebContext::getStatistics(WKContextStatistics* statistics)
(*it)->getStatistics(statistics);
}
+void WebContext::setAdditionalPluginPath(const WebCore::String& pluginPath)
+{
+ Vector<String> pluginPaths;
+ pluginPaths.append(pluginPath);
+
+ m_pluginInfoStore.setAdditionalPluginPaths(pluginPaths);
+}
+
} // namespace WebKit
diff --git a/WebKit2/UIProcess/WebContext.h b/WebKit2/UIProcess/WebContext.h
index 54478eb..08b46f0 100644
--- a/WebKit2/UIProcess/WebContext.h
+++ b/WebKit2/UIProcess/WebContext.h
@@ -26,6 +26,7 @@
#ifndef WebContext_h
#define WebContext_h
+#include "PluginInfoStore.h"
#include "ProcessModel.h"
#include "WebContextInjectedBundleClient.h"
#include <WebCore/PlatformString.h>
@@ -80,6 +81,9 @@ public:
void postMessageToInjectedBundle(WebCore::StringImpl*);
void getStatistics(WKContextStatistics* statistics);
+ void setAdditionalPluginPath(const WebCore::String&);
+
+ PluginInfoStore* pluginInfoStore() { return &m_pluginInfoStore; }
private:
WebContext(ProcessModel, const WebCore::String& injectedBundlePath);
@@ -96,6 +100,8 @@ private:
WebCore::String m_injectedBundlePath;
WebContextInjectedBundleClient m_injectedBundleClient;
+
+ PluginInfoStore m_pluginInfoStore;
};
} // namespace WebKit
diff --git a/WebKit2/UIProcess/WebProcessProxy.cpp b/WebKit2/UIProcess/WebProcessProxy.cpp
index da79393..9101f7b 100644
--- a/WebKit2/UIProcess/WebProcessProxy.cpp
+++ b/WebKit2/UIProcess/WebProcessProxy.cpp
@@ -170,15 +170,15 @@ void WebProcessProxy::forwardMessageToWebContext(const String& message)
void WebProcessProxy::getPlugins(bool refresh, Vector<PluginInfo>& plugins)
{
if (refresh)
- PluginInfoStore::shared().refresh();
- PluginInfoStore::shared().getPlugins(plugins);
+ m_context->pluginInfoStore()->refresh();
+ m_context->pluginInfoStore()->getPlugins(plugins);
}
void WebProcessProxy::getPluginHostConnection(const String& mimeType, const KURL& url, WebCore::String& pluginPath)
{
String newMimeType = mimeType.lower();
- PluginInfoStore::Plugin plugin = PluginInfoStore::shared().findPlugin(newMimeType, url);
+ PluginInfoStore::Plugin plugin = m_context->pluginInfoStore()->findPlugin(newMimeType, url);
if (!plugin.path)
return;
diff --git a/WebKit2/UIProcess/WebProcessProxy.h b/WebKit2/UIProcess/WebProcessProxy.h
index 55435c3..a95085c 100644
--- a/WebKit2/UIProcess/WebProcessProxy.h
+++ b/WebKit2/UIProcess/WebProcessProxy.h
@@ -28,6 +28,7 @@
#include "Connection.h"
#include "PlatformProcessIdentifier.h"
+#include "PluginInfoStore.h"
#include "ProcessLauncher.h"
#include "ProcessModel.h"
#include "ResponsivenessTimer.h"
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 151b3dd..768851c 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,23 @@
+2010-07-17 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::initialize):
+ Get the test plug-in path and set it on the context.
+
+ * WebKitTestRunner/TestController.h:
+ * WebKitTestRunner/mac/TestControllerMac.mm:
+ (WTR::TestController::initializeInjectedBundlePath):
+ Simplify this code by using NSBundle.
+
+ (WTR::TestController::testPluginPath):
+ Return the test plug-in path.
+
+ * WebKitTestRunner/win/TestControllerWin.cpp:
+ (WTR::TestController::testPluginPath):
+ Ditto.
+
2010-07-16 Adam Barth <abarth at webkit.org>
Reviewed by Eric Seidel.
diff --git a/WebKitTools/WebKitTestRunner/TestController.cpp b/WebKitTools/WebKitTestRunner/TestController.cpp
index b5b15d1..914043d 100644
--- a/WebKitTools/WebKitTestRunner/TestController.cpp
+++ b/WebKitTools/WebKitTestRunner/TestController.cpp
@@ -27,6 +27,7 @@
#include "PlatformWebView.h"
#include "TestInvocation.h"
+#include <WebKit2/WKContextPrivate.h>
#include <getopt.h>
namespace WTR {
@@ -104,6 +105,8 @@ void TestController::initialize(int argc, const char *argv[])
};
WKContextSetInjectedBundleClient(m_context.get(), &injectedBundlePathClient);
+ _WKContextSetAdditionalPluginPath(m_context.get(), testPluginPath().get());
+
m_pageNamespace.adopt(WKPageNamespaceCreate(m_context.get()));
m_mainWebView = new PlatformWebView(m_pageNamespace.get());
}
diff --git a/WebKitTools/WebKitTestRunner/TestController.h b/WebKitTools/WebKitTestRunner/TestController.h
index 7ad11fe..96bdec9 100644
--- a/WebKitTools/WebKitTestRunner/TestController.h
+++ b/WebKitTools/WebKitTestRunner/TestController.h
@@ -62,6 +62,7 @@ private:
void runTest(const char* pathOrURL);
void initializeInjectedBundlePath();
+ WKRetainPtr<WKStringRef> testPluginPath();
// WKContextInjectedBundleClient
static void _didRecieveMessageFromInjectedBundle(WKContextRef context, WKStringRef message, const void*);
diff --git a/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm b/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm
index 5957e0e..67cc1f4 100644
--- a/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm
+++ b/WebKitTools/WebKitTestRunner/mac/TestControllerMac.mm
@@ -32,20 +32,13 @@ namespace WTR {
void TestController::initializeInjectedBundlePath()
{
- uint32_t pathLength = 0;
- _NSGetExecutablePath(0, &pathLength);
- char* path = (char*)malloc(pathLength);
- _NSGetExecutablePath(path, &pathLength);
- char* theRealPath = (char*)malloc(pathLength);
- realpath(path, theRealPath);
-
- NSString *pwd = [[NSString stringWithUTF8String:theRealPath] stringByDeletingLastPathComponent];
- NSString *nsBundlePath = [pwd stringByAppendingPathComponent:@"InjectedBundle.bundle"];
-
- free(path);
- free(theRealPath);
-
+ NSString *nsBundlePath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"InjectedBundle.bundle"];
m_injectedBundlePath.adopt(WKStringCreateWithCFString((CFStringRef)nsBundlePath));
}
+WKRetainPtr<WKStringRef> TestController::testPluginPath()
+{
+ return WKRetainPtr<WKStringRef>(AdoptWK, WKStringCreateWithCFString((CFStringRef)[[NSBundle mainBundle] bundlePath]));
+}
+
} // namespace WTR
diff --git a/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp b/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
index ba99451..deb8d42 100644
--- a/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
+++ b/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
@@ -42,4 +42,11 @@ void TestController::initializeInjectedBundlePath()
m_injectedBundlePath.adopt(WKStringCreateWithCFString(bundlePath));
}
+WKRetainPtr<WKStringRef> TestController::testPluginPath()
+{
+ CFStringRef exeContainerPath = CFURLCopyFileSystemPath(CFURLCreateCopyDeletingLastPathComponent(0, CFBundleCopyExecutableURL(CFBundleGetMainBundle())), kCFURLWindowsPathStyle);
+ CFMutableStringRef bundlePath = CFStringCreateMutableCopy(0, 0, exeContainerPath);
+ return WKRetainPtr<WKStringRef>(AdoptWK, WKStringCreateWithCFString(bundlePath));
+}
+
} // namespace WTR
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list