Conversation.WebView: Convert to using messages for JS → client comms

This commit is contained in:
Michael Gratton 2020-08-28 11:45:35 +10:00 committed by Michael James Gratton
parent 3655f4896f
commit 7b0146274c
2 changed files with 37 additions and 36 deletions

View file

@ -26,6 +26,8 @@ ConversationPageState.prototype = {
init: function() {
PageState.prototype.init.apply(this, []);
this._deceptiveLinkClicked = MessageSender("deceptive_link_clicked");
let state = this;
document.addEventListener("click", function(e) {
if (e.target.tagName == "A" &&
@ -267,7 +269,7 @@ ConversationPageState.prototype = {
let reason = ConversationPageState.isDeceptiveText(text, href);
if (reason != ConversationPageState.NOT_DECEPTIVE) {
cancelClick = true;
window.webkit.messageHandlers.deceptiveLinkClicked.postMessage({
this._deceptiveLinkClicked({
reason: reason,
text: text,
href: href,