[TIMOB-7887] Android: Gingerbread 2.3.X: Emulator: WebView evalJS crashes app
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | High |
| Status | Closed |
| Resolution | Duplicate |
| Resolution Date | 2012-03-14T16:55:20.000+0000 |
| Affected Version/s | Release 1.7.5, Release 1.8.0.1, Release 2.0.0, Release 1.8.1, Release 1.8.2 |
| Fix Version/s | n/a |
| Components | Android |
| Labels | module_webview, qe-testadded |
| Reporter | Dustin Hyde |
| Assignee | Hieu Pham |
| Created | 2012-03-05T15:35:57.000+0000 |
| Updated | 2013-09-26T17:04:56.000+0000 |
Description
When the evalJS method of a WebView is called, the app will crash. Log attached.
Steps to Reproduce:
1. Run code on 2.3.3 Emulator (WebViewTest project attached).
Note: This is a minimal fail case. TIMOB-4885 provides a similar example.
var win = Ti.UI.createWindow();
var webView = Ti.UI.createWebView({ url:'test.html' });
win.add(webView);
win.open();
webView.addEventListener('load', function() {
webView.evalJS("run()");
});
<!doctype html>
<html>
<head>
<title>WebView Test Page</title>
</head>
<body><h1>WebView Test Page</h1>
<script type="text/javascript">
function run() { alert('WebView JS Eval'); };
</script>
</body>
</html>
Expected Result:
An alert should appear indicating evalJS was successful.
Actual Result:
Crash.
Attachments
| File | Date | Size |
|---|---|---|
| 2.0 Android V8 Emulator 2.3.3 WebView JSEval Crash.txt | 2012-03-05T15:35:57.000+0000 | 15644 |
| WebViewTest.zip | 2012-03-05T15:35:57.000+0000 | 3653158 |
This behavior is not limited to the evalJS method. Many Titanium API calls from the HTML cause the same crash, such as:
or<!doctype html> <html> <head> <title>WebView Test Page</title> </head> <body><h1>WebView Test Page</h1> <script type="text/javascript"> Ti.API.info('WebView JS Log Info'); </script> </body> </html>However, some API calls do not crash the app, such as:<!doctype html> <html> <head> <title>WebView Test Page</title> </head> <body><h1>WebView Test Page</h1> <script type="text/javascript"> Ti.App.addEventListener('pause', function() { }); </script> </body> </html>Closing.