forked from mirrors/gecko-dev
		
	- Use the frame's message manager to direct messages via the ProxyMessenger to the right tab instead of directly to the tab. - Put the implementation in a separate file that is only loaded in child processes (in the future). - Explicitly list all addon-process specific files in a new category instead of reusing the content one. MozReview-Commit-ID: 8oIMx9ol7Tl --HG-- extra : rebase_source : f93805ecdf44d4607dffc20ffe1cf0cbeb8c86be
		
			
				
	
	
		
			35 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 | 
						|
/* vim: set sts=2 sw=2 et tw=80: */
 | 
						|
"use strict";
 | 
						|
 | 
						|
extensions.registerSchemaAPI("tabs", "addon_child", context => {
 | 
						|
  return {
 | 
						|
    tabs: {
 | 
						|
      connect: function(tabId, connectInfo) {
 | 
						|
        let name = "";
 | 
						|
        if (connectInfo && connectInfo.name !== null) {
 | 
						|
          name = connectInfo.name;
 | 
						|
        }
 | 
						|
        let recipient = {
 | 
						|
          extensionId: context.extension.id,
 | 
						|
          tabId,
 | 
						|
        };
 | 
						|
        if (connectInfo && connectInfo.frameId !== null) {
 | 
						|
          recipient.frameId = connectInfo.frameId;
 | 
						|
        }
 | 
						|
        return context.messenger.connect(context.messageManager, name, recipient);
 | 
						|
      },
 | 
						|
 | 
						|
      sendMessage: function(tabId, message, options, responseCallback) {
 | 
						|
        let recipient = {
 | 
						|
          extensionId: context.extension.id,
 | 
						|
          tabId: tabId,
 | 
						|
        };
 | 
						|
        if (options && options.frameId !== null) {
 | 
						|
          recipient.frameId = options.frameId;
 | 
						|
        }
 | 
						|
        return context.messenger.sendMessage(context.messageManager, message, recipient, responseCallback);
 | 
						|
      },
 | 
						|
    },
 | 
						|
  };
 | 
						|
});
 |