Object.prototype
builtins should not be used directly JS-002110851 l.extraData.hasOwnProperty(n) &&
10852 (q.isPlainObject(l.extraData[n]) &&
10853 l.extraData[n].hasOwnProperty("name") &&
10854 l.extraData[n].hasOwnProperty("value")10855 ? a.push(
10856 q(
10857 '<input type="hidden" name="' +
10850 for (var n in l.extraData)
10851 l.extraData.hasOwnProperty(n) &&
10852 (q.isPlainObject(l.extraData[n]) &&
10853 l.extraData[n].hasOwnProperty("name") &&10854 l.extraData[n].hasOwnProperty("value")
10855 ? a.push(
10856 q(
10848 try {
10849 if (l.extraData)
10850 for (var n in l.extraData)
10851 l.extraData.hasOwnProperty(n) &&10852 (q.isPlainObject(l.extraData[n]) &&
10853 l.extraData[n].hasOwnProperty("name") &&
10854 l.extraData[n].hasOwnProperty("value")
9788 }
9789 }
9790
9791 if (ajax.hasOwnProperty("element") && !focusChanged) { 9792 ajax.element.focus();
9793 }
9794 },
7474 }
7475 } else if ($.isPlainObject(constraints)) {
7476 for (var n in constraints) {
7477 if (constraints.hasOwnProperty(n)) { 7478 result = ternary(
7479 result,
7480 this.checkConstraints(constraints[n], selector, n)
It is preferable to call certain Object.prototype
methods through Object
on object instances instead of using the builtins directly.
Objects can have properties that shadow the builtins on Object.prototype
, potentially causing unintended behavior or denial-of-service security vulnerabilities.
For example, it would be unsafe for a webserver to parse JSON input from a client and call hasOwnProperty
directly on the resulting object, because a malicious client could send a JSON value like {"hasOwnProperty": 1}
and cause the server to crash.
It's better to always call these methods from Object.prototype
. For example, obj.hasOwnProperty("bar")
should be replaced with Object.prototype.hasOwnProperty.call(obj, "bar")
.
let hasBarProperty = obj.hasOwnProperty("property");
let isPrototypeOfBar = obj.isPrototypeOf(property);
let barIsEnumerable = obj.propertyIsEnumerable("property");
let hasBarProperty = Object.prototype.hasOwnProperty.call(obj, "property");
let isPrototypeOfBar = Object.prototype.isPrototypeOf.call(obj, property);
let barIsEnumerable = {}.propertyIsEnumerable.call(obj, "property");