{ "id": "174216", "key": "TIMOB-27483", "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": null, "resolutiondate": null, "created": "2019-10-03T15:03:15.000+0000", "priority": null, "labels": [ "engSchedule", "ios", "promise" ], "versions": [ { "id": "20827", "name": "Release 8.2.0", "archived": false, "released": true, "releaseDate": "2019-09-19" } ], "issuelinks": [], "assignee": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2019-10-22T18:07:09.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": "Titanium SDK has a problem with correct code execution order on iOS in code like this:\r\n\r\n{code:javascript}\r\nPromise.resolve()\r\n .then(() => console.log('A'));\r\nconsole.log('B');\r\n{code}\r\nCorrect output for this sample is:\r\n{noformat}\r\nB\r\nA\r\n{noformat}\r\n\r\n{code:javascript}\r\nnew Promise(function(resolve, reject) {\r\n setTimeout(function() {\r\n console.log('1');\r\n reject();\r\n console.log('2');\r\n }, 1000);\r\n})\r\n.then(function() {\r\n console.log('3');\r\n})\r\n.catch(function() {\r\n console.log('4');\r\n})\r\n{code}\r\nCorrect output for this sample is:\r\n{noformat}\r\n1\r\n2\r\n4\r\n{noformat}\r\n\r\nTested on 8.2.0.GA and 8.3.0 (master branch).\r\n\r\nI sent PR with additional test:\r\nhttps://github.com/appcelerator/titanium_mobile/pull/11260", "attachment": [], "flagged": false, "summary": "iOS: code execution order in Promise ", "creator": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "subtasks": [], "reporter": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "environment": null, "comment": { "comments": [], "maxResults": 0, "total": 0, "startAt": 0 } } }