{ "id": "85040", "key": "TIMOB-7258", "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": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2013-03-25T17:11:00.000+0000", "created": "2012-01-17T10:54:19.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "exalture" ], "versions": [ { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" }, { "id": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" } ], "issuelinks": [], "assignee": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "updated": "2017-03-21T21:29: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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h4. PROBLEM DESCRIPTION\r\nCustomer refactored his app to use the require function instead of Ti.include. But I detect an issue with the require feature. My instanceof checks do no longer work. It's a bit strange and took me a long time to break it down.\r\n\r\nh4. STEPS TO REPRODUCE\r\n1. Create new mobile project\r\n2. Add app.js listed below\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow();\r\nwin.open();\r\n \r\nfunction callback (myarray) {\r\n \r\n if ((myarray instanceof Array)) {\r\n alert('myarray is instance of array');\r\n } else {\r\n alert('myarray is NOT instance of array');\r\n }\r\n};\r\n \r\nvar caller = require('caller');\r\nvar call = new caller();\r\ncall.setCallback(callback);\r\ncall.start();\r\n{code}\r\n\r\n3. add a file caller.js with this:\r\n\r\n{code}\r\nfunction caller () {\r\n}\r\n \r\ncaller.prototype.setCallback = function (callback) {\r\n this.callback = callback;\r\n};\r\n \r\ncaller.prototype.start = function () {\r\n this.callback.apply({}, [[]]);\r\n};\r\n \r\nmodule.exports = caller;\r\n{code}\r\n\r\nh4. EXTRA INFO\r\nIn iOS is working fine. Screenshots attached. ", "attachment": [ { "id": "25100", "filename": "Screen Shot 2012-01-17 at 10.07.03 AM.png", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2012-01-17T10:54:39.000+0000", "size": 56407, "mimeType": "image/png" }, { "id": "25101", "filename": "Screen Shot 2012-01-17 at 10.33.09 AM.png", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2012-01-17T10:54:39.000+0000", "size": 37327, "mimeType": "image/png" } ], "flagged": false, "summary": "Android - Android does not detect an array as an instanceof Array", "creator": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "subtasks": [], "reporter": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "environment": null, "comment": { "comments": [ { "id": "179852", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "There is definitely something strange going on here. The issue is not related to \"apply\" function, regular function call (\"this.callback([])\") also suffers from same problem.\r\n\r\n\r\nI tried to see \"myarray\" variable contains but debug information does not show.\r\n\r\n{code}\r\nfunction callback (myarray) {\r\n Ti.API.debug(myarray); //doesn't print anything\r\n Ti.API.debug(Object.prototype.toString.call(myarray)); //prints [object Array], that's OK\r\n if ((myarray instanceof Array)) {\r\n alert('myarray is instance of array');\r\n } else {\r\n alert('myarray is NOT instance of array');\r\n }\r\n};\r\n{code}\r\n\r\n\r\nIt seems like array's value is lost somewhere.", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2012-01-19T02:05:26.000+0000", "updated": "2012-01-19T02:05:26.000+0000" }, { "id": "179927", "author": { "name": "jicks83", "key": "jicks83", "displayName": "Jick Steen", "active": true, "timeZone": "Europe/Berlin" }, "body": "Same happens for example with a {{(myobject instanceof Object)}} check. Doesn't work.", "updateAuthor": { "name": "jicks83", "key": "jicks83", "displayName": "Jick Steen", "active": true, "timeZone": "Europe/Berlin" }, "created": "2012-01-19T14:04:19.000+0000", "updated": "2012-01-19T14:04:19.000+0000" }, { "id": "243936", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "I can't reproduce the problem, it works fine with SDK 3.1.0.\r\n", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2013-03-25T17:11:00.000+0000", "updated": "2013-03-25T17:11:00.000+0000" }, { "id": "414453", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as the issue cannot be reproduced.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-21T21:29:50.000+0000", "updated": "2017-03-21T21:29:50.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }