{ "id": "170697", "key": "TIMOB-25750", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2018-01-02T11:00:25.000+0000", "priority": null, "labels": [ "engSchedule", "ios", "webview" ], "versions": [ { "id": "19988", "description": "", "name": "Release 7.0.1", "archived": false, "released": true, "releaseDate": "2017-12-21" }, { "id": "19882", "name": "Release 8.0.0", "archived": false, "released": true, "releaseDate": "2019-03-14" } ], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2019-04-23T21:56:12.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [], "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.\r\n\r\n{code:javascript}\r\n$.webView.addEventListener(\"load\", onWebViewLoad);\r\n\r\n// This crashes\r\nfunction onWebViewLoad(e) {\r\n $.webWindow.close();\r\n}\r\n\r\n// This works\r\nfunction onWebViewLoad(e) {\r\n setTimeout(function() {\r\n $.webWindow.close();\r\n }, 0);\r\n}\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: Closing window with webview from within load event crashes app", "creator": { "name": "michielve", "key": "michielve", "displayName": "Michiel van Eerd", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "michielve", "key": "michielve", "displayName": "Michiel van Eerd", "active": true, "timeZone": "Europe/Berlin" }, "environment": "SDK 7.0.1.GA\r\nMac OS High Sierra, 64bit\r\nNode 8.9.1\r\niOS simulator", "comment": { "comments": [ { "id": "432673", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello [~michielve],\r\n\r\nTested the issue with the sample code below and unable to reproduce this on on our end using SDK \r\nSDK 7.0.1.GA. The project is running without any crash.\r\n\r\n*Test code:*\r\n\r\n*index.js*\r\n\r\n{code}\r\n$.win.open();\r\n$.webView.addEventListener(\"load\", onWebViewLoad);\r\n \r\n// This crashes\r\nfunction onWebViewLoad(e) {\r\n $.win.close();\r\n}\r\n /*\r\n// This works\r\nfunction onWebViewLoad(e) {\r\n setTimeout(function() {\r\n $.webWindow.close();\r\n }, 0);\r\n}\r\n*/\r\n{code}\r\n\r\n*index.xml*\r\n{code}\r\n\r\n \r\n \r\n \r\n\r\n{code}\r\n\r\n*Test environment:*\r\n{code}\r\n\r\nAppcelerator Command-Line Interface, version 7.0.1\r\nCopyright (c) 2014-2018, Appcelerator, Inc. All Rights Reserved.\r\n\r\nOperating System\r\n Name = Mac OS X\r\n Version = 10.13.1\r\n Architecture = 64bit\r\n # CPUs = 4\r\n Memory = 8.0GB\r\n\r\nNode.js\r\n Node.js Version = 8.9.1\r\n npm Version = 5.5.1\r\n\r\nAppcelerator CLI\r\n Installer = 4.2.11\r\n Core Package = 7.0.1\r\n\r\nTitanium CLI\r\n CLI Version = 5.0.14\r\n node-appc Version = 0.2.41\r\n\r\nTitanium SDKs\r\n 7.0.1.GA\r\n Version = 7.0.1\r\nplatform=iOS Simulator\r\n\r\n{code}\r\n\r\n\r\n*Test Result:*\r\n\r\n*Console logs:*\r\n\r\n{code}\r\n[INFO] : Invoking xcodebuild\r\n[DEBUG] : Invoking: DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild build -target jn_Alloy2017 -configuration Debug -scheme jn_Alloy2017 -derivedDataPath /Users/user/Documents/Appcelerator_Studio_Workspace/jn_Alloy2017/build/iphone/DerivedData OBJROOT=/Users/user/Documents/Appcelerator_Studio_Workspace/jn_Alloy2017/build/iphone/build/Intermediates SHARED_PRECOMPS_DIR=/Users/user/Documents/Appcelerator_Studio_Workspace/jn_Alloy2017/build/iphone/build/Intermediates/PrecompiledHeaders SYMROOT=/Users/user/Documents/Appcelerator_Studio_Workspace/jn_Alloy2017/build/iphone/build/Products -destination \"platform=iOS Simulator,id=C7002023-D6CC-4E16-AE36-B0CD715809F5,OS=11.0\" ONLY_ACTIVE_ARCH=1\r\n[INFO] : Finished building the application in 2m 26s 727ms\r\n{code}\r\n\r\nCan you please try the sample code above and share the logs here?", "updateAuthor": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2018-01-03T10:29:58.000+0000", "updated": "2018-01-03T10:31:34.000+0000" }, { "id": "432679", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Tested it as well (env: 7.0.1, both kroll- and main-thread) and it works fine:\r\n\r\n{code:js}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: 'green',\r\n title: 'Window 1'\r\n});\r\n\r\n\r\nvar btn = Ti.UI.createButton({\r\n title: 'Open Window'\r\n});\r\n\r\nbtn.addEventListener('click', openWindow);\r\n\r\nwin.add(btn);\r\n\r\nvar nav = Ti.UI.iOS.createNavigationWindow({\r\n window: win\r\n});\r\n\r\nnav.open();\r\n\r\nfunction openWindow() {\r\n var win2 = Ti.UI.createWindow({\r\n backgroundColor: 'blue',\r\n title: 'Window 2'\r\n });\r\n\r\n var webView = Ti.UI.createWebView({\r\n url: 'http://appcelerator.com'\r\n });\r\n\r\n webView.addEventListener(\"load\", function() {\r\n win2.close();\r\n });\r\n \r\n win2.add(webView);\r\n \r\n nav.openWindow(win2);\r\n}\r\n{code}\r\n\r\nI 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!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-01-03T11:41:26.000+0000", "updated": "2018-01-03T11:44:04.000+0000" }, { "id": "432735", "author": { "name": "michielve", "key": "michielve", "displayName": "Michiel van Eerd", "active": true, "timeZone": "Europe/Berlin" }, "body": "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.\r\n\r\nI see no log in the console after the crash, but in the system.log file is see the following:\r\n\r\n{noformat}\r\nJan 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.\r\nJan 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]\r\n{noformat}\r\n\r\nThe Alloy project:\r\n\r\n{code:javascript|title=index.js}\r\nfunction doClick(e) {\r\n var win = Alloy.createController(\"webWindow\").getView();\r\n win.open();\r\n}\r\n$.index.open();\r\n{code}\r\n\r\n{code:xml|title=index.xml}\r\n\r\n \r\n \r\n \r\n\r\n{code}\r\n\r\n{code:javascript|title=webWindow.js}\r\n$.webView.addEventListener(\"load\", function() {\r\n $.webWindow.close();\r\n});\r\n{code}\r\n\r\n{code:xml|title=webWindow.xml}\r\n\r\n \r\n \r\n \r\n\r\n{code}", "updateAuthor": { "name": "michielve", "key": "michielve", "displayName": "Michiel van Eerd", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-01-04T08:10:23.000+0000", "updated": "2018-01-04T08:10:23.000+0000" }, { "id": "432736", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "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.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-01-04T08:16:36.000+0000", "updated": "2018-01-04T08:16:36.000+0000" }, { "id": "432764", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "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\r\n{code}\r\nMac OS High Sierra, 64bit\r\nNode 8.9.1\r\niOS simulator 11.2\r\nSDK 7.0.1.GA\r\n{code}\r\n\r\nThanks.\r\n", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2018-01-04T22:16:54.000+0000", "updated": "2018-01-04T22:16:54.000+0000" }, { "id": "447836", "author": { "name": "ahutton", "key": "ahutton", "displayName": "Alan Hutton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Reproducable with : \r\n\r\niOS simulator 12.2\r\nNode.js\r\n Node.js Version = 8.11.3\r\n npm Version = 6.7.0\r\nTitanium CLI\r\n CLI Version = 5.1.1\r\nTitanium SDK\r\n SDK Version = 8.0.0.GA", "updateAuthor": { "name": "ahutton", "key": "ahutton", "displayName": "Alan Hutton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-04-22T18:27:07.000+0000", "updated": "2019-04-22T18:29:02.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }