{ "id": "142361", "key": "TIMOB-18328", "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": "16723", "description": "Windows Platform Support, ListView updates, Vector overlays in maps", "name": "Release 4.1.0", "archived": false, "released": true, "releaseDate": "2015-07-08" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-03-19T22:07:29.000+0000", "created": "2015-01-06T21:00:44.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [], "issuelinks": [ { "id": "46693", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "145639", "key": "TIMOB-18681", "fields": { "summary": "Windows HAL: Need a way to expose static function/property for JSExport class", "status": { "description": "This issue was once resolved, but the resolution was deemed incorrect. From here issues are either marked assigned or resolved.", "name": "Reopened", "id": "4", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false } } } } ], "assignee": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2015-07-10T00:36:00.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": "12642", "name": "Windows", "description": "Windows authoring support" } ], "description": "Related to #12 . Opened this so that we can trace this issue.\r\n\r\n{code}\r\nc++\r\njs_context.JSEvaluateScript(\"Ti.API.trace('Hello, world');\"); // OK\r\njs_context.JSEvaluateScript(\"var a = {}; a.trace = Ti.API.trace; a.trace('Hello, world');\"); // FAIL\r\n{code}", "attachment": [], "flagged": false, "summary": "Windows: Changing function parent did not work", "creator": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 351, "state": "closed", "name": "2015 Sprint 06 Windows", "startDate": "2015-03-14T13:58:11.366Z", "endDate": "2015-03-28T00:00:00.000Z", "completeDate": "2015-03-30T14:10:54.840Z", "originBoardId": 144 } ], "comment": { "comments": [ { "id": "341309", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "For the record: latest HAL doesn't fix this issue yet.", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-01-30T00:38:21.000+0000", "updated": "2015-01-30T00:38:21.000+0000" }, { "id": "345730", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "I can confirm this is still an issue with the version of HAL being pointed at from titanium_mobile_windows now.", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2015-03-11T19:35:29.000+0000", "updated": "2015-03-11T19:35:29.000+0000" }, { "id": "346193", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "I think that changing parent \"should not\" work for functions because in this case the caller (function parent) does not point to correct object.\r\n\r\nFor example:\r\n\r\nThis should work, because \"parent\" of trace is not changed.\r\n{code}\r\nvar A = Ti.API; A.trace(\"Hello, World\");\r\n{code}\r\n\r\nOn the other hand this should not work (do nothing, or throw exception?), because function parent (A) does not point to Ti.API anymore. I am thinking that it does nothing but return undefined. Even in this case this should not cause crash.\r\n\r\n{code}\r\nvar A = {};\r\nA.trace = Ti.API.trace;\r\nA.trace(\"Hello, World\");\r\n{code}\r\n", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-03-17T10:54:20.000+0000", "updated": "2015-03-17T10:54:20.000+0000" }, { "id": "346194", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "I found that Node.js handles all of scenarios above. We should handle that similarly.\r\n\r\n{code}\r\n> var a = console; a.log('hello');\r\nhello\r\n> var a = console.log; a('hello');\r\nhello\r\n> var a = {}; a.log = console.log; a.log('hello');\r\nhello\r\n{code}\r\n", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-03-17T12:43:24.000+0000", "updated": "2015-03-17T12:43:24.000+0000" }, { "id": "346203", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Unlike static functions like Ti.API and Ti.UI.createXXX functions, functions involving \"new\" would work differently. \r\n\r\n{code}\r\n> var buf = new Buffer(128); var fill = buf.fill; fill(0);\r\nTypeError: Cannot call method 'fill' of undefined\r\n\r\n> var buf = new Buffer(128); var a = {}; a.fill = buf.fill; a.fill(0);\r\nTypeError: Cannot call method 'fill' of undefined\r\n{code}\r\n", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-03-17T14:47:02.000+0000", "updated": "2015-03-17T14:47:02.000+0000" }, { "id": "346525", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "https://github.com/appcelerator/titanium_mobile_windows/pull/177", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-03-19T12:32:42.000+0000", "updated": "2015-03-19T12:32:42.000+0000" }, { "id": "357413", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "Verified using:\r\n\r\nWindows 8.1\r\nAppc CLI (NPM): 4.1.0\r\nAppc CLI (Registry): 4.1.0\r\nTi SDK: 4.1.0.GA\r\n\r\nWhen using changing the function parent such as \r\n\r\n{code}\r\nvar API = Ti.API; API.info('Hello, world');\r\nvar info = Ti.API.info; info('Hello, world');\r\nvar API = {info:Ti.API.info}; API.info('Hello, world');\r\n{code}\r\n\r\nthe code works as expected\r\n\r\nClosing ticket", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2015-07-10T00:35:53.000+0000", "updated": "2015-07-10T00:35:53.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }