5 Commits
Author SHA1 Message Date
Neil Roberts 0c207d3479 jsuno: Add a parameter to execute() to specify a list of global variables
Adds an optional parameter to jsuno::execute to specify a list of global
variables to define in the global scope of the running script. The
values are references to XInterfaces.

Change-Id: I03b7de9fb904f4a172324f0e54c11ff9b0d76134
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205120
Tested-by: Jenkins
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
2026-05-13 09:06:12 +02:00
Stephan Bergmann f403d56b9a jsuno: Return script's last expression value (as JSON)
Signed-off-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Change-Id: I009d60d36a1279b42d12fa4e3b0369aeab4af51e
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2078
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
(cherry picked from commit daf47e0b734a0985fe5051ac1ce62c5fbed82802)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205119
Tested-by: Jenkins
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
2026-05-13 09:05:59 +02:00
Stephan Bergmann 368792e83c jsuno: Throw css.script.provider.ScriptExceptionRaisedException on JS errors
Signed-off-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Change-Id: Ia5df077d78b1650e28bf73716a10fdbd024f6e8a
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2077
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
(cherry picked from commit a4feac2f06bf3d1a6ed55a94dd5e05d01fc0f7c4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205118
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
Tested-by: Jenkins
2026-05-13 09:05:48 +02:00
Neil Roberts 67326438c6 jsuno: Fix the source header comments
I forgot to update the project name when cherry picking the jsuno code.

Change-Id: I2e2a58e514f605da00e12e598790bc45c9814e0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204612
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
Tested-by: Jenkins
2026-04-30 18:45:27 +02:00
Stephan Bergmann 6b31c63ec7 QuickJS-based JS UNO support
Somewhat loosely based on <https://github.com/allotropia/zetajs>.

Main part that is still missing from this WIP commit is implementing UNO objects
in JS.  (And there are a number of TODOs throughout, mostly regarding error
handling.)

===
Comments from Neil Roberts:

This patch was cherry-picked from
1cd8ad398b38763cb3578f1305a28e7774163714 in Collabora’s repo. The
following changes were made in order to get it to pass the CI:

* The unit test has been modified to continue using embindtest instead
  of testuno.
* The name of the external library is quickjs instead of qjs because a
  different patch is used to add the external QuickJS package.
* The asserts on argc that were captured in the lambda function have been
  moved outside of the lambda function in order to avoid having an unused
  capture on release builds. The argc parameter has then been marked as
  [[maybe_unused]].
* The constructors for JSClassDef have been changed to consistently use
  { } brace initialisers because otherwise it fails to build on macOS.
===

Change-Id: I8810e43fe5f3e4b1a53a654070fe87e95f51231a
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/190
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203963
Tested-by: Jenkins
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
2026-04-30 10:38:54 +02:00