[TIMOB-18336] iOS: JavaScript function overriding doesn't work
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2015-01-12T22:24:44.000+0000 |
Affected Version/s | Release 3.5.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | qe-3.5.0, regression |
Reporter | Kajenthiran Velummaylum |
Assignee | Ingo Muschenetz |
Created | 2015-01-07T07:06:16.000+0000 |
Updated | 2017-03-23T22:38:51.000+0000 |
Description
JavaScript function overriding doesn't work in 3.5.0
It's a regression since it works fine in 3.4.1 GA
Steps To Reproduce
1. Create a Classic App 2. Replace following code in app.js file
var win = Ti.UI.createWindow({backgroundColor:'white'});
var b = Ti.UI.createButton({
title:"Alert",
width:200,
height:40,
top:50
});
b.addEventListener('click', function() {
alert("durp durp durp");
});
win.add(b);
var b2 = Ti.UI.createButton({
title:"Change alert",
width:200,
height:40,
bottom:50
});
b2.addEventListener('click', function() {
alert = function(e) {
Ti.API.info("durp durp durp");
};
});
win.add(b2);
win.open();
3. Run on iOS device
4. Click on *Alert* button. It will alert a message "durp durp durp". It works!
5. Click on *Change alert* button.
6. Again click on *Alert* button
Can you please locate/paste the origin of this test case?
Note, to workaround this issue, you can add something like this from Fokke (http://www.tidev.io/2014/03/17/snippet-for-a-better-alert/ ):
This test case is originated from the ticket TIMOB-6572.
Resolving issue as "won't fix". Looking at the source code I verified that we made "alert", and other global variables, not-deletable and read-only. The fact that in an earlier version of Titanium they could be overwritten is that it was a bug in our JavaScriptCore. This has now been fixed and this issue is no longer valid.
Can't we generate any warning or error messages at this situation?
Closing ticket as Won't Fix with reference to the above comments.