Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/simulation2/serialization/BinarySerializer.cpp
Show First 20 Lines • Show All 266 Lines • ▼ Show 20 Lines | #endif | ||||
for (size_t i = 0; i < ida.length(); ++i) | for (size_t i = 0; i < ida.length(); ++i) | ||||
{ | { | ||||
JS::RootedId id(rq.cx, ida[i]); | JS::RootedId id(rq.cx, ida[i]); | ||||
JS::RootedValue idval(rq.cx); | JS::RootedValue idval(rq.cx); | ||||
JS::RootedValue propval(rq.cx); | JS::RootedValue propval(rq.cx); | ||||
// Forbid getters, which might delete values and mess things up. | // Forbid getters, which might delete values and mess things up. | ||||
JS::Rooted<JSPropertyDescriptor> desc(rq.cx); | JS::Rooted<JS::PropertyDescriptor> desc(rq.cx); | ||||
if (!JS_GetPropertyDescriptorById(rq.cx, obj, id, &desc)) | if (!JS_GetPropertyDescriptorById(rq.cx, obj, id, &desc)) | ||||
throw PSERROR_Serialize_ScriptError("JS_GetPropertyDescriptorById failed"); | throw PSERROR_Serialize_ScriptError("JS_GetPropertyDescriptorById failed"); | ||||
if (desc.hasGetterObject()) | if (desc.hasGetterObject()) | ||||
throw PSERROR_Serialize_ScriptError("Cannot serialize property getters"); | throw PSERROR_Serialize_ScriptError("Cannot serialize property getters"); | ||||
// Get the property name as a string | // Get the property name as a string | ||||
if (!JS_IdToValue(rq.cx, id, &idval)) | if (!JS_IdToValue(rq.cx, id, &idval)) | ||||
throw PSERROR_Serialize_ScriptError("JS_IdToValue failed"); | throw PSERROR_Serialize_ScriptError("JS_IdToValue failed"); | ||||
▲ Show 20 Lines • Show All 159 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator