See bug 489329 #52:

Make defineProperty throw a TypeError when attributes is both data and accessor descriptor.  As per 8.10.5 step 9 of the spec.
Patch from Raphel Speyer.


git-svn-id: svn://10.0.0.236/trunk@257920 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
nboyd%atg.com 2009-08-02 01:40:42 +00:00
parent 29d9a51d58
commit 16a73576ee
2 changed files with 6 additions and 0 deletions

View File

@ -1581,6 +1581,9 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
if (setter != NOT_FOUND && !(setter instanceof Callable)) {
throw ScriptRuntime.notFunctionError(setter);
}
if (isDataDescriptor(desc) && isAccessorDescriptor(desc)) {
throw ScriptRuntime.typeError0("msg.both.data.and.accessor.desc");
}
if (slot == null) { // new property
if (!isExtensible()) throw ScriptRuntime.typeError("msg.not.extensible");

View File

@ -680,6 +680,9 @@ msg.modify.sealed =\
msg.modify.readonly =\
Cannot modify readonly property: {0}.
msg.both.data.and.accessor.desc =\
Cannot be both a data and an accessor descriptor.
msg.change.configurable.false.to.true =\
Cannot change the configurable attribute of "{0}" from false to true.