summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/arguments/iterator-set-and-redefine.js
blob: bcf182790f6ecbc6404af12b5c245f40074dce14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function mapped() {
    var Iterator = {};

    // First overwrite the iterator.
    arguments[Symbol.iterator] = Iterator;

    // And then redefine a property attribute.
    Object.defineProperty(arguments, Symbol.iterator, {
        writable: false
    });

    // Make sure redefining an attribute doesn't reset the iterator value.
    assertEq(arguments[Symbol.iterator], Iterator);
}
mapped();

function unmapped() {
  "use strict";

  var Iterator = {};

  // First overwrite the iterator.
  arguments[Symbol.iterator] = Iterator;

  // And then redefine a property attribute.
  Object.defineProperty(arguments, Symbol.iterator, {
      writable: false
  });

  // Make sure redefining an attribute doesn't reset the iterator value.
  assertEq(arguments[Symbol.iterator], Iterator);
}
unmapped();