Closed philBrown closed 7 years ago
What is the bug that this fixes?
According to the specification (and the browser I was trying to use this with), hasOwnProperty
is an Object.prototype
method and Object.hasOwnProperty
does not exist
That does not answer my question. What bug does this repair?
Running the current parse_json
function (from either json_parse.js
or json_parse_state.js
) in a browser that implements only the specification (ie, does not implement Object.hasOwnProperty
as a function) results in a runtime error to the tune of
Cannot read property 'call' of undefined
This PR fixes that error by using Object.prototype.hasOwnProperty
which is part of the specification and is implemented by a wider range of browsers.
Would you like me to raise an issue first?
What browser does this?
The one I was having trouble with was an embedded ANT browser.
I know you probably don't aim to support something like this but making this change works correctly. As far as I can tell, there is no official documentation for hasOwnProperty
as a static method of Object
and apart from the two line changes in this pull request, all other calls to the method are made via Object.prototype.hasOwnProperty
so if nothing else, this makes the code consistent.
This code is stable and near end of life. I will not make changes unless they fix real problems.
Object inherits from Object.prototype, so correct implementations will find hasOwnProperty.
Change incorrect references of
to