[SERVER-21338] ScopedThreads do not receive non-enumerable properties of objects Created: 06/Nov/15  Updated: 09/May/16  Resolved: 09/May/16

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

Type: Bug Priority: Minor - P4
Reporter: Judah Schvimer Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Steps To Reproduce:

load('jstests/libs/parallelTester.js')
 
var func = function (args) {
    assert(args.a, 'no property a');
    assert.eq(args.a, 1, 'property a has wrong value');
    assert(args.b, 'no property b');
    assert.eq(args.b, 2, 'property b has wrong value');
    assert(args.c, 'no property c');
    assert.eq(args.c, 3, 'property c has wrong value');
}
var args = {a: 1};
Object.defineProperty(args, 'b', {
    value: 2,
    enumerable: true
});
Object.defineProperty(args, 'c', {
    value: 3
});
a = new ScopedThread( func, args );
a.start();
a.join();

Participants:

 Description   

Non-enumerable properties to a Scoped Thread via an arguments object do not get passed properly and do not appear in the object inside of the ScopedThread function. The following snippet of code illustrates the problem. Ideally none of the asserts would fail, but here only the asserts for property 'c' fail, showing that while 'args.a' and 'args.b' both get passed, 'args.c' does not.



 Comments   
Comment by Mira Carey [ 09/May/16 ]

Threads are already just a facility for testing and we can only pass types that translate into bson. I'd rather avoid doing any kind of fancy introspection and leave this the way it is.

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