{ "id": "65718", "key": "TIMOB-4201", "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": "11356", "description": "Mobile 1.8.0 M03", "name": "Sprint 2011-24", "archived": true, "released": true, "releaseDate": "2011-06-20" } ], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2011-06-20T09:59:37.000+0000", "created": "2011-05-24T11:27:14.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "regression" ], "versions": [ { "id": "11244", "name": "Release 1.7.0", "archived": true, "released": true, "releaseDate": "2011-06-13" } ], "issuelinks": [], "assignee": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-02T21:06:50.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": "If you call Ti.Platform.displayCaps from a different context it says that it is undefined.\r\n\r\nStep 1: run the code below\r\nStep 2: notice the error when you click the button\r\nStep 3: when you call the same function from the same context it works fine.\r\n\r\napp.js\r\n{code:javascript}\r\nvar app ={\r\n\tgetWidth : function(){\r\n\t\treturn Ti.Platform.displayCaps.platformWidth;\r\n\t}\r\n};\r\n\r\nvar win = Ti.UI.createWindow({ \r\n backgroundColor:'white',\r\n\tfullscreen: true\r\n});\r\n\r\nvar button = Ti.UI.createButton({\r\n\ttitle: 'Width',\r\n\ttop: 100,\r\n\theight: 40,\r\n\twidth: 200\r\n});\r\nbutton.addEventListener('click', function(e){\r\n\t// alert( app.getWidth() );\r\n\tvar newWin = Ti.UI.createWindow({ \r\n\t backgroundColor:'blue',\r\n\t\turl: 'win1.js'\r\n\t});\r\n\tnewWin.app = app;\r\n\tnewWin.open();\r\n});\r\n\r\nwin.add(button);\r\nwin.open();\r\n{code}\r\n\r\nwin1.js\r\n{code:javascript}\r\n(function(){\r\n\tvar win = Ti.UI.currentWindow;\r\n\talert( win.app.getWidth() );\r\n})();\r\n{code}", "attachment": [ { "id": "18986", "filename": "4201.crash", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-06-06T14:54:11.000+0000", "size": 20774, "mimeType": "application/octet-stream" }, { "id": "18562", "filename": "Screen shot 2011-05-24 at 11.12.44 AM.png", "author": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-05-24T11:27:14.000+0000", "size": 37977, "mimeType": "image/png" } ], "flagged": false, "summary": "iOS: Ti.Platform.displayCaps is undefined if called from another context", "creator": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Errors with: TiSDK 1.7.0.RC1, iOS 4.3\r\nWorks with: TiSDK 1.6.2, iOS 4.3", "comment": { "comments": [ { "id": "134240", "author": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "body": "h3. Associated Helpdesk Ticket\nhttp://appc.me/c/APP-783212", "updateAuthor": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-05-25T09:10:18.000+0000", "updated": "2011-05-25T09:10:18.000+0000" }, { "id": "134241", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "h3. Second Associated Helpdesk Ticket\nhttp://appc.me/c/APP-367438", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-05-25T09:15:41.000+0000", "updated": "2011-05-25T09:16:14.000+0000" }, { "id": "134281", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "h1. Where The Regression Happened\nI just tested this on a build I made last night from the latest source, and it is working again. So sometime between 1.6.2 and 1.7.0.RC1 this regressed, and from 1.7.0.RC1 to now it was fixed.\n\nh2. Works With\nTitanium SDK version: 1.8.0 (05/24/11 16:32 ce16436)\n(pulled from GitHub, built myself)\n\nh2. Tested With\n{code:title=app.js}\nTi.App.Dawson = {\n createRedBox: function() {\n var v = Ti.UI.createView({ backgroundColor: 'red', width: 50, height: 50 });\n v.add(Ti.UI.createLabel({ text: 'Hello!' })); //This line fails with an exception saying v is undefined.\n alert(Ti.Platform.displayCaps.platformWidth);\n return v;\n }\n};\nTi.UI.createWindow({ url: 'sub.js', backgroundColor: 'white' }).open();\n{code}\n{code:title=sub.js}\nTi.UI.currentWindow.add(Ti.App.Dawson.createRedBox());\n{code}", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-05-25T14:16:52.000+0000", "updated": "2011-05-25T14:16:52.000+0000" }, { "id": "134837", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "If it's working now, let's call it fixed.", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-06-03T14:37:55.000+0000", "updated": "2011-06-03T14:37:55.000+0000" }, { "id": "140659", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Now it crashes.\r\n\r\nMon Jun 6 14:41:35 unknown ReportCrash[4648] : Formulating crash report for process timob4201[4647]\r\nMon Jun 6 14:41:35 unknown ReportCrash[4648] : Saved crashreport to /var/mobile/Library/Logs/CrashReporter/timob4201_2011-06-06-144135_Pippen.plist using uid: 0 gid: 0, synthetic_euid: 501 egid: 0\r\nMon Jun 6 14:41:35 unknown com.apple.launchd[1] : (UIKitApplication:com.appcelerator.4201[0xea7b]) Job appears to have crashed: Trace/BPT trap\r\nMon Jun 6 14:41:35 unknown SpringBoard[28] : Application 'timob4201' exited abnormally with signal 5: Trace/BPT trap\r\n\r\nSee attached crash log.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-06-06T14:53:46.000+0000", "updated": "2011-06-06T14:53:46.000+0000" }, { "id": "156674", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tempted to mark this is invalid; For reasons of safety, creating proxies in the wrong context is disallowed (It leads to deadlocks or crashes) and so displayCaps, since it wasn't defined previously and would be in the wrong context, is not registered.\r\n\r\nIf you absolutely must make cross-context calls, refer to Ti.Platform.displayCaps in the JS file beforehand.", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-06-13T19:45:31.000+0000", "updated": "2011-06-13T19:45:31.000+0000" }, { "id": "157139", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "No objections to marking this invalid. Creating a proxy cross-context (That includes accessing previously un-accessed globals) was intentionally disallowed to stop things from crashing.", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-06-20T09:59:37.000+0000", "updated": "2011-06-20T09:59:37.000+0000" }, { "id": "408513", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closed as invalid.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-02T21:06:50.000+0000", "updated": "2017-03-02T21:06:50.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }