[TIMOB-26452] iOS: Object.hasProperty incorrectly reports false when a property's value is null
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-12-12T21:43:03.000+0000 |
Affected Version/s | Release 7.5.0 |
Fix Version/s | Release 7.5.1 |
Components | iOS |
Labels | n/a |
Reporter | Christopher Williams |
Assignee | Jan Vennemann |
Created | 2018-10-12T15:02:02.000+0000 |
Updated | 2018-12-12T23:15:13.000+0000 |
Description
With the new
KrollHasProperty
tweaks, asking Ti proxies for property existence is generally better (doesn't always return true!). However, in the edge case where a property is defined but has no value (nil natively) it will report the property doesn't exist. This is because the implementation is generally naive in that it asks for the value for a given key and checks against nil.
The easiest way to test this is to query for Ti.Geolocation's lastGeolocation property in a mocha/should test:
should(Ti.Geolocation).have.property('lastGeolocation');
PR (master): https://github.com/appcelerator/titanium_mobile/pull/10524 PR (7_5_X): https://github.com/appcelerator/titanium_mobile/pull/10525
Verified the fix in SDK 7.5.1.v20181212134635. Closing.