[TIMOB-25750] iOS: Closing window with webview from within load event crashes app
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 7.0.1, Release 8.0.0 |
Fix Version/s | n/a |
Components | n/a |
Labels | engSchedule, ios, webview |
Reporter | Michiel van Eerd |
Assignee | Shak Hossain |
Created | 2018-01-02T11:00:25.000+0000 |
Updated | 2019-04-23T21:56:12.000+0000 |
Description
When I close a window with a webview from within the load event the app crashes. I'm not sure this is a bug. A simple workaround is to close the with a timeout of 0 seconds.
$.webView.addEventListener("load", onWebViewLoad);
// This crashes
function onWebViewLoad(e) {
$.webWindow.close();
}
// This works
function onWebViewLoad(e) {
setTimeout(function() {
$.webWindow.close();
}, 0);
}
Hello [~michielve], Tested the issue with the sample code below and unable to reproduce this on on our end using SDK SDK 7.0.1.GA. The project is running without any crash. *Test code:* *index.js*
*index.xml*
*Test environment:*
*Test Result:* *Console logs:*
Can you please try the sample code above and share the logs here?
Tested it as well (env: 7.0.1, both kroll- and main-thread) and it works fine:
I agree with [~shossain], we either need a full trace-log of the crash or something with your scope is incorrect, causing this crash. I've seen those crashes when you have global Ti.App listeners in a sub-scope like event-listeners. Please check your code!
Thank you for your feedback. I created a new empty project without any dependencies with the same result. Immediately closing the window crashes the app, with a setTimeout 0 everything is okay. I see no log in the console after the crash, but in the system.log file is see the following: {noformat} Jan 4 09:02:01 Mac-mini-van-Michiel WebviewTest[5202]: objc[5202]: Class MPExportableArtworkProperties is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/MediaPlayer.framework/MediaPlayer (0x10b9e97d0) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/MediaPlaybackCore.framework/MediaPlaybackCore (0x12cccb108). One of the two will be used. Which one is undefined. Jan 4 09:02:02 Mac-mini-van-Michiel com.apple.CoreSimulator.SimDevice.13F4A5B8-3342-4E04-BA4D-8D5506B487FD[5076] (UIKitApplication:nl.michielve.webviewtest[0x8b14][5102][5202]): Service exited due to signal: Segmentation fault: 11 sent by exc handler[0] {noformat} The Alloy project:
Thanks, we'll check. The logs are system-logs from iOS and unrelated. They started appearing with Xcode 8 (both Titanium and native) and can be pretty misleading. We'll come back to you later.
Hello [~hknoechel], [~michielve], I was able to reproduce the issue in iOS simulator 11.2. I ran the project with trace log. When I click on the "hello world" I do see the Appcelerator website open and in 2 seconds the app crashes to simulator home screen. No crash log in the console. My environment
Thanks.
Reproducable with : iOS simulator 12.2 Node.js Node.js Version = 8.11.3 npm Version = 6.7.0 Titanium CLI CLI Version = 5.1.1 Titanium SDK SDK Version = 8.0.0.GA