{
"id": "171066",
"key": "ALOY-1604",
"fields": {
"issuetype": {
"id": "1",
"description": "A problem which impairs or prevents the functions of the product.",
"name": "Bug",
"subtask": false
},
"project": {
"id": "11113",
"key": "ALOY",
"name": "Alloy",
"projectCategory": {
"id": "10400",
"description": "Tools for developing applications",
"name": "Tooling"
}
},
"fixVersions": [],
"resolution": {
"id": "11",
"description": "Is not a bug in our product",
"name": "Not Our Bug"
},
"resolutiondate": "2018-03-05T21:48:09.000+0000",
"created": "2018-02-08T17:07:55.000+0000",
"priority": {
"name": "Critical",
"id": "1"
},
"labels": [
"alloy",
"bluebird",
"promises"
],
"versions": [],
"issuelinks": [],
"assignee": {
"name": "fmiao",
"key": "fmiao",
"displayName": "Feon Sua Xin Miao",
"active": true,
"timeZone": "America/Vancouver"
},
"updated": "2018-03-06T12:32:11.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": "12329",
"name": "Runtime",
"description": "Generic bucket for uncategorized runtime issues"
}
],
"description": "When I use Alloy for something, bluebird promise not firing 'then' on iphone 5s with OS 10.0.\r\n\r\nIf I use OS 11.0, it works normally.\r\nIf I use SDK 6.x, it works normally on all OS versions.\r\n\r\nTo Reproduce:\r\n\r\n1. Create a new Project\r\n2. Download bluebird.min.js at https://github.com/petkaantonov/bluebird/releases\r\n3. Rename to bluebid.js and past on lib folder.\r\n4. Write on app/alloy.js: \r\n\r\n{code}\r\nAlloy.Globals.test = 'test';\r\n{code}\r\n\r\n3. Write on index.js: \r\n{code}\r\nvar Promise = require('bluebird');\r\n\r\nvar test = new Promise(function (resolve){\r\n\r\n\tresolve();\r\n});\r\n\r\ntest.then(function (){\r\n\r\n\tconsole.log('not working!!');\r\n});\r\n\r\nconsole.log(Alloy.Globals.test);\r\n{code}\r\n\r\n5. Run os Iphone 5s simulator with OS 10.0.\r\n\r\nThe ('not working!!') log doesn't work.\r\n\r\nIf I remove the (Alloy.Globals.test) log, then promise is fired and the The ('not working!!') log works.\r\n\r\n\r\n",
"attachment": [
{
"id": "64888",
"filename": "classic.zip",
"author": {
"name": "fmiao",
"key": "fmiao",
"displayName": "Feon Sua Xin Miao",
"active": true,
"timeZone": "America/Vancouver"
},
"created": "2018-02-22T19:31:17.000+0000",
"size": 23824,
"mimeType": "application/zip"
}
],
"flagged": false,
"summary": "iOS 10.0: Bluebird Promise not firing 'then' if Alloy is used.",
"creator": {
"name": "hrfn",
"key": "hrfn",
"displayName": "Hugo Ramos Freire Neto",
"active": true,
"timeZone": "America/Los_Angeles"
},
"subtasks": [],
"reporter": {
"name": "hrfn",
"key": "hrfn",
"displayName": "Hugo Ramos Freire Neto",
"active": true,
"timeZone": "America/Los_Angeles"
},
"environment": "TiSDK: 7.0.1\r\nSimulator: Iphone 5s, OS 10.0\r\n",
"comment": {
"comments": [
{
"id": "434325",
"author": {
"name": "hknoechel",
"key": "hansknoechel",
"displayName": "Hans Knöchel",
"active": true,
"timeZone": "Europe/Berlin"
},
"body": "Titanium SDK 7.1.0 and later will support built-in promises, so you won't need any external library for it anymore. Therefore I would propose to not address this but use the built in solution in the next release. Since we won't have a release before 7.1.0, this will be the earliest fix date anyway. Are you okay with that?\r\n\r\nP.S.: You can try out the ES6 / promises support today using the master branch ({{appc ti sdk install -b master}}). Thanks!",
"updateAuthor": {
"name": "hknoechel",
"key": "hansknoechel",
"displayName": "Hans Knöchel",
"active": true,
"timeZone": "Europe/Berlin"
},
"created": "2018-02-10T17:03:50.000+0000",
"updated": "2018-02-10T17:03:50.000+0000"
},
{
"id": "434340",
"author": {
"name": "sdarda",
"key": "sdarda",
"displayName": "Sharif AbuDarda",
"active": false,
"timeZone": "Asia/Dhaka"
},
"body": "Hello [~hrfn], Can you get back to us testing with the master release? Thanks.",
"updateAuthor": {
"name": "sdarda",
"key": "sdarda",
"displayName": "Sharif AbuDarda",
"active": false,
"timeZone": "Asia/Dhaka"
},
"created": "2018-02-11T21:29:19.000+0000",
"updated": "2018-02-11T21:29:19.000+0000"
},
{
"id": "434342",
"author": {
"name": "davidbenko",
"key": "davidbenko",
"displayName": "David Benko",
"active": true,
"timeZone": "America/Los_Angeles"
},
"body": "Hello, I'm having this issue as well. I have a large app and we have other libraries that depend on bluebird. We use bluebird specific methods such as Promise.mapSeries that are not present the native implementation. The native implementation also have very bad stack traces, and bluebird provides has a complete stack when exceptions occur. Unfortunatelly we cant switch to native promises because of those reasons",
"updateAuthor": {
"name": "davidbenko",
"key": "davidbenko",
"displayName": "David Benko",
"active": true,
"timeZone": "America/Los_Angeles"
},
"created": "2018-02-11T23:27:22.000+0000",
"updated": "2018-02-11T23:27:22.000+0000"
},
{
"id": "434421",
"author": {
"name": "hknoechel",
"key": "hansknoechel",
"displayName": "Hans Knöchel",
"active": true,
"timeZone": "Europe/Berlin"
},
"body": "JavaScriptCore on iOS 11 supports Promises built-in (even without transpilation / Babel), which you are basically overriding. Since SDK 7, we enable JavaScriptCore by default and you can disable with {{false}} in the {{}} section of the tiapp.xml.\r\n\r\nPlease also confirm this only happens with Alloy and not classic apps.",
"updateAuthor": {
"name": "hknoechel",
"key": "hansknoechel",
"displayName": "Hans Knöchel",
"active": true,
"timeZone": "Europe/Berlin"
},
"created": "2018-02-13T16:52:11.000+0000",
"updated": "2018-02-13T16:52:30.000+0000"
},
{
"id": "434703",
"author": {
"name": "hrfn",
"key": "hrfn",
"displayName": "Hugo Ramos Freire Neto",
"active": true,
"timeZone": "America/Los_Angeles"
},
"body": "false Not solved the problem.\r\n\r\nThe problem only happens on iOS 10.\r\n\r\nThe Problem only happens when I use Alloy.\r\n\r\nOn Classic app works fine, because Alloy is not called. ex: Alloy.Globals.test.\r\n\r\nI've tested on master branch, and the problem persists.",
"updateAuthor": {
"name": "hrfn",
"key": "hrfn",
"displayName": "Hugo Ramos Freire Neto",
"active": true,
"timeZone": "America/Los_Angeles"
},
"created": "2018-02-21T17:35:54.000+0000",
"updated": "2018-02-21T17:35:54.000+0000"
},
{
"id": "434705",
"author": {
"name": "arthurpadilha",
"key": "arthurpadilha",
"displayName": "Arthur Padilha",
"active": true,
"timeZone": "America/Recife"
},
"body": "This issue is happening in my apps too.\r\nIt's critical because I use Bluebird everywhere in my app and it's happening when my app is used on iOS 10 devices.\r\nI use Alloy too.\r\n",
"updateAuthor": {
"name": "arthurpadilha",
"key": "arthurpadilha",
"displayName": "Arthur Padilha",
"active": true,
"timeZone": "America/Recife"
},
"created": "2018-02-21T17:43:11.000+0000",
"updated": "2018-02-21T17:43:11.000+0000"
},
{
"id": "434786",
"author": {
"name": "fmiao",
"key": "fmiao",
"displayName": "Feon Sua Xin Miao",
"active": true,
"timeZone": "America/Vancouver"
},
"body": "Attached a classic app that has the same issue. In {{app.js}} at line 2, 21 and 32, the same module is called but produces different out come.\r\n\r\n[~amukherjee], let me know if you and anyone is able to verify this.",
"updateAuthor": {
"name": "fmiao",
"key": "fmiao",
"displayName": "Feon Sua Xin Miao",
"active": true,
"timeZone": "America/Vancouver"
},
"created": "2018-02-22T19:46:53.000+0000",
"updated": "2018-03-05T21:47:29.000+0000"
},
{
"id": "434789",
"author": {
"name": "fmiao",
"key": "fmiao",
"displayName": "Feon Sua Xin Miao",
"active": true,
"timeZone": "America/Vancouver"
},
"body": "[~hrfn], if you replace {{console.log(Alloy.Globals.test);}} with say {{console.log('####');}} the promise listener registered with {{.then()}} won't get called either. So I'm not exactly sure what's the purpose of the reproduce step #4. \r\n\r\nThis might be related to the promise library, it seems like a scheduling issue, and I'm able to reproduce with a classic app.\r\n \r\nYou can workaround is by using {{setTimeout}}: \r\n\r\n{code}\r\nvar test = new Promise(function (resolve){\r\n\tsetTimeout(function() { resolve(); }, 0);\r\n});\r\n{code}\r\n",
"updateAuthor": {
"name": "fmiao",
"key": "fmiao",
"displayName": "Feon Sua Xin Miao",
"active": true,
"timeZone": "America/Vancouver"
},
"created": "2018-02-22T20:13:33.000+0000",
"updated": "2018-02-22T20:13:33.000+0000"
},
{
"id": "434790",
"author": {
"name": "hrfn",
"key": "hrfn",
"displayName": "Hugo Ramos Freire Neto",
"active": true,
"timeZone": "America/Los_Angeles"
},
"body": "I've tested right now, if I use console.log('####'); instead console.log(Alloy.Globals.test); it work's for me.\r\n\r\nAnd on classic app works for me too.",
"updateAuthor": {
"name": "hrfn",
"key": "hrfn",
"displayName": "Hugo Ramos Freire Neto",
"active": true,
"timeZone": "America/Los_Angeles"
},
"created": "2018-02-22T20:31:34.000+0000",
"updated": "2018-02-22T20:33:36.000+0000"
},
{
"id": "435014",
"author": {
"name": "davidbenko",
"key": "davidbenko",
"displayName": "David Benko",
"active": true,
"timeZone": "America/Los_Angeles"
},
"body": "Any thoughts on why this is happening on iphone OS 10 only? Does it have anything different?",
"updateAuthor": {
"name": "davidbenko",
"key": "davidbenko",
"displayName": "David Benko",
"active": true,
"timeZone": "America/Los_Angeles"
},
"created": "2018-02-28T17:46:57.000+0000",
"updated": "2018-02-28T17:47:12.000+0000"
},
{
"id": "435213",
"author": {
"name": "fmiao",
"key": "fmiao",
"displayName": "Feon Sua Xin Miao",
"active": true,
"timeZone": "America/Vancouver"
},
"body": "According to [~eharris], removing this commit fixes the issue https://github.com/petkaantonov/bluebird/commit/b8e580c52504457f618018c5e434abb72548a3b8.\r\n\r\nLooks like an issue with the promise library itself.",
"updateAuthor": {
"name": "fmiao",
"key": "fmiao",
"displayName": "Feon Sua Xin Miao",
"active": true,
"timeZone": "America/Vancouver"
},
"created": "2018-03-05T21:47:59.000+0000",
"updated": "2018-03-05T21:47:59.000+0000"
},
{
"id": "435240",
"author": {
"name": "eharris",
"key": "eharris",
"displayName": "Ewan Harris",
"active": true,
"timeZone": "Europe/Dublin"
},
"body": "To expand upon Feons comment here's how I arrived at that conclusion\r\n\r\n- I searched the Bluebird issue tracker on the GitHub for any known issues on iOS, I found [this|https://github.com/petkaantonov/bluebird/issues/1022] which appeared to be a similar issue, albeit closed as fixed\r\n- We know this worked in SDK 6, one major change around JavaScript usage from SDK 6 to 7 was that the on device JavaScriptCore framework became\r\nthe default.\r\n- Seeing as how the fix for the above issue is using the JS Engines promise implementation, it seemed possible to me that this bug was due to the JavaScriptCore Promise implementation on certain iOS versions pre 11.0 (from my tests, I could see the issue down to iOS 8)\r\n- I ran with {{false}} in my tiapp, which forces the app to use TiJSCore (i.e pre-7 behavior), the issue was not seen\r\n- I removed the changes in [the fix|https://github.com/petkaantonov/bluebird/commit/b8e580c52504457f618018c5e434abb72548a3b8], this fixed the issue\r\n\r\nSo the issue here appears to be due to Bluebird delegating to the native Promise implementation when possible. This isn't seen when using TiJScore (pre 7 behaviour, false behaviour), because it doesn't have a native Promise implementation.\r\n\r\nBut there is good news, as there's a few ways to fix this!\r\n\r\n1. As stated in the original issue on GitHub you can call [Promise.setScheduler|http://bluebirdjs.com/docs/api/promise.setscheduler.html] to override the schedule, which should fix the problem. In Feons classic example changing test.js to the below fixes the issue for me, and also adding the setScheduler call in the Alloy sample fixes it for me too\r\n{code}\r\nvar Promise = require('bluebird');\r\nPromise.setScheduler(function(fn) {\r\n setTimeout(fn, 0);\r\n});\r\nfunction Test(str) {\r\n console.log('@@@@@@@@@@ ', Promise);\r\n var test = new Promise(function (resolve){\r\n resolve();\r\n });\r\n\r\n test.then(function (){\r\n alert(str);\r\n });\r\n}\r\n\r\nmodule.exports = Test;\r\n{code}\r\n2. Fork bluebird, remove the changes in the aforementioned commit, build the libraries yourself and use those.\r\n3. Set {{false}}, to use TiJSCore. But I do not recommend this way as you'll just be deferring this problem for a little while as TiJSCore is I believe is due for removal in SDK 8",
"updateAuthor": {
"name": "eharris",
"key": "eharris",
"displayName": "Ewan Harris",
"active": true,
"timeZone": "Europe/Dublin"
},
"created": "2018-03-06T12:32:11.000+0000",
"updated": "2018-03-06T12:32:11.000+0000"
}
],
"maxResults": 16,
"total": 16,
"startAt": 0
}
}
}