WebKit2 should look for WebKit2WebProcess.exe next to WebKit.dll
authorbweinstein@apple.com <bweinstein@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Sep 2010 20:19:42 +0000 (20:19 +0000)
committerbweinstein@apple.com <bweinstein@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Sep 2010 20:19:42 +0000 (20:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=46209
<rdar://problem/8445639>

Reviewed by Adam Roben.

Find WebKit2WebProcess.exe by getting the full path to WebKit.dll, and then
removing the last path component and replacing it with WebKit2WebProcess.exe.

* UIProcess/Launcher/win/ProcessLauncherWin.cpp:
(WebKit::ProcessLauncher::launchProcess):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@67979 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit2/ChangeLog
WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp

index f129f1e..b756263 100644 (file)
@@ -1,3 +1,17 @@
+2010-09-21  Brian Weinstein  <bweinstein@apple.com>
+
+        Reviewed by Adam Roben.
+
+        WebKit2 should look for WebKit2WebProcess.exe next to WebKit.dll
+        https://bugs.webkit.org/show_bug.cgi?id=46209
+        <rdar://problem/8445639>
+        
+        Find WebKit2WebProcess.exe by getting the full path to WebKit.dll, and then
+        removing the last path component and replacing it with WebKit2WebProcess.exe.
+
+        * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
+        (WebKit::ProcessLauncher::launchProcess):
+
 2010-09-21  Anders Carlsson  <andersca@apple.com>
 
         Reviewed by Adam Roben.
index 22f1e71..755ca40 100644 (file)
 
 #include "Connection.h"
 #include "RunLoop.h"
+#include <shlwapi.h>
 #include <wtf/text/WTFString.h>
 
 #if !defined(NDEBUG) && (!defined(DEBUG_INTERNAL) || defined(DEBUG_ALL))
 const LPCWSTR webProcessName = L"WebKit2WebProcess_debug.exe";
+const LPCWSTR webKitDLLName = L"WebKit_debug.dll";
 #else
 const LPCWSTR webProcessName = L"WebKit2WebProcess.exe";
+const LPCWSTR webKitDLLName = L"WebKit.dll";
 #endif
 
 namespace WebKit {
@@ -48,12 +51,25 @@ void ProcessLauncher::launchProcess()
 
     // Ensure that the child process inherits the client identifier.
     ::SetHandleInformation(clientIdentifier, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
-        
-    Vector<UChar> commandLineVector;
 
-    // FIXME: We would like to pass a full path to the .exe here.
+    // To get the full file path to WebKit2WebProcess.exe, we fild the location of WebKit.dll,
+    // remove the last path component, and then append WebKit2WebProcess(_debug).exe.
+    HMODULE webKitModule = ::GetModuleHandleW(webKitDLLName);
+    ASSERT(webKitModule);
+    if (!webKitModule)
+        return;
+
+    WCHAR pathStr[MAX_PATH];
+    if (!::GetModuleFileNameW(webKitModule, pathStr, _countof(pathStr)))
+        return;
+
+    ::PathRemoveFileSpecW(pathStr);
+    if (!::PathAppendW(pathStr, webProcessName))
+        return;
+
+    String commandLine(pathStr);
 
-    String commandLine(webProcessName);
+    Vector<UChar> commandLineVector;
     append(commandLineVector, commandLine);
     append(commandLineVector, " -mode webprocess");
     append(commandLineVector, " -clientIdentifier ");