Bug 1722576 - Rename PostMessageOptions to StructuredSerializeOptions. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D126717
This commit is contained in:
Tom Schuster 2021-09-29 12:48:17 +00:00
Родитель 5cc3ab5f12
Коммит 5d023856bb
19 изменённых файлов: 44 добавлений и 41 удалений

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

@ -7438,11 +7438,10 @@ already_AddRefed<Promise> nsGlobalWindowInner::CreateImageBitmap(
}
// https://html.spec.whatwg.org/#structured-cloning
void nsGlobalWindowInner::StructuredClone(JSContext* aCx,
JS::Handle<JS::Value> aValue,
const PostMessageOptions& aOptions,
JS::MutableHandle<JS::Value> aRetval,
ErrorResult& aError) {
void nsGlobalWindowInner::StructuredClone(
JSContext* aCx, JS::Handle<JS::Value> aValue,
const StructuredSerializeOptions& aOptions,
JS::MutableHandle<JS::Value> aRetval, ErrorResult& aError) {
JS::Rooted<JS::Value> transferArray(aCx, JS::UndefinedValue());
aError = nsContentUtils::CreateJSValueFromSequenceOfObject(
aCx, aOptions.mTransfer, &transferArray);

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

@ -898,7 +898,7 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
mozilla::ErrorResult& aRv);
void StructuredClone(JSContext* aCx, JS::Handle<JS::Value> aValue,
const mozilla::dom::PostMessageOptions& aOptions,
const mozilla::dom::StructuredSerializeOptions& aOptions,
JS::MutableHandle<JS::Value> aRetval,
mozilla::ErrorResult& aError);

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

@ -109,7 +109,8 @@ void Client::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
}
void Client::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const PostMessageOptions& aOptions, ErrorResult& aRv) {
const StructuredSerializeOptions& aOptions,
ErrorResult& aRv) {
PostMessage(aCx, aMessage, aOptions.mTransfer, aRv);
}

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

@ -24,11 +24,10 @@ namespace dom {
class ClientHandle;
class ClientInfoAndState;
struct PostMessageOptions;
class Promise;
template <typename t>
class Sequence;
struct StructuredSerializeOptions;
class Client final : public nsISupports, public nsWrapperCache {
nsCOMPtr<nsIGlobalObject> mGlobal;
@ -77,7 +76,8 @@ class Client final : public nsISupports, public nsWrapperCache {
const Sequence<JSObject*>& aTransferrable, ErrorResult& aRv);
void PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const PostMessageOptions& aOptions, ErrorResult& aRv);
const StructuredSerializeOptions& aOptions,
ErrorResult& aRv);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(mozilla::dom::Client)

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

@ -412,7 +412,7 @@ void MessagePort::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
}
void MessagePort::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const PostMessageOptions& aOptions,
const StructuredSerializeOptions& aOptions,
ErrorResult& aRv) {
PostMessage(aCx, aMessage, aOptions.mTransfer, aRv);
}

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

@ -24,11 +24,11 @@ namespace dom {
class MessageData;
class MessagePortChild;
struct PostMessageOptions;
class PostMessageRunnable;
class SharedMessageBody;
class RefMessageBodyService;
class SharedMessageBody;
class StrongWorkerRef;
struct StructuredSerializeOptions;
// A class to hold a MessagePortIdentifier from
// MessagePort::CloneAndDistentangle() and close if neither passed to
@ -96,7 +96,8 @@ class MessagePort final : public DOMEventTargetHelper {
const Sequence<JSObject*>& aTransferable, ErrorResult& aRv);
void PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const PostMessageOptions& aOptions, ErrorResult& aRv);
const StructuredSerializeOptions& aOptions,
ErrorResult& aRv);
void Start();

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

@ -223,7 +223,7 @@ void ServiceWorker::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
}
void ServiceWorker::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const PostMessageOptions& aOptions,
const StructuredSerializeOptions& aOptions,
ErrorResult& aRv) {
PostMessage(aCx, aMessage, aOptions.mTransfer, aRv);
}

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

@ -21,8 +21,8 @@ class nsIGlobalObject;
namespace mozilla {
namespace dom {
struct PostMessageOptions;
class ServiceWorkerCloneData;
struct StructuredSerializeOptions;
#define NS_DOM_SERVICEWORKER_IID \
{ \
@ -93,7 +93,8 @@ class ServiceWorker final : public DOMEventTargetHelper {
const Sequence<JSObject*>& aTransferable, ErrorResult& aRv);
void PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const PostMessageOptions& aOptions, ErrorResult& aRv);
const StructuredSerializeOptions& aOptions,
ErrorResult& aRv);
const ServiceWorkerDescriptor& Descriptor() const;

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

@ -25,7 +25,7 @@ interface Client {
[Throws]
void postMessage(any message, sequence<object> transfer);
[Throws]
void postMessage(any message, optional PostMessageOptions aOptions = {});
void postMessage(any message, optional StructuredSerializeOptions aOptions = {});
};
[Exposed=ServiceWorker]

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

@ -21,7 +21,7 @@ interface DedicatedWorkerGlobalScope : WorkerGlobalScope {
[Throws]
void postMessage(any message, sequence<object> transfer);
[Throws]
void postMessage(any message, optional PostMessageOptions options = {});
void postMessage(any message, optional StructuredSerializeOptions options = {});
void close();

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

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* For more information on this interface, please see
* http://www.whatwg.org/specs/web-apps/current-work/#channel-messaging
* https://html.spec.whatwg.org/#message-ports
*/
[Exposed=(Window,Worker,AudioWorklet)]
@ -12,7 +12,7 @@ interface MessagePort : EventTarget {
[Throws]
void postMessage(any message, sequence<object> transferable);
[Throws]
void postMessage(any message, optional PostMessageOptions options = {});
void postMessage(any message, optional StructuredSerializeOptions options = {});
void start();
void close();
@ -22,6 +22,6 @@ interface MessagePort : EventTarget {
attribute EventHandler onmessageerror;
};
dictionary PostMessageOptions {
dictionary StructuredSerializeOptions {
sequence<object> transfer = [];
};

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

@ -22,7 +22,7 @@ interface ServiceWorker : EventTarget {
[Throws]
void postMessage(any message, sequence<object> transferable);
[Throws]
void postMessage(any message, optional PostMessageOptions options = {});
void postMessage(any message, optional StructuredSerializeOptions options = {});
};
ServiceWorker includes AbstractWorker;

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

@ -804,6 +804,6 @@ partial interface Window {
void setScrollMarks(sequence<unsigned long> marks);
};
dictionary WindowPostMessageOptions : PostMessageOptions {
dictionary WindowPostMessageOptions : StructuredSerializeOptions {
USVString targetOrigin = "/";
};

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

@ -53,7 +53,7 @@ interface mixin WindowOrWorkerGlobalScope {
// structured cloning
[Throws]
any structuredClone(any value, optional PostMessageOptions options = {});
any structuredClone(any value, optional StructuredSerializeOptions options = {});
};
// https://fetch.spec.whatwg.org/#fetch-method

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

@ -22,7 +22,7 @@ interface Worker : EventTarget {
[Throws]
void postMessage(any message, sequence<object> transfer);
[Throws]
void postMessage(any message, optional PostMessageOptions aOptions = {});
void postMessage(any message, optional StructuredSerializeOptions aOptions = {});
attribute EventHandler onmessage;
attribute EventHandler onmessageerror;

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

@ -162,7 +162,8 @@ void Worker::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
}
void Worker::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const PostMessageOptions& aOptions, ErrorResult& aRv) {
const StructuredSerializeOptions& aOptions,
ErrorResult& aRv) {
PostMessage(aCx, aMessage, aOptions.mTransfer, aRv);
}

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

@ -20,7 +20,7 @@
namespace mozilla {
namespace dom {
struct PostMessageOptions;
struct StructuredSerializeOptions;
struct WorkerOptions;
class WorkerPrivate;
@ -46,7 +46,8 @@ class Worker : public DOMEventTargetHelper, public SupportsWeakPtr {
const Sequence<JSObject*>& aTransferable, ErrorResult& aRv);
void PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const PostMessageOptions& aOptions, ErrorResult& aRv);
const StructuredSerializeOptions& aOptions,
ErrorResult& aRv);
void Terminate();

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

@ -671,11 +671,10 @@ already_AddRefed<Promise> WorkerGlobalScope::CreateImageBitmap(
}
// https://html.spec.whatwg.org/#structured-cloning
void WorkerGlobalScope::StructuredClone(JSContext* aCx,
JS::Handle<JS::Value> aValue,
const PostMessageOptions& aOptions,
JS::MutableHandle<JS::Value> aRetval,
ErrorResult& aError) {
void WorkerGlobalScope::StructuredClone(
JSContext* aCx, JS::Handle<JS::Value> aValue,
const StructuredSerializeOptions& aOptions,
JS::MutableHandle<JS::Value> aRetval, ErrorResult& aError) {
JS::Rooted<JS::Value> transferArray(aCx, JS::UndefinedValue());
aError = nsContentUtils::CreateJSValueFromSequenceOfObject(
aCx, aOptions.mTransfer, &transferArray);
@ -817,10 +816,9 @@ void DedicatedWorkerGlobalScope::PostMessage(
mWorkerPrivate->PostMessageToParent(aCx, aMessage, aTransferable, aRv);
}
void DedicatedWorkerGlobalScope::PostMessage(JSContext* aCx,
JS::Handle<JS::Value> aMessage,
const PostMessageOptions& aOptions,
ErrorResult& aRv) {
void DedicatedWorkerGlobalScope::PostMessage(
JSContext* aCx, JS::Handle<JS::Value> aMessage,
const StructuredSerializeOptions& aOptions, ErrorResult& aRv) {
mWorkerPrivate->AssertIsOnWorkerThread();
mWorkerPrivate->PostMessageToParent(aCx, aMessage, aOptions.mTransfer, aRv);
}

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

@ -60,7 +60,6 @@ class OnErrorEventHandlerNonNull;
template <typename T>
class Optional;
class Performance;
struct PostMessageOptions;
class Promise;
class RequestOrUSVString;
template <typename T>
@ -68,6 +67,7 @@ class Sequence;
class ServiceWorkerDescriptor;
class ServiceWorkerRegistration;
class ServiceWorkerRegistrationDescriptor;
struct StructuredSerializeOptions;
class WorkerLocation;
class WorkerNavigator;
class WorkerPrivate;
@ -275,7 +275,7 @@ class WorkerGlobalScope : public WorkerGlobalScopeBase,
int32_t aSh, const ImageBitmapOptions& aOptions, ErrorResult& aRv);
void StructuredClone(JSContext* aCx, JS::Handle<JS::Value> aValue,
const PostMessageOptions& aOptions,
const StructuredSerializeOptions& aOptions,
JS::MutableHandle<JS::Value> aRetval,
ErrorResult& aError);
@ -337,7 +337,8 @@ class DedicatedWorkerGlobalScope final
const Sequence<JSObject*>& aTransferable, ErrorResult& aRv);
void PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const PostMessageOptions& aOptions, ErrorResult& aRv);
const StructuredSerializeOptions& aOptions,
ErrorResult& aRv);
void Close();