//----------------------------------------------------------------------------- //Verify all attributes specified data property of given object: //value, writable, enumerable, configurable //If all attribute values are expected, return true, otherwise, return false function dataPropertyAttributesAreCorrect(obj, name, value, writable, enumerable, configurable) { var attributesCorrect = true; if (obj[name] !== value) { if (typeof obj[name] === "number" && isNaN(obj[name]) && typeof value === "number" && isNaN(value)) { // keep empty } else { attributesCorrect = false; } } try { if (obj[name] === "oldValue") { obj[name] = "newValue"; } else { obj[name] = "OldValue"; } } catch (we) { } var overwrited = false; if (obj[name] !== value) { if (typeof obj[name] === "number" && isNaN(obj[name]) && typeof value === "number" && isNaN(value)) { // keep empty } else { overwrited = true; } } if (overwrited !== writable) { attributesCorrect = false; } var enumerated = false; for (var prop in obj) { if (obj.hasOwnProperty(prop) && prop === name) { enumerated = true; } } if (enumerated !== enumerable) { attributesCorrect = false; } var deleted = false; try { delete obj[name]; } catch (de) { } if (!obj.hasOwnProperty(name)) { deleted = true; } if (deleted !== configurable) { attributesCorrect = false; } return attributesCorrect; }