{ "id": "134085", "key": "TIMOB-17449", "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": "2014-08-02T11:45:00.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [ { "id": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "issuelinks": [], "assignee": null, "updated": "2018-02-28T20:03:11.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": "h2. problem\r\n\r\nThe property exposed on {{this}} in app.js on iOS, {{this.Kroll}}, causing errors when you try to do just about anything with it. This forces any inspection of {{this}} to have special handling code to skip looking at {{this.Kroll}}. It's also just a little wonky to expose a property on {{this}} that can catastrophically abort your app if you so much as try to print it. Below are a few scenarios that will cause various errors:\r\n\r\nh3. Try to print it\r\n{code:javascript}\r\n// either line will result in the following error\r\nTi.API.info(this);\r\nTi.API.info(this.Kroll);\r\n{code}\r\n\r\n{code}\r\n[DEBUG] 2014-08-02 07:33:37.164 joober[36913:3703] -[KrollContext target]: unrecognized selector sent to instance 0xd12bb00\r\n[ERROR] Script Error {\r\n[ERROR] backtrace = \"#0 () at :0\";\r\n[ERROR] line = 1;\r\n[ERROR] message = \"-[KrollContext target]: unrecognized selector sent to instance 0xd12bb00\";\r\n[ERROR] sourceId = 324225728;\r\n[ERROR] sourceURL = \"file:///Users/tlukasavage/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/4C55CF1B-BD0A-44A6-9D7E-A3048ACCDC55/joober.app/app.js\";\r\n[ERROR] } \r\n{code} \r\n\r\nh3. try to iterate over its keys\r\n{code:javascript}\r\nObject.keys(this.Kroll)\r\n{code}\r\n\r\n{code}\r\n[DEBUG] 2014-08-02 07:40:31.403 joober[37262:3703] -[KrollContext target]: unrecognized selector sent to instance 0xd054a10\r\n[ERROR] The application has crashed with an uncaught exception 'NSInvalidArgumentException'.\r\n[ERROR] Reason:\r\n[ERROR] -[KrollContext target]: unrecognized selector sent to instance 0xd054a10\r\n[ERROR] Stack trace:\r\n[ERROR] 0 CoreFoundation 0x042201c8 __exceptionPreprocess + 152\r\n[ERROR] 1 libobjc.A.dylib 0x03edc8e5 objc_exception_throw + 44\r\n[ERROR] 2 CoreFoundation 0x042bd243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275\r\n[ERROR] 3 CoreFoundation 0x0421050b ___forwarding___ + 1019\r\n[ERROR] 4 CoreFoundation 0x042100ee _CF_forwarding_prep_0 + 14\r\n[ERROR] 5 joober 0x00032aeb KrollPropertyNames + 107\r\n[ERROR] 6 joober 0x002b9f2e _ZN2TI16TiCallbackObjectINS_24TiObjectWithGlobalObjectEE19getOwnPropertyNamesEPNS_10TiExcStateERNS_17PropertyNameArrayENS_15EnumerationModeE + 94\r\n[ERROR] 7 joober 0x0036b83a _ZN2TIL21objectConstructorKeysEPNS_10TiExcStateE + 202\r\n[ERROR] 8 joober 0x002fac2a _ZN2TI11Interpreter14privateExecuteENS0_13ExecutionFlagEPNS_12RegisterFileEPNS_10TiExcStateE + 34890\r\n[ERROR] 9 joober 0x002ff71f _ZN2TI11Interpreter7executeEPNS_17ProgramExecutableEPNS_10TiExcStateEPNS_14ScopeChainNodeEPNS_8TiObjectE + 4431\r\n[ERROR] 10 joober 0x00344321 _ZN2TI8evaluateEPNS_10TiExcStateEPNS_14ScopeChainNodeERKNS_10SourceCodeENS_7TiValueE + 337\r\n[ERROR] 11 joober 0x002acce8 TiEvalScript + 344\r\n[ERROR] 12 joober 0x000205bf -[KrollBridge evalFileOnThread:context:] + 1711\r\n[ERROR] 13 libobjc.A.dylib 0x03eee880 -[NSObject performSelector:withObject:withObject:] + 77\r\n[ERROR] 14 joober 0x00028351 -[KrollInvocation invoke:] + 145\r\n[ERROR] 15 joober 0x0002a7d8 -[KrollContext invokeOnThread:method:withObject:callback:selector:] + 248\r\n[ERROR] 16 joober 0x0002079d -[KrollBridge evalFile:callback:selector:] + 125\r\n[ERROR] 17 joober 0x000217a2 -[KrollBridge didStartNewContext:] + 2898\r\n[ERROR] 18 libobjc.A.dylib 0x03eee82b -[NSObject performSelector:withObject:] + 70\r\n[ERROR] 19 joober 0x0002b8ab -[KrollContext main] + 3339\r\n[ERROR] 20 Foundation 0x00e11a07 -[NSThread main] + 76\r\n[ERROR] 21 Foundation 0x00e11966 __NSThread__main__ + 1275\r\n[ERROR] 22 libsystem_pthread.dylib 0x04ad45fb _pthread_body + 144\r\n[ERROR] 23 libsystem_pthread.dylib 0x04ad4485 _pthread_struct_init + 0\r\n[ERROR] 24 libsystem_pthread.dylib 0x04ad9cf2 thread_start + 34\r\n[ERROR] 2014-08-02 07:40:31.408 joober[37262:3703] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[KrollContext target]: unrecognized selector sent to instance 0xd054a10'\r\n[ERROR] *** First throw call stack:\r\n[ERROR] ( \r\n[ERROR] 0 CoreFoundation 0x042201e4 __exceptionPreprocess + 180\r\n[ERROR] 1 libobjc.A.dylib 0x03edc8e5 objc_exception_throw + 44\r\n[ERROR] 2 CoreFoundation 0x042bd243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275\r\n[ERROR] 3 CoreFoundation 0x0421050b ___forwarding___ + 1019\r\n[ERROR] 4 CoreFoundation 0x042100ee _CF_forwarding_prep_0 + 14\r\n[ERROR] 5 joober 0x00032aeb KrollPropertyNames + 107\r\n[ERROR] 6 joober 0x002b9f2e _ZN2TI16TiCallbackObjectINS_24TiObjectWithGlobalObjectEE19getOwnPropertyNamesEPNS_10TiExcStateERNS_17PropertyNameArrayENS_15EnumerationModeE + 94\r\n[ERROR] 7 joober 0x0036b83a _ZN2TIL21objectConstructorKeysEPNS_10TiExcStateE + 202\r\n[ERROR] 8 joober 0x002fac2a _ZN2TI11Interpreter14privateExecuteENS0_13ExecutionFlagEPNS_12RegisterFileEPNS_10TiExcStateE + 34890\r\n[ERROR] 9 joober 0x002ff71f _ZN2TI11Interpreter7executeEPNS_17ProgramExecutableEPNS_10TiExcStateEPNS_14ScopeChainNodeEPNS_8TiObjectE + 4431\r\n[ERROR] 10 joober 0x00344321 _ZN2TI8evaluateEPNS_10TiExcStateEPNS_14ScopeChainNodeERKNS_10SourceCodeENS_7TiValueE + 337\r\n[ERROR] 11 joober 0x002acce8 TiEvalScript + 344\r\n[ERROR] 12 joober 0x000205bf -[KrollBridge evalFileOnThread:context:] + 1711\r\n[ERROR] 13 libobjc.A.dylib 0x03eee880 -[NSObject performSelector:withObject:withObject:] + 77\r\n[ERROR] 14 joober 0x00028351 -[KrollInvocation invoke:] + 145\r\n[ERROR] 15 joober 0x0002a7d8 -[KrollContext invokeOnThread:method:withObject:callback:selector:] + 248\r\n[ERROR] 16 joober 0x0002079d -[KrollBridge evalFile:callback:selector:] + 125\r\n[ERROR] 17 joober 0x000217a2 -[KrollBridge didStartNewContext:] + 2898\r\n[ERROR] 18 libobjc.A.dylib 0x03eee82b -[NSObject performSelector:withObject:] + 70\r\n[ERROR] 19 joober 0x0002b8ab -[KrollContext main] + 3339\r\n[ERROR] 20 Foundation 0x00e11a07 -[NSThread main] + 76\r\n[ERROR] 21 Foundation 0x00e11966 __NSThread__main__ + 1275\r\n[ERROR] 22 libsystem_pthread.dylib 0x04ad45fb _pthread_body + 144\r\n[ERROR] 23 libsystem_pthread.dylib 0x04ad4485 _pthread_struct_init + 0\r\n[ERROR] 24 libsystem_pthread.dylib 0x04ad9cf2 thread_start + 34\r\n[ERROR] ) \r\n[ERROR] libc++abi.dylib: terminating with uncaught exception of type NSException\r\n{code}\r\n\r\nh3. trying toString()\r\n{code:javascript}\r\nthis.Kroll.toString()\r\n// you can get it to say \"object\" though this way:\r\n// Object.prototype.toString.call(this.Kroll)\r\n{code}\r\n\r\n{code}\r\n[DEBUG] 2014-08-02 07:43:40.035 joober[37361:3703] -[KrollContext objectForTiString:context:]: unrecognized selector sent to instance 0xd078b30\r\n[DEBUG] objc[37361]: Method cache corrupted. This may be a message to an invalid object, or a memory error somewhere else.\r\n[DEBUG] objc[37361]: receiver 0x101fc19c, SEL 0xcae53c8, isa 0x103ec128, cache 0x103ec130, buckets 0x10707600, mask 0x0, occupied 0x0\r\n[DEBUG] objc[37361]: receiver 0 bytes, buckets 0 bytes\r\n[DEBUG] objc[37361]: selector 'context'\r\n[DEBUG] objc[37361]: isa '��N'\r\n[DEBUG] objc[37361]: Method cache corrupted.\r\n{code}\r\n\r\nh2. expected\r\n\r\n{{this.Kroll}} should be hidden entirely from {{this}} (non-enumerable or not exposed altogether), or its inspection should be safe, even if it just returns a basic string for any inspection attempts.", "attachment": [], "flagged": false, "summary": "iOS: this.Kroll cannot be inspected, and throws errors when you try", "creator": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "TiSDK 3.3.0.GA\r\niOS 7.1 sim", "comment": { "comments": [], "maxResults": 0, "total": 0, "startAt": 0 } } }