apache / couchdb

Seamless multi-master syncing database with an intuitive HTTP/JSON API, designed for reliability
https://couchdb.apache.org/
Apache License 2.0
6.28k stars 1.03k forks source link

Add support for SpiderMonkeys 102, 115 and 128 #5314

Closed janl closed 3 weeks ago

janl commented 1 month ago

This PR combines work from #4305 (@nickva) #5146 (@big-r81) & and #5306 (@indutny) plus some more original work from @indutny to swap out our usage of our homegrown seal() function for Object.freeze().

Compiles and make check passes on macOS with SpiderMonkey 91, 102, 115 and 128.

It’d be great if we can test this on other systems as well and double check that Object.freeze() has the security properties be want (but I think it does, it might even be stricter than before, not allowing reassignment of values to existing properties).

The underlying issue is that starting with SpiderMonkey 102 one of our original seal() calls would seal the State.funs array, which then makes a subsequent State.funs.push() fail with the type error reported in #4305 and #5146. (h/t to @indutny for teasing this out).

This should unblock support for Ubuntu 24.04, which ships with SpiderMonkey 128.

It feels like the build args lists in src/couch/rebar.config.script are due for a refactor, but I didn’t want to mess too much with the shape of the project just yet.

Similarly, the differences in couch_js/main.cpp and couch_js/util.cpp from 91 to 128 are not a lot and one could argue we should start switching to ifdef the relevant bits, rather than duplicating a lot of code. On the other hand, this will make it easier to drop versions later, if we ever want to.

Thanks all for doing the hard work here, I’m just pulling it all together to validate this is (hopefully) a way forward ✌️

big-r81 commented 1 month ago

Hey,

that looks really great! I think we could merge 102 and 115 together like we did in 86 & 91.

In v115 I explicitly removed the global_ops var to not deal with the record members. This should be handled by the class DefaultGlobalClassOps … But need to deep dive into it again ...

janl commented 1 month ago

that looks really great! I think we could merge 102 and 115 together like we did in 86 & 91.

yeah, that’s what I meant. My question is “should we?”.

big-r81 commented 1 month ago

btw, we should test this in a branch starting with jenkins-... to test full CI runs , so we could se problems with SM 78 ...

big-r81 commented 1 month ago

Hi,

I tried to merge and simplify different SpiderMonkey versions together. This is the result PR. I tested it with v91, v115 and v128.

Please try it out and take a look!

janl commented 3 weeks ago

closing in favour of https://github.com/apache/couchdb/pull/5321/