[TIMOB-23773] Windows: Wrong items returned on for-in loop
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Done |
Resolution Date | 2018-07-26T03:48:46.000+0000 |
Affected Version/s | Release 5.4.0 |
Fix Version/s | n/a |
Components | Windows |
Labels | n/a |
Reporter | Kota Iguchi |
Assignee | Kota Iguchi |
Created | 2016-08-15T03:22:11.000+0000 |
Updated | 2018-07-26T03:48:46.000+0000 |
Description
We have experienced wrong behavior on JavaScript for-in loop. I suspect JavaScriptCore has some issues with for-in loop, because this only happens on Windows Desktop (8.1 and 10.0) Jenkins.
See also:
https://github.com/appcelerator/titanium_mobile_windows/pull/817
*Test Code*
it('fireListSectionEvent (header and footer)', function (finish) {
var section = Ti.UI.createListSection({
headerTitle: 'HEADER',
footerTitle: 'FOOTER',
items: [
{ properties: { title: 'B' } },
{ properties: { title: 'A' } },
{ properties: { title: 'E' } },
{ properties: { title: 'G' } }
]
}),
listView = Ti.UI.createListView({ sections: [section] }),
items_a = [
{ properties: { title: 'A' } },
],
items_b = [
{ properties: { title: 'C' } },
{ properties: { title: 'D' } }
],
items_c = [
{ properties: { title: 'E' } },
{ properties: { title: 'F' } },
],
validation = ['A', 'B', 'C', 'D', 'E', 'F'];
section.updateItemAt(0, { properties: { title: 'A' } });
section.updateItemAt(1, { properties: { title: 'B' } });
section.updateItemAt(3, { properties: { title: 'F' } });
section.insertItemsAt(2, items_b);
section.deleteItemsAt(0, 1);
section.deleteItemsAt(3, 2);
section.appendItems(items_c);
section.insertItemsAt(0, items_a);
var items = section.getItems();
should(items.length).be.eql(6);
for (var i in items) {
var item = items[i].properties.title;
should(item).be.eql(validation[i]);
}
finish();
});
Based on discussions from WebKit Bugzilla, it seems WebKit committers actually don't quite care about for-in loop against Array. They think it's a bad idea doing it. https://bugs.webkit.org/show_bug.cgi?id=14901
Closing as we haven't seen this error for a while since we have updated our JavaScriptCore. Feel free to create new ticket if this happens again.