[SERVER-3631] modifying a non object member of a read only js object fails silently Created: 17/Aug/11  Updated: 27/Apr/13  Resolved: 04/Oct/11

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

Type: Question Priority: Major - P3
Reporter: Aaron Staple Assignee: Antoine Girbal
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-9448 Read-only receivers in MapReduce code... Closed
is related to SERVER-3107 For JS, add a findRO() that returns a... Closed
Participants:

 Description   

See QA-19

There may not be much we can do about this - just wanted to bring it up:

  • If I perform an operation on an array within a read only document, it fails silently rather than printing an error:
    obj.arr[0] = 1;
  • Same for other data types:
    obj.date.setSeconds( 1 );


 Comments   
Comment by Antoine Girbal [ 04/Oct/11 ]

yes read-only only applies for an actual JS object.
For arrays, V8 does not let you define interceptors.
For special types, it makes little sense to add interceptors.
The idea of read-only is not so much for safety but speed in the context of our engine.

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