Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Prepend Safari.exe's path to the command-line passed to CreateProcess

Safari expects the first argument in the command-line to be the path to Safari.exe itself.
This is how things get set up when Safari is launched normally (e.g., by Explorer). Safari
thus ignores the first argument when looking for command-line arguments. WebKitLauncherWin
was not including the path to Safari.exe in the command-line, so Safari was ignoring the
first argument that WebKitLauncherWin was trying to pass to it.

Fixes <http://webkit.org/b/56571> First argument passed to WebKit.exe is ignored by Safari

Reviewed by Steve Falkenburg.

* WebKitLauncherWin/WebKitLauncherWin.cpp:
(_tWinMain): Construct a command-line for CreateProcess that first contains a double-quoted
path to Safari.exe, then contains any arguments that were passed to WebKitLauncherWin.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104190 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information...
commit abbcc34e051402a90a90b6c079f27c0d69143bb3 1 parent 2ce145d
aroben@apple.com authored
Showing with 21 additions and 1 deletion.
  1. +18 −0 Tools/ChangeLog
  2. +3 −1 Tools/WebKitLauncherWin/WebKitLauncherWin.cpp
View
18 Tools/ChangeLog
@@ -1,5 +1,23 @@
2012-01-05 Adam Roben <aroben@apple.com>
+ Prepend Safari.exe's path to the command-line passed to CreateProcess
+
+ Safari expects the first argument in the command-line to be the path to Safari.exe itself.
+ This is how things get set up when Safari is launched normally (e.g., by Explorer). Safari
+ thus ignores the first argument when looking for command-line arguments. WebKitLauncherWin
+ was not including the path to Safari.exe in the command-line, so Safari was ignoring the
+ first argument that WebKitLauncherWin was trying to pass to it.
+
+ Fixes <http://webkit.org/b/56571> First argument passed to WebKit.exe is ignored by Safari
+
+ Reviewed by Steve Falkenburg.
+
+ * WebKitLauncherWin/WebKitLauncherWin.cpp:
+ (_tWinMain): Construct a command-line for CreateProcess that first contains a double-quoted
+ path to Safari.exe, then contains any arguments that were passed to WebKitLauncherWin.
+
+2012-01-05 Adam Roben <aroben@apple.com>
+
Stop using explicit memory management in WebKitLauncherWin
We now use stack-allocated STL objects instead.
View
4 Tools/WebKitLauncherWin/WebKitLauncherWin.cpp
@@ -86,11 +86,13 @@ int APIENTRY _tWinMain(HINSTANCE instance, HINSTANCE, LPTSTR commandLine, int)
return 1;
SetEnvironmentVariable(TEXT("WEBKITNIGHTLY"), exePath);
+ tstring finalCommandLine = TEXT('"') + browserExe + TEXT("\" ") + commandLine;
+
// Launch Safari as a child process
STARTUPINFO startupInfo = {0};
startupInfo.cb = sizeof(startupInfo);
PROCESS_INFORMATION processInfo = {0};
- if (!CreateProcess(browserExe.c_str(), commandLine, 0, 0, FALSE, NORMAL_PRIORITY_CLASS | CREATE_UNICODE_ENVIRONMENT, 0, path.c_str(), &startupInfo, &processInfo))
+ if (!CreateProcess(browserExe.c_str(), const_cast<LPTSTR>(finalCommandLine.c_str()), 0, 0, FALSE, NORMAL_PRIORITY_CLASS | CREATE_UNICODE_ENVIRONMENT, 0, path.c_str(), &startupInfo, &processInfo))
MessageBox(0, TEXT("Safari could not be launched. Please make sure you have the latest version of Safari installed and try again. You can download Safari from http://www.apple.com/safari/download"), TEXT("Safari launch failed"), MB_ICONSTOP);
return 0;
Please sign in to comment.
Something went wrong with that request. Please try again.