GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-03-14T13:25:13.000+0000 |
Affected Version/s | Release 1.7.5, Release 1.8.0, Release 1.8.0.1 |
Fix Version/s | Sprint 2011-48, Release 1.7.6, Release 1.8.0.1 |
Components | iOS |
Labels | merge-1.7.6, module_webview, qe-testadded |
Reporter | Qing Gao |
Assignee | Sabil Rahim |
Created | 2011-11-30T12:25:55.000+0000 |
Updated | 2016-01-15T10:16:43.000+0000 |
The "error" event is not handled properly in WebView and crash the app.
Repro Steps
Step 1. Create a project based on the following code.
Step 2. Input "www.yahoo.com," and return. The webview will open up it correctly
Step 3. Input some random word and hit enter. the app would crash.
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
var input = Ti.UI.createTextArea({
top:40,
height:60,
borderColor:'#333',
borderRadius: 10,
autocapitalization:Titanium.UI.TEXT_AUTOCAPITALIZATION_NONE
});
function makeweb(url2){
var web = Ti.UI.createWebView({
html:null,
url:url2
});
var window = Titanium.UI.createWindow({});
//
//
// Attaching the 'error' event listener results in a crash on poorly formed URLS
//
//
web.addEventListener('error', function(e) {
alert('error');
});
window.add(web);
return window;
};
win.add(input);
input.addEventListener('return', function(e) {
var link = input.value.toString();
web = makeweb('http://'+link);
web.open();
});
win.addEventListener('open', function() {
input.focus();
});
win.open();
Tested on Ti Studio 1.0.7.201112041107 Ti Mob SDK 1.8.0.1.v20111205011857 OSX Lion iPod Touch 4.3.5, iPhone 4S OS 5.0.1, iPad 2 OS 4.3.5 Expected behavior shown of proper error handling with a invalid url
Open to add label
Bug still exists under certain conditions: - Invalid characters such as: % and : (ascii 37 and 58). - Spaces in the url. SDK: 1.8.2 githash=59b3a90s, 2.0.0.v20120312213243 Studio: 2.0.0.201203121914 OS: Snow Leopard Devices Tested: iPod 4.3.3, iOS Simulator 5.0 Crash does not occur on Android. Steps to Reproduce: 1. Run code below.
2. Click 'ascii char url test' or 'url string url test'. Expected Result: App should not crash. Actual Result: App crashes.
Anvil test case added. PR link: https://github.com/appcelerator/titanium_mobile/pull/5020