broulik created this revision.
broulik added reviewers: Plasma, davidedmundson, fvogt.
Herald added a project: Plasma.
Herald added a subscriber: plasma-devel.
broulik requested review of this revision.
REVISION SUMMARY
Instead of manually matching a sent message to a port message, allow adding a
serial which is then used to relate a reply back so you just get a neat
Promise-based API.
For compatibility, the existing method cannot be changed, as with new
extension and older host I will never get a reply, and I cannot tell whether
the caller actually asked for the promise or not and if they didn't we would
leak the promise resolvers as we never got a reply.
TEST PLAN
Placed a `sendReply` call in a `handleData`
sendPortMessageWithReply("settings", "getSubsystemStatus").then((message)
=> {
console.log("got the status", message);
});
REPOSITORY
R856 Plasma Browser Integration
REVISION DETAIL
https://phabricator.kde.org/D23099
AFFECTED FILES
extension/extension-utils.js
extension/extension.js
host/abstractbrowserplugin.cpp
host/abstractbrowserplugin.h
host/pluginmanager.cpp
To: broulik, #plasma, davidedmundson, fvogt
Cc: plasma-devel, LeGast00n, jraleigh, fbampaloukas, GB_2, ragreen, Pitel,
ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas,
apol, mart