[TIMOB-4455] Updating elements of a webview using evalJS() causes crash
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2017-06-08T19:59:41.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | evaljs |
Reporter | Paul Dowsett |
Assignee | Ingo Muschenetz |
Created | 2011-06-18T17:09:16.000+0000 |
Updated | 2017-06-08T19:59:41.000+0000 |
Description
Although the following code works as expected at first, pressing return multiple times in quick succession causes a crash.
var win = Ti.UI.createWindow({
fullscreen: false,
exitOnClose: true
});
var view = Ti.UI.createWebView({
html: "<html><body>Empty</body></html>"
});
var text = Ti.UI.createTextArea({
top: 50,
width:'100%',
height: 50
});
text.addEventListener('return', function() {
view.evalJS('document.body.innerHTML = "' + text.value + '"');
text.value = "";
setTimeout(function() {
text.focus();
}, 500);
});
win.add(view);
win.add(text);
win.open();
text.focus();
Curiously, using an event variable makes it even more unstable, causing it to crash the second time the user enters text:
e.addEventListener('return', function(e) {
view.evalJS('document.body.innerHTML = "' + text.value + '"');
e.value = "";
setTimeout(function() {
e.focus();
}, 500);
});
Logcat output for the first example code is as follows:
2360 TiWebViewBinding D (main) [544,32553] getJSValue:javascript:_TiReturn.setValue((function(){try{return document.body.innerHTML = "sdlvkns"+"";}catch(ti_eval_err){return '';}})());
91 dalvikvm D GC freed 226 objects / 13688 bytes in 99ms
2360 TitaniumModule D (kroll$2: file:///android_asset/Resources/app.js) [521,33074] calling timeout timer 12 @1308440929855
2360 TiWebViewBinding D (main) [577,33651] getJSValue:javascript:_TiReturn.setValue((function(){try{return document.body.innerHTML = "sldvknsd"+"";}catch(ti_eval_err){return '';}})());
2360 TiWebViewBinding D (main) [209,33860] getJSValue:javascript:_TiReturn.setValue((function(){try{return document.body.innerHTML = " "+"";}catch(ti_eval_err){return '';}})());
91 dalvikvm D GC freed 184 objects / 12352 bytes in 61ms
2360 TiWebViewBinding D (main) [264,34124] getJSValue:javascript:_TiReturn.setValue((function(){try{return document.body.innerHTML = "
2360 TiWebViewBinding D "+"";}catch(ti_eval_err){return '';}})());
91 onnectionWrapper.ICC W Timed out waiting on IInputContextCallback
53 WindowManager W Key dispatching timed out sending to com.testing.testing7/org.appcelerator.titanium.TiActivity
53 WindowManager W Dispatch state: {{KeyEvent{action=1 code=66 repeat=0 meta=0 scancode=28 mFlags=8} to Window{44d9e8b8 com.testing.testing7/org.appcelerator.titanium.TiActivity paused=false
} @ 1308440930916 lw=Window{44d9e8b8 com.testing.testing7/org.appcelerator.titanium.TiActivity paused=false} lb=android.os.BinderProxy@44d18970 fin=false gfw=true ed=true
tts=0 wf=false fp=false mcf=Window{44d9e8b8 com.testing.testing7/org.appcelerator.titanium.TiActivity paused=false}}}
53 WindowManager W Current state: {{KeyEvent{action=0 code=66 repeat=0 meta=0 scancode=28 mFlags=8} to Window{44d9e8b8 com.testing.testing7/org.appcelerator.titanium.TiActivity paused=false
} @ 1308440935948 lw=Window{44d9e8b8 com.testing.testing7/org.appcelerator.titanium.TiActivity paused=false} lb=android.os.BinderProxy@44d18970 fin=false gfw=true ed=true
tts=0 wf=false fp=false mcf=Window{44d9e8b8 com.testing.testing7/org.appcelerator.titanium.TiActivity paused=false}}}
53 ActivityManager I ANR in process: com.testing.testing7 (last in com.testing.testing7)
53 ActivityManager I Annotation: keyDispatchingTimedOut
53 ActivityManager I CPU usage:
53 ActivityManager I Load: 0.25 / 0.3 / 0.22
53 ActivityManager I CPU usage from 39546ms to 29ms ago:
53 ActivityManager I esting.testing7: 16% = 14% user + 2% kernel / faults: 8670 minor
53 ActivityManager I system_server: 8% = 6% user + 2% kernel / faults: 1106 minor
53 ActivityManager I putmethod.latin: 7% = 5% user + 1% kernel / faults: 3231 minor
53 ActivityManager I adbd: 0% = 0% user + 0% kernel
53 ActivityManager I m.android.phone: 0% = 0% user + 0% kernel
53 ActivityManager I logcat: 0% = 0% user + 0% kernel
53 ActivityManager I mmcqd: 0% = 0% user + 0% kernel
53 ActivityManager I qemud: 0% = 0% user + 0% kernel
53 ActivityManager I logcat: 0% = 0% user + 0% kernel
53 ActivityManager I TOTAL: 28% = 22% user + 6% kernel + 0% softirq
53 ActivityManager I Removing old ANR trace file from /data/anr/traces.txt
53 Process I Sending signal. PID: 2360 SIG: 3
2360 dalvikvm I threadid=7: reacting to signal 3
2360 dalvikvm I Wrote stack trace to '/data/anr/traces.txt'
53 Process I Sending signal. PID: 53 SIG: 3
53 dalvikvm I threadid=7: reacting to signal 3
53 dalvikvm I Wrote stack trace to '/data/anr/traces.txt'
53 Process I Sending signal. PID: 96 SIG: 3
96 dalvikvm I threadid=7: reacting to signal 3
96 dalvikvm I Wrote stack trace to '/data/anr/traces.txt'
53 Process I Sending signal. PID: 229 SIG: 3
229 dalvikvm I threadid=7: reacting to signal 3
229 dalvikvm I Wrote stack trace to '/data/anr/traces.txt'
53 Process I Sending signal. PID: 143 SIG: 3
143 dalvikvm I threadid=7: reacting to signal 3
143 dalvikvm I Wrote stack trace to '/data/anr/traces.txt'
53 Process I Sending signal. PID: 154 SIG: 3
154 dalvikvm I threadid=7: reacting to signal 3
154 dalvikvm I Wrote stack trace to '/data/anr/traces.txt'
53 Process I Sending signal. PID: 191 SIG: 3
191 dalvikvm I threadid=7: reacting to signal 3
191 dalvikvm I Wrote stack trace to '/data/anr/traces.txt'
53 Process I Sending signal. PID: 182 SIG: 3
182 dalvikvm I threadid=7: reacting to signal 3
182 dalvikvm I Wrote stack trace to '/data/anr/traces.txt'
53 Process I Sending signal. PID: 173 SIG: 3
173 dalvikvm I threadid=7: reacting to signal 3
173 dalvikvm I Wrote stack trace to '/data/anr/traces.txt'
53 Process I Sending signal. PID: 92 SIG: 3
92 dalvikvm I threadid=7: reacting to signal 3
92 dalvikvm I Wrote stack trace to '/data/anr/traces.txt'
53 Process I Sending signal. PID: 132 SIG: 3
132 dalvikvm I threadid=7: reacting to signal 3
132 dalvikvm I Wrote stack trace to '/data/anr/traces.txt'
53 Process I Sending signal. PID: 91 SIG: 3
91 dalvikvm I threadid=7: reacting to signal 3
91 dalvikvm I Wrote stack trace to '/data/anr/traces.txt'
Closing ticket due to time passed and lack of input or progress in the past few years.