{ "id": "143672", "key": "TIMOB-18465", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "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": null, "resolutiondate": null, "created": "2015-01-29T09:26:28.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [ "ios-jscore", "kroll", "parity" ], "versions": [ { "id": "16704", "description": "Release 3.5.0", "name": "Release 3.5.0", "archived": false, "released": true, "releaseDate": "2015-01-13" } ], "issuelinks": [ { "id": "57603", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "161046", "key": "TIMOB-23504", "fields": { "summary": "iOS: Titanium proxies don't extend Object.prototype properly", "status": { "description": "This issue is being actively worked on at the moment by the assignee.", "name": "In Progress", "id": "3", "statusCategory": { "id": 4, "key": "indeterminate", "colorName": "yellow", "name": "In Progress" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "57605", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "171652", "key": "TIMOB-26038", "fields": { "summary": "iOS: Move from legacy JavaScriptCore C Api to Obj-C API", "status": { "description": "This issue is being actively worked on at the moment by the assignee.", "name": "In Progress", "id": "3", "statusCategory": { "id": 4, "key": "indeterminate", "colorName": "yellow", "name": "In Progress" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "6", "description": "gh.issue.epic.desc", "name": "Epic", "subtask": false } } } }, { "id": "57602", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "171876", "key": "TIMOB-26179", "fields": { "summary": "iOS: Property check on proxy always returns true", "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": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "updated": "2019-04-26T19:04:21.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "Currently globals are not set with the ‘right’ flags. We cannot actually say right or wrong flags, because they’re not in the EcmaScript definition.\r\n\r\nSome discussion happened on https://github.com/smclab/titaniumifier/issues/31.\r\n\r\nThe code to test the descriptors is the following:\r\n\r\n{code:javascript}\r\nvar global = (function () { return this; }());\r\n\r\nif ((typeof window !== 'undefined') &&\r\n (window === global) &&\r\n (!window.hasOwnProperty('alert'))) {\r\n // In the browser the globals are not directly in the window, but in the\r\n // prototype chain\r\n global = Object.getPrototypeOf(global);\r\n}\r\n\r\nprintPropertyDescriptor(global, 'alert');\r\n\r\nprintPropertyDescriptor(global, 'setTimeout');\r\nprintPropertyDescriptor(global, 'clearTimeout');\r\nprintPropertyDescriptor(global, 'setInterval');\r\nprintPropertyDescriptor(global, 'clearInterval');\r\n\r\nfunction printPropertyDescriptor(obj, name) {\r\n\tvar descriptor = Object.getOwnPropertyDescriptor(obj, 'clearTimeout');\r\n\tvar formatted = JSON.stringify(descriptor, null, 2);\r\n\tconsole.log(name + \" = \" + formatted);\r\n}\r\n{code}\r\n\r\nThe result is different in every environment. As you will see only Titanium *on iOS* is setting the properties as non-writable.\r\n\r\nAlso, if using {{\"use strict\"}} trying to overwrite those properties will result in an error thrown.\r\n\r\n*Node.js*\r\n\r\n{code:javascript}\r\nalert = {\r\n \"writable\": true,\r\n \"enumerable\": true,\r\n \"configurable\": true\r\n}\r\nsetTimeout = {\r\n \"writable\": true,\r\n \"enumerable\": true,\r\n \"configurable\": true\r\n}\r\nclearTimeout = {\r\n \"writable\": true,\r\n \"enumerable\": true,\r\n \"configurable\": true\r\n}\r\nsetInterval = {\r\n \"writable\": true,\r\n \"enumerable\": true,\r\n \"configurable\": true\r\n}\r\nclearInterval = {\r\n \"writable\": true,\r\n \"enumerable\": true,\r\n \"configurable\": true\r\n}\r\n{code}\r\n\r\n*Chrome*\r\n\r\n{code:javascript}\r\nalert = {\r\n \"writable\": true,\r\n \"enumerable\": true,\r\n \"configurable\": false\r\n}\r\nsetTimeout = {\r\n \"writable\": true,\r\n \"enumerable\": true,\r\n \"configurable\": false\r\n}\r\nclearTimeout = {\r\n \"writable\": true,\r\n \"enumerable\": true,\r\n \"configurable\": false\r\n}\r\nsetInterval = {\r\n \"writable\": true,\r\n \"enumerable\": true,\r\n \"configurable\": false\r\n}\r\nclearInterval = {\r\n \"writable\": true,\r\n \"enumerable\": true,\r\n \"configurable\": false\r\n}\r\n{code}\r\n\r\n*Firefox*\r\n\r\n{code:javascript}\r\nalert = {\r\n \"configurable\": true,\r\n \"enumerable\": true,\r\n \"writable\": true\r\n}\r\nsetTimeout = {\r\n \"configurable\": true,\r\n \"enumerable\": true,\r\n \"writable\": true\r\n}\r\nclearTimeout = {\r\n \"configurable\": true,\r\n \"enumerable\": true,\r\n \"writable\": true\r\n}\r\nsetInterval = {\r\n \"configurable\": true,\r\n \"enumerable\": true,\r\n \"writable\": true\r\n}\r\nclearInterval = {\r\n \"configurable\": true,\r\n \"enumerable\": true,\r\n \"writable\": true\r\n}\r\n{code}\r\n\r\n*Titanium Android*\r\n\r\n{code:javascript}\r\nalert = {\r\n \"writable\": true,\r\n \"enumerable\": true,\r\n \"configurable\": true\r\n}\r\nsetTimeout = {\r\n \"writable\": true,\r\n \"enumerable\": true,\r\n \"configurable\": true\r\n}\r\nclearTimeout = {\r\n \"writable\": true,\r\n \"enumerable\": true,\r\n \"configurable\": true\r\n}\r\nsetInterval = {\r\n \"writable\": true,\r\n \"enumerable\": true,\r\n \"configurable\": true\r\n}\r\nclearInterval = {\r\n \"writable\": true,\r\n \"enumerable\": true,\r\n \"configurable\": true\r\n}\r\n{code}\r\n\r\n*Titanium iOS* (drumroll)\r\n\r\n{code:javascript}\r\nalert = {\r\n \"writable\": false,\r\n \"enumerable\": true,\r\n \"configurable\": false\r\n}\r\nsetTimeout = {\r\n \"writable\": false,\r\n \"enumerable\": true,\r\n \"configurable\": false\r\n}\r\nclearTimeout = {\r\n \"writable\": false,\r\n \"enumerable\": true,\r\n \"configurable\": false\r\n}\r\nsetInterval = {\r\n \"writable\": false,\r\n \"enumerable\": true,\r\n \"configurable\": false\r\n}\r\nclearInterval = {\r\n \"writable\": false,\r\n \"enumerable\": true,\r\n \"configurable\": false\r\n}\r\n{code}", "attachment": [], "flagged": false, "summary": "Globals are not (over)writable", "creator": { "name": "yuchi", "key": "yuchi", "displayName": "Pier Paolo Ramon", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "yuchi", "key": "yuchi", "displayName": "Pier Paolo Ramon", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Titanium SDK 3.5.0, iOS", "comment": { "comments": [ { "id": "341141", "author": { "name": "yuchi", "key": "yuchi", "displayName": "Pier Paolo Ramon", "active": true, "timeZone": "Europe/Berlin" }, "body": "Here’s the culprit: https://github.com/appcelerator/titanium_mobile/blob/2c7f6fb74fa772e1ecc8d9d5209f83c4a0c06aab/iphone/Classes/KrollContext.m#L1112\r\n\r\nWhy are them explicitly set as {{kTiPropertyAttributeReadOnly | kTiPropertyAttributeDontDelete}}? There’s no (real) reason for doing this…", "updateAuthor": { "name": "yuchi", "key": "yuchi", "displayName": "Pier Paolo Ramon", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-01-29T10:05:48.000+0000", "updated": "2015-01-29T10:05:48.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }