chakra-core / chakra-core/ChakraCore
Chakra should throw TypeError when try to set property of an object which has only a getter
- Dominant language
- JavaScript
- Stars
- 9.3k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Hi everyone,
I found an inconsistency when we try to set a getter-only property of an object.
OS: Ubuntu 16.04 x86
Chakra: 1.9
Step to reproduce:
```
try{
var a = {get "0"() {return 1;}, length: 1};
[].fill.call(a, 2);
throw new Error("should not reach this point")
}
catch(error){
if (!(error instanceof TypeError)) throw new Error('Should throw TypeError')
}
```
Actual results:
Error: Should throw TypeError
Expected results:
pass without errors
V8, SpiderMonkey and JavascriptCore throws a TypeError when attempted to assign to readonly property.
cinfuzz
Contributor guide
Research direction
Start by running the provided getter-only property reproduction against ChakraCore and tracing Array.prototype.fill through the engine's property-assignment handling. Compare the result with the expected JavaScript accessor semantics and add a regression test showing that filling the object throws TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100