You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Quite often when loading a webpage, XWVObject.denit() crashes my program, on the line webView.evaluateJavaScript(script, completionHandler: nil). This behaviour is inconsistent, so it is difficult to reproduce on demand. I have no experience debugging memory errors, so I don't know exactly what information to provide.
The line on which the program crashes:
Zombies profiling for all instruments:
Zombies profiling for XWebView-related instruments:
Below is the general layout of my code (I have simplified it as much as possible).
This Swift function is called inside the ViewController's loadView():
This Swift class is loaded into the webView as a plugin:
class Tokenizing: NSObject {
@objc func tokenize(_ callback: XWVScriptObject, _ input: String) {
let inputText: NSString = input as NSString
var tokens = [String]()
// ...
// Do tokenising here, and add to tokens array.
// ...
callback.call(arguments: [tokens], completionHandler: nil)
}
init() { }
}
This JavaScript function is added to webView.configuration.userContentController as a WKUserScript:
function fn1(){
/* The callback that Swift's Tokenizing.tokenize calls. */
function callback(tokens){
var div = document.createElement('div');
tokens.forEach(function(token) {
var span = document.createElement('span');
span.innerText = token;
div.appendChild(span);
});
document.body.appendChild(div);
}
// We call the Swift function many times quickly.
for(var i = 0; i < 500; i++) window.Tokenizing.tokenize(callback, ["some mock text to tokenize"]);
}
Edit: added mocked text data for JS function.
The text was updated successfully, but these errors were encountered:
Quite often when loading a webpage,
XWVObject.denit()
crashes my program, on the linewebView.evaluateJavaScript(script, completionHandler: nil)
. This behaviour is inconsistent, so it is difficult to reproduce on demand. I have no experience debugging memory errors, so I don't know exactly what information to provide.The line on which the program crashes:
Zombies profiling for all instruments:
Zombies profiling for XWebView-related instruments:
Below is the general layout of my code (I have simplified it as much as possible).
This Swift function is called inside the
ViewController
'sloadView()
:This Swift class is loaded into the
webView
as a plugin:This JavaScript function is added to
webView.configuration.userContentController
as aWKUserScript
:Edit: added mocked text data for JS function.
The text was updated successfully, but these errors were encountered: