1. Object derived from primitive value can't define its new property

2. Fix bug with floating point precision in Date.parse
3. Fix bug in Date.setYear()/setFullyear() occured with invalid date value

Signed-off-by: Saebom Kim sae-bom.kim@samsung.com
This commit is contained in:
Saebom Kim 2017-03-30 20:43:02 +09:00
commit ab00bdfdd2
4 changed files with 57 additions and 31 deletions

View file

@ -691,11 +691,13 @@ Value ByteCodeInterpreter::interpret(ExecutionState& state, ByteCodeBlock* byteC
const Value& willBeObject = registerFile[code->m_objectRegisterIndex];
const Value& property = registerFile[code->m_propertyRegisterIndex];
Object* obj = willBeObject.toObject(state);
if (willBeObject.isPrimitive()) {
obj->ensureObjectRareData()->m_isExtensible = false;
}
bool result = obj->setIndexedProperty(state, property, registerFile[code->m_loadRegisterIndex]);
if (UNLIKELY(!result)) {
if (state.inStrictMode()) {
// copy assignee for generating right execution result
registerFile[code->m_objectRegisterIndex] = registerFile[code->m_loadRegisterIndex];
Object::throwCannotWriteError(state, PropertyName(state, property.toString(state)));
}
}