aboutsummaryrefslogtreecommitdiffstats
path: root/platform/firefox
diff options
context:
space:
mode:
authorgorhill <rhill@raymondhill.net>2015-06-26 15:45:54 -0400
committergorhill <rhill@raymondhill.net>2015-06-26 15:45:54 -0400
commit7d2855180c5560ebc1d850261edc5a2f5bdf3b0c (patch)
tree594357fdb9d32485f746fab72d2bc519c6399d57 /platform/firefox
parent631443768f2359e6fdb0bc6a3e457a0951e0a9e9 (diff)
downloaduBlock-7d2855180c5560ebc1d850261edc5a2f5bdf3b0c.zip
uBlock-7d2855180c5560ebc1d850261edc5a2f5bdf3b0c.tar.gz
uBlock-7d2855180c5560ebc1d850261edc5a2f5bdf3b0c.tar.bz2
some refactoring of new DOM inspector code
Diffstat (limited to 'platform/firefox')
-rw-r--r--platform/firefox/vapi-background.js26
1 files changed, 23 insertions, 3 deletions
diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js
index f7a4d72..67bda4f 100644
--- a/platform/firefox/vapi-background.js
+++ b/platform/firefox/vapi-background.js
@@ -1239,10 +1239,30 @@ vAPI.messaging.setup = function(defaultHandler) {
/******************************************************************************/
-vAPI.messaging.send = function(tabId, channelName, message) {
- var ffTabId = tabId || '';
+// "Auxiliary process": any process other than main process.
+//
+// Main process to auxiliary processes messaging. The approach is that of
+// smoke-signal messaging, so emitters have to be ready to deal with no
+// response at all (i.e. use timeout where needed).
+//
+// Mandatory:
+// - receiverTabId: Which tab to send the message.
+// No target tab id means sends to all tabs.
+// - receiverChannel: Which channel to send the message.
+//
+// Optional:
+// - senderTabId: From which tab the message originates.
+// - senderChannel: From which channel the message originates.
+// These optional fields are useful for the target, and may be used
+// to send back a response to the sender.
+
+vAPI.messaging.post = function(message) {
+ var ffTabId = message.receiverTabId || '';
var targetId = location.host + ':broadcast';
- var payload = JSON.stringify({ channelName: channelName, msg: message });
+ var payload = JSON.stringify({
+ channelName: message.receiverChannel,
+ msg: message
+ });
if ( ffTabId === '' ) {
this.globalMessageManager.broadcastAsyncMessage(targetId, payload);