{ "id": "64005", "key": "TIMOB-3373", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2011-08-10T09:45:20.000+0000", "created": "2011-04-15T03:43:25.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "android" ], "versions": [ { "id": "11570", "description": "", "name": "Release 1.7.2", "archived": true, "released": true, "releaseDate": "2011-07-21" } ], "issuelinks": [ { "id": "12362", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "78705", "key": "TIMOB-4876", "fields": { "summary": "Android - \"hasOwnProperty\" and JSON.parse incompatible", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-22T22:20:32.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}

The JSLint parser barfs warnings in Developer if you do a 'for'\r\niteration through an object's properties. It states that you need\r\nto wrap the for loop's logic with an 'if' condition to filter out\r\nproperties from the prototype. JSLint is not happy until you do\r\nso.

\r\n

Using the Object.hasOwnProperty(p) function is necessary to do\r\nso. So, I dutifully implemented it, and the warnings went away.\r\nThen I ran my app on Android. Puke! Android doesn't like that\r\nfunction.

\r\n

I hereby nominate DT to fix this, because Don seems to rock the\r\nknown universe.

{html}", "attachment": [], "flagged": false, "summary": "Android: hasOwnProperty function fails", "creator": { "name": "tedhaeger", "key": "tedhaeger", "displayName": "Ted Haeger", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "rpfeiffer", "key": "rpfeiffer", "displayName": "Ralf Pfeiffer", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "130620", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Please edit the ticket and provide more information.

\n

1) Small source sample that demonstrates the problem.

\n

2) What version(s) of the TiSDK are you using?

\n

3) Have you tried the 1.7 CI build.

{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:43:25.000+0000", "updated": "2011-04-15T03:43:25.000+0000" }, { "id": "130621", "author": { "name": "nate", "key": "nate", "displayName": "Nate", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I just tested the latest 1.7 build, no luck, same error. You can\nsee it using this plugin https://github.com/appcelerator/TiStorage

{html}", "updateAuthor": { "name": "nate", "key": "nate", "displayName": "Nate", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:43:25.000+0000", "updated": "2011-04-15T03:43:25.000+0000" }, { "id": "130622", "author": { "name": "j1m", "key": "j1m", "displayName": "j1m", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

JSON.parse('{z: 1}').hasOwnProperty('z');

\n

Gives:

\n

TypeError: Cannot call property hasOwnProperty in object: { 'z':\n1 }. It is not a function. It is \"object\".

\n

I don't get an error from:

\n

({z: 1}).hasOwnProperty('z');

\n

So I assume this has something to do with JSON parsing.

{html}", "updateAuthor": { "name": "j1m", "key": "j1m", "displayName": "j1m", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:43:27.000+0000", "updated": "2011-04-15T03:43:27.000+0000" }, { "id": "130623", "author": { "name": "j1m", "key": "j1m", "displayName": "j1m", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

BTW, so far I've been able to work around this with:

\n
\nvar json_parse = function (s) {\n    var result = {};\n    s = JSON.parse(s);\n    for (var name in s) {\n        if (! (name in result)) {\n            result[name] = s[name];\n        }\n    }\n    return result;\n};\n
{html}", "updateAuthor": { "name": "j1m", "key": "j1m", "displayName": "j1m", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:43:27.000+0000", "updated": "2011-04-15T03:43:27.000+0000" }, { "id": "161982", "author": { "name": "karl.astrom", "key": "karl.astrom", "displayName": "Karl Åström", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Titanium Mobile SDK 1.7.2 on android\r\n\r\nThe following code:\r\n\r\nvar foo = JSON.parse('{\"x\":1}');\r\nfoo.hasOwnProperty('x');\r\n\r\nExpected behaviour:\r\nfoo.hasOwnProperty('x') should return true or false\r\n\r\nActual behaviour: \r\na crash saying \r\nTypeError: Cannot call property hasOwnProperty in object {'x':1}. It is not a function, it is \"object\"\r\n\r\nDetailed enough?\r\n(Since when is basic working status of the javascript language a trivial issue btw?)", "updateAuthor": { "name": "karl.astrom", "key": "karl.astrom", "displayName": "Karl Åström", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-08-05T03:59:45.000+0000", "updated": "2011-08-05T04:00:54.000+0000" }, { "id": "415115", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as duplicate and links to the related ticket have been provided above.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-22T22:20:32.000+0000", "updated": "2017-03-22T22:20:32.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }