Changeset 156911 in webkit
- Timestamp:
- Oct 4, 2013 1:37:53 PM (10 years ago)
- Location:
- trunk/Tools
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r156899 r156911 1 2013-10-04 Alex Christensen <achristensen@webkit.org> 2 3 Made WinLauncher have better error handling, crash reporting, and modifiability. 4 https://bugs.webkit.org/show_bug.cgi?id=122319 5 6 Reviewed by Brent Fulgham. 7 8 * WinLauncher/WinLauncher.cpp: 9 (WinLauncherWebHost::didFailProvisionalLoadWithError): 10 Don't display the numerous "Cancelled" messages that are obviously from the user. 11 (createCrashReport): Added. 12 (dllLauncherEntryPoint): 13 Made main loop back into while loop and write a crash report if it crashes. 14 * WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj: 15 * WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj.filters: 16 Added WinLauncherReplace.h. 17 * WinLauncher/WinLauncher.vcxproj/WinLauncherLibCommon.props: 18 Added linking to DbgHelp.lib. 19 * WinLauncher/WinLauncherReplace.h: 20 Added to make modifying WinLauncher behaviour and appearance easy. 21 (processCrashDump): Added. 22 1 23 2013-10-04 Dirk Pranke <dpranke@chromium.org> 2 24 -
trunk/Tools/WinLauncher/WinLauncher.cpp
r156662 r156911 34 34 #include "PrintWebUIDelegate.h" 35 35 #include "WinLauncherLibResource.h" 36 #include "WinLauncherReplace.h" 36 37 #include <WebKit/WebKitCOMAPI.h> 37 38 #include <wtf/ExportMacros.h> … … 48 49 #include <commdlg.h> 49 50 #include <comutil.h> 51 #include <dbghelp.h> 50 52 #include <functional> 51 53 #include <objbase.h> 52 54 #include <shellapi.h> 55 #include <shlobj.h> 53 56 #include <shlwapi.h> 54 57 #include <string> … … 181 184 errorDescription = L"Failed to load page and to localize error description."; 182 185 183 ::MessageBoxW(0, static_cast<LPCWSTR>(errorDescription), L"Error", MB_APPLMODAL | MB_OK); 186 if (_wcsicmp(errorDescription, L"Cancelled")) 187 ::MessageBoxW(0, static_cast<LPCWSTR>(errorDescription), L"Error", MB_APPLMODAL | MB_OK); 184 188 185 189 return S_OK; … … 409 413 } 410 414 411 412 #if USE(CF) 413 extern "C" void _CFRunLoopSetWindowsMessageQueueMask(CFRunLoopRef, uint32_t, CFStringRef); 415 void createCrashReport(EXCEPTION_POINTERS* exceptionPointers) 416 { 417 wchar_t appDataDirectory[MAX_PATH]; 418 if (FAILED(SHGetFolderPathW(0, CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE, 0, 0, appDataDirectory))) 419 return; 420 421 std::wstring directory = std::wstring(appDataDirectory) + L"\\WinLauncher"; 422 if (::SHCreateDirectoryEx(0, directory.c_str(), 0) != ERROR_SUCCESS 423 && ::GetLastError() != ERROR_FILE_EXISTS 424 && ::GetLastError() != ERROR_ALREADY_EXISTS) 425 return; 426 427 std::wstring fileName = directory + L"\\CrashReport.dmp"; 428 HANDLE miniDumpFile = ::CreateFile(fileName.c_str(), GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); 429 430 if (miniDumpFile && miniDumpFile != INVALID_HANDLE_VALUE) { 431 432 MINIDUMP_EXCEPTION_INFORMATION mdei; 433 mdei.ThreadId = ::GetCurrentThreadId(); 434 mdei.ExceptionPointers = exceptionPointers; 435 mdei.ClientPointers = 0; 436 437 #ifdef _DEBUG 438 MINIDUMP_TYPE dumpType = MiniDumpWithFullMemory; 439 #else 440 MINIDUMP_TYPE dumpType = MiniDumpNormal; 414 441 #endif 442 443 ::MiniDumpWriteDump(::GetCurrentProcess(), ::GetCurrentProcessId(), miniDumpFile, dumpType, &mdei, 0, 0); 444 ::CloseHandle(miniDumpFile); 445 processCrashReport(fileName.c_str()); 446 } 447 } 415 448 416 449 extern "C" __declspec(dllexport) int WINAPI dllLauncherEntryPoint(HINSTANCE, HINSTANCE, LPTSTR, int nCmdShow) … … 540 573 goto exit; 541 574 542 _bstr_t defaultHTML(L"<p style=\"background-color: #00FF00\">Testing</p><img id=\"webkit logo\" src=\"http://webkit.org/images/icon-gold.png\" alt=\"Face\"><div style=\"border: solid blue; background: white;\" contenteditable=\"true\">div with blue border</div><ul><li>foo<li>bar<li>baz</ul>"); 543 frame->loadHTMLString(defaultHTML.GetBSTR(), 0); 575 frame->loadHTMLString(_bstr_t(defaultHTML).GetBSTR(), 0); 544 576 } 545 577 … … 569 601 loadURL(requestedURL.GetBSTR()); 570 602 603 #pragma warning(disable:4509) 604 571 605 // Main message loop: 606 __try { 607 while (GetMessage(&msg, 0, 0, 0)) { 572 608 #if USE(CF) 573 _CFRunLoopSetWindowsMessageQueueMask(CFRunLoopGetMain(), QS_ALLINPUT | QS_ALLPOSTMESSAGE, kCFRunLoopDefaultMode); 574 CFRunLoopRun(); 575 #else 576 while (GetMessage(&msg, NULL, 0, 0)) { 577 if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { 578 TranslateMessage(&msg); 579 DispatchMessage(&msg); 609 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true); 610 #endif 611 if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { 612 TranslateMessage(&msg); 613 DispatchMessage(&msg); 614 } 580 615 } 581 } 582 #endif 616 } __except(createCrashReport(GetExceptionInformation()), EXCEPTION_EXECUTE_HANDLER) { } 583 617 584 618 exit: -
trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj
r152921 r156911 207 207 <ClInclude Include="..\stdafx.h" /> 208 208 <ClInclude Include="..\WinLauncher.h" /> 209 <ClInclude Include="..\WinLauncherReplace.h" /> 209 210 <ClInclude Include="WinLauncherLibResource.h" /> 210 211 </ItemGroup> -
trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj.filters
r152174 r156911 58 58 <Filter>Header Files</Filter> 59 59 </ClInclude> 60 <ClInclude Include="..\WinLauncherReplace.h"> 61 <Filter>Header Files</Filter> 62 </ClInclude> 60 63 </ItemGroup> 61 64 <ItemGroup> -
trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLibCommon.props
r155922 r156911 11 11 </ClCompile> 12 12 <Link> 13 <AdditionalDependencies> 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>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> 14 14 </Link> 15 15 </ItemDefinitionGroup>
Note: See TracChangeset
for help on using the changeset viewer.