[TIMOB-8022] Android: WebView: load event is fired when an invalid url is loaded instead of an error event
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Won't Do |
Resolution Date | 2020-01-09T21:42:11.000+0000 |
Affected Version/s | Release 2.0.0, Release 1.8.2, Release 3.1.0 |
Fix Version/s | n/a |
Components | Android |
Labels | parity, reprod |
Reporter | Dustin Hyde |
Assignee | Unknown |
Created | 2012-03-14T15:46:54.000+0000 |
Updated | 2020-01-09T21:42:11.000+0000 |
Description
When an invalid url is loaded from a webview, a load event is fired instead of an error event.
An error event is fired in iOS, with no load event.
Steps to Reproduce:
1. Run code, click 'Open Invalid URL'.
var win = Ti.UI.createWindow({
backgroundColor:'blue'
});
var buttonGoogle = Ti.UI.createButton({
title:'Open Google',
top:'20%',
height:'30%',
left:'10%',
right:'10%'
});
buttonGoogle.addEventListener('click', function(){
var webView = Ti.UI.createWebView({
url:'http://www.google.com'
});
webView.addEventListener('load', function(){
alert('load: ' + webView.url);
});
webView.addEventListener('beforeload', function(){
alert('beforeload: ' + webView.url);
});
webView.addEventListener('error', function(){
alert('error: ' + webView.url);
});
win.add(webView);
var button = Ti.UI.createButton({
title:'Close',
right:0,
bottom:0,
height:'10%',
width:'20%'
});
button.addEventListener('click', function(){
win.remove(webView);
});
webView.add(button);
});
win.add(buttonGoogle);
var buttonInvalid = Ti.UI.createButton({
title:'Open Invalid URL',
bottom:'20%',
height:'30%',
left:'10%',
right:'10%'
});
buttonInvalid.addEventListener('click', function(){
var webView = Ti.UI.createWebView({
url:'http://xxx'
});
webView.addEventListener('load', function(){
alert('load: ' + webView.url);
});
webView.addEventListener('beforeload', function(){
alert('beforeload: ' + webView.url);
});
webView.addEventListener('error', function(){
alert('error: ' + webView.url);
});
win.add(webView);
var button = Ti.UI.createButton({
title:'Close',
right:0,
bottom:0,
height:'10%',
width:'20%'
});
button.addEventListener('click', function(){
win.remove(webView);
});
webView.add(button);
});
win.add(buttonInvalid);
win.open();
Expected Result:
One error event should fire.
Actual Result:
Two load events fire.
The problem can reproduce with release 3.0.2 and master release 3.1.0 Both 'load' alert and 'beforeload' alert are repeat twice. Titanium Studio, build: 2.1.2.201208301612 Titanium SDK version: 3.1.0 (28/02/2013) Titanium SDK version: 3.0.2 (28/02/2013) Device: Samsung galaxy s duos Android version: 4.0.4
I am able to reproduce this issue, both loads events fire and also the error event fires with the following environment; Pixel (7.1) Studio 4.9.0.201705302345 Ti SDK 6.1.1 GA Appc NPM 4.2.9 Appc CLI 6.2.2 Ti CLI 5.0.14 Alloy 1.9.11 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131
It has been decided that this issue should be closed as “Won’t do.” This issue is out of date with our current supported SDK release (7.5.2.GA as of the date of closure), and out of date with mobile OS versions. If community members feel that the issue is still valid, please create a new ticket. Please reference this closed ticket number, include SDK used, comments, and code that demonstrates/reproduces the issue.