Two api methods for lua scripting has been added.
`reload()` allows to refresh the document without triggering a new
html request. This commits expose that existing internal function to the
lua api.
One example where it is useful : making a lua hook that allows to edit a
local file we're browsing and see the change without having to perform a
full reload (thus losing the scrolling position). Or anything else that
allows to interactively modify the currently loaded document.
`goto_url()` allows to navigate to given url long after the page has been
loaded (so follow_url_hooks can't be used).
Example where it's useful : binding a key to load the latest archive.org
snapshot for current page (especially useful when using tor and being
constantly harassed by cloudflare).
Replace JS_EncodeString by jsval_to_string. It will allow easier
changes in the future. In smjs nullptr everywhere.
In ecmascript arrays don't work. For example
document.getElementsByTagName("H1")[0]
smjs even does not start.
Plan is to bump mozjs version, and later back to fixing bugs.
SpiderMonkey was updated to mozjs24. If you want to build elinks
with ecmascript support, you must compile using g++ with -fpermissive .
There is a lot of warnings.
There are some memleaks in ecmascript code, especially related to JSAutoCompartment.
I don't know yet, where and how to free it.
Debian does not support mozjs24, so I'm going to gradually update SpiderMonkey version.
Once to utf-8 before pre_format_html_hook, and second time to the original encoding after python
script execution. I know it is inefficient, but computers are quite fast nowadays.
Fixes the errors
x86_64-pc-linux-gnu-ld: hooks.o:(.bss+0x0): multiple definition of `erb_module'; core.o:(.bss+0x0): first defined here
x86_64-pc-linux-gnu-ld: ruby.o:(.bss+0x0): multiple definition of `erb_module'; core.o:(.bss+0x0): first defined here
Bug: https://bugs.gentoo.org/730658
Weak points:
- alignof
- js problems
Todo:
- make js work with C++ and mozjs-17
- then mozjs-24
- then mozjs-52
- then mozjs-60
- decrease number of warnings