[JSC] RegExp#lastIndex should handle writable attribute when defining in defineOwnPro...
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Mar 2016 20:08:28 +0000 (20:08 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Mar 2016 20:08:28 +0000 (20:08 +0000)
commit43af28fb77d17f1b5b2ce59a2a7c819b8aa24658
tree5848906d20ab6b60d7401942009ab7d41d8bbef7
parent83ff4dc8b9a817693e68f48ce2711b613cc780c0
[JSC] RegExp#lastIndex should handle writable attribute when defining in defineOwnProperty path
https://bugs.webkit.org/show_bug.cgi?id=155093

Reviewed by Filip Pizlo.

Before this patch, `setLastIndex(ExecState* exec, size_t lastIndex)` always overwrites the existing value
regardless of writable attribute.
And when defining RegExp#lastIndex in defineOwnProperty, we need to define the value first
before making the attribute readonly. After changing the writable attribute, we cannot define the value.

* runtime/RegExpObject.cpp:
(JSC::RegExpObject::defineOwnProperty):
* runtime/RegExpObject.h:
(JSC::RegExpObject::setLastIndex):
* tests/stress/regexp-last-index-writable.js: Added.
(shouldBe):
(shouldThrow):
(regExpLastIndex):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197640 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/RegExpObject.cpp
Source/JavaScriptCore/runtime/RegExpObject.h
Source/JavaScriptCore/tests/stress/regexp-last-index-writable.js [new file with mode: 0644]