[TIMOB-23609] Windows: read-only properties incorrectly identify themselves as configurable
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Not Our Bug |
Resolution Date | 2016-07-05T10:12:52.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Windows |
Labels | n/a |
Reporter | Christopher Williams |
Assignee | Kota Iguchi |
Created | 2016-07-01T20:38:32.000+0000 |
Updated | 2017-03-24T18:55:45.000+0000 |
Description
Properties like apiName on all proxies, or Ti.App.version are marked as read-only properties in our docs. That means the user should not be able to overwrite their values or delete them.On Windows, we cannot delete the property, but the common way of checking is to look at the configurable value of the property descriptor. That is oddly reporting true (which should mean it can be deleted).
var target = Ti.API,
propName = 'apiName';
while (!Object.prototype.hasOwnProperty.call(target, propName)) {
target = Object.getPrototypeOf(target); // go up the prototype chain
if (!target) {
alert('Failed!');
}
}
Ti.API.info(JSON.stringify(Object.getOwnPropertyDescriptor(Object(target), propName)));
Ti.API.info(Ti.API.apiName);
delete Ti.API.apiName;
Ti.API.info(Ti.API.apiName);
Note that the linked ticket for iOS may also have the same behavior? Maybe it's just reporting configurable: true but isn't actually able to be deleted?
Confirmed that JavaScriptCore doesn't handle
enumerable
andconfigurable
well withgetOwnPropertyDescriptor
even on OS X. I assume it doesn't work well on iOS too. Found WebKit bug reports related to this: https://bugs.webkit.org/show_bug.cgi?id=158116 https://bugs.webkit.org/show_bug.cgi?id=151348 Maybe related: https://github.com/adobe/webkit/blob/master/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h#L216 *Test Code*[~kota] [~cwilliams] as this is resolved as not our bug, could the fix version be removed. Thanks!
Closing ticket with reference to the previous comments.