Skip to content

Commit 832520a

Browse files
Alex Christensenwebkit-commit-queue
authored andcommitted
Improved WinLauncher.
https://bugs.webkit.org/show_bug.cgi?id=122536 Patch by Alex Christensen <achristensen@webkit.org> on 2013-10-08 Reviewed by Brent Fulgham. Source/WebCore: * platform/network/curl/ResourceHandleManager.cpp: (WebCore::cookieJarPath): Put cookies.dat into the AppData directory on Windows. Tools: * WinLauncher/PrintWebUIDelegate.cpp: (PrintWebUIDelegate::runJavaScriptAlertPanelWithMessage): Added. (PrintWebUIDelegate::runJavaScriptConfirmPanelWithMessage): Added. * WinLauncher/PrintWebUIDelegate.h: Removed stubs. * WinLauncher/WinLauncher.cpp: (createCrashReport): Use the executable name instead of "WinLauncher". * WinLauncher/WinLauncher.vcxproj/WinLauncher.exe.manifest: Removed. * WinLauncher/WinLauncher.vcxproj/WinLauncherLibCommon.props: Link to Wininet.lib. * win/DLLLauncher/DLLLauncherMain.cpp: Remove VS2005 dependency for WinCairo. Canonical link: https://commits.webkit.org/140623@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157154 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent bbd5440 commit 832520a

9 files changed

Lines changed: 79 additions & 54 deletions

File tree

Source/WebCore/ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2013-10-08 Alex Christensen <achristensen@webkit.org>
2+
3+
Improved WinLauncher.
4+
https://bugs.webkit.org/show_bug.cgi?id=122536
5+
6+
Reviewed by Brent Fulgham.
7+
8+
* platform/network/curl/ResourceHandleManager.cpp:
9+
(WebCore::cookieJarPath):
10+
Put cookies.dat into the AppData directory on Windows.
11+
112
2013-10-08 Ryosuke Niwa <rniwa@webkit.org>
213

314
Remove the code erroneously in the previous commit.

Source/WebCore/platform/network/curl/ResourceHandleManager.cpp

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Copyright (C) 2009 Appcelerator Inc.
99
* Copyright (C) 2009 Brent Fulgham <bfulgham@webkit.org>
1010
* Copyright (C) 2013 Peter Gal <galpeter@inf.u-szeged.hu>, University of Szeged
11+
* Copyright (C) 2013 Alex Christensen <achristensen@webkit.org>
1112
* All rights reserved.
1213
*
1314
* Redistribution and use in source and binary forms, with or without
@@ -44,8 +45,14 @@
4445
#include "ResourceError.h"
4546
#include "ResourceHandle.h"
4647
#include "ResourceHandleInternal.h"
48+
4749
#if OS(WINDOWS)
4850
#include "WebCoreBundleWin.h"
51+
#include <shlobj.h>
52+
#include <shlwapi.h>
53+
#else
54+
#include <sys/param.h>
55+
#define MAX_PATH MAXPATHLEN
4956
#endif
5057

5158
#include <errno.h>
@@ -57,10 +64,6 @@
5764
#include <wtf/Vector.h>
5865
#include <wtf/text/CString.h>
5966

60-
#if !OS(WINDOWS)
61-
#include <sys/param.h>
62-
#define MAX_PATH MAXPATHLEN
63-
#endif
6467

6568
namespace WebCore {
6669

@@ -96,7 +99,30 @@ static char* cookieJarPath()
9699
if (cookieJarPath)
97100
return fastStrDup(cookieJarPath);
98101

102+
#if OS(WINDOWS)
103+
char executablePath[MAX_PATH];
104+
char appDataDirectory[MAX_PATH];
105+
char cookieJarFullPath[MAX_PATH];
106+
char cookieJarDirectory[MAX_PATH];
107+
108+
if (FAILED(::SHGetFolderPathA(0, CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE, 0, 0, appDataDirectory))
109+
|| FAILED(::GetModuleFileNameA(0, executablePath, MAX_PATH)))
110+
return fastStrDup("cookies.dat");
111+
112+
::PathRemoveExtensionA(executablePath);
113+
LPSTR executableName = ::PathFindFileNameA(executablePath);
114+
sprintf_s(cookieJarDirectory, MAX_PATH, "%s/%s", appDataDirectory, executableName);
115+
sprintf_s(cookieJarFullPath, MAX_PATH, "%s/cookies.dat", cookieJarDirectory);
116+
117+
if (::SHCreateDirectoryExA(0, cookieJarDirectory, 0) != ERROR_SUCCESS
118+
&& ::GetLastError() != ERROR_FILE_EXISTS
119+
&& ::GetLastError() != ERROR_ALREADY_EXISTS)
120+
return fastStrDup("cookies.dat");
121+
122+
return fastStrDup(cookieJarFullPath);
123+
#else
99124
return fastStrDup("cookies.dat");
125+
#endif
100126
}
101127

102128
static Mutex* sharedResourceMutex(curl_lock_data data) {

Tools/ChangeLog

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
2013-10-08 Alex Christensen <achristensen@webkit.org>
2+
3+
Improved WinLauncher.
4+
https://bugs.webkit.org/show_bug.cgi?id=122536
5+
6+
Reviewed by Brent Fulgham.
7+
8+
* WinLauncher/PrintWebUIDelegate.cpp:
9+
(PrintWebUIDelegate::runJavaScriptAlertPanelWithMessage): Added.
10+
(PrintWebUIDelegate::runJavaScriptConfirmPanelWithMessage): Added.
11+
* WinLauncher/PrintWebUIDelegate.h: Removed stubs.
12+
* WinLauncher/WinLauncher.cpp:
13+
(createCrashReport): Use the executable name instead of "WinLauncher".
14+
* WinLauncher/WinLauncher.vcxproj/WinLauncher.exe.manifest: Removed.
15+
* WinLauncher/WinLauncher.vcxproj/WinLauncherLibCommon.props: Link to Wininet.lib.
16+
* win/DLLLauncher/DLLLauncherMain.cpp: Remove VS2005 dependency for WinCairo.
17+
118
2013-10-08 Mark Lam <mark.lam@apple.com>
219

320
Fix ruby LoadError when running run-javascriptcore-tests.

Tools/WinLauncher/PrintWebUIDelegate.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@
3838

3939
static const int MARGIN = 20;
4040

41+
HRESULT STDMETHODCALLTYPE PrintWebUIDelegate::runJavaScriptAlertPanelWithMessage(IWebView*, BSTR message)
42+
{
43+
::MessageBoxW(0, message, L"JavaScript Alert", MB_OK);
44+
return S_OK;
45+
}
46+
47+
HRESULT STDMETHODCALLTYPE PrintWebUIDelegate::runJavaScriptConfirmPanelWithMessage(IWebView*, BSTR message, BOOL* result)
48+
{
49+
*result = ::MessageBoxW(0, message, L"JavaScript Confirm", MB_OKCANCEL) == IDOK;
50+
return S_OK;
51+
}
52+
4153
HRESULT STDMETHODCALLTYPE PrintWebUIDelegate::createWebViewWithRequest(IWebView*, IWebURLRequest* request, IWebView**)
4254
{
4355
if (!request)

Tools/WinLauncher/PrintWebUIDelegate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ class PrintWebUIDelegate : public IWebUIDelegate {
5757
virtual HRESULT STDMETHODCALLTYPE webViewFrame(IWebView*, RECT*) { return E_NOTIMPL; }
5858
virtual HRESULT STDMETHODCALLTYPE setContentRect(IWebView*, RECT*) { return E_NOTIMPL; }
5959
virtual HRESULT STDMETHODCALLTYPE webViewContentRect(IWebView*, RECT*) { return E_NOTIMPL; }
60-
virtual HRESULT STDMETHODCALLTYPE runJavaScriptAlertPanelWithMessage(IWebView*, BSTR) { return E_NOTIMPL; }
61-
virtual HRESULT STDMETHODCALLTYPE runJavaScriptConfirmPanelWithMessage(IWebView*, BSTR, BOOL*) { return E_NOTIMPL; }
60+
virtual HRESULT STDMETHODCALLTYPE runJavaScriptAlertPanelWithMessage(IWebView*, BSTR);
61+
virtual HRESULT STDMETHODCALLTYPE runJavaScriptConfirmPanelWithMessage(IWebView*, BSTR, BOOL*);
6262
virtual HRESULT STDMETHODCALLTYPE runJavaScriptTextInputPanelWithPrompt(IWebView*, BSTR, BSTR, BSTR*) { return E_NOTIMPL; }
6363
virtual HRESULT STDMETHODCALLTYPE runBeforeUnloadConfirmPanelWithMessage(IWebView*, BSTR, IWebFrame*, BOOL*) { return E_NOTIMPL; }
6464
virtual HRESULT STDMETHODCALLTYPE runOpenPanelForFileButtonWithResultListener(IWebView*, IWebOpenPanelResultListener*) { return E_NOTIMPL; }

Tools/WinLauncher/WinLauncher.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,11 @@ void createCrashReport(EXCEPTION_POINTERS* exceptionPointers)
418418
if (FAILED(SHGetFolderPathW(0, CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE, 0, 0, appDataDirectory)))
419419
return;
420420

421-
std::wstring directory = std::wstring(appDataDirectory) + L"\\WinLauncher";
421+
wchar_t executablePath[MAX_PATH];
422+
::GetModuleFileNameW(0, executablePath, MAX_PATH);
423+
::PathRemoveExtensionW(executablePath);
424+
425+
std::wstring directory = std::wstring(appDataDirectory) + L"\\" + PathFindFileNameW(executablePath);
422426
if (::SHCreateDirectoryEx(0, directory.c_str(), 0) != ERROR_SUCCESS
423427
&& ::GetLastError() != ERROR_FILE_EXISTS
424428
&& ::GetLastError() != ERROR_ALREADY_EXISTS)

Tools/WinLauncher/WinLauncher.vcxproj/WinLauncher.exe.manifest

Lines changed: 0 additions & 45 deletions
This file was deleted.

Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLibCommon.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<PrecompiledHeaderFile>StdAfx.h</PrecompiledHeaderFile>
1111
</ClCompile>
1212
<Link>
13-
<AdditionalDependencies>DbgHelp.lib;comdlg32.lib;comsuppw.lib;gdi32.lib;comctl32.lib;shlwapi.lib;user32.lib;ole32.lib;oleaut32.lib;WebKitGUID$(DebugSuffix).lib;WebKit$(DebugSuffix).lib;%(AdditionalDependencies)</AdditionalDependencies>
13+
<AdditionalDependencies>Wininet.lib;DbgHelp.lib;comdlg32.lib;comsuppw.lib;gdi32.lib;comctl32.lib;shlwapi.lib;user32.lib;ole32.lib;oleaut32.lib;WebKitGUID$(DebugSuffix).lib;WebKit$(DebugSuffix).lib;%(AdditionalDependencies)</AdditionalDependencies>
1414
</Link>
1515
</ItemDefinitionGroup>
1616
</Project>

Tools/win/DLLLauncher/DLLLauncherMain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ using namespace std;
4848
#endif
4949

5050
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='" PROCESSORARCHITECTURE "' publicKeyToken='6595b64144ccf1df' language='*'\"")
51-
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
51+
#if defined(_MSC_VER) && (_MSC_VER >= 1600) && !defined(WIN_CAIRO)
5252
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.VC80.CRT' version='8.0.50727.6195' processorArchitecture='" PROCESSORARCHITECTURE "' publicKeyToken='1fc8b3b9a1e18e3b' language='*'\"")
5353
#endif
5454

0 commit comments

Comments
 (0)