Use a standard for instead of Object.keys

Object.keys is not available in all platforms, even though it is already
available in most of the browsers.
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys