Do not access Object.prototype method 'hasOwnProperty' from target object.
131 }
132
133 containsDefinition(featureTypeString) {
134 if (this.__definitions.hasOwnProperty(featureTypeString)) return true;135 else return false;
136 }
137
Do not access Object.prototype method 'hasOwnProperty' from target object.
181 getDefinition(typeString) {
182 // console.log("Called", typeString);
183 //TODO:Clean up this hacky code and shift everything to use MINT convention
184 if (!this.__library.hasOwnProperty(typeString)) {185 typeString = this.getTypeForMINT(typeString);
186 }
187
Do not access Object.prototype method 'hasOwnProperty' from target object.
266
267 __checkDefinitions() {
268 for (let key in this.__definitions) {
269 if (!this.__tools.hasOwnProperty(key) || !this.__render2D.hasOwnProperty(key) || !this.__render3D.hasOwnProperty(key)) {270 throw new Error("Feature set does not contain a renderer or tool definition for: " + key);
271 }
272 }
Do not access Object.prototype method 'hasOwnProperty' from target object.
266
267 __checkDefinitions() {
268 for (let key in this.__definitions) {
269 if (!this.__tools.hasOwnProperty(key) || !this.__render2D.hasOwnProperty(key) || !this.__render3D.hasOwnProperty(key)) {270 throw new Error("Feature set does not contain a renderer or tool definition for: " + key);
271 }
272 }
Do not access Object.prototype method 'hasOwnProperty' from target object.
266
267 __checkDefinitions() {
268 for (let key in this.__definitions) {
269 if (!this.__tools.hasOwnProperty(key) || !this.__render2D.hasOwnProperty(key) || !this.__render3D.hasOwnProperty(key)) {270 throw new Error("Feature set does not contain a renderer or tool definition for: " + key);
271 }
272 }
Do not access Object.prototype method 'hasOwnProperty' from target object.
185 typeString = this.getTypeForMINT(typeString);
186 }
187
188 if (!this.__library.hasOwnProperty(typeString)) {189 console.error("Could not find the type in featureset definition !: " + typeString);
190 return null;
191 }
Do not access Object.prototype method 'hasOwnProperty' from target object.
130 * @memberof TextFeature
131 */
132 hasDefaultParam(key) {
133 if (this.getDefaults().hasOwnProperty(key)) return true;134 else return false;
135 }
136 /**
Do not access Object.prototype method 'hasOwnProperty' from target object.
86 * @memberof Params
87 */
88 isHeritable(key) {
89 return this.heritable.hasOwnProperty(key); 90 }
91 /**
92 * Checks if param has unique key.
Do not access Object.prototype method 'hasOwnProperty' from target object.
48 * @returns {void}
49 */
50 __ensureHasKey(key) {
51 if (!this.parameters.hasOwnProperty(key)) throw new Error(key + " parameter not found in Params object."); 52 }
53 /**
54 * Gets the value of the selected parameter.
Do not access Object.prototype method 'hasOwnProperty' from target object.
33 * @returns {void}
34 */
35 updateParameter(key, value) {
36 if (this.parameters.hasOwnProperty(key)) { 37 this.parameters[key].updateValue(value);
38 } else {
39 if (this.isHeritable(key)) {
Do not access Object.prototype method 'hasOwnProperty' from target object.
197 * @memberof Params
198 */
199 hasParam(key) {
200 return this.parameters.hasOwnProperty(key);201 }
202
203 /**
Do not access Object.prototype method 'hasOwnProperty' from target object.
77 * @memberof Params
78 */
79 isUnique(key) {
80 return this.unique.hasOwnProperty(key); 81 }
82 /**
83 * Checks if param object has heritable attribute.
Do not access Object.prototype method 'hasOwnProperty' from target object.
207 * @memberof Layer
208 */
209 containsFeatureID(featureID) {
210 return this.features.hasOwnProperty(featureID);211 }
212 /**
213 * Gets all features from the layers
Do not access Object.prototype method 'hasOwnProperty' from target object.
198 */
199 containsFeature(feature) {
200 this.__ensureIsAFeature(feature);
201 return this.features.hasOwnProperty(feature.getID());202 }
203 /**
204 * Checks if object contains a feature based on the feature's ID
Do not access Object.prototype method 'hasOwnProperty' from target object.
223 * @memberof Feature
224 */
225 hasDefaultParam(key) {
226 if (this.getDefaults().hasOwnProperty(key)) return true;227 else return false;
228 }
229 /**
Do not access Object.prototype method 'hasOwnProperty' from target object.
292 * @memberof Connection
293 */
294 hasDefaultParam(key) {
295 if (this.getDefaults().hasOwnProperty(key)) return true;296 else return false;
297 }
298
Do not access Object.prototype method 'hasOwnProperty' from target object.
275 * @memberof Component
276 */
277 hasDefaultParam(key) {
278 if (this.getDefaults().hasOwnProperty(key)) return true;279 else return false;
280 }
281
Description
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")
.
Bad Practice
let hasBarProperty = obj.hasOwnProperty("property");
let isPrototypeOfBar = obj.isPrototypeOf(property);
let barIsEnumerable = obj.propertyIsEnumerable("property");
Recommended
let hasBarProperty = Object.prototype.hasOwnProperty.call(obj, "property");
let isPrototypeOfBar = Object.prototype.isPrototypeOf.call(obj, property);
let barIsEnumerable = {}.propertyIsEnumerable.call(obj, "property");