Use hasOwnProperty() instead of !== undefined

This prevents conflicts with predefined object methods.

Change-Id: I3804d3c7c1439d0818a01c03b5fb5b0328c953a4
Merge "Use hasOwnProperty() instead of !== undefined"