janl opened a new pull request, #5314:
URL: https://github.com/apache/couchdb/pull/5314

   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()`](https://github.com/apache/couchdb/blob/main/src/couch/priv/couch_js/86/main.cpp#L214-L228)
 function for 
[`Object.freeze()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze#deep_freezing).
   
   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](https://github.com/apache/couchdb/blob/main/share/server/state.js#L16), 
which then makes a subsequent 
[`State.funs.push()`](https://github.com/apache/couchdb/blob/main/share/server/state.js#L32)
 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](https://github.com/apache/couchdb-pkg/issues/136), 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 ✌️ 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to