/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
class ClientPostMessageArgs; struct MessageEventInit; class Promise; struct RegistrationOptions; class ServiceWorker; class ServiceWorkerContainerChild; class TrustedScriptURLOrUSVString;
// Lightweight serviceWorker APIs collection. class ServiceWorkerContainer final : public DOMEventTargetHelper { public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ServiceWorkerContainer,
DOMEventTargetHelper)
// Almost a manual expansion of IMPL_EVENT_HANDLER(message), but // with the additional StartMessages() when setting the handler, as // required by the spec. inline mozilla::dom::EventHandlerNonNull* GetOnmessage() { return GetEventHandler(nsGkAtoms::onmessage);
} inlinevoid SetOnmessage(mozilla::dom::EventHandlerNonNull* aCallback) {
SetEventHandler(nsGkAtoms::onmessage, aCallback);
StartMessages();
}
// Utility method to get the global if its present and if certain // additional validaty checks pass. One of these additional checks // verifies the global can access storage. Since storage access can // vary based on user settings we want to often provide some error // message if the storage check fails. This method takes an optional // callback that can be used to report the storage failure to the // devtools console.
nsIGlobalObject* GetGlobalIfValid(
ErrorResult& aRv, const std::function<void(nsIGlobalObject*)>&& aStorageFailureCB =
nullptr) const;
struct ReceivedMessage;
// Dispatch a Runnable that dispatches the given message on this // object. When the owner of this object is a Window, the Runnable // is dispatched on the corresponding TabGroup. void EnqueueReceivedMessageDispatch(RefPtr<ReceivedMessage> aMessage);
// Set after StartMessages() has been called. bool mMessagesStarted = false;
// Queue holding messages posted from service worker as long as // StartMessages() hasn't been called.
nsTArray<RefPtr<ReceivedMessage>> mPendingMessages;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.