зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1502802 - Implement PostMessageOptions for Worker, r=smaug
This commit is contained in:
Родитель
70526c2e29
Коммит
a1f26d6d31
|
@ -19,7 +19,9 @@ interface DedicatedWorkerGlobalScope : WorkerGlobalScope {
|
|||
readonly attribute DOMString name;
|
||||
|
||||
[Throws]
|
||||
void postMessage(any message, optional sequence<object> transfer = []);
|
||||
void postMessage(any message, sequence<object> transfer);
|
||||
[Throws]
|
||||
void postMessage(any message, optional PostMessageOptions options);
|
||||
|
||||
void close();
|
||||
|
||||
|
|
|
@ -18,7 +18,9 @@ interface Worker : EventTarget {
|
|||
void terminate();
|
||||
|
||||
[Throws]
|
||||
void postMessage(any message, optional sequence<object> transfer = []);
|
||||
void postMessage(any message, sequence<object> transfer);
|
||||
[Throws]
|
||||
void postMessage(any message, optional PostMessageOptions aOptions);
|
||||
|
||||
attribute EventHandler onmessage;
|
||||
attribute EventHandler onmessageerror;
|
||||
|
|
|
@ -124,6 +124,14 @@ Worker::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Worker::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
|
||||
const PostMessageOptions& aOptions,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
PostMessage(aCx, aMessage, aOptions.mTransfer, aRv);
|
||||
}
|
||||
|
||||
void
|
||||
Worker::Terminate()
|
||||
{
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
struct PostMessageOptions;
|
||||
struct WorkerOptions;
|
||||
class WorkerPrivate;
|
||||
|
||||
|
@ -43,6 +44,11 @@ public:
|
|||
const Sequence<JSObject*>& aTransferable,
|
||||
ErrorResult& aRv);
|
||||
|
||||
void
|
||||
PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
|
||||
const PostMessageOptions& aOptions,
|
||||
ErrorResult& aRv);
|
||||
|
||||
void
|
||||
Terminate();
|
||||
|
||||
|
|
|
@ -614,6 +614,16 @@ DedicatedWorkerGlobalScope::PostMessage(JSContext* aCx,
|
|||
mWorkerPrivate->PostMessageToParent(aCx, aMessage, aTransferable, aRv);
|
||||
}
|
||||
|
||||
void
|
||||
DedicatedWorkerGlobalScope::PostMessage(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aMessage,
|
||||
const PostMessageOptions& aOptions,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
mWorkerPrivate->PostMessageToParent(aCx, aMessage, aOptions.mTransfer, aRv);
|
||||
}
|
||||
|
||||
void
|
||||
DedicatedWorkerGlobalScope::Close()
|
||||
{
|
||||
|
|
|
@ -33,6 +33,7 @@ class Function;
|
|||
class IDBFactory;
|
||||
enum class ImageBitmapFormat : uint8_t;
|
||||
class Performance;
|
||||
struct PostMessageOptions;
|
||||
class Promise;
|
||||
class RequestOrUSVString;
|
||||
class WorkerLocation;
|
||||
|
@ -261,6 +262,10 @@ public:
|
|||
PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
|
||||
const Sequence<JSObject*>& aTransferable,
|
||||
ErrorResult& aRv);
|
||||
void
|
||||
PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
|
||||
const PostMessageOptions& aOptions,
|
||||
ErrorResult& aRv);
|
||||
|
||||
void
|
||||
Close();
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
[second-argument-dictionary.html]
|
||||
[Using dictionary as postMessage's second argument]
|
||||
expected: FAIL
|
||||
|
Загрузка…
Ссылка в новой задаче