Add support for SpiderMonkeys 102, 115 and 128 #5314
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 forObject.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 theState.funs
array, which then makes a subsequentState.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
andcouch_js/util.cpp
from 91 to 128 are not a lot and one could argue we should start switching toifdef
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 ✌️