I found the culprit: UnityWebAppsUtils.js (from the unity-webapps-qml package) does this:
var script = 'import com.canonical.Oxide 1.0 as Oxide; ' + ' Oxide.ScriptMessageHandler { msgId: "UnityWebappApi-Message"; contexts: ["' + this._WEBAPPS_USER_SCRIPT_CONTEXT + '"]; ' + '}'; var messageHandler = Qt.createQmlObject(script, this.webview); messageHandler.callback = handler; this.webview.messageHandlers = [ messageHandler ];
So it effectively overrides the webview’s existing message handlers.
I found the culprit: UnityWebAppsUti ls.js (from the unity-webapps-qml package) does this:
var script = 'import com.canonical.Oxide 1.0 as Oxide; ' + sageHandler { msgId: "UnityWebappApi -Message" ; contexts: ["' +
this. _WEBAPPS_ USER_SCRIPT_ CONTEXT +
'"]; ' +
'}'; ect(script, this.webview);
messageHandler .callback = handler;
this.webview. messageHandlers = [ messageHandler ];
' Oxide.ScriptMes
var messageHandler = Qt.createQmlObj
So it effectively overrides the webview’s existing message handlers.