diff options
Diffstat (limited to 'WebKitTools/DumpRenderTree/win')
5 files changed, 22 insertions, 16 deletions
diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp index e96adae..dfa4de0 100644 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp @@ -140,6 +140,17 @@ wstring urlSuitableForTestResult(const wstring& url) return PathFindFileNameW(url.c_str()); } +string toUTF8(BSTR bstr) +{ + int result = WideCharToMultiByte(CP_UTF8, 0, bstr, SysStringLen(bstr) + 1, 0, 0, 0, 0); + Vector<char> utf8Vector(result); + result = WideCharToMultiByte(CP_UTF8, 0, bstr, SysStringLen(bstr) + 1, utf8Vector.data(), result, 0, 0); + if (!result) + return string(); + + return string(utf8Vector.data(), utf8Vector.size() - 1); +} + static LRESULT CALLBACK DumpRenderTreeWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h b/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h index 499c57b..eb5d312 100644 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h +++ b/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h @@ -49,6 +49,7 @@ extern HWND webViewWindow; #include <wtf/Vector.h> std::wstring urlSuitableForTestResult(const std::wstring& url); +std::string toUTF8(BSTR); IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow = 0); Vector<HWND>& openWindows(); typedef HashMap<HWND, COMPtr<IWebView> > WindowToWebViewMap; diff --git a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp b/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp index cf4d221..9b9e3c1 100644 --- a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp +++ b/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp @@ -48,17 +48,6 @@ using std::string; static FrameLoadDelegate* g_delegateWaitingOnTimer; -string BSTRtoString(BSTR bstr) -{ - int result = WideCharToMultiByte(CP_UTF8, 0, bstr, SysStringLen(bstr) + 1, 0, 0, 0, 0); - Vector<char> utf8Vector(result); - result = WideCharToMultiByte(CP_UTF8, 0, bstr, SysStringLen(bstr) + 1, utf8Vector.data(), result, 0, 0); - if (!result) - return string(); - - return string(utf8Vector.data(), utf8Vector.size() - 1); -} - string descriptionSuitableForTestResult(IWebFrame* webFrame) { COMPtr<IWebView> webView; @@ -70,11 +59,11 @@ string descriptionSuitableForTestResult(IWebFrame* webFrame) return string(); BSTR frameNameBSTR; - if (FAILED(webFrame->name(&frameNameBSTR)) || BSTRtoString(frameNameBSTR).empty() ) + if (FAILED(webFrame->name(&frameNameBSTR)) || toUTF8(frameNameBSTR).empty()) return (webFrame == mainFrame) ? "main frame" : string(); string frameName = (webFrame == mainFrame) ? "main frame" : "frame"; - frameName += " \"" + BSTRtoString(frameNameBSTR) + "\""; + frameName += " \"" + toUTF8(frameNameBSTR) + "\""; SysFreeString(frameNameBSTR); return frameName; diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp index 89873b6..321d9cf 100644 --- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp +++ b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp @@ -106,7 +106,9 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc pluginLog(instance, "src: %s", argv[i]); } else if (_stricmp(argn[i], "testdocumentopenindestroystream") == 0) obj->testDocumentOpenInDestroyStream = TRUE; - else if (_stricmp(argn[i], "testwindowopen") == 0) + else if (_stricmp(argn[i], "testGetURLOnDestroy") == 0) + obj->testGetURLOnDestroy = TRUE; + else if (_stricmp(argn[i], "testwindowopen") == 0) obj->testWindowOpen = TRUE; else if (_stricmp(argn[i], "onSetWindow") == 0 && !obj->onSetWindow) obj->onSetWindow = strdup(argv[i]); @@ -122,6 +124,9 @@ NPError NPP_Destroy(NPP instance, NPSavedData **save) { PluginObject *obj = (PluginObject*)instance->pdata; if (obj) { + if (obj->testGetURLOnDestroy) + browser->geturlnotify(obj->npp, "about:blank", "", ""); + if (obj->onStreamLoad) free(obj->onStreamLoad); @@ -137,7 +142,7 @@ NPError NPP_Destroy(NPP instance, NPSavedData **save) } if (obj->logDestroy) - printf("PLUGIN: NPP_Destroy\n"); + pluginLog(instance, "NPP_Destroy\n"); if (obj->onSetWindow) free(obj->onSetWindow); diff --git a/WebKitTools/DumpRenderTree/win/UIDelegate.cpp b/WebKitTools/DumpRenderTree/win/UIDelegate.cpp index 16724d7..6637068 100755 --- a/WebKitTools/DumpRenderTree/win/UIDelegate.cpp +++ b/WebKitTools/DumpRenderTree/win/UIDelegate.cpp @@ -625,7 +625,7 @@ HRESULT STDMETHODCALLTYPE UIDelegate::webViewDidInvalidate( HRESULT STDMETHODCALLTYPE UIDelegate::setStatusText(IWebView*, BSTR text) { if (gLayoutTestController->dumpStatusCallbacks()) - printf("UI DELEGATE STATUS CALLBACK: setStatusText:%S\n", text ? text : L""); + printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", text ? toUTF8(text).c_str() : ""); return S_OK; } |