I tried some other technique to debug this and get to the root of the issue, I decided to put window.webkit.messageHandlers.handlerOne.postMessage(... and window.webkit.messageHandlers.handlerTwo.postMessage(... inside an if conditional and check which is the object that is `undefined.
(function() {
addEventListener('mousedown', function() {
if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.handlerOne) {
window.webkit.messageHandlers.handlerOne.postMessage('WKUserScriptMouseDown');
}
}, true);
})();
After debugging this I found out that window.webkit.messageHandlers is the undefined object, which leads me to believe that webView.configuration.userContentController.add(handlerClass, name: "...") is broken on iOS 17.2 beta
hence messageHandlers is never defined, I'd appreciate to hear if this is happening to someone else with their apps.
Topic:
App & System Services
SubTopic:
Core OS
Tags: