Skip to content

An error should be thrown when defining a property for a read-only variable in strict mode. #2914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Implementist opened this issue Jun 17, 2019 · 4 comments · Fixed by #2917
Labels
bug Undesired behaviour

Comments

@Implementist
Copy link

As the title suggests, the testcase is:

var func = function (number) {
    "use strict";
    number.snippetText = "";
};
func(-334918463);

The defination and assignment at the third line leads to an exception when I run this testcase in V8 and SpiderMonkey. But Jerry doesn't throws any exception.

@rerobika
Copy link
Member

@Implementist Thanks for the report I think it is a valid bug, since I've found the corresponding part of the standard for that special case.

https://www.ecma-international.org/ecma-262/5.1/#sec-8.7

The object that may be created in step 1 is not accessible outside of the above method.
An implementation might choose to avoid the actual creation of that transient object.
The only situations where such an actual property assignment that uses this internal
method can have visible effect are when it either invokes an accessor function
or is in violation of a Throw predicated error check. When Throw is true any property
assignment that would create a new property on the transient object throws an error.

Do you have any fix for this issue or are you planning to open a PR for this problem? (Ofc, it is only optional.)

@Implementist
Copy link
Author

Implementist commented Jun 18, 2019

@rerobika Thanks for your reply. I have no idea about how to fix this at present.

@rerobika
Copy link
Member

@Implementist No problem I'll take a look at it.

galpeter added a commit to galpeter/jerryscript that referenced this issue Jun 18, 2019
@galpeter
Copy link
Contributor

@rerobika I've done a bit of debugging and created this: galpeter@d3f6254 however I think it is only a partial fix.

rerobika added a commit to rerobika/jerryscript that referenced this issue Jun 19, 2019
…e base cannot be extensible

Related part of the standard: https://www.ecma-international.org/ecma-262/5.1/#sec-8.7 1st note.

This patch fixes jerryscript-project#2914.

Co-authored-by: Gabor Loki loki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
@rerobika rerobika added the bug Undesired behaviour label Jun 19, 2019
rerobika added a commit to rerobika/jerryscript that referenced this issue Jun 21, 2019
…e base cannot be extensible

Related part of the standard: https://www.ecma-international.org/ecma-262/5.1/#sec-8.7 1st note.

This patch fixes jerryscript-project#2914.

Co-authored-by: Gabor Loki loki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
rerobika added a commit that referenced this issue Jun 24, 2019
…e base cannot be extensible (#2917)

Related part of the standard: https://www.ecma-international.org/ecma-262/5.1/#sec-8.7 1st note.

This patch fixes #2914.

Co-authored-by: Gabor Loki loki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Undesired behaviour
Projects
None yet
3 participants