[Win][MiniBrowser] wchar_t strings shouldn't be treated as BSTR
https://bugs.webkit.org/show_bug.cgi?id=193271
Reviewed by Brent Fulgham.
BSTR is a special data structure created by SysAllocString, not a
wchar_t null-terminated string.
* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::setDatabaseQuota): Use L"" instead of "" for _bstr_t.
* MiniBrowser/win/MiniBrowserWebHost.cpp:
(MiniBrowserWebHost::didFinishLoadForFrame): Use _bstr_t to create
BSTR from wide string literals.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@239812 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 2bab926..291b276 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,19 @@
+2019-01-09 Fujii Hironori <Hironori.Fujii@sony.com>
+
+ [Win][MiniBrowser] wchar_t strings shouldn't be treated as BSTR
+ https://bugs.webkit.org/show_bug.cgi?id=193271
+
+ Reviewed by Brent Fulgham.
+
+ BSTR is a special data structure created by SysAllocString, not a
+ wchar_t null-terminated string.
+
+ * DumpRenderTree/win/TestRunnerWin.cpp:
+ (TestRunner::setDatabaseQuota): Use L"" instead of "" for _bstr_t.
+ * MiniBrowser/win/MiniBrowserWebHost.cpp:
+ (MiniBrowserWebHost::didFinishLoadForFrame): Use _bstr_t to create
+ BSTR from wide string literals.
+
2019-01-09 Alexey Proskuryakov <ap@apple.com>
Tweak wording for build/version_check style checker error
diff --git a/Tools/DumpRenderTree/win/TestRunnerWin.cpp b/Tools/DumpRenderTree/win/TestRunnerWin.cpp
index bea5931..1072532 100644
--- a/Tools/DumpRenderTree/win/TestRunnerWin.cpp
+++ b/Tools/DumpRenderTree/win/TestRunnerWin.cpp
@@ -448,7 +448,7 @@
if (FAILED(tmpDatabaseManager->sharedWebDatabaseManager(&databaseManager)))
return;
- databaseManager->setQuota(_bstr_t("file:///"), quota);
+ databaseManager->setQuota(_bstr_t(L"file:///"), quota);
}
void TestRunner::goBack()
diff --git a/Tools/MiniBrowser/win/MiniBrowserWebHost.cpp b/Tools/MiniBrowser/win/MiniBrowserWebHost.cpp
index 7fe7324..a604b8c 100644
--- a/Tools/MiniBrowser/win/MiniBrowserWebHost.cpp
+++ b/Tools/MiniBrowser/win/MiniBrowserWebHost.cpp
@@ -167,7 +167,8 @@
m_client->showLastVisitedSites(*webView);
// The following is for the test page:
- HRESULT hr = doc->getElementById(L"webkit logo", &element.GetInterfacePtr());
+ static _bstr_t id = L"webkit logo";
+ HRESULT hr = doc->getElementById(id, &element.GetInterfacePtr());
if (!SUCCEEDED(hr))
return hr;
@@ -175,7 +176,9 @@
if (!SUCCEEDED(hr))
return hr;
- hr = target->addEventListener(L"click", new SimpleEventListener (L"webkit logo click"), FALSE);
+ static _bstr_t eventName = L"click";
+ static _bstr_t eventType = L"webkit logo click";
+ hr = target->addEventListener(eventName, new SimpleEventListener(eventType), FALSE);
if (!SUCCEEDED(hr))
return hr;