Timob 12379: Backport to 3_0_X: TIMOB-12362 

https://jira.appcelerator.org/browse/TIMOB-12379
Test cases in https://jira.appcelerator.org/browse/TIMOB-12362, https://jira.appcelerator.org/browse/TIMOB-12380, https://jira.appcelerator.org/browse/TIMOB-11762