Bug 122392

Summary: Support: UNO for firefox JS engine - javascript document scripting
Product: LibreOffice Reporter: Tim <timo>
Component: Android ViewerAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED WORKSFORME    
Severity: enhancement CC: ilmari.lauhakangas
Priority: medium    
Version: unspecified   
Hardware: All   
OS: Android   
Whiteboard:
Crash report or crash signature: Regression By:

Description Tim 2018-12-31 11:49:16 UTC
I think that if this is integrated with Firefox, then it would be reasonable to offer the JS engine runtime as a UNO plugin to the document. This way i can make cross platform macros.
Comment 1 Buovjaga 2018-12-31 11:55:43 UTC
It is already possible to use JS, it is just sadly not documented. https://phpandmore.net/2012/10/22/libreoffice-javascript/
There is also bug 97827 for changing the engine.
Comment 2 Tim 2019-01-01 09:14:27 UTC
So in the android version the javascript engine is already available? meaning i can make javascript macros under linux and have them work in the android viewer?
Comment 3 Buovjaga 2019-01-01 09:58:01 UTC
(In reply to Tim from comment #2)
> So in the android version the javascript engine is already available?
> meaning i can make javascript macros under linux and have them work in the
> android viewer?

The Android viewer is a different story. If I had to guess, they probably don't work, but I really have no idea.
Comment 4 Tim 2019-01-01 10:40:16 UTC
Ok i will try it out, when i get the chance. 

The intent of my bug was to suggest the enhancement that the firefox integration (in the android version which i assumed was the same as the core?), could re-use the firefox JS engine which it has to interact with already, with a UNO interface support javascript in a cross platform way.
Comment 5 Buovjaga 2019-01-01 15:03:56 UTC
(In reply to Tim from comment #4)
> The intent of my bug was to suggest the enhancement that the firefox
> integration (in the android version which i assumed was the same as the
> core?), could re-use the firefox JS engine which it has to interact with
> already, with a UNO interface support javascript in a cross platform way.

I don't believe the Android version interacts with Firefox in any way.

The current engine, Rhino, is provided by Mozilla: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino

In bug 97827, I proposed that Duktape could be used as the engine.

Michael Stahl commented: "SpiderMonkey and V8 are very large and complex C++ projects with unstable APIs so integrating them would be very painful"