Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-21338

ScopedThreads do not receive non-enumerable properties of objects

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • JavaScript
    • None
    • ALL
    • Hide

      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();
      

      Show
      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();

    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.

      Attachments

        Activity

          People

            backlog-server-platform DO NOT USE - Backlog - Platform Team
            judah.schvimer@mongodb.com Judah Schvimer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: