tc39 / tc39/test262

Missing test for mapped arguments object

Open
#729 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

coverage missing
Dominant language
JavaScript
Stars
2.8k
Forks
564
Avg merge
3d 7h
Merged PRs (30d)
10

Description

It looks to me like there's a couple of holes in the tests for mapped arguments, namely,

  • defineProperty with both a value and writable: false should write the value and then break the mapping between arguments and the corresponding parameter
  • Object.freeze should break the mapping for every parameter

For example, both of these should return true:

(function nonwritableAndValue(a) {
  Object.defineProperty(arguments, '0', {writable: false, value: 1});
  const postWriteCondition = arguments[0] === 1 && a === 1;
  a = 2;
  return postWriteCondition && arguments[0] === 1 && a === 2;
})(0);
(function freeze(a) {
  Object.freeze(arguments);
  a = 2;
  return arguments[0] === 0 && a === 2;
})(0);

The Object.freeze case is particularly important as a potential security issue. (Firefox fails it, even though manually setting the property as nonwritable does correctly break the mapping.)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in test/language/arguments-object/mapped, reviewing the existing mapped-arguments tests and the two examples in the issue. Add coverage for defineProperty with value and writable:false, and for Object.freeze; done means both cases verify the mapping is broken as described and pass the Test262 tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing-qa
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.