Emscripten: Move execute_browser to the browser main thread
...so that it can reference the JS `window` object (e.g., when clicking on "Help
- About LibreOffice - Credits")
Change-Id: Ia08226af7bbf5a503be9e0b81c27217ad2775269
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185801
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Tested-by: Jenkins
(cherry picked from commit 28b1b9af5e1388940b4c59503092c0f804e4bac6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185875
Tested-by: allotropia jenkins <jenkins@allotropia.de>
diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx
index 153827a..3cc8146 100644
--- a/shell/source/unix/exec/shellexec.cxx
+++ b/shell/source/unix/exec/shellexec.cxx
@@ -41,6 +41,7 @@
#endif
#ifdef EMSCRIPTEN
+#include <emscripten/threading.h>
#include <rtl/uri.hxx>
extern void execute_browser(const char* sUrl);
#endif
@@ -279,7 +280,8 @@
OUString sEscapedURI(rtl::Uri::encode(aCommand, rtl_UriCharClassUric,
rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8));
- execute_browser(sEscapedURI.toUtf8().getStr());
+ emscripten_sync_run_in_main_runtime_thread(
+ EM_FUNC_SIG_VI, execute_browser, sEscapedURI.toUtf8().getStr());
#endif
}