{ "id": "171773", "key": "TIMOB-26117", "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": [ { "id": "19882", "name": "Release 8.0.0", "archived": false, "released": true, "releaseDate": "2019-03-14" }, { "id": "20206", "name": "node-titanium-sdk 0.4.13", "archived": false, "released": true, "releaseDate": "2018-06-19" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2019-01-07T15:43:25.000+0000", "created": "2018-06-08T22:35:51.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "es6", "ios", "promise" ], "versions": [ { "id": "19957", "description": "", "name": "Release 7.1.0", "archived": false, "released": true, "releaseDate": "2018-03-14" } ], "issuelinks": [ { "id": "56941", "type": { "id": "10020", "name": "Depends", "inward": "is dependent of", "outward": "depends on" }, "outwardIssue": { "id": "170743", "key": "TIMOB-25650", "fields": { "summary": "Upgrade to babel 7", "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": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false } } } }, { "id": "56654", "type": { "id": "10122", "name": "Gantt: start-finish", "inward": "is triggered by", "outward": "is triggering" }, "outwardIssue": { "id": "171843", "key": "TIMOB-26158", "fields": { "summary": "Windows: Build fails with ENOENT error when using transpile", "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": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "56602", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "171619", "key": "TIMOB-26015", "fields": { "summary": "TiAPI: Add JavaScript app bootstrapping support", "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": "Medium", "id": "3" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } }, { "id": "56940", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "171202", "key": "TIMOB-25816", "fields": { "summary": "Decide on best practices for polyfilling for ES6+ usage", "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": "None", "id": "6" }, "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false } } } }, { "id": "56939", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "171011", "key": "TIMOB-25740", "fields": { "summary": "TiAPI: Add support for async/await", "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": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } } ], "assignee": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2019-01-07T15:43:29.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "*Summary:*\r\nJavaScript ES6 \"promises\" are not supported on iOS 9 when setting \"tiapp.xml\" setting {{true}}.\r\n\r\nHowever, promises are supported on iOS 8 and iOS 10.\r\n\r\n*Steps to reproduce:*\r\n# Set up a project's \"tiapp.xml\" with the below \"transpile\" setting.\r\n# Build and run the below code on iOS 9.\r\n\r\n{code:xml}\r\n\r\n\r\n\ttrue\r\n\r\n{code}\r\n\r\n{code:javascript}\r\nTi.API.info(\"@@@ typeof Promise: \" + (typeof Promise));\r\nvar promise = new Promise(function(resolve, reject) {\r\n\tTi.API.info(\"@@@ Promise execution started.\");\r\n\tsetTimeout(function() {\r\n\t\tTi.API.info(\"@@@ Promise execution ended.\");\r\n\t\tresolve();\r\n//\t\treject();\r\n\t}, 1000);\r\n}).then(function() {\r\n\tTi.API.info(\"@@@ Promise.then() called.\");\r\n}).catch(function(e) {\r\n\tTi.API.info(\"@@@ Promise.catch() called.\");\r\n});\r\n{code}\r\n\r\n*Result:*\r\nAn exception dialog is displayed stating \"Can't find variable: Promise\".\r\n\r\n*Notes:*\r\n* This issue does not happen in iOS 8.1 and 8.4 simulators.\r\n* This issue does not happen in iOS 10.3.1 simulator.\r\n* I verified that this issue happens in iOS 9.0 and 9.3 simulator.\r\n* I've tried setting \"tiapp.xml\" {{}} setting true and false. No difference. Always fails on iOS 9.x Setting {{}} to false surprisingly works on iOS 8.\r\n", "attachment": [], "flagged": false, "summary": "iOS: ES6 promises not supported on iOS 9. (Works on iOS 8 and 10.)", "creator": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 1045, "state": "closed", "name": "2018 Sprint 13 SDK", "startDate": "2018-06-17T20:47:13.621Z", "endDate": "2018-07-01T20:47:00.000Z", "completeDate": "2018-07-02T18:40:05.029Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "438268", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Could this be an issue with Babel? I remember we specify the target level when transpiling, so that we only need to add the parts that are missing from that version.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-06-10T13:19:53.000+0000", "updated": "2018-06-10T13:19:53.000+0000" }, { "id": "438284", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "We use babel-preset-env, which is supposed to use the target to partially transform the code based on what the underlying JS engine supports. But as discussed before, this doesn't mean we can support everything, particularly new features that require syntactical JS changes. The ticket Josh mentioned is very relevant here: TIMOB-25816\r\n\r\niOS 8 is quite old and not even listed under the \"obsolete\" targets here: http://kangax.github.io/compat-table/es6/ As a result, I'm not sure to what degree ES6 is supported there, so presumably transpilation should try and transform everything (but Promises shouldn't work unless we add polyfills?)\r\n\r\niOS 9 has partial ES6 support, but should mostly support Promises \"out of the box\" - presumably without the need for polyfills.\r\n\r\n... Actually looking at this: https://caniuse.com/#feat=promises it does looks like Promises have been supported in iOS since 8.", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2018-06-11T14:26:12.000+0000", "updated": "2018-06-11T14:26:12.000+0000" }, { "id": "438296", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "My experience:\r\n\r\n| | iOS 8.1 | iOS 9.3 | iOS 11.4 |\r\n| Transpile on | works | broken | works |\r\n| Transpile off | works | broken | works |\r\n\r\nIn fact, Promise is undefined on iOS 9.3 for me. So it does indeed seem like Promises are broken in iOS 9 specifically.\r\n\r\nWe may need to somehow patch this ourselves since I don't think babel/babel-preset-env will fix it for us.\r\n\r\nRelated finds: https://github.com/babel/babel/issues/8078", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2018-06-11T17:34:14.000+0000", "updated": "2018-06-11T17:34:14.000+0000" }, { "id": "438300", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks for looking into this Chris.\r\n\r\nThis sounds like a good opportunity for me to use my new \"ti.shell.js\" and bootstrap loader via [TIMOB-26015] to extend our JS APIs. I'm already using it to add the newest ES6 functions to \"String.prototype\" if missing (was pretty easy to do). I'll look into doing the same for Promises if the type is missing. Since the team wants my \"ti.shell.js\" to use promises, then this type needs to exist even if transpiling is disabled.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-06-11T18:03:16.000+0000", "updated": "2018-06-11T18:03:16.000+0000" }, { "id": "438348", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "I verified that JavaScriptCore defines {{Promise}} in iOS Simulator 8.4, but not iOS Simulator 9.0, 9.1, 9.2, and 9.3.\r\n\r\nTo be clear, I do not believe this is an issue with the iOS SDK version used to build the app. I tested using iOS SDK 11.3 and was still able to reproduce.\r\n\r\nIt's also worth noting that {{Promise}} is defined on iOS 9.x simulators in both Mobile Safari and WebViews. This appears to only affect JavaScriptCore.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2018-06-12T16:05:50.000+0000", "updated": "2018-06-12T16:05:50.000+0000" }, { "id": "438363", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "master: https://github.com/appcelerator/node-titanium-sdk/pull/32\r\n\r\ntitanium_mobile: https://github.com/appcelerator/titanium_mobile/pull/10107\r\ntitanium_mobile_windows: https://github.com/appcelerator/titanium_mobile_windows/pull/1257", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-06-12T18:20:10.000+0000", "updated": "2018-06-13T21:00:26.000+0000" }, { "id": "438550", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "This was integrated (successfully) in node-titanium-sdk 0.4.13, which is now part of SDk master (7.4.0 target).\r\n\r\nKeep in mind this allows for user-code to make use of Promises (or async await) with transpilation, the issue of using Promises in bootstrap code/without transpilation is another issue.", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2018-06-20T12:51:19.000+0000", "updated": "2018-06-20T12:51:19.000+0000" }, { "id": "442688", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~gmathews] When testing on SDK Version {{7.5.0.v20181016071050}} on iOS 9 the following error can be seen with and without transpile. \r\n\r\n{code:java}\r\n[INFO] : @@@ typeof Promise: undefined\r\n[ERROR] : Script Error {\r\n[ERROR] : column = 26;\r\n[ERROR] : line = 2;\r\n[ERROR] : message = \"Can't find variable: Promise\";\r\n[ERROR] : sourceURL = \"file:///Users/Samir/Library/Developer/CoreSimulator/Devices/A80C19A6-EDA8-4BC5-B0D9-4829C585D0A9/data/Containers/Bundle/Application/5F61DA77-F342-4127-884C-69399303DFAB/T1.app/app.js\";\r\n[ERROR] : stack = \" at (/app.js:2:26)\\n at global code(/app.js:15:70)\\n at require@[native code]\\n at (/ti.main.js:28:10)\\n at loadAsync(/ti.internal/bootstrap.loader.js:102:13)\\n at global code(/ti.main.js:25:52)\";\r\n[ERROR] : toJSON = \"\";\r\n[ERROR] : }\r\n[ERROR] : Script Error Module \"app.js\" failed to leave a valid exports object\r\n{code}\r\n\r\n*Test Environment*\r\n{code:java}\r\nAPPC Studio: 5.1.0.201808080937\r\niPhone 6 Sim (6.0)\r\nAPPC CLI: 7.0.6\r\nOperating System Name: Mac OS Mojave\r\nOperating System Version: 10.14\r\nNode.js Version: 8.9.1\r\nXcode 10.0\r\n{code}\r\n", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-10-17T10:36:06.000+0000", "updated": "2018-10-17T10:36:06.000+0000" }, { "id": "442756", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "I'm reopening this ticket.\r\n\r\nTook a quick look at today, the useBuiltIns option in babel 6 will only replace {{require('babel-polfyfill')}} with individual corejs requires for polyfills required by the specified target, so for iOS 9 it'll generate 42 requires for the environment.\r\n\r\nSo here's our options to actually fix this:\r\n\r\n1. Inject {{require('babel-polyfill')}} into a users app.js which would allow the change made in this ticket work as intended.\r\n * That'll probably have a performance impact due to the excessive requires\r\n\r\n2. Upgrade to the babel 7 packages (TIMOB-25650). @babel/preset-env has a {{useBuiltIns: 'usage'}} option which polyfills as needed.\r\n * The work is mostly done, but the main problem here is (for correctness) the code makes use the {{paths}} arg for require.resolve when copying packages across. That was only added in Node 8.9.0, our current min is 6 (well we say 4 in the package.json but it's broke), we'd have to bump this to 8.9.0 in 7.5.0, which would be a semver major change in a semver minor release.\r\n\r\nWhat does everyone think?", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2018-10-18T12:39:10.000+0000", "updated": "2018-10-18T15:42:16.000+0000" }, { "id": "442839", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "Odd question, but can we \"combine\" the options here? i.e., Move to babel 7 and the if the dev is using Node < 8.9.0 we inject the require (and possible spit out a warning that we're doing so and to avoid it they can use Node 8.9+); and if they're on Node 8.9+ then switch to usage based useBuiltins?", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2018-10-22T19:17:22.000+0000", "updated": "2018-10-22T19:17:22.000+0000" }, { "id": "442840", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "[~cwilliams], I think that's possible.\r\n\r\nThinking about it properly, I think we can actually move to babel 7 without having that hard requirement on 8.9. \r\nTo my knowledge the code wont break if we're using lower than 8.9, it will just not do anything and we not might pull in the correct dep version that is required by @babel/polyfill), however that might not actually be a real cause for concern right now. Users on 8.9 will just have a more guaranteed correctness", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2018-10-22T19:27:19.000+0000", "updated": "2018-10-22T19:27:19.000+0000" }, { "id": "442876", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "https://github.com/appcelerator/node-titanium-sdk/pull/37/commits/3600c9428e0be7910c469f1a44ac153c63ebf92a Updates the changes to allow Node 6 compatability", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2018-10-23T15:12:32.000+0000", "updated": "2018-10-23T15:12:32.000+0000" }, { "id": "442877", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "TIMOB-25740 and TIMOB-25816 should be closed at the same time as this", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2018-10-23T15:36:39.000+0000", "updated": "2018-10-23T15:36:39.000+0000" }, { "id": "442891", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "[~amukherjee], this ticket can be fixed by TIMOB-25650, but that isn't in scope for 7.5.0. Do we want to fix this in 7.5.0?", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2018-10-23T22:39:04.000+0000", "updated": "2018-10-23T22:39:04.000+0000" }, { "id": "442892", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~eharris], I think if TIMOB-25650 will fix this issue, then I would say move this one out of 7.5.0, and we'll close this ticket when TIMOB-25650 is closed. ", "updateAuthor": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-10-23T22:56:52.000+0000", "updated": "2018-10-23T22:56:52.000+0000" }, { "id": "442899", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "[~amukherjee], that's fine with me", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2018-10-24T08:16:58.000+0000", "updated": "2018-10-24T08:16:58.000+0000" }, { "id": "445039", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-01-07T15:43:19.000+0000", "updated": "2019-01-07T15:43:19.000+0000" } ], "maxResults": 22, "total": 22, "startAt": 0 } } }