SERVER-128125ClosedFixed

Align bsonObjToArray ownership semantics with bsonGetImmutable

bsonObjToArray and bsonGetImmutable are sibling functions in the MozJS BSON binding layer. bsonGetImmutable ensures the BSONObj it works with is owned before creating JS wrappers around it;  bsonObjToArray does not apply the same treatment. This inconsistency can lead to incorrect behaviour when operating on sub-document wrappers. Bring bsonObjToArray in line with the established pattern used by bsonGetImmutable.

Affected Versions
Versions known to exhibit this issue
8.0.27
Fixed Versions
Versions that include the fix
4.4.316.0.295.0.348.3.48.0.267.0.378.2.128.0.287.0.398.3.7
Components
Server components related to this issue

No components specified.

Labels
Tags and classification
bkp