Components.WebView: Convert to using messages for JS method invocation

Use WebKitGTK UserMessage objects for invoking JS methods rather than
serialising to JS strings and running those. This is possibly slightly
less efficient, but removes the onus on serialising to and parsing from
JS and once switched over from message handlers to UserMessage objects
will be using a single uniform IPC interface for both.
This commit is contained in:
Michael Gratton 2020-08-27 12:12:22 +10:00 committed by Michael James Gratton
parent 1ba2bd0f5b
commit ff565bc6ef
8 changed files with 268 additions and 74 deletions

View file

@ -87,6 +87,8 @@ PageState.prototype = {
window.addEventListener("transitionend", function(e) {
queuePreferredHeightUpdate();
}, false); // load does not bubble
this.testResult = null;
},
getPreferredHeight: function() {
// Return the scroll height of the HTML element since the BODY
@ -184,5 +186,13 @@ PageState.prototype = {
this.hasSelection = hasSelection;
window.webkit.messageHandlers.selectionChanged.postMessage(hasSelection);
}
},
// Methods below are for unit tests.
testVoid: function() {
this.testResult = "void";
},
testReturn: function(value) {
this.testResult = value;
return value;
}
};