diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-03-07 11:49:39 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-04-16 22:47:21 +0200 |
commit | 2951fea8236f7455e5dde36b5e799c1e1448cf40 (patch) | |
tree | 48b9560c422a7d5b62122d837d082ccad7d546cf /vcl/source/uitest | |
parent | 31abe9e44df092a557a34537f6b4ffa48d12edc4 (diff) |
uitest: escape the " for the json string conversion
Change-Id: I989b8add4bba0b10dedb126e5014be59879ed898
Reviewed-on: https://gerrit.libreoffice.org/36585
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'vcl/source/uitest')
-rw-r--r-- | vcl/source/uitest/uiobject.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
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); } |