summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/arguments-object/mapped/writable-enumerable-configurable-descriptor.js
blob: 01e9f2fb2f472c3d5550fdb4a56293c0a585aeff (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
description: >
  Index stays mapped when redefined with complete descriptor, which differs only
  by the [[Value]] field. Unmapped index is created.
info: |
  [[DefineOwnProperty]] ( P, Desc )

  [...]
  6. Let allowed be ? OrdinaryDefineOwnProperty(args, P, newArgDesc).
  7. If allowed is false, return false.
  8. If isMapped is true, then
    [...]
    b. Else,
      i. If Desc.[[Value]] is present, then
        1. Let setStatus be Set(map, P, Desc.[[Value]], false).
        2. Assert: setStatus is true because formal parameters mapped by argument objects are always writable.
  9. Return true.
flags: [noStrict]
---*/

(function(a) {
  Object.defineProperty(arguments, "0", {
    value: "foo",
    writable: true,
    enumerable: true,
    configurable: true,
  });

  assert.sameValue(a, "foo");
  assert.sameValue(arguments[0], "foo");


  Object.defineProperty(arguments, "1", {
    value: "bar",
    writable: true,
    enumerable: true,
    configurable: true,
  });

  assert.sameValue(arguments[1], "bar");
})(0);

reportCompare(0, 0);