tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

spread-obj-override-immutable.js (1468B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/spread/obj-override-immutable.case
      3 // - src/spread/default/array.template
      4 /*---
      5 description: Object Spread overriding immutable properties (Array initializer)
      6 esid: sec-runtime-semantics-arrayaccumulation
      7 features: [object-spread]
      8 flags: [generated]
      9 includes: [propertyHelper.js]
     10 info: |
     11    SpreadElement : ...AssignmentExpression
     12 
     13    1. Let spreadRef be the result of evaluating AssignmentExpression.
     14    2. Let spreadObj be ? GetValue(spreadRef).
     15    3. Let iterator be ? GetIterator(spreadObj).
     16    4. Repeat
     17       a. Let next be ? IteratorStep(iterator).
     18       b. If next is false, return nextIndex.
     19       c. Let nextValue be ? IteratorValue(next).
     20       d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)),
     21          nextValue).
     22       e. Assert: status is true.
     23       f. Let nextIndex be nextIndex + 1.
     24 ---*/
     25 
     26 let o = {b: 2};
     27 Object.defineProperty(o, "a", {value: 1, enumerable: true, writable: false, configurable: true});
     28 
     29 
     30 var callCount = 0;
     31 
     32 (function(obj) {
     33  assert.sameValue(obj.a, 3)
     34  assert.sameValue(obj.b, 2);
     35 
     36  verifyProperty(obj, "a", {
     37    enumerable: true,
     38    writable: true,
     39    configurable: true,
     40    value: 3
     41  });
     42 
     43  verifyProperty(obj, "b", {
     44    enumerable: true,
     45    writable: true,
     46    configurable: true,
     47    value: 2
     48  });
     49  callCount += 1;
     50 }.apply(null, [{...o, a: 3}]));
     51 
     52 assert.sameValue(callCount, 1);
     53 
     54 reportCompare(0, 0);