[TIMOB-26179] iOS: Property check on proxy always returns true
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-08-24T17:24:12.000+0000 |
Affected Version/s | Release 7.2.0 |
Fix Version/s | Release 7.5.0 |
Components | iOS |
Labels | n/a |
Reporter | Jan Vennemann |
Assignee | Jan Vennemann |
Created | 2018-07-03T12:23:29.000+0000 |
Updated | 2019-04-26T19:03:53.000+0000 |
Description
Checking for property existence on Titanium proxy objects always returns true, ignoring if a property really exists or not. Various aspects of Vue/Angular and module bundling with Rollup/Webpack rely on proper existence checks for properties on our proxies.
*Steps to reproduce the behavior*
Run the following example code in a Titanium app which compares the behavior to a plain JavaScript object.
const win = Ti.UI.createWindow();
const plainObject = {
prop: 'bar',
func: () => {}
};
Ti.API.debug('### hasProperty check ###');
Ti.API.debug('non-existing property');
Ti.API.debug(proxy: ${'foo' in win}
);
Ti.API.debug(plain: ${'foo' in plainObject}
);
Ti.API.debug('existing property');
Ti.API.debug(proxy: ${'children' in win}
);
Ti.API.debug(plain: ${'prop' in plainObject}
);
*Actual behavior*
The property check returns true for non-existing properties on the Ti.UI.Window object.
*Expected behavior*
The property check should return true only for existing properties and false otherwise.
PR: https://github.com/appcelerator/titanium_mobile/pull/10150
*Closing ticket*, Verified fix in SDK Version:
7.4.0.v20180717131401
*FR Passed (Test Steps):*Created a titanium Application
Added the following code in the description in to the
app.js
Ran the program
Following was seen in the console (Proxy for non-existing property no longer always set to true):
*Test Environment*