mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 982726 - Patch 2: Add postMessage to service worker. r=baku
This commit is contained in:
parent
d6f7422100
commit
80a1b203b6
@ -18,6 +18,10 @@ interface ServiceWorker : EventTarget {
|
||||
readonly attribute ServiceWorkerState state;
|
||||
|
||||
attribute EventHandler onstatechange;
|
||||
|
||||
// FIXME(catalinb): Should inherit this from Worker.
|
||||
[Throws]
|
||||
void postMessage(any message, optional sequence<Transferable> transferable);
|
||||
};
|
||||
|
||||
ServiceWorker implements AbstractWorker;
|
||||
|
@ -13,6 +13,11 @@
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/ServiceWorkerGlobalScopeBinding.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#undef PostMessage
|
||||
#endif
|
||||
|
||||
using mozilla::ErrorResult;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
namespace mozilla {
|
||||
@ -64,6 +69,17 @@ ServiceWorker::WrapObject(JSContext* aCx)
|
||||
return ServiceWorkerBinding::Wrap(aCx, this);
|
||||
}
|
||||
|
||||
void
|
||||
ServiceWorker::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
|
||||
const Optional<Sequence<JS::Value>>& aTransferable,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivate();
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
|
||||
workerPrivate->PostMessage(aCx, aMessage, aTransferable, aRv);
|
||||
}
|
||||
|
||||
WorkerPrivate*
|
||||
ServiceWorker::GetWorkerPrivate() const
|
||||
{
|
||||
|
@ -61,6 +61,15 @@ public:
|
||||
DOMEventTargetHelper::DispatchTrustedEvent(NS_LITERAL_STRING("statechange"));
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
#undef PostMessage
|
||||
#endif
|
||||
|
||||
void
|
||||
PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
|
||||
const Optional<Sequence<JS::Value>>& aTransferable,
|
||||
ErrorResult& aRv);
|
||||
|
||||
WorkerPrivate*
|
||||
GetWorkerPrivate() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user