Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26452] iOS: Object.hasProperty incorrectly reports false when a property's value is null

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2018-12-12T21:43:03.000+0000
Affected Version/sRelease 7.5.0
Fix Version/sRelease 7.5.1
ComponentsiOS
Labelsn/a
ReporterChristopher Williams
AssigneeJan Vennemann
Created2018-10-12T15:02:02.000+0000
Updated2018-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');

Comments

  1. Jan Vennemann 2018-12-10

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/10524 PR (7_5_X): https://github.com/appcelerator/titanium_mobile/pull/10525
  2. Lokesh Choudhary 2018-12-12

    Verified the fix in SDK 7.5.1.v20181212134635. Closing.

JSON Source