Issue #2197 - Part 2c: Implement StructuredSerializeOptions for ServiceWorker

Partially based on https://bugzilla.mozilla.org/show_bug.cgi?id=1502802
This commit is contained in:
FranklinDM 2023-04-07 16:39:41 +08:00 committed by roytam1
commit 4d58139fe1
6 changed files with 39 additions and 2 deletions

View file

@ -14,6 +14,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/MessagePortBinding.h"
#include "mozilla/dom/ServiceWorkerGlobalScopeBinding.h"
#ifdef XP_WIN
@ -97,6 +98,15 @@ ServiceWorker::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
aRv = workerPrivate->SendMessageEvent(aCx, aMessage, aTransferable, Move(clientInfo));
}
void
ServiceWorker::PostMessage(JSContext* aCx,
JS::Handle<JS::Value> aMessage,
const StructuredSerializeOptions& aOptions,
ErrorResult& aRv)
{
PostMessage(aCx, aMessage, aOptions.mTransfer, aRv);
}
} // namespace workers
} // namespace dom
} // namespace mozilla