[Win][MiniBrowser] wchar_t strings shouldn't be treated as BSTR
authorHironori.Fujii@sony.com <Hironori.Fujii@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Jan 2019 02:04:53 +0000 (02:04 +0000)
committerHironori.Fujii@sony.com <Hironori.Fujii@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Jan 2019 02:04:53 +0000 (02:04 +0000)
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: https://svn.webkit.org/repository/webkit/trunk@239812 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/DumpRenderTree/win/TestRunnerWin.cpp
Tools/MiniBrowser/win/MiniBrowserWebHost.cpp

index 2bab926..291b276 100644 (file)
@@ -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
index bea5931..1072532 100644 (file)
@@ -448,7 +448,7 @@ void TestRunner::setDatabaseQuota(unsigned long long quota)
     if (FAILED(tmpDatabaseManager->sharedWebDatabaseManager(&databaseManager)))
         return;
 
-    databaseManager->setQuota(_bstr_t("file:///"), quota);
+    databaseManager->setQuota(_bstr_t(L"file:///"), quota);
 }
 
 void TestRunner::goBack()
index 7fe7324..a604b8c 100644 (file)
@@ -167,7 +167,8 @@ HRESULT MiniBrowserWebHost::didFinishLoadForFrame(_In_opt_ IWebView* webView, _I
         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 @@ HRESULT MiniBrowserWebHost::didFinishLoadForFrame(_In_opt_ IWebView* webView, _I
     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;