[SERVER-8215] ES5: Object.preventExtensions() broken when run on documents Created: 17/Jan/13  Updated: 28/Apr/17  Resolved: 28/Apr/17

Status: Closed
Project: Core Server
Component/s: JavaScript, Shell
Affects Version/s: 2.3.2
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Aaron Heckmann Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to DOCS-1136 Document limitation described in SERV... Closed
Operating System: ALL
Steps To Reproduce:

db.u.drop()
db.u.insert(

{a: 1}

)
doc = db.u.findOne() //

{ "_id" : ObjectId("50f859962db7a1d82e1ec250"), "a" : 1 }

Object.preventExtensions(doc);
doc.o = 9
Object.keys(doc) // [ "_id", "a", "o" ] ("o" should not exist)
assert(null != doc.o) // fails

Participants:

 Description   

Passing a document to Object.preventExtensions() does not work properly, the property in question is set on the document with the value discarded and `null` assigned.

Expected the property in question to be discarded entirely, not set on the document at all.

Note that passing plain (non-document) objects works correctly.



 Comments   
Comment by Andrew Morrow (Inactive) [ 28/Apr/17 ]

This was fixed either during the move from MozJS to V8, or in the subsequent move from V8 back to MozJS. In either event, the currently behavior in the shell does not reproduce the issue

Generated at Thu Feb 08 03:16:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.