Bug 1429082 - Drop SyncChromeSender from proxy module. r=whimboo

The SyncChromeSender class and its factory construction function
proxy.toChrome is not used in Marionette and can be safely removed.

MozReview-Commit-ID: jBJ0nIkn3i

--HG--
extra : rebase_source : 83d9c8261eafc9385d8edee913cc0fdfed48dcaa
This commit is contained in:
Andreas Tolfsen 2018-01-09 15:42:55 +00:00
Родитель 813ae317c3
Коммит cc531c6af0
1 изменённых файлов: 0 добавлений и 45 удалений

Просмотреть файл

@ -321,51 +321,6 @@ proxy.AsyncMessageChannel.ReplyType = {
Error: 2,
};
/**
* Creates a transparent interface from the content- to the chrome context.
*
* Calls to this object will be proxied via the frame's sendSyncMessage
* ({@link nsISyncMessageSender}) function. Since the message is
* synchronous, the return value is presented as a return value.
*
* Example on how to use from a frame content script:
*
* <pre><code>
* let chrome = proxy.toChrome(sendSyncMessage.bind(this));
* let cookie = chrome.getCookie("foo");
* </code></pre>
*
* @param {nsISyncMessageSender} sendSyncMessageFn
* The frame message manager's sendSyncMessage function.
*/
proxy.toChrome = function(sendSyncMessageFn) {
let sender = new proxy.SyncChromeSender(sendSyncMessageFn);
return new Proxy(sender, ownPriorityGetterTrap);
};
/**
* The SyncChromeSender sends synchronous RPC messages to the chrome
* context, using a frame's sendSyncMessage ({@link nsISyncMessageSender})
* function.
*
* Example on how to use from a frame content script:
*
* <pre><code>
* let sender = new SyncChromeSender(sendSyncMessage.bind(this));
* let res = sender.send("addCookie", cookie);
* </code></pre>
*/
proxy.SyncChromeSender = class {
constructor(sendSyncMessage) {
this.sendSyncMessage_ = sendSyncMessage;
}
send(func, args) {
let name = "Marionette:" + func.toString();
return this.sendSyncMessage_(name, marshal(args));
}
};
function marshal(args) {
if (args.length == 1 && typeof args[0] == "object") {
return args[0];