BOOL ModuleRoot::SetProperty(PropertyId propertyId, Var value, PropertyOperationFlags flags, PropertyValueInfo* info) { PropertyIndex index = GetPropertyIndex(propertyId); if (index != Constants::NoSlot) { if (this->IsWritable(propertyId) == FALSE) { JavascriptError::ThrowCantAssignIfStrictMode(flags, this->GetScriptContext()); if (!this->IsFixedProperty(propertyId)) { PropertyValueInfo::Set(info, this, index, PropertyNone); // Try to cache property info even if not writable } else { PropertyValueInfo::SetNoCache(info, this); } return FALSE; } this->SetSlot(SetSlotArguments(propertyId, index, value)); if (!this->IsFixedProperty(propertyId)) { PropertyValueInfo::Set(info, this, index); } else { PropertyValueInfo::SetNoCache(info, this); } return TRUE; } else if (this->hostObject && this->hostObject->HasProperty(propertyId)) { return this->hostObject->SetProperty(propertyId, value, flags, NULL); } // // Try checking the global object // if the module root doesn't have the property and the host object also doesn't have it // GlobalObject* globalObj = this->GetLibrary()->GetGlobalObject(); BOOL setAttempted = TRUE; if (globalObj->SetExistingProperty(propertyId, value, NULL, &setAttempted)) { return TRUE; } // // Set was attempted. But the set operation returned false. // This happens, when the property is read only. // In those scenarios, we should be setting the property with default attributes // if (setAttempted) { return FALSE; } return DynamicObject::SetProperty(propertyId, value, flags, info); }