[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

aroben at apple.com aroben at apple.com
Wed Dec 22 11:44:23 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 8e98a39b59c8ab1073b1ea93eeded19d7abb89b4
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 5 14:02:15 2010 +0000

    Get WebKitTestRunner loading TestNetscapePlugin on Windows
    
    Fixes <http://webkit.org/b/43513> WebKitTestRunner on Windows fails to
    load TestNetscapePlugin
    
    Reviewed by Jon Honeycutt.
    
    WebKit2:
    
    Teach WebKit2 how to load the TestNetscapePlugin
    
    * Platform/Module.cpp:
    (WebKit::Module::Module): Initialize m_module on Windows.
    
    * Platform/Module.h: Added m_module on Windows.
    
    * Platform/win/ModuleWin.cpp:
    (WebKit::Module::load): Implemented using ::LoadLibraryExW.
    (WebKit::Module::unload): Implemented using ::FreeLibrary.
    (WebKit::Module::platformFunctionPointer): Implemented using
    ::GetProcAddress.
    
    * Platform/win/RunLoopWin.cpp:
    (RunLoop::TimerBase::timerFired): Kill the native timer before calling
    the fired callback. This makes all our timers non-repeating, but
    that's all we need currently.
    (RunLoop::TimerBase::start): Added an assertion to help us figure out
    when we need to implement repeating timers. Also fixed a typo.
    
    * UIProcess/Plugins/win/PluginInfoStoreWin.cpp:
    (WebKit::PluginInfoStore::pluginsDirectories): Added a FIXME.
    
    (WebKit::PathWalker::PathWalker):
    (WebKit::PathWalker::~PathWalker):
    (WebKit::PathWalker::isValid):
    (WebKit::PathWalker::data):
    (WebKit::PathWalker::step):
    Added. This class wraps the ::FindFirstFile/::FindNextFile APIs.
    
    (WebKit::PluginInfoStore::pluginPathsInDirectory): Implemented by
    porting logic from
    WebCore::PluginDatabase::getPluginPathsInDirectories.
    (WebKit::getVersionInfo): Copied from PluginDatabaseWin.cpp.
    (WebKit::PluginInfoStore::getPluginInfo): Implemented by porting logic
    from WebCore::PluginPackage::fetchInfo.
    (WebKit::PluginInfoStore::shouldUsePlugin): Changed to always return
    true for now. Added a FIXME about implementing this for real.
    
    * UIProcess/WebProcessProxy.cpp:
    (WebKit::WebProcessProxy::didReceiveSyncMessage):
    * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
    (WebKit::WebFrameLoaderClient::createPlugin):
    Removed PLATFORM(MAC) guards around plugin code.
    
    * win/WebKit2.vcproj: Let VS sort the file.
    
    WebKitTools:
    
    Fix the path to TestNetscapePlugin's directory on Windows
    
    * WebKitTestRunner/win/TestControllerWin.cpp:
    (WTR::TestController::initializeTestPluginDirectory):
    TestNetscapePlugin is in a TestNetscapePlugin[_Debug] directory that's
    next to WebKitTestRunner.exe. Previously we were passing the directory
    that contains WebKitTestRunner.exe. Also fixed some leaks.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64744 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 61bc138..44da029 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,57 @@
+2010-08-04  Adam Roben  <aroben at apple.com>
+
+        Teach WebKit2 how to load the TestNetscapePlugin
+
+        Fixes <http://webkit.org/b/43513> WebKitTestRunner on Windows fails to
+        load TestNetscapePlugin
+
+        Reviewed by Jon Honeycutt.
+
+        * Platform/Module.cpp:
+        (WebKit::Module::Module): Initialize m_module on Windows.
+
+        * Platform/Module.h: Added m_module on Windows.
+
+        * Platform/win/ModuleWin.cpp:
+        (WebKit::Module::load): Implemented using ::LoadLibraryExW.
+        (WebKit::Module::unload): Implemented using ::FreeLibrary.
+        (WebKit::Module::platformFunctionPointer): Implemented using
+        ::GetProcAddress.
+
+        * Platform/win/RunLoopWin.cpp:
+        (RunLoop::TimerBase::timerFired): Kill the native timer before calling
+        the fired callback. This makes all our timers non-repeating, but
+        that's all we need currently.
+        (RunLoop::TimerBase::start): Added an assertion to help us figure out
+        when we need to implement repeating timers. Also fixed a typo.
+
+        * UIProcess/Plugins/win/PluginInfoStoreWin.cpp:
+        (WebKit::PluginInfoStore::pluginsDirectories): Added a FIXME.
+
+        (WebKit::PathWalker::PathWalker):
+        (WebKit::PathWalker::~PathWalker):
+        (WebKit::PathWalker::isValid):
+        (WebKit::PathWalker::data):
+        (WebKit::PathWalker::step):
+        Added. This class wraps the ::FindFirstFile/::FindNextFile APIs.
+
+        (WebKit::PluginInfoStore::pluginPathsInDirectory): Implemented by
+        porting logic from
+        WebCore::PluginDatabase::getPluginPathsInDirectories.
+        (WebKit::getVersionInfo): Copied from PluginDatabaseWin.cpp.
+        (WebKit::PluginInfoStore::getPluginInfo): Implemented by porting logic
+        from WebCore::PluginPackage::fetchInfo.
+        (WebKit::PluginInfoStore::shouldUsePlugin): Changed to always return
+        true for now. Added a FIXME about implementing this for real.
+
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::didReceiveSyncMessage):
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::createPlugin):
+        Removed PLATFORM(MAC) guards around plugin code.
+
+        * win/WebKit2.vcproj: Let VS sort the file.
+
 2010-08-05  Antti Koivisto  <koivisto at iki.fi>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKit2/Platform/Module.cpp b/WebKit2/Platform/Module.cpp
index 92fdd47..a39833d 100644
--- a/WebKit2/Platform/Module.cpp
+++ b/WebKit2/Platform/Module.cpp
@@ -31,6 +31,9 @@ namespace WebKit {
 
 Module::Module(const String& path)
     : m_path(path)
+#if PLATFORM(WIN)
+    , m_module(0)
+#endif
 {
 }
 
diff --git a/WebKit2/Platform/Module.h b/WebKit2/Platform/Module.h
index 33bcf43..1143d35 100644
--- a/WebKit2/Platform/Module.h
+++ b/WebKit2/Platform/Module.h
@@ -53,6 +53,8 @@ private:
     WebCore::String m_path;
 #if PLATFORM(MAC)
     RetainPtr<CFBundleRef> m_bundle;
+#elif PLATFORM(WIN)
+    HMODULE m_module;
 #endif
 };
 
diff --git a/WebKit2/Platform/win/ModuleWin.cpp b/WebKit2/Platform/win/ModuleWin.cpp
index 53bee1b..2c2250d 100644
--- a/WebKit2/Platform/win/ModuleWin.cpp
+++ b/WebKit2/Platform/win/ModuleWin.cpp
@@ -25,25 +25,31 @@
 
 #include "Module.h"
 
-#include "NotImplemented.h"
+#include <shlwapi.h>
 
 namespace WebKit {
 
 bool Module::load()
 {
-    notImplemented();
-    return false;
+    ASSERT(!::PathIsRelativeW(m_path.charactersWithNullTermination()));
+    m_module = ::LoadLibraryExW(m_path.charactersWithNullTermination(), 0, LOAD_WITH_ALTERED_SEARCH_PATH);
+    return m_module;
 }
 
 void Module::unload()
 {
-    notImplemented();
+    if (!m_module)
+        return;
+    ::FreeLibrary(m_module);
+    m_module = 0;
 }
 
 void* Module::platformFunctionPointer(const char* functionName) const
 {
-    notImplemented();
-    return 0;
-}
+    if (!m_module)
+        return 0;
 
+    return ::GetProcAddress(m_module, functionName);
 }
+
+} // namespace WebKit
diff --git a/WebKit2/Platform/win/RunLoopWin.cpp b/WebKit2/Platform/win/RunLoopWin.cpp
index baafbf3..be1cae8 100644
--- a/WebKit2/Platform/win/RunLoopWin.cpp
+++ b/WebKit2/Platform/win/RunLoopWin.cpp
@@ -121,6 +121,9 @@ void RunLoop::TimerBase::timerFired(RunLoop* runLoop, uint64_t ID)
     ASSERT(it != runLoop->m_activeTimers.end());
     TimerBase* timer = it->second;
 
+    // FIMXE: Support repeating timers.
+
+    ::KillTimer(runLoop->m_runLoopMessageWindow, ID);
     timer->fired();
 }
 
@@ -141,9 +144,10 @@ RunLoop::TimerBase::~TimerBase()
     stop();
 }
 
-void RunLoop::TimerBase::start(double nextFireInterval, double /*repeatInterval*/)
+void RunLoop::TimerBase::start(double nextFireInterval, double repeatInterval)
 {
-    // FIMXE: Support repeating timers.
+    // FIXME: Support repeating timers.
+    ASSERT_ARG(repeatInterval, !repeatInterval);
 
     m_runLoop->m_activeTimers.set(m_ID, this);
     ::SetTimer(m_runLoop->m_runLoopMessageWindow, m_ID, nextFireInterval, 0);
diff --git a/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp b/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp
index 2b10123..852d76f 100644
--- a/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp
+++ b/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp
@@ -26,6 +26,8 @@
 #include "PluginInfoStore.h"
 
 #include "NotImplemented.h"
+#include <WebCore/FileSystem.h>
+#include <wtf/OwnArrayPtr.h>
 
 using namespace WebCore;
 
@@ -33,26 +35,130 @@ namespace WebKit {
 
 Vector<String> PluginInfoStore::pluginsDirectories()
 {
+    // FIXME: <http://webkit.org/b/43510> Migrate logic here from PluginDatabase::defaultPluginDirectories.
     notImplemented();
     return Vector<String>();
 }
 
+class PathWalker : public Noncopyable {
+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)
 {
-    notImplemented();
-    return Vector<String>();
+    Vector<String> paths;
+
+    PathWalker walker(directory);
+    if (!walker.isValid())
+        return paths;
+
+    do {
+        if (walker.data().dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+            continue;
+
+        String filename = walker.data().cFileName;
+        if ((!filename.startsWith("np", false) || !filename.endsWith("dll", false)) && (!equalIgnoringCase(filename, "Plugin.dll") || !directory.endsWith("Shockwave 10", false)))
+            continue;
+
+        paths.append(directory + "\\" + filename);
+    } while (walker.step());
+
+    return paths;
+}
+
+static String getVersionInfo(const LPVOID versionInfoData, const String& info)
+{
+    LPVOID buffer;
+    UINT bufferLength;
+    String subInfo = "\\StringfileInfo\\040904E4\\" + info;
+    if (!::VerQueryValueW(versionInfoData, const_cast<UChar*>(subInfo.charactersWithNullTermination()), &buffer, &bufferLength) || !bufferLength)
+        return String();
+
+    // Subtract 1 from the length; we don't want the trailing null character.
+    return String(reinterpret_cast<UChar*>(buffer), bufferLength - 1);
 }
 
 bool PluginInfoStore::getPluginInfo(const String& pluginPath, Plugin& plugin)
 {
-    notImplemented();
-    return false;
+    String pathCopy = pluginPath;
+    DWORD versionInfoSize = ::GetFileVersionInfoSizeW(pathCopy.charactersWithNullTermination(), 0);
+    if (!versionInfoSize)
+        return false;
+
+    OwnArrayPtr<char> versionInfoData(new char[versionInfoSize]);
+    if (!::GetFileVersionInfoW(pathCopy.charactersWithNullTermination(), 0, versionInfoSize, versionInfoData.get()))
+        return false;
+
+    String name = getVersionInfo(versionInfoData.get(), "ProductName");
+    String description = getVersionInfo(versionInfoData.get(), "FileDescription");
+    if (name.isNull() || description.isNull())
+        return false;
+
+    Vector<String> types;
+    getVersionInfo(versionInfoData.get(), "MIMEType").split('|', types);
+    Vector<String> extensionLists;
+    getVersionInfo(versionInfoData.get(), "FileExtents").split('|', extensionLists);
+    Vector<String> descriptions;
+    getVersionInfo(versionInfoData.get(), "FileOpenName").split('|', descriptions);
+
+    Vector<MimeClassInfo> mimes(types.size());
+    for (size_t i = 0; i < types.size(); i++) {
+        String type = types[i].lower();
+        String description = i < descriptions.size() ? descriptions[i] : "";
+        String extensionList = i < extensionLists.size() ? extensionLists[i] : "";
+
+        Vector<String> extensionsVector;
+        extensionList.split(',', extensionsVector);
+
+        // Get rid of the extension list that may be at the end of the description string.
+        int pos = description.find("(*");
+        if (pos != -1) {
+            // There might be a space that we need to get rid of.
+            if (pos > 1 && description[pos - 1] == ' ')
+                pos--;
+            description = description.left(pos);
+        }
+
+        mimes[i].type = type;
+        mimes[i].desc = description;
+        mimes[i].extensions.swap(extensionsVector);
+    }
+
+    plugin.path = pluginPath;
+    plugin.info.desc = description;
+    plugin.info.name = name;
+    plugin.info.file = pathGetFileName(pluginPath);
+    plugin.info.mimes.swap(mimes);
+    return true;
 }
 
 bool PluginInfoStore::shouldUsePlugin(const Plugin& plugin, const Vector<Plugin>& loadedPlugins)
 {
+    // FIXME: <http://webkit.org/b/43509> Migrate logic here from
+    // PluginDatabase::getPluginPathsInDirectories and PluginPackage::isPluginBlacklisted.
     notImplemented();
-    return false;
+    return true;
 }
 
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebProcessProxy.cpp b/WebKit2/UIProcess/WebProcessProxy.cpp
index 5fa82db..63b534c 100644
--- a/WebKit2/UIProcess/WebProcessProxy.cpp
+++ b/WebKit2/UIProcess/WebProcessProxy.cpp
@@ -337,7 +337,6 @@ void WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, Cor
             }
 
             case WebProcessProxyMessage::GetPluginHostConnection: {
-#if PLATFORM(MAC)
                 String mimeType;
                 String urlString;
                 
@@ -347,7 +346,6 @@ void WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, Cor
                 String pluginPath;
                 getPluginHostConnection(mimeType, KURL(ParsedURLString, urlString), pluginPath);
                 reply->encode(CoreIPC::In(pluginPath));
-#endif
                 break;
             }
 
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
index 79fb2e8..16e839d 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -28,10 +28,7 @@
 #define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
 #include "NotImplemented.h"
 
-#if PLATFORM(MAC)
 #include "NetscapePlugin.h"
-#endif
-
 #include "PluginView.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebErrors.h"
@@ -836,8 +833,6 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize&, HTMLPlugIn
     if (pluginPath.isNull())
         return 0;
 
-    // FIXME: This is Mac specific now because Windows doesn't have the necessary parts of NetscapePluginModule implemented.
-#if PLATFORM(MAC)
     RefPtr<NetscapePluginModule> pluginModule = NetscapePluginModule::getOrCreate(pluginPath);
     if (!pluginModule)
         return 0;
@@ -851,9 +846,6 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize&, HTMLPlugIn
 
     RefPtr<Plugin> plugin = NetscapePlugin::create(pluginModule.release());
     return PluginView::create(pluginElement, plugin.release(), parameters);
-#else
-    return 0;
-#endif
 }
 
 void WebFrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget)
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index 1963be9..14c1b9d 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -1341,15 +1341,15 @@
 			Name="Platform"
 			>
 			<File
-				RelativePath="..\Platform\PlatformProcessIdentifier.h"
+				RelativePath="..\Platform\Module.cpp"
 				>
 			</File>
 			<File
-				RelativePath="..\Platform\Module.cpp"
+				RelativePath="..\Platform\Module.h"
 				>
 			</File>
 			<File
-				RelativePath="..\Platform\Module.h"
+				RelativePath="..\Platform\PlatformProcessIdentifier.h"
 				>
 			</File>
 			<File
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 2366d7c..8897dc9 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,18 @@
+2010-08-04  Adam Roben  <aroben at apple.com>
+
+        Fix the path to TestNetscapePlugin's directory on Windows
+
+        Fixes <http://webkit.org/b/43513> WebKitTestRunner on Windows fails to
+        load TestNetscapePlugin
+
+        Reviewed by Jon Honeycutt.
+
+        * WebKitTestRunner/win/TestControllerWin.cpp:
+        (WTR::TestController::initializeTestPluginDirectory):
+        TestNetscapePlugin is in a TestNetscapePlugin[_Debug] directory that's
+        next to WebKitTestRunner.exe. Previously we were passing the directory
+        that contains WebKitTestRunner.exe. Also fixed some leaks.
+
 2010-08-05  Kenichi Ishibashi  <bashi at google.com>
 
         Reviewed by Shinichiro Hamaji.
diff --git a/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp b/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
index 9bec373..176ddb4 100644
--- a/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
+++ b/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
@@ -28,9 +28,16 @@
 #include <fcntl.h>
 #include <io.h>
 #include <WebKit2/WKStringCF.h>
+#include <wtf/RetainPtr.h>
 
 namespace WTR {
 
+#if !defined(NDEBUG) && (!defined(DEBUG_INTERNAL) || defined(DEBUG_ALL))
+const LPWSTR testPluginDirectoryName = L"TestNetscapePlugin_Debug";
+#else
+const LPWSTR testPluginDirectoryName = L"TestNetscapePlugin";
+#endif
+
 void TestController::platformInitialize()
 {
     _setmode(1, _O_BINARY);
@@ -52,9 +59,12 @@ void TestController::initializeInjectedBundlePath()
 
 void TestController::initializeTestPluginDirectory()
 {
-    CFStringRef exeContainerPath = CFURLCopyFileSystemPath(CFURLCreateCopyDeletingLastPathComponent(0, CFBundleCopyExecutableURL(CFBundleGetMainBundle())), kCFURLWindowsPathStyle);
-    CFMutableStringRef bundlePath = CFStringCreateMutableCopy(0, 0, exeContainerPath);
-    m_testPluginDirectory.adopt(WKStringCreateWithCFString(bundlePath));
+    RetainPtr<CFURLRef> bundleURL(AdoptCF, CFBundleCopyExecutableURL(CFBundleGetMainBundle()));
+    RetainPtr<CFURLRef> bundleDirectoryURL(AdoptCF, CFURLCreateCopyDeletingLastPathComponent(0, bundleURL.get()));
+    RetainPtr<CFStringRef> testPluginDirectoryNameString(AdoptCF, CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(testPluginDirectoryName), wcslen(testPluginDirectoryName)));
+    RetainPtr<CFURLRef> testPluginDirectoryURL(AdoptCF, CFURLCreateCopyAppendingPathComponent(0, bundleDirectoryURL.get(), testPluginDirectoryNameString.get(), true));
+    RetainPtr<CFStringRef> testPluginDirectoryPath(AdoptCF, CFURLCopyFileSystemPath(testPluginDirectoryURL.get(), kCFURLWindowsPathStyle));
+    m_testPluginDirectory.adopt(WKStringCreateWithCFString(testPluginDirectoryPath.get()));
 }
 
 } // namespace WTR

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list