Bug 1502802 - Implement PostMessageOptions for MessagePort, r=smaug

This commit is contained in:
Andrea Marchesini 2018-10-29 16:26:30 +01:00
parent 588efafd5e
commit 4817d8d6c8
4 changed files with 21 additions and 5 deletions

View File

@ -411,6 +411,14 @@ MessagePort::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
mActor->SendPostMessages(messages);
}
void
MessagePort::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const PostMessageOptions& aOptions,
ErrorResult& aRv)
{
PostMessage(aCx, aMessage, aOptions.mTransfer, aRv);
}
void
MessagePort::Start()
{

View File

@ -24,6 +24,7 @@ namespace dom {
class ClonedMessageData;
class MessagePortChild;
class MessagePortIdentifier;
struct PostMessageOptions;
class PostMessageRunnable;
class SharedMessagePortMessage;
class StrongWorkerRef;
@ -58,6 +59,11 @@ public:
const Sequence<JSObject*>& aTransferable,
ErrorResult& aRv);
void
PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const PostMessageOptions& aOptions,
ErrorResult& aRv);
void Start();
void Close();

View File

@ -10,7 +10,9 @@
[Exposed=(Window,Worker,AudioWorklet)]
interface MessagePort : EventTarget {
[Throws]
void postMessage(any message, optional sequence<object> transferable = []);
void postMessage(any message, sequence<object> transferable);
[Throws]
void postMessage(any message, optional PostMessageOptions options);
void start();
void close();
@ -20,3 +22,7 @@ interface MessagePort : EventTarget {
attribute EventHandler onmessageerror;
};
// MessagePort implements Transferable;
dictionary PostMessageOptions {
sequence<object> transfer = [];
};

View File

@ -1,4 +0,0 @@
[dictionary-transferrable.html]
[basic messagechannel with transfer]
expected: FAIL