From 048c1c43219e466b3c2a72fade9b2d31572eb2b9 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Thu, 16 Jan 2020 20:49:00 +0100 Subject: [PATCH] Fix javascript return values Return values where wrapped by quotes because of wrapper code used for IE compatibility. --- include/wx/private/jsscriptwrapper.h | 2 ++ src/msw/webview_edge.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/wx/private/jsscriptwrapper.h b/include/wx/private/jsscriptwrapper.h index 4bd061197e..e60070fc1e 100644 --- a/include/wx/private/jsscriptwrapper.h +++ b/include/wx/private/jsscriptwrapper.h @@ -150,6 +150,8 @@ public: #endif } + const wxString& GetUnwrappedOutputCode() { return m_outputVarName; } + // Execute the code returned by this function to let the output of the code // we executed be garbage-collected. wxString GetCleanUpCode() const diff --git a/src/msw/webview_edge.cpp b/src/msw/webview_edge.cpp index a6209a18d4..d44914ebb4 100644 --- a/src/msw/webview_edge.cpp +++ b/src/msw/webview_edge.cpp @@ -795,7 +795,7 @@ bool wxWebViewEdge::RunScript(const wxString& javascript, wxString* output) if (RunScriptSync(wrapJS.GetWrappedCode(), &result) && result == wxS("true")) { - if (RunScriptSync(wrapJS.GetOutputCode(), &result)) + if (RunScriptSync(wrapJS.GetUnwrappedOutputCode() + ";", &result)) { if (output) *output = result;