Changeset 64744 in webkit
- Timestamp:
- Aug 5, 2010 7:02:15 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r64739 r64744 1 2010-08-04 Adam Roben <aroben@apple.com> 2 3 Teach WebKit2 how to load the TestNetscapePlugin 4 5 Fixes <http://webkit.org/b/43513> WebKitTestRunner on Windows fails to 6 load TestNetscapePlugin 7 8 Reviewed by Jon Honeycutt. 9 10 * Platform/Module.cpp: 11 (WebKit::Module::Module): Initialize m_module on Windows. 12 13 * Platform/Module.h: Added m_module on Windows. 14 15 * Platform/win/ModuleWin.cpp: 16 (WebKit::Module::load): Implemented using ::LoadLibraryExW. 17 (WebKit::Module::unload): Implemented using ::FreeLibrary. 18 (WebKit::Module::platformFunctionPointer): Implemented using 19 ::GetProcAddress. 20 21 * Platform/win/RunLoopWin.cpp: 22 (RunLoop::TimerBase::timerFired): Kill the native timer before calling 23 the fired callback. This makes all our timers non-repeating, but 24 that's all we need currently. 25 (RunLoop::TimerBase::start): Added an assertion to help us figure out 26 when we need to implement repeating timers. Also fixed a typo. 27 28 * UIProcess/Plugins/win/PluginInfoStoreWin.cpp: 29 (WebKit::PluginInfoStore::pluginsDirectories): Added a FIXME. 30 31 (WebKit::PathWalker::PathWalker): 32 (WebKit::PathWalker::~PathWalker): 33 (WebKit::PathWalker::isValid): 34 (WebKit::PathWalker::data): 35 (WebKit::PathWalker::step): 36 Added. This class wraps the ::FindFirstFile/::FindNextFile APIs. 37 38 (WebKit::PluginInfoStore::pluginPathsInDirectory): Implemented by 39 porting logic from 40 WebCore::PluginDatabase::getPluginPathsInDirectories. 41 (WebKit::getVersionInfo): Copied from PluginDatabaseWin.cpp. 42 (WebKit::PluginInfoStore::getPluginInfo): Implemented by porting logic 43 from WebCore::PluginPackage::fetchInfo. 44 (WebKit::PluginInfoStore::shouldUsePlugin): Changed to always return 45 true for now. Added a FIXME about implementing this for real. 46 47 * UIProcess/WebProcessProxy.cpp: 48 (WebKit::WebProcessProxy::didReceiveSyncMessage): 49 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 50 (WebKit::WebFrameLoaderClient::createPlugin): 51 Removed PLATFORM(MAC) guards around plugin code. 52 53 * win/WebKit2.vcproj: Let VS sort the file. 54 1 55 2010-08-05 Antti Koivisto <koivisto@iki.fi> 2 56 -
trunk/WebKit2/Platform/Module.cpp
r64663 r64744 32 32 Module::Module(const String& path) 33 33 : m_path(path) 34 #if PLATFORM(WIN) 35 , m_module(0) 36 #endif 34 37 { 35 38 } -
trunk/WebKit2/Platform/Module.h
r64663 r64744 54 54 #if PLATFORM(MAC) 55 55 RetainPtr<CFBundleRef> m_bundle; 56 #elif PLATFORM(WIN) 57 HMODULE m_module; 56 58 #endif 57 59 }; -
trunk/WebKit2/Platform/win/ModuleWin.cpp
r64663 r64744 26 26 #include "Module.h" 27 27 28 #include "NotImplemented.h"28 #include <shlwapi.h> 29 29 30 30 namespace WebKit { … … 32 32 bool Module::load() 33 33 { 34 notImplemented(); 35 return false; 34 ASSERT(!::PathIsRelativeW(m_path.charactersWithNullTermination())); 35 m_module = ::LoadLibraryExW(m_path.charactersWithNullTermination(), 0, LOAD_WITH_ALTERED_SEARCH_PATH); 36 return m_module; 36 37 } 37 38 38 39 void Module::unload() 39 40 { 40 notImplemented(); 41 if (!m_module) 42 return; 43 ::FreeLibrary(m_module); 44 m_module = 0; 41 45 } 42 46 43 47 void* Module::platformFunctionPointer(const char* functionName) const 44 48 { 45 notImplemented(); 46 return 0; 49 if (!m_module) 50 return 0; 51 52 return ::GetProcAddress(m_module, functionName); 47 53 } 48 54 49 } 55 } // namespace WebKit -
trunk/WebKit2/Platform/win/RunLoopWin.cpp
r57739 r64744 122 122 TimerBase* timer = it->second; 123 123 124 // FIMXE: Support repeating timers. 125 126 ::KillTimer(runLoop->m_runLoopMessageWindow, ID); 124 127 timer->fired(); 125 128 } … … 142 145 } 143 146 144 void RunLoop::TimerBase::start(double nextFireInterval, double /*repeatInterval*/)147 void RunLoop::TimerBase::start(double nextFireInterval, double repeatInterval) 145 148 { 146 // FIMXE: Support repeating timers. 149 // FIXME: Support repeating timers. 150 ASSERT_ARG(repeatInterval, !repeatInterval); 147 151 148 152 m_runLoop->m_activeTimers.set(m_ID, this); -
trunk/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp
r64287 r64744 27 27 28 28 #include "NotImplemented.h" 29 #include <WebCore/FileSystem.h> 30 #include <wtf/OwnArrayPtr.h> 29 31 30 32 using namespace WebCore; … … 34 36 Vector<String> PluginInfoStore::pluginsDirectories() 35 37 { 38 // FIXME: <http://webkit.org/b/43510> Migrate logic here from PluginDatabase::defaultPluginDirectories. 36 39 notImplemented(); 37 40 return Vector<String>(); 38 41 } 39 42 43 class PathWalker : public Noncopyable { 44 public: 45 PathWalker(const String& directory) 46 { 47 String pattern = directory + "\\*"; 48 m_handle = ::FindFirstFileW(pattern.charactersWithNullTermination(), &m_data); 49 } 50 51 ~PathWalker() 52 { 53 if (!isValid()) 54 return; 55 ::FindClose(m_handle); 56 } 57 58 bool isValid() const { return m_handle != INVALID_HANDLE_VALUE; } 59 const WIN32_FIND_DATAW& data() const { return m_data; } 60 61 bool step() { return ::FindNextFileW(m_handle, &m_data); } 62 63 private: 64 HANDLE m_handle; 65 WIN32_FIND_DATAW m_data; 66 }; 67 40 68 Vector<String> PluginInfoStore::pluginPathsInDirectory(const String& directory) 41 69 { 42 notImplemented(); 43 return Vector<String>(); 70 Vector<String> paths; 71 72 PathWalker walker(directory); 73 if (!walker.isValid()) 74 return paths; 75 76 do { 77 if (walker.data().dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) 78 continue; 79 80 String filename = walker.data().cFileName; 81 if ((!filename.startsWith("np", false) || !filename.endsWith("dll", false)) && (!equalIgnoringCase(filename, "Plugin.dll") || !directory.endsWith("Shockwave 10", false))) 82 continue; 83 84 paths.append(directory + "\\" + filename); 85 } while (walker.step()); 86 87 return paths; 88 } 89 90 static String getVersionInfo(const LPVOID versionInfoData, const String& info) 91 { 92 LPVOID buffer; 93 UINT bufferLength; 94 String subInfo = "\\StringfileInfo\\040904E4\\" + info; 95 if (!::VerQueryValueW(versionInfoData, const_cast<UChar*>(subInfo.charactersWithNullTermination()), &buffer, &bufferLength) || !bufferLength) 96 return String(); 97 98 // Subtract 1 from the length; we don't want the trailing null character. 99 return String(reinterpret_cast<UChar*>(buffer), bufferLength - 1); 44 100 } 45 101 46 102 bool PluginInfoStore::getPluginInfo(const String& pluginPath, Plugin& plugin) 47 103 { 48 notImplemented(); 49 return false; 104 String pathCopy = pluginPath; 105 DWORD versionInfoSize = ::GetFileVersionInfoSizeW(pathCopy.charactersWithNullTermination(), 0); 106 if (!versionInfoSize) 107 return false; 108 109 OwnArrayPtr<char> versionInfoData(new char[versionInfoSize]); 110 if (!::GetFileVersionInfoW(pathCopy.charactersWithNullTermination(), 0, versionInfoSize, versionInfoData.get())) 111 return false; 112 113 String name = getVersionInfo(versionInfoData.get(), "ProductName"); 114 String description = getVersionInfo(versionInfoData.get(), "FileDescription"); 115 if (name.isNull() || description.isNull()) 116 return false; 117 118 Vector<String> types; 119 getVersionInfo(versionInfoData.get(), "MIMEType").split('|', types); 120 Vector<String> extensionLists; 121 getVersionInfo(versionInfoData.get(), "FileExtents").split('|', extensionLists); 122 Vector<String> descriptions; 123 getVersionInfo(versionInfoData.get(), "FileOpenName").split('|', descriptions); 124 125 Vector<MimeClassInfo> mimes(types.size()); 126 for (size_t i = 0; i < types.size(); i++) { 127 String type = types[i].lower(); 128 String description = i < descriptions.size() ? descriptions[i] : ""; 129 String extensionList = i < extensionLists.size() ? extensionLists[i] : ""; 130 131 Vector<String> extensionsVector; 132 extensionList.split(',', extensionsVector); 133 134 // Get rid of the extension list that may be at the end of the description string. 135 int pos = description.find("(*"); 136 if (pos != -1) { 137 // There might be a space that we need to get rid of. 138 if (pos > 1 && description[pos - 1] == ' ') 139 pos--; 140 description = description.left(pos); 141 } 142 143 mimes[i].type = type; 144 mimes[i].desc = description; 145 mimes[i].extensions.swap(extensionsVector); 146 } 147 148 plugin.path = pluginPath; 149 plugin.info.desc = description; 150 plugin.info.name = name; 151 plugin.info.file = pathGetFileName(pluginPath); 152 plugin.info.mimes.swap(mimes); 153 return true; 50 154 } 51 155 52 156 bool PluginInfoStore::shouldUsePlugin(const Plugin& plugin, const Vector<Plugin>& loadedPlugins) 53 157 { 158 // FIXME: <http://webkit.org/b/43509> Migrate logic here from 159 // PluginDatabase::getPluginPathsInDirectories and PluginPackage::isPluginBlacklisted. 54 160 notImplemented(); 55 return false;161 return true; 56 162 } 57 163 -
trunk/WebKit2/UIProcess/WebProcessProxy.cpp
r64396 r64744 338 338 339 339 case WebProcessProxyMessage::GetPluginHostConnection: { 340 #if PLATFORM(MAC)341 340 String mimeType; 342 341 String urlString; … … 348 347 getPluginHostConnection(mimeType, KURL(ParsedURLString, urlString), pluginPath); 349 348 reply->encode(CoreIPC::In(pluginPath)); 350 #endif351 349 break; 352 350 } -
trunk/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r64494 r64744 29 29 #include "NotImplemented.h" 30 30 31 #if PLATFORM(MAC)32 31 #include "NetscapePlugin.h" 33 #endif34 35 32 #include "PluginView.h" 36 33 #include "WebCoreArgumentCoders.h" … … 837 834 return 0; 838 835 839 // FIXME: This is Mac specific now because Windows doesn't have the necessary parts of NetscapePluginModule implemented.840 #if PLATFORM(MAC)841 836 RefPtr<NetscapePluginModule> pluginModule = NetscapePluginModule::getOrCreate(pluginPath); 842 837 if (!pluginModule) … … 852 847 RefPtr<Plugin> plugin = NetscapePlugin::create(pluginModule.release()); 853 848 return PluginView::create(pluginElement, plugin.release(), parameters); 854 #else855 return 0;856 #endif857 849 } 858 850 -
trunk/WebKit2/win/WebKit2.vcproj
r64688 r64744 1342 1342 > 1343 1343 <File 1344 RelativePath="..\Platform\Module.cpp" 1345 > 1346 </File> 1347 <File 1348 RelativePath="..\Platform\Module.h" 1349 > 1350 </File> 1351 <File 1344 1352 RelativePath="..\Platform\PlatformProcessIdentifier.h" 1345 >1346 </File>1347 <File1348 RelativePath="..\Platform\Module.cpp"1349 >1350 </File>1351 <File1352 RelativePath="..\Platform\Module.h"1353 1353 > 1354 1354 </File> -
trunk/WebKitTools/ChangeLog
r64743 r64744 1 2010-08-04 Adam Roben <aroben@apple.com> 2 3 Fix the path to TestNetscapePlugin's directory on Windows 4 5 Fixes <http://webkit.org/b/43513> WebKitTestRunner on Windows fails to 6 load TestNetscapePlugin 7 8 Reviewed by Jon Honeycutt. 9 10 * WebKitTestRunner/win/TestControllerWin.cpp: 11 (WTR::TestController::initializeTestPluginDirectory): 12 TestNetscapePlugin is in a TestNetscapePlugin[_Debug] directory that's 13 next to WebKitTestRunner.exe. Previously we were passing the directory 14 that contains WebKitTestRunner.exe. Also fixed some leaks. 15 1 16 2010-08-05 Kenichi Ishibashi <bashi@google.com> 2 17 -
trunk/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
r64286 r64744 29 29 #include <io.h> 30 30 #include <WebKit2/WKStringCF.h> 31 #include <wtf/RetainPtr.h> 31 32 32 33 namespace WTR { 34 35 #if !defined(NDEBUG) && (!defined(DEBUG_INTERNAL) || defined(DEBUG_ALL)) 36 const LPWSTR testPluginDirectoryName = L"TestNetscapePlugin_Debug"; 37 #else 38 const LPWSTR testPluginDirectoryName = L"TestNetscapePlugin"; 39 #endif 33 40 34 41 void TestController::platformInitialize() … … 53 60 void TestController::initializeTestPluginDirectory() 54 61 { 55 CFStringRef exeContainerPath = CFURLCopyFileSystemPath(CFURLCreateCopyDeletingLastPathComponent(0, CFBundleCopyExecutableURL(CFBundleGetMainBundle())), kCFURLWindowsPathStyle); 56 CFMutableStringRef bundlePath = CFStringCreateMutableCopy(0, 0, exeContainerPath); 57 m_testPluginDirectory.adopt(WKStringCreateWithCFString(bundlePath)); 62 RetainPtr<CFURLRef> bundleURL(AdoptCF, CFBundleCopyExecutableURL(CFBundleGetMainBundle())); 63 RetainPtr<CFURLRef> bundleDirectoryURL(AdoptCF, CFURLCreateCopyDeletingLastPathComponent(0, bundleURL.get())); 64 RetainPtr<CFStringRef> testPluginDirectoryNameString(AdoptCF, CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(testPluginDirectoryName), wcslen(testPluginDirectoryName))); 65 RetainPtr<CFURLRef> testPluginDirectoryURL(AdoptCF, CFURLCreateCopyAppendingPathComponent(0, bundleDirectoryURL.get(), testPluginDirectoryNameString.get(), true)); 66 RetainPtr<CFStringRef> testPluginDirectoryPath(AdoptCF, CFURLCopyFileSystemPath(testPluginDirectoryURL.get(), kCFURLWindowsPathStyle)); 67 m_testPluginDirectory.adopt(WKStringCreateWithCFString(testPluginDirectoryPath.get())); 58 68 } 59 69
Note: See TracChangeset
for help on using the changeset viewer.