Changeset 178530 in webkit
- Timestamp:
- Jan 15, 2015 2:49:26 PM (9 years ago)
- Location:
- trunk/Tools
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r178528 r178530 1 2015-01-15 Brent Fulgham <bfulgham@apple.com> 2 3 [Win] Miscellaneous DRT fixes 4 https://bugs.webkit.org/show_bug.cgi?id=116562 5 6 Reviewed by Tim Horton. 7 8 While investigating the cause of several Windows crashes, I found: 9 (1) Messy conversions to and from BSTR types 10 (2) Weird mixes of wide-string and narrow string conversions 11 (3) Passing nullptr to some CoreFoundation routines that do not 12 permit null arguments. 13 (4) Commands to link the executable to the VS2005 runtime. 14 15 This patch cleans up these issues to improve DRT reliability on 16 Windows. 17 18 * DumpRenderTree/cg/ImageDiffCG.cpp: 19 (main): Get rid of VS2005 runtime linking. 20 * DumpRenderTree/win/DumpRenderTree.cpp: 21 (urlSuitableForTestResult): Protect against being asked 22 to process an empty URL. 23 (dumpHistoryItem): Do BSTR string building using _bstr_t, rather 24 than converting to/from wchar_t buffers. 25 (runTest): Simplify string and BSTR handling. 26 (createWebViewAndOffscreenWindow): Ditto. 27 (main): Get rid of VS2005 runtime linking. 28 * DumpRenderTree/win/TestRunnerWin.cpp: 29 (jsStringRefToWString): Simplify code. 30 (TestRunner::pathToLocalResource): 31 (TestRunner::setUserStyleSheetLocation): 32 * TestWebKitAPI/win/main.cpp: Get rid of 33 VS2005 runtime linking. 34 * win/DLLLauncher/DLLLauncherMain.cpp: 35 (wWinMain): Ditto. 36 1 37 2015-01-15 Alexey Proskuryakov <ap@apple.com> 2 38 -
trunk/Tools/DumpRenderTree/cg/ImageDiffCG.cpp
r174471 r178530 226 226 if (CGImageGetWidth(actualImage.get()) != CGImageGetWidth(baselineImage.get()) || CGImageGetHeight(actualImage.get()) != CGImageGetHeight(baselineImage.get())) { 227 227 #if OS(WINDOWS) 228 fprintf(stderr, "Error: test and reference images have different sizes. Test image is % zux%zu, reference image is %Iux%Iu\n",228 fprintf(stderr, "Error: test and reference images have different sizes. Test image is %Iux%Iu, reference image is %Iux%Iu\n", 229 229 #else 230 230 fprintf(stderr, "Error: test and reference images have different sizes. Test image is %zux%zu, reference image is %zux%zu\n", -
trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp
r178139 r178530 44 44 45 45 #include <comutil.h> 46 #include <cstdio> 47 #include <cstring> 46 48 #include <fcntl.h> 49 #include <fstream> 47 50 #include <io.h> 48 51 #include <math.h> 49 52 #include <shlwapi.h> 50 #include <stdio.h>51 #include <string.h>52 53 #include <tchar.h> 53 54 #include <wtf/NeverDestroyed.h> … … 69 70 70 71 #ifdef DEBUG_ALL 71 const LPWSTRTestPluginDir = L"TestNetscapePlugin_Debug";72 const _bstr_t TestPluginDir = L"TestNetscapePlugin_Debug"; 72 73 #else 73 const LPWSTRTestPluginDir = L"TestNetscapePlugin";74 const _bstr_t TestPluginDir = L"TestNetscapePlugin"; 74 75 #endif 75 76 … … 144 145 wstring urlSuitableForTestResult(const wstring& urlString) 145 146 { 147 if (urlString.empty()) 148 return urlString; 149 146 150 RetainPtr<CFURLRef> url = adoptCF(CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(urlString.c_str()), urlString.length() * sizeof(wstring::value_type), kCFStringEncodingUTF16, 0)); 147 151 … … 516 520 517 521 if (wcsstr(static_cast<wchar_t*>(url), L"file:/") == static_cast<wchar_t*>(url)) { 518 static wchar_t* layoutTestsString = L"/LayoutTests/";519 static wchar_t* fileTestString = L"(file test):";522 static wchar_t* layoutTestsStringUnixPath = L"/LayoutTests/"; 523 static wchar_t* layoutTestsStringDOSPath = L"\\LayoutTests\\"; 520 524 521 wchar_t* result = wcsstr(static_cast<wchar_t*>(url), layoutTestsString); 522 if (result == NULL) 525 wchar_t* result = wcsstr(static_cast<wchar_t*>(url), layoutTestsStringUnixPath); 526 if (!result) 527 result = wcsstr(static_cast<wchar_t*>(url), layoutTestsStringDOSPath); 528 if (!result) 523 529 return; 524 wchar_t* start = result + wcslen(layoutTestsString); 525 526 _bstr_t newURL(SysAllocStringLen(0, SysStringLen(url)), false); 527 wcscpy(static_cast<wchar_t*>(newURL), fileTestString); 528 wcscpy(static_cast<wchar_t*>(newURL) + wcslen(fileTestString), start); 529 530 url = newURL; 530 531 wchar_t* start = result + wcslen(layoutTestsStringUnixPath); 532 533 url = _bstr_t(L"(file test):") + _bstr_t(start); 531 534 } 532 535 … … 1039 1042 1040 1043 CFIndex length = CFStringGetLength(str); 1041 UniChar* buffer = new UniChar[length + 1]; 1042 1043 CFStringGetCharacters(str, CFRangeMake(0, length), buffer); 1044 buffer[length] = 0; 1045 1046 _bstr_t urlBStr((OLECHAR*)buffer); 1044 1045 Vector<UniChar> buffer(length + 1, 0); 1046 CFStringGetCharacters(str, CFRangeMake(0, length), buffer.data()); 1047 1048 _bstr_t urlBStr(reinterpret_cast<wchar_t*>(buffer.data())); 1047 1049 ASSERT(urlBStr.length() == length); 1048 delete[] buffer;1049 1050 1050 1051 CFIndex maximumURLLengthAsUTF8 = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8) + 1; 1051 char* testURL = new char[maximumURLLengthAsUTF8];1052 CFStringGetCString(str, testURL , maximumURLLengthAsUTF8, kCFStringEncodingUTF8);1052 Vector<char> testURL(maximumURLLengthAsUTF8 + 1, 0); 1053 CFStringGetCString(str, testURL.data(), maximumURLLengthAsUTF8, kCFStringEncodingUTF8); 1053 1054 1054 1055 CFRelease(url); … … 1056 1057 resetWebViewToConsistentStateBeforeTesting(); 1057 1058 1058 ::gTestRunner = TestRunner::create(testURL, command.expectedPixelHash); 1059 delete[] testURL; 1059 ::gTestRunner = TestRunner::create(testURL.data(), command.expectedPixelHash); 1060 1060 ::gTestRunner->setCustomTimeout(command.timeout); 1061 1061 topLoadingFrame = nullptr; … … 1221 1221 viewPrivate->setAlwaysUsesComplexTextCodePath(forceComplexText); 1222 1222 1223 _bstr_t pluginPath(SysAllocStringLen(0, exePath().length() + _tcslen(TestPluginDir)), false); 1224 _tcscpy(static_cast<TCHAR*>(pluginPath), exePath().c_str()); 1225 _tcscat(static_cast<TCHAR*>(pluginPath), TestPluginDir); 1226 if (FAILED(viewPrivate->addAdditionalPluginDirectory(pluginPath))) 1223 _bstr_t pluginPath = _bstr_t(exePath().data()) + TestPluginDir; 1224 if (FAILED(viewPrivate->addAdditionalPluginDirectory(pluginPath.GetBSTR()))) 1227 1225 return nullptr; 1228 1226 … … 1385 1383 int main(int argc, const char* argv[]) 1386 1384 { 1387 #ifdef _CRTDBG_MAP_ALLOC1388 _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);1389 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);1390 #endif1391 1392 1385 // Cygwin calls ::SetErrorMode(SEM_FAILCRITICALERRORS), which we will inherit. This is bad for 1393 1386 // testing/debugging, as it causes the post-mortem debugger not to be invoked. We reset the -
trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp
r178139 r178530 274 274 { 275 275 size_t length = JSStringGetLength(jsStr); 276 Vector<WCHAR> buffer(length + 1 );276 Vector<WCHAR> buffer(length + 1, 0); 277 277 memcpy(buffer.data(), JSStringGetCharactersPtr(jsStr), length * sizeof(WCHAR)); 278 buffer[length] = '\0';278 buffer[length] = 0; 279 279 280 280 return buffer.data(); … … 288 288 if (!resolveCygwinPath(input, localPath)) { 289 289 printf("ERROR: Failed to resolve Cygwin path %S\n", input.c_str()); 290 return 0;290 return nullptr; 291 291 } 292 292 … … 767 767 768 768 // The path has been resolved, now convert it back to a CFURL. 769 int result = WideCharToMultiByte(CP_UTF8, 0, resultPath.c_str(), resultPath.size() + 1, 0, 0, 0, 0);769 int result = ::WideCharToMultiByte(CP_UTF8, 0, resultPath.c_str(), resultPath.size() + 1, nullptr, 0, nullptr, nullptr); 770 770 Vector<char> utf8Vector(result); 771 result = WideCharToMultiByte(CP_UTF8, 0, resultPath.c_str(), resultPath.size() + 1, utf8Vector.data(), result, 0, 0);771 result = ::WideCharToMultiByte(CP_UTF8, 0, resultPath.c_str(), resultPath.size() + 1, utf8Vector.data(), result, nullptr, nullptr); 772 772 if (!result) 773 773 return; -
trunk/Tools/TestWebKitAPI/win/main.cpp
r151173 r178530 39 39 40 40 #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='" PROCESSORARCHITECTURE "' publicKeyToken='6595b64144ccf1df' language='*'\"") 41 #if defined(_MSC_VER) && (_MSC_VER >= 1600)42 #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.VC80.CRT' version='8.0.50727.6195' processorArchitecture='" PROCESSORARCHITECTURE "' publicKeyToken='1fc8b3b9a1e18e3b' language='*'\"")43 #endif44 41 45 42 int main(int argc, char** argv) -
trunk/Tools/win/DLLLauncher/DLLLauncherMain.cpp
r178001 r178530 49 49 50 50 #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) && !defined(WIN_CAIRO)52 #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.VC80.CRT' version='8.0.50727.6195' processorArchitecture='" PROCESSORARCHITECTURE "' publicKeyToken='1fc8b3b9a1e18e3b' language='*'\"")53 #endif54 51 55 52 static void enableTerminationOnHeapCorruption() … … 188 185 #endif 189 186 { 190 _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF); 187 #ifdef _CRTDBG_MAP_ALLOC 188 _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); 189 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); 190 #endif 191 192 _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_DELAY_FREE_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF); 191 193 192 194 enableTerminationOnHeapCorruption();
Note: See TracChangeset
for help on using the changeset viewer.