vcl/source/uitest/uiobject.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
New commits: commit 2951fea8236f7455e5dde36b5e799c1e1448cf40 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Tue Mar 7 11:49:39 2017 +0100 uitest: escape the " for the json string conversion Change-Id: I989b8add4bba0b10dedb126e5014be59879ed898 Reviewed-on: https://gerrit.libreoffice.org/36585 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index 24fac7a4dd31..74d75b7a2fad 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -442,6 +442,15 @@ OUString WindowUIObject::get_name() const return OUString("WindowUIObject"); } +namespace { + +OUString escape(const OUString& rStr) +{ + return rStr.replaceAll("\"", "\\\""); +} + +} + OUString WindowUIObject::dumpState() const { OUStringBuffer aStateString = "{\"name\":\"" + mxWindow->get_id() + "\""; @@ -449,7 +458,7 @@ OUString WindowUIObject::dumpState() const StringMap aState = const_cast<WindowUIObject*>(this)->get_state(); for (auto itr = aState.begin(), itrEnd = aState.end(); itr != itrEnd; ++itr) { - OUString property = ",\"" + itr->first + "\":\"" + itr->second + "\""; + OUString property = ",\"" + itr->first + "\":\"" + escape(itr->second) + "\""; aStateString.append(property); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits